Marcus Folkesson

Embedded Linux Artist

TIL - Parse command output from shell

TIL - Parse command output from shell TIL, Today I Learned, is more of a "I just figured this out: here are my notes, you may find them useful too" rather than a full blog post Parse text output in shell scripts is something that is needed every now and then. It used to be some clever pipeline with regular expressions, grep, cut or even awk. But now I've started to use read for such things, and it has helped me a lot.

Changing the root of your Linux filesystem

Changing the root of your Linux filesystem After my previous post [1], I've got a few questions from people about the difference between chroot, pivot_root and switch_root, they all seems to do the same thing, right? Almost. Lets shed some light on this topic. Rootfs First of all, we need to specify what we mean when we say rootfs. rootfs is a special instance of a ram filesystem (usually tpmfs) that is created in an early boot stage.

chroot and user namespaces

chroot and user namespaces When playing around with libcamera [1] and br2-readonly-rootfs-overlay [2] I found something.. well.. unexpected. At least at first glance. What happened was that I encountered this error: 1 $ libcamera-still 2Preview window unavailable 3[0:02:54.785102683] [517] INFO Camera camera_manager.cpp:299 libcamera v0.0.0+67319-2023.02-22-gd530afad-dirty (2024-02-20T16:56:34+01:00) 4[0:02:54.885731084] [518] ERROR Process process.cpp:312 Failed to unshare execution context: Operation not permitted Failed to unshare execution context: Operation not permitted... what? I know that libcamera executes proprietary IPAs (Image Processing Algorithms) as black boxes, and that the execution is isolated in their own namespace.

Streamline your kernel config

Streamline your kernel config When working with embedded systems, it's not that uncommon that you need to compile your own kernel for your hardware platform. The configuration file you use is probably based on some default configuration that you borrowed from the kernel tree, a vendor tree, a SoM-vendor or simply from your collegue. As the configuration is somehow generic, it probably contains tons of kernel modules that is not needed for your application.

Power button and embedded Linux

Power button and embedded Linux Not all embedded Linux systems has a power button, but for consumer electronic devices it could be a good thing to be able to turn it off. But how does it work in practice? Physical button It all starts with a physical button. At the board level, the button is usually connected to a General-Purpose-Input-Output (GPIO) pin on the processor. It doesn't have to be directly connected to the processor though, all that matters is that the button press can somehow be mapped to the Linux input subsystem.

br2-readonly-rootfs-overlay

br2-readonly-rootfs-overlay This is a Buildroot external module that could be used as a reference design when building your own system with an overlayed root filesystem. It's created as an external module to make it easy to adapt for your to your own application. The goal is to achieve the same functionality I have in meta-readonly-rootfs-overlay [1] but for Buildroot. Why does this exists? Having a read-only root file system is useful for many scenarios:

Watch repair

Watch repair Time for another watch repair! The watch can be winded up to max, but it does not move nor tick, so my guess is that the gear train is stuck somewhere. It is also the first time I use my microscope to something else other than soldering components (and looking at creepy bugs with my kids..). Take it apart I started to take everything apart as usual, starting with the balance wheel. cover

TIL - Reuse your SSH connection

TIL - Reuse your SSH connection TIL, Today I Learned, is more of a "I just figured this out: here are my notes, you may find them useful too" rather than a full blog post OpenSSH has the feature to reuse an existing SSH connection for multiple subsequent connections to the same host. It will improve your workflow because it reduces the time it takes to establish a new connection and in cases where you have to type a password, the time saving is even more.

TIL - xxd color support

TIL - xxd color support TIL, Today I Learned, is more of a "I just figured this out: here are my notes, you may find them useful too" rather than a full blog post Today (2 January 2024), version 9.1 of the Vim editor has been released [1]! xxd [2] is a utility that is distributed with Vim and is my go-to-tool when it comes to view or manipulating binary files. cover

TIL - git credential storage

TIL - git credential storage TIL, Today I Learned, is more of a "I just figured this out: here are my notes, you may find them useful too" rather than a full blog post When using SSH as transport protocol for connecting to remotes you could use a key without need to type a username nor password. Unfortunately, this is not possible when the underlaying protocol is HTTPS as it requires a username and password for every connection made.