YMMV

* your mileage may vary

Saturday, 24 May 2014

Beaglebone Black (BBB) Boot Process

The BBB boot process is actually a series of steps that can be control based on inputs.  Changing the inputs can change how it boots.  Just because an SD card inserted does not mean all the boot processes are originating from the SD card.
5 Stages to Booting:
Stage 1
  • The ROM loads.   This is on board read only and can't change.  It looks for the MLO file and runs it.
Stage 2 (x-loader)
  • MLO file runs and looks for Zimage
Stage 3 (u-boot)
  • Zimage loads & run with configuration uEnv.txt
  • uEnv.txt files have info on where to find the linux kernal plus lots of other parameters
  • Parameters  can be passed from the uEnv.txt file into Linux kernal (provided the kernal was complied with the required modules for the parameters)
Stage 4
  • Linux Kernal loads
Stage 5
  • Root file system loads (e.g. debian, ubuntu, etc.)

Boot control:
The normal sequence is (S2 button not pushed):
  • MC1 (eMMC on-board flash), MMC0 (SD card), UART0, USB0
S2 button pushed:
  •  SPI0, MMC0 (SD card), USB0, UART0
Notes and Caution:
  • Stage 2 and forward is basically software so it can be changed & modified.  Be careful what you read in blogs (this one!) and wiki as they could be out of date.
  • Standard boot process can be overridden by placing a resistor between P8.43  and ground.  Pushing S2 is not required.
  • S2 button push must have a power down/power up cycle.  Rebooting and pushing S2  has not impact.
  • The BBB will boot from the SD card with out pushing S2.  However the stage 1 (MLO) and Stage 2 (U-boot) will be from the eMMC.
  • Pushing S2 forces Stage 2 and Stage 3 to be pulled from SD card.
  • Alternative remove MLO and Zimage from the eMMC to force boot from the SD card without pushing the S2 button
  • Booting from eMMC will pull the uEnv.txt information from SD card if available.
  • A blank SD card inserted will cause the BBB to hang.  The following is needed in a uEnv.txt file in the main partition of the SD card. 
    • mmcdev=1 
    • bootpart=1:2 
    • mmcroot=/dev/mmcblk1p2 ro



6 comments:

  1. Hello,

    I am newbie to Beaglebone (Black). I tried booting Beaglebone with default image in eMMC but boot sequence stops after few steps. Following is the copy of boot steps. Can any one let me know if I am missing some thing here.

    U-Boot 2013.04-dirty (Jul 10 2013 - 14:02:53)

    I2C: ready
    DRAM: 512 MiB
    WARNING: Caches not enabled
    NAND: No NAND device found!!!
    0 MiB
    MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Warning - readenv() failed, using default environment

    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Peripheral mode controller at 47401000 using PIO, IRQ 0
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Host mode controller at 47401800 using PIO, IRQ 0
    Net: not set. Validating first E-fuse MAC
    cpsw, usb_ether
    Hit any key to stop autoboot: 0
    gpio: pin 53 (gpio 53) value is 1
    Card did not respond to voltage select!
    mmc0(part 0) is current device
    Card did not respond to voltage select!
    No micro SD card found, setting mmcdev to 1
    mmc_send_cmd : timeout: No status update
    mmc1(part 0) is current device
    mmc_send_cmd : timeout: No status update
    gpio: pin 54 (gpio 54) value is 1
    SD/MMC found on device 1
    reading uEnv.txt
    26 bytes read in 3 ms (7.8 KiB/s)
    Loaded environment from uEnv.txt
    Importing environment from mmc ...
    gpio: pin 55 (gpio 55) value is 1
    4385024 bytes read in 765 ms (5.5 MiB/s)
    gpio: pin 56 (gpio 56) value is 1
    24808 bytes read in 52 ms (465.8 KiB/s)
    Booting from mmc ...
    ## Booting kernel from Legacy Image at 80007fc0 ...
    Image Name: Angstrom/3.8.13/beaglebone
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 4384960 Bytes = 4.2 MiB
    Load Address: 80008000
    Entry Point: 80008000
    Verifying Checksum ... OK
    ## Flattened Device Tree blob at 80f80000
    Booting using the fdt blob at 0x80f80000
    XIP Kernel Image ... OK
    OK
    Using Device Tree in place at 80f80000, end 80f890e7

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    [ 0.196410] omap2_mbox_probe: platform not supported
    [ 0.206977] tps65217-bl tps65217-bl: no platform data provided
    [ 0.283534] bone-capemgr bone_capemgr.8: slot #0: No cape found
    [ 0.320638] bone-capemgr bone_capemgr.8: slot #1: No cape found
    [ 0.357748] bone-capemgr bone_capemgr.8: slot #2: No cape found
    [ 0.394856] bone-capemgr bone_capemgr.8: slot #3: No cape found
    [ 0.414585] bone-capemgr bone_capemgr.8: slot #6: BB-BONELT-HDMIN conflict P8.45 (#5:BB-BONELT-HDMI)
    [ 0.424195] bone-capemgr bone_capemgr.8: slot #6: Failed verification
    [ 0.444657] omap_hsmmc mmc.4: of_parse_phandle_with_args of 'reset' failed
    [ 0.451953] bone-capemgr bone_capemgr.8: loader: failed to load slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
    [ 0.518398] pinctrl-single 44e10800.pinmux: pin 44e10854 already requested by 44e10800.pinmux; cannot claim for gpio-leds.7
    [ 0.530134] pinctrl-single 44e10800.pinmux: pin-21 (gpio-leds.7) status -22
    [ 0.537459] pinctrl-single 44e10800.pinmux: could not request pin 21 on device pinctrl-single

    ReplyDelete
  2. I am try to USB0 boot flashing in am335x based on custom board using boot switch(with press/without press),please can you share USB0 boot flash details.

    please find bellow uEnv.txt boot args file

    bootpart=0:2
    mmcroot=/dev/sda2
    console=ttyO1,115200n8
    fdtfile=am335x-boneblack.dtb

    ReplyDelete
  3. can you pleas axplain the content of the uenv.txt file that we put on first partition of the SD card?

    ReplyDelete
  4. Hi.. Nice post... I would like to know if its possible to disable BBB to boot from SD card even if s2 button is pressed? ... thanks!

    ReplyDelete
  5. I've tried this before and I think you need a hardware override on the S2 button or a custom MLO file. To be honest, this is beyond me but I would suggest checking with google groups https://groups.google.com/forum/#!forum/beaglebone

    ReplyDelete