Raspberry Pi: Boot Modes
Raspberry Pi boot modes
Raspberry Pi 1 and Zero(BCM2835), Raspberry Pi 2(BCM2836)
The Pi will try SD card boot, followed by USB device mode boot.Pi 2B version 1.2,, Raspberry Pi 3(BCM2837), Raspberry Pi 3B+ and 3A+ (BCM2837B0)
USB host and Ethernet boot can be performed by BCM2837-based Raspberry Pis.When the BCM2837 boots, it uses two different sources to determine which boot modes to enable
The overall boot mode process is as follows:
- CPU(2837) boots
- CPU read OTP to determine which boot modes to enable
- check GPIO boot mode enabled use GPIO boot mode to refine list of enabled boot modes
- check primary SD for bootcode.bin enabled
- check secondary SD enabled
- check SPI enabled
- check USB enabled
- If OTG pin == 0 (USB Host mode boot)
- Enable USB, wait for valid USB 2.0 devices (two seconds) Device found:
- If device type == hub Recurse for each port
- If device type == (mass storage or LAN951x) Store in list of devices
- Recurse through each MSD
If bootcode.bin found boot
- Recurse through each LAN951x
- else (USB Device mode boot) Enable device mode and wait for host PC to enumerate. We reply to PC with VID: 0a5c PID: 0x2763 (Pi 1 or Pi 2) or 0x2764 (Pi 3)
DHCP / TFTP boot
Raspberry Pi 4B(BCM2711)
The Raspberry Pi 4B does not use the bootcode.bin file - instead the bootloader is located in an on-board EEPROM chip. The Pi 4B bootloader currently only supports booting from an SD card.- When the Raspberry Pi is first turned on, the ARM core is off, and the GPU core is on. At this point the SDRAM is disabled.
- The GPU starts executing the first stage bootloader, which is stored in ROM on the SoC. The first stage bootloader reads the SD card, and loads the second stage bootloader (bootcode.bin) into the L2 cache, and runs it.
- The second stage bootloader bootcode.bin enables SDRAM, and reads the third stage bootloader (loader.bin) from the SD card into RAM, and runs it.
- The third stage bootloader loader.bin reads the GPU firmware (start.elf).
- start.elf reads config.txt, cmdline.txt and kernel.img
loader.bin is used to load start.elf at the top of memory (ARM uses SDRAM from address zero).
bootcode.bin UART enable
To do this, make sure you've got a recent version of the firmware (including bootcode.bin). To check if UART is supported in your current firmware:
$ strings /boot/bootcode.bin | grep BOOT_UART
BOOT_UART=0
To enable UART from bootcode.bin use:
sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" /boot/bootcode.bin
Next, connect a suitable USB serial cable to your host computer to the standard pins on a Pi: - 6 GND pin is connected to USB cable's GND.
- 8 GPIO14(UART0_TX0) pin is connected to USB cable's RX.
- 10 GPIO15(UART0_RX0) pin is connected to USB cable's TX.
留言