Trace: » linux08.html

[hemmerling] Linux 8/8 - Useful Commands & Tricks

Machine-specific Programming on Linux

uio Framework

  • The “uio framework” is suitable to avoid Linux license problems for Linux applications with simple, but machines-specific i/o - You may access any memory-mapped hardware by user applications, but you must not provide your source code for any drivers, as there is just a standard Linux mainline driver “mmap” :-).
  • You may not access legacy and classical PC hardware ( e.g. printer port,.. ) which is connected to the special Intel i/o hardware ports.
  • There is a special patch available at Git repository of DENX Software Engineering for Linux kernel 3.8 to allow the necessary device tree binding by command line commands - this was “missing link” before. It is expected that this option becomes a standard feature of Linux Kernel 3.10, hopefully :-).

Select() / Poll() Framework

  • “include <sys/select.h>”.
  • Poll() is a variation of Select().
  • Suitable to work with the “uio framework” and it's “mmap” function, to provide interrupt-driven data transfer with any memory-mapped hardware, without the need for thread programming, and it's overhead.
  • Loop operation:
    1. Select() expects an array of file selectors as input.
    2. It will got to sleep.
    3. In case of a change of the contents linked with the file descriptors, Select() wakes up again.
    4. The application which uses Select() has to explore and find out, which file descriptor contents changed.
    5. The application handels the file descriptor ( read or writes data,.. ).
    6. End-of-loop.

Gpio on Lemonboard

  • On the Lemonboard with Ubuntu Linux / Linux, show Gpio Pins:
cat /sys/kernel/debug/gpio
  • Set Gpioi LED Value:
echo "1" > /sys/class/gpio/gpio203/value
echo "0" > /sys/class/gpio/gpio2/value
  • Additionally, there is a small application “gpioin”. Config the GPIO CSI0_DAT12 to INPUT:
echo in > /sys/class/gpio/gpio158/direction
echo 1 > /sys/class/gpio/gpio158/active_low
echo falling > /sys/class/gpio/gpio128/edge
./gpioin /sys/class/gpio/gpio158/value

The Effect

  • You may now control hardware, even interrupt-driven hardware, from your Linux applications written in high-level language, e.g. C/C++, Python, Perl, Java, running on a standard Linux Kernel 3.10 ( or patched Linux Kernel 3.8 ).
  • For comparison,, with Python and “Raspberry Pi” platform, you need a special Python library...

LInux Commands for Embedded Linux Boards

  • “cat /proc/cpuinfo”.
  • “ls - l /proc/cpuinfo”.
  • “file hello-world”.
  • “printenv”.
  • For successful use of aa remote NFS filesystem as “root” filesystem, the Linux server option “no_root_squash” is necessary. By this, “root” is not handled as unprivileged user, but the server believes that a true “root” wants to access.
  • For cross-compilation, add a variable ( e.g. $Cross_compile ) to your makefiles, and define $Cross_compile as environment variable on your host. So that you may use the same makefile to compile both on host and target, but just use a environment variable to create the name of the cross-compiler from the name of the native compiler. So no if-then-else with different compiler calls, but the name of the called compiler is modified to meet the requirements of host and target compilers.

Some other useful Linux Commands

Forgotten root Password

"su" vs. "sudo"

Linux running on Systems with little RAM

  • Experts told me in the late 1990th, that even if a PC just has 16 or 32 MByte RAM, the Linux swapspace should be 128 MB on the harddisk.

Some other Tips & Tricks

Tips for installation and Operation of Debian Linux

Debian OS Installation from downloaded DVD ISO Images

  • Does it work, to create first a bootable USB stick by the “Rufus” ISO2USB tool, and then to copy the 2 additonal DVDS into subdirectories “debian2” and “debian3”?
    1. Sufficient disk space on a 14GB USB stick? YES, for Debian 10.7 :-)
    2. Does the installer “aptitude” find the installable applications, if the USB stick is available at ”/media/cdrom/”, by soft link ? Yes, it finds and scans the directories of the 2nd and 3rd DVD ( e.g. “debian2”, “debian3” ), properly :-).

Add the default User to the Group "sudoers"

Installation of Applications

Application: Lua 5.3

  • Lua is shipped on the data DVDs #2 & #3 of Debian Linux 10.7 ( so not on the bootable DVD #1 ) :-).

Application: Executing Graphical Applications like "GEdit", from User "root"

Application: Visual Studio Code

Using "dpkg", "apt-get" & "GDebi" Command-Line Solution

Using "aptitude", "tasksel"

aptitude
  • aptitude is not installed by default, with virgin out-of-the-box Debian Linux 10.7.
  • Installation: “sudo apt-get install aptitude”.
tasksel
  • A task is a collection of several individual Debian packages all related to a specific activity. Tasks can be installed through the “tasksel” program or through “aptitude”.
  • The tasksel installation options are also offered during installation of Debian Linux.

Using "Synaptic Package Manager"

Resources

Appropriate OpenDirectory Directory Pages

 
en/linux08.html.txt · Last modified: 2024/04/27 14:43 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki