Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save devantler/7dfcf13f12cb68b65eaa0e6f93dc2b19 to your computer and use it in GitHub Desktop.
Save devantler/7dfcf13f12cb68b65eaa0e6f93dc2b19 to your computer and use it in GitHub Desktop.
How to add RBD and NBD modules to Raspbian-64bit Linux Kernel

Adding RBD and NBD modules to Raspbian-64bit Linux kernel

DISCLAIMER: Building Linux locally can easily ruin your system. Doing this is at your own risk!

This guide assumes you are using 64bit. If not you have to find the commands that target 32bit for step 3 and 5.

  1. Install Git and build dependencies
    • sudo apt install git bc bison flex libssl-dev make
  2. Clone linux sources
    • git clone --depth=1 https://github.com/raspberrypi/linux
  3. Apply default configuration
    •  cd linux
       KERNEL=kernel8
       make bcm2711_defconfig
  4. Update the configuration by opening .config
    • Set CONFIG_BLK_DEV_DRBD=m
    • Set CONFIG_BLK_DEV_RBD=m
    • Set CONFIG_BLK_DEV_NDB=m
  5. Build linux (-j4 utilizes all cores)
    •  make -j4 Image modules dtbs
       sudo make modules_install
       sudo cp arch/arm64/boot/dts/broadcom/*.dtb /boot/
       sudo cp arch/arm64/boot/dts/overlays/*.dtb* /boot/overlays/
       sudo cp arch/arm64/boot/dts/overlays/README /boot/overlays/
       sudo cp arch/arm64/boot/Image /boot/$KERNEL.img
  6. Wait 1-3 hours
  7. Reboot
    • sudo reboot now
  8. Enable RBD module
    • sudo modprobe rbd
    • lsmod | grep rbd
  9. If all went well you should see something like this:
    • rbd                    90112  0
      libceph               339968  1 rbd
      
  10. If not you might have ruined your OS 🥹
@shiipou
Copy link

shiipou commented May 14, 2024

For thoses who search a solution about getting a kernel 6.6.30-v8-16k+ when you just build a kernel 6.6.30-v8+,

Follow theses steps :

First, execute sudo rpi-update to get latest kernel (I got updated to kernel 3b768c3f4d2b9a275fafdb53978f126d7ad72a1a, so if you want the same as me just use sudo rpi-update 3b768c3f4d2b9a275fafdb53978f126d7ad72a1a)

Then execute sudo make install in the ~/linux directory. Be sure to still have the KERNEL=kernel8 variable.

That must show you an error but that normal :

  INSTALL /boot
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 6.6.30-v8+ /boot/vmlinuz-6.6.30-v8+
update-initramfs: Generating /boot/initrd.img-6.6.30-v8+
ERROR: Unsupported initramfs version (6.6.30-v8+)
run-parts: executing /etc/kernel/postinst.d/z50-raspi-firmware 6.6.30-v8+ /boot/vmlinuz-6.6.30-v8+

Then run :

sudo mkinitramfs -o /boot/initrd.img-6.6.30-v8+ 6.6.30-v8+

Which will show you nothing in the output.

You can simply change your /boot/firmware/config.txt line where auto_initramfs=1 to 0 and adding just bellow :

kernel=kernel8.img
initramfs initrd.img-6.6.30-v8+

You can finalize with a new :

sudo make modules_install

Reboot and that must work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment