Marcus Folkesson

Embedded Linux Artist

Versioning with SWUpdate

Versioning with SWUpdate TLDR; It is now possible to let SWUpdate manage the sw-versions file entirely thanks to the --gen--swversions feature I've been working on. SWUpdate SWUpdate [1] is a project I've been using for a very long time for updating firmware on embedded systems. The update service is a critical part of any embedded system, so having a well-tested, flexible, competent and ready-to-use solution is so much worth. Too many times I've seen custom made update services that contain bugs, is not flexible enough or using slots for whatever software that could be updated. cover

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: $ libcamera-still Preview window unavailable [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) [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:

Expose network namespace created by Docker

Expose network namespace created by Docker Disclaimer: this is probably *not* the best way for doing this, but it's pretty good for educational purposes. During a debug session I wanted to connect an application to a service tha ran in a docker container. This was for test-purposes only, so hackish and fast are the keywords. First of all, I'm not a Docker expert, but I've a pretty good understanding on Linux internals, namespaces and how things works on a Linux system.

Skip flashing unused blocks with UUU

Skip flashing unused blocks with UUU TL;DR: UUU does now (or will shortly) support blockmaps for flashing images. Use it. It will shorten your flashing time *a lot.* It will soon be time to manufacture circuit boards for a project I'm currently working on. After manufacturing, it will need some firmware for sure, but how do we flash it in the most efficient way? The board is based on an i. cover

Burn eFuses for MAC address on iMX8MP

Burn eFuses for MAC address on iMX8MP The iMX (iMX6, iMX7, iMX8) has a similiar OCOTP (On-Chip One Time Programmable) module that store, for example the MAC addresses for the internal ethernet controllers. The reference manual is not clear either on the byte order or which bytes belong to which MAC address when there are several. In fact, I had to look at the U-boot implementation [1] to know for sure how these fuses is used: cover

Loopback with two (physical) ethernet interfaces

Loopback with two (physical) ethernet interfaces Imagine that you have an embedded device with two physical ethernet ports. You want to verify the functionality of both these ports in the manufacturing process, so you connect an ethernet cable between the ports, setup IP addresses and now what? As Linux (actually the default network namespace) is aware of the both adapters and their IP/MAC-addresses, the system see no reason to send any traffic out. cover