Linux: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 70: | Line 70: | ||
More information: https://bbs.archlinux.org/viewtopic.php?id=94990 | More information: https://bbs.archlinux.org/viewtopic.php?id=94990 | ||
== udev == | === udev === | ||
=== udev rules === | ==== udev rules ==== | ||
Some sample udev rules which might come handy: | Some sample udev rules which might come handy: | ||
KERNEL=="tty*", GROUP="dialout", MODE="0660" | KERNEL=="tty*", GROUP="dialout", MODE="0660" | ||
SUBSYSTEM=="gpio", GROUP:="gpio", MODE:="0660" | SUBSYSTEM=="gpio", GROUP:="gpio", MODE:="0660" | ||
=== udev debugging === | ==== udev debugging ==== | ||
Command to test udev rules: | Command to test udev rules: | ||
udevadm test --action=add /class/gpio | udevadm test --action=add /class/gpio |
Revision as of 08:35, 31 August 2017
Debugging Linux applications
LDD
Linux LDD is just a wrapper for:
LD_TRACE_LOADED_OBJECTS=1 <cmd>
Core dumps
To check core dump handler:
cat /proc/sys/kernel/core_pattern |/usr/sbin/coredump-handler %h_%t_%p.core
Valgrind
valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all <binary>
Configuring Linux
Disable Nvidia drivers and enable Intel embedded HD graphics driver
sudo apt-get purge nvidia-* sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core sudo dpkg-reconfigure xserver-xorg sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf reboot
Switch default compiler
(cc --version;c++ --version;gcc --version;g++ --version) | grep Debian cc (Debian 6.1.1-11) 6.1.1 20160802 c++ (Debian 6.1.1-11) 6.1.1 20160802 gcc (Debian 6.1.1-11) 6.1.1 20160802 g++ (Debian 6.1.1-11) 6.1.1 20160802 sudo apt-get install gcc-4.9 g++-4.9 gcc-4.9 --version gcc-4.9 (Debian 4.9.3-14) 4.9.3 g++-4.9 --version g++-4.9 (Debian 4.9.3-14) 4.9.3 gcc-5 --version gcc-5 (Debian 5.4.1-1) 5.4.1 20160803 g++-5 --version g++-5 (Debian 5.4.1-1) 5.4.1 20160803 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 sudo update-alternatives --set cc /usr/bin/gcc sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 sudo update-alternatives --set c++ /usr/bin/g++ (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian cc (Debian 4.9.3-14) 4.9.3 c++ (Debian 4.9.3-14) 4.9.3 gcc (Debian 4.9.3-14) 4.9.3 g++ (Debian 4.9.3-14) 4.9.3
To go back:
sudo update-alternatives --config gcc sudo update-alternatives --config g++
Console is not filling the screen completely
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.
ls /sys/class/drm card0@ card0-DisplayPort-1@ card0-DisplayPort-2@ card0-DisplayPort-3@ card0-HDMI Type A-1@ card0-HDMI Type A-2@ card0-LVDS-1@ card0-SVIDEO-1@ card0-VGA-1@ controlD64@ version
Now check the different "modes" and "connected" and "enabled" nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as
video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d
More information: https://bbs.archlinux.org/viewtopic.php?id=94990
udev
udev rules
Some sample udev rules which might come handy:
KERNEL=="tty*", GROUP="dialout", MODE="0660" SUBSYSTEM=="gpio", GROUP:="gpio", MODE:="0660"
udev debugging
Command to test udev rules:
udevadm test --action=add /class/gpio