Nix: Testing a Single NixOS Module in CI

In this blog post, I explain how to test a single NixOS module in CI. By single NixOS module, I mean a module that provides some options and configurations, but itself is not a valid NixOS configuration. The use case is to have a common module (in a git repository) that you want to integrate in a full NixOS configuration, when you don’t have or want the full NixOS configuration at the same Read more…

Kernel/Boot: Cope with a Relocation by a Bootloader in 32-bit x86 Assembly Code

A kernel should be relocatable by bootloaders as this is the only guarantee that it doesn’t interfere with addresses already in use by the firmware. This is especially true for the legacy boot flow on x86, i.e., without UEFI. TL;DR Introduction There are multiple ways to make a kernel relocatable. One option is to use the “relocatable” tag when the kernel uses the Multiboot2 boot flow. The assembly code must cope with runtime Read more…

How Does the “File Size is Smaller Than Mem Size” Optimization Work in GNU ld for the .bss Section?

This article explains how the GNU linker (GNU ld) can save disk space for symbols in the .bss section. TL;DR: If a section is of type SHT_NOBITS and if it is the last section in a LOAD segment, GNU ld uses this optimization. When you build software with a compiled language, such as C, certain symbols, which may originate in variable declarations, may be initialized to zero. An example are the following two Read more…