Change boot order on RPi 4

Is it possible to change the boot order like it is possbile with raspi-config?
With the config tool you can choose between:

|   B1 SD Card Boot Boot from SD Card if available, otherwise boot from USB    │
│   B2 USB Boot     Boot from USB if available, otherwise boot from SD Card    │
│   B3 Network Boot Boot from network if SD card boot fails                    │                                                                           

On my current setup I use the SDcard to hold some music files. Whenever I reboot the device I have to take out the card, to be able to boot via USB.

The interesting part of raspi-config looks like this:

 case "$BOOTOPT" in
        if ! grep -q "BOOT_ORDER" $EECFG ; then
          sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=0xf41"
          sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=0xf41/"
        STATUS="SD Card"
        if ! grep -q "BOOT_ORDER" $EECFG ; then
          sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=0xf14"
          sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=0xf14/"
        if ! grep -q "BOOT_ORDER" $EECFG ; then
          sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=0xf21"
          sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=0xf21/"

What RPi SBC you have?

I have a Rasperry Pi 4

You can configure the bootloader and set boot order Raspberry Pi Documentation - Raspberry Pi hardware

0xf14 will try USB first, followed by SD then repeat

1 Like

For some reason it’s not working, altough it’s set to 0xf14.
If I reboot with the inserted SD card, nothing happens. I also connected a monitor but I have no output since I disabled the HDMI outputs I guess.
I will try again with activated HDMI and see if I can get some useful information.

This whole stuff is part of bootloader. Something we don’t manage as it’s the original one from RPI foundation. Did you tried RPI OS? Does it behave differently?

Since the RPi 4 is my productive system I can not test with RPi OS. I could try on a RPi 3 but the bootloader works a bit different there.
Since it’s not an important problem I will go with the simplest solution and save the few files also on the USB SSD an remove the SD card.

if you are running static ip, you could add your HDD to the RPI3. It should boot up like the original system. This way you get the RPI4 for testing :crazy_face: