Boot Debian from NVMe

Modifying uboot environment variables is a solid approach

Hi all,

I was able to build my SPI FLASH Firmware U-Boot using EFI and then I’ve install Debian 13 Trixie on SSD NVMe. U-Boot EFI detects the EFI partition on NVMe (of course, U-Boot needs to be last version or with PCIe patches) and then I’m booting GRUB EFI. In GRUB I’ve added devicetree /boot/… to load the DTB.

Is working very nice.

I’m working o a BASH script which builds the firmware and the rootfs for NVMe, but is not finish yet.

Which dtb? There are some overlays which are probed in the fit approach. Thats why i think extlinux and efi is not the best way…you are fixed to 1 config and if e.g. on R3 the other spi/mmc device is active it does not work.

Which dtb? There are some overlays which are probed in the fit approach. Thats why i think extlinux and efi is not the best way…you are fixed to 1 config and if e.g. on R3 the other spi/mmc device is active it does not work.

Btw. Just a note for others: Debian trixie is not yet released (date 2025-08-09), it is freezed and can be tested,but it is not yet defined as stable.

https://wiki.debian.org/DebianTrixie

Even is not relaaed yet, is in testing, I’ve created a rootfs.

For DTB I’m using the one based on eMMC.

Now I’m testing dtoverlay tool from RaspberryPi to build a new DTB from base DTB + DTBO. The apply to GRUB “devicetree” and reboot de device.

Example of DTB + DTBO merged by dtoverlay:

dtmerge
dtoverlay
dtparam
libdtovl.a
mt7988a-bananapi-bpi-r4-emmc.dtb
mt7988a-bananapi-bpi-r4-emmc.dtbo
mt7988a-bananapi-bpi-r4-sd.dtb
mt7988a-bananapi-bpi-r4-sd.dtbo
mt7988a-bananapi-bpi-r4.dtb

I used this command:

# ./dtmerge ./mt7988a-bananapi-bpi-r4.dtb mt7988a-bananapi-bpi-r4-emmc.dtb ./mt7988a-bananapi-bpi-r4-emmc.dtbo

# ./dtmerge ./mt7988a-bananapi-bpi-r4.dtb mt7988a-bananapi-bpi-r4-sd.dtb ./mt7988a-bananapi-bpi-r4-sd.dtbo

# ls -1 /boot/dtb-6.16.0-rc1-EasyOS-bpi-r4/mediatek/
mt7986a-bananapi-bpi-r3-emmc.dtbo
mt7986a-bananapi-bpi-r3-mini.dtb
mt7986a-bananapi-bpi-r3-nand.dtbo
mt7986a-bananapi-bpi-r3-nor.dtbo
mt7986a-bananapi-bpi-r3-sata.dtbo
mt7986a-bananapi-bpi-r3-sd.dtbo
mt7986a-bananapi-bpi-r3.dtb
mt7988a-bananapi-bpi-r4-2g5.dtb
mt7988a-bananapi-bpi-r4-emmc.dtb
mt7988a-bananapi-bpi-r4-emmc.dtbo
mt7988a-bananapi-bpi-r4-sd.dtb
mt7988a-bananapi-bpi-r4-sd.dtbo
mt7988a-bananapi-bpi-r4.dtb

And here is the GRUB config:

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-05329a7f-410a-419b-840b-2fde100897cc' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        search --no-floppy --fs-uuid --set=root 05329a7f-410a-419b-840b-2fde100897cc
        echo       'Loading Linux 6.16.0-rc1-EasyOS-bpi-r4 ...'
        linux      /boot/vmlinux-6.16.0-rc1-EasyOS-bpi-r4 root=UUID=05329a7f-410a-419b-840b-2fde100897cc ro console=ttyS0,115200n1 earlycon=uart8250,mmio32,0x11000000
        echo       'Loading initial ramdisk ...'
        initrd     /boot/initrd.img-6.16.0-rc1-EasyOS-bpi-r4
        echo       'Loading devicetree ...'
        devicetree /boot/dtb-6.16.0-rc1-EasyOS-bpi-r4/mediatek/mt7988a-bananapi-bpi-r4-emmc.dtb
}

And this is the OS:

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.0
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

And here is the OS booted with the merged DTBO to DTB with eMMC:

# ls -1 /dev/mmcblk0*
/dev/mmcblk0
/dev/mmcblk0boot0
/dev/mmcblk0boot1
/dev/mmcblk0p1
/dev/mmcblk0p2
/dev/mmcblk0p3
/dev/mmcblk0p4
/dev/mmcblk0p5
/dev/mmcblk0rpmb

I think is enough flexible also the solution U-Boot EFI + GRUB EFI.

Source for dtoverlay can be found here:

I am using the standard Linux commands

fdtoverlay
fdtput
1 Like

Good tip! Thanks. I will give it a try.

//LE: is working perfect with fdtoverlay. Thanks for this.