# Source: bootmodes.adoc

*Note: This file could not be automatically converted from AsciiDoc.*

== Raspberry Pi boot modes

The Raspberry Pi has a number of different stages of booting. This document explains how the boot modes work, and which ones are supported for Linux booting.

=== Special `bootcode.bin`-only boot mode

USB host and Ethernet boot can be performed by BCM2837-based Raspberry Pis - that is, Raspberry Pi 2B version 1.2, Raspberry Pi 3B, and Raspberry Pi 3B+ (Raspberry Pi 3A+ cannot net boot since it does not have a built-in Ethernet interface). In addition, all Raspberry Pi models prior to Raspberry Pi 4 can use a `bootcode.bin`-only method to enable USB host boot.

NOTE: Since Raspberry Pi 4, flagship devices do not use the `bootcode.bin` file. Instead, these devices use a bootloader located in an on-board EEPROM chip. For more information, see the documentation on xref:raspberry-pi.adoc#eeprom-boot-flow[EEPROM bootflow] and xref:raspberry-pi.adoc#raspberry-pi-boot-eeprom[SPI boot EEPROM].

Format an SD card as FAT32 and copy over the latest https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin[`bootcode.bin`]. The SD card must be present in the Raspberry Pi for it to boot. Once `bootcode.bin` is loaded from the SD card, the Raspberry Pi continues booting using USB host mode.

This is useful for the Raspberry Pi 1, 2, and Zero models, which are based on the BCM2835 and BCM2836 chips, and in situations where a Raspberry Pi 3 fails to boot (the latest `bootcode.bin` includes additional bugfixes for the Raspberry Pi 3B, compared to the boot code burned into the BCM2837A0).

If you have a problem with a mass storage device still not working, even with this `bootcode.bin`, then add a new file called "timeout" to the SD card. This will extend to six seconds the time for which it waits for the mass storage device to initialise.

=== `bootcode.bin` UART Enable

NOTE: For boards released prior to Raspberry Pi 4.

For information on enabling UART with the EEPROM bootloader, see the xref:raspberry-pi.adoc#raspberry-pi-bootloader-configuration[bootloader configuration] documentation.

It is possible to enable an early stage UART to debug booting issues (useful with the above `bootcode.bin` only boot mode). 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:

[source,console]
----
$ strings bootcode.bin | grep BOOT_UART
----
 
To enable UART from `bootcode.bin`:

[source,console]
----
$ sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" bootcode.bin
----

Next, connect a suitable USB serial cable to your host computer (a Raspberry Pi will work, although you may find that the easiest path is to use a USB serial cable, since it'll work out the box without any pesky config.txt settings). Use the standard pins 6, 8 and 10 (GND, GPIO14, GPIO15) on a Raspberry Pi or Compute Module.

Then use `screen` on Linux or macOS or `putty` on Windows to connect to the serial.

Set up your serial to receive at 115200-8-N-1, and then boot your Raspberry Pi.  You should get an immediate serial output from the device as `bootcode.bin` runs.