0

I have RaspberryPi 3B+. I read that there is a way to make my raspberry boot from USB by changing config.txt that will change the OTP. Is there a way to make my raspberry to boot from USB and only if there isn't USB connected or bootable it will try to boot from SD?

0

2 Answers 2

2

Is there a way to make my raspberry to boot from USB and only if there isn't USB connected or bootable it will try to boot from SD

Here you can find details about the Boot sequence of the Raspberry Pi. It is described in detail there but in short you will find, that the Raspberry Pi will allways first boot from the SD Card if one is inserted with at least containing the bootcode.bin file.

So it is not possible what you want. As long as the RasPi finds a bootable SD Card, it will boot from it first.

2
  • And what if I'll use different bootloader?
    – PokerFace
    Dec 13, 2020 at 10:30
  • @PokerFace The closed source boot loader looks for the first vat formatted partition of a selected device (determined by some bits in a ROM or EPROM) as described at the link I have given. There is no MBR (master boot record, sector 0). I don't know if any generic bootloader is able to mange this. Have never tried it. Have a look at BerryBoot, uboot, and have heard that even grub can be used.
    – Ingo
    Dec 13, 2020 at 15:38
1

One very very messy way to achieve part of this is to set the Pi into GPIO boot mode.

You would then have to work out how to strap the GPIO pins to decide to boot from the SD or USB - if the USB is not fitted then the SD card pin must be asserted to boot from that.

This will not help you boot from SD if the USB device is not bootable though...

It may be better to look towards using just the USB boot but have multiple OS partitions via PINN or similar - this gives you an optional manual start but more control along the lines of GRUB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.