The videos from Bootlin’s presentations earlier this month at FOSDEM 2021 are now publicly available. Once again, FOSDEM was a busy event, even if it was online for once. As in most technical conferences, Bootlin engineers volunteered to share their experience and research by giving two talks.
Maxime Chevallier – Network Performance in the Linux Kernel, Getting the most out of the Hardware
Abstract: The networking stack is one of the most complex and optimized subsystems in the Linux kernel, and for a good reason. Between the wild range of applications, the complexity and variety of the networking hardware, getting good performance while keeping the stack easily usable from userspace has been a long-standing challenge.
Nowadays, complex Network Interface Controllers (NICs) can be found even on small embedded systems, bringing powerful features that were previously found only in the server world closest to day to day users.
This is a good opportunity to dive into the Linux Networking stack, to discover what is used to make networking as fast as possible, both by using all the features of the hardware and by implementing some clever software tricks.
In this talk, we cover these various techniques, ranging from simple batch processing with NAPI, queue management with RSS, RPS, XPS and so on, flow steering and filtering with ethool and TC, to finish with the newest big change that is XDP.
We dive into these various techniques and see how to configure them to squeeze the most out of your hardware, and discover that what was previously in the realm of datacenters and huge computers can now also be applied to embedded linux development.
Here are PDF slides for this presentation.
Michael Opdenacker – Embedded Linux from Scratch in 45 minutes, on RISC-V
Abstract: Discover how to build your own embedded Linux system completely from scratch. In this presentation and tutorial, we show how to build a custom toolchain (Buildroot), bootloader (opensbi / U-Boot) and kernel (Linux), that one can run on a system with the new RISV-V open Instruction Set Architecture emulated by QEMU. We also show how one can build a minimal root filesystem by oneself thanks to the BusyBox project. The presentation ends by showing how to control the system remotely through a tiny webserver. The approach is to provide only the files that are strictly necessary. That’s all the interest of embedded Linux: one can really control and understand everything that runs on the system, and see how simple the system can be. That’s much easier than trying to understand how a GNU/Linux system works from a distribution as complex as Debian!
The presentation also shares details about what’s specific to the RISC-V architecture, in particular about the various stages of the boot process. This presentation shares all the hardware (!), source code build instructions and demo binaries needed to reproduce everything at home, and add specific improvements. Most of the details are also useful to people using other hardware architectures (in particular arm and arm64).
It’s probably the first time a tutorial manages to show so many aspects of embedded Linux in less than an hour. See by yourself! At least, that’s for sure the first one demonstrating how to boot Linux from U-Boot in a RISC-V system emulated by QEMU.
Here are PDF slides for this presentation.
A few more details about my new “Embedded Linux from Scratch” presentation…
Compared to my talk at Live Embedded Event in December 2020, this time I managed to include booting Linux from U-Boot in the QEMU emulated machine, instead of directly booting Linux from QEMU which is too easy and doesn’t happen this way in real life with real hardware.
So, not counting all the explanations that are given, here are the things that are demonstrated in this talk:
– Building a custom cross-compiling toolchain (based on the musl C library) with Buildroot
– Testing the toolchains with QEMU user emulation (“qemu-riscv64”)
– Emulating a headless RISC-V 64 machine with QEMU in a terminal, and killing it from the same terminal.
– Configuring and cross-compiling the U-Boot bootloader
– Building OpenSBI (Open Supervisor Binary Interface), needed to start U-Boot in Supervisor mode on RISC-V
– Configuring and cross-compiling the Linux kernel
– Creating a disk image for the QEMU machine, create partitions inside this image, have them automatically detected with the “–partscan” option to the “losetup” command, and format them with the FAT32 and ext4 filesystems.
– Configuring U-Boot to store its “environment” settings in a file in a FAT partition.
– Passing a virtio storage device to QEMU
– In U-Boot, setting environment variables, finding suitable RAM addresses for loading the kernel and Device Tree binaries in U-Boot, setting the Linux kernel command line arguments, and then loading such binaries and booting the Linux kernel from U-Boot.
– Configuring BusyBox to choose the commands to have in the root filesystem.
– Cross-compiling BusyBox and installing it in the root filesystem.
– Managing device files with the devtmpfs filesystem
– Configuring how the system is started with BusyBox init and the /etc/inittab file, automating tasks such as mounting the proc and sysfs filesystems.
– Setting up networking between the host and QEMU virtual target
– Starting a webserver on the target and interacting with it through dynamic pages (CGI).
I wasn’t sure I would manage to do all this in only 45 minutes. Actually, I ended up needing 53 minutes. This was close.