I want to compile a Linux kernel for the Raspberry Pi 4.
When compiling a Linux kernel, menuconfig
is used to configure the Linux kernel before compiling it.
In my case, Linux 5.10 from raspberrypi git would by default compile module brd
as a built-in module, meaning it is embedded in the kernel image vmlinuz or kernel8.img by default, unless otherwise configured with menuconfig
.
The problem is that the brd
module cannot be used at all if it is a built-in module. It must be a loadable kernel module in order to be usable for creating a RAMdisk block device (/dev/ram0
). See also: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1593293
My problem is that I cannot make brd
a loadable kernel module in my testing inside initrd.img
:
BusyBox v1.30.1 (Ubuntu 1:1.30.1-6ubuntu2) built-in shell (ash)$ uname -aLinux ubuntu 5.10.20-v8+ #1 SMP PREMPT Mon Mar 8 11:33:05 UTC 2021 aarch64 GNU/Linux$ rmmod brdrmmod: ERROR: Module brd is builtin.$ echo $?1# normal usage: create RAM block device of 128MiB (rd_size is in kilobytes)$ modprobe brd rd_nr=1 rd_size=$(( 128 * 1024 ))$ echo $?1# note: no error message, only exit code 1# usage of the verbose flag to modprobe does not change anything:$ modprobe -v brd rd_nr=1 rd_size=$(( 128 * 1024 ))$ echo $?1# again: only exit code 1 and no output at all, even though -v (verbose) was specifically requested# lsmod is unavailable inside initrd$ lsmod/bin/sh: lsmod: not found$ cat /proc/modules# -> lists modules such as radi10 md_mod and spi_bcm2835 but not brd$ cat /sys/module/brdcat: can' t open '/sys/module/brd': No such file or directory
My question is: how can I force brd
to become a loadable kernel module, and not loaded already. And what is going on with brd
being a builtin module, but not listed in /proc/modules
? I don't understand what is going on.