Anda di halaman 1dari 2

BeagleBoneBlack Upgrading uBoot - BeyondLogic http://wiki.beyondlogic.org/index.php?title=Bea...

Build, Test & Deploy


Google Cloud Platform. With Ease. Start your 12
month free trial today.

Navigation

Main page
Recent changes
Random page

Search

Search Go Search

Tools

What links here


Related changes
Special pages
Printable version
Permanent link
Page information

Personal tools

Log in

Contents
1 U-Boot on the BeagleBone Black
1.1 Compiling U-Boot for the BeagleBone Black
1.2 Testing the fully featured second stage U-Boot Bootloader
1.3 Saving the Bootloader Images to Flash/Card
1.4 Setting Environment Variables for booting from TFTP/NFSRoot
1.5 Booting from uSD Card (MMC0)
1.6 Setting up the environment area on your uSD Card

U-Boot on the BeagleBone Black


The AM335X contains ROM code that can load a bootloader from external memory such
as the on-board eMMC. On reset, this ROM code searches for the bootloader and then
copies it to the internal RAM before executing it. The internal RAM on the AM335X is
128KB, but due to various limitations, only 109KB is available for the initial bootloader
for program memory, heap and stack.

A fully featured version of U-Boot can be over 400KB, hence it is not possible to load this
immediately. For this reason, a cut down version of U-Boot called U-Boot SPL (Second
Program Loader) is loaded rst, and once it has initialised the CPU, it chain loads a fully
featured version of U-Boot (u-boot.img).

1 of 4 25/05/17, 2:46 PM
BeagleBoneBlack Upgrading uBoot - BeyondLogic http://wiki.beyondlogic.org/index.php?title=Bea...

By default, the ROM code in the Sitara AM3359 will boot from the MMC1 interface rst
(the onboard eMMC), followed by MMC0 (external uSD), UART0 and USB0.

If the boot switch (S2) is held down during power-up, the ROM will boot from the SPI0
Interface rst, followed by MMC0 (external uSD), USB0 and UART0. This allows the
BeagleBone Black to bypass the onboard eMMC and boot from the removable uSD
(provided no valid boot device is found on SPI0.) This can be used to recover from a
corrupted onboard eMMC/U-Boot.

The ROM code will try to load and execute the rst stage bootloader called "MLO"
(U-Boot SPL) from a Fat 12/16 or 32 bit MBR based lesystem. Alternatively, if using
eMMC, the bootloader can be loaded using RAW mode.

Early BeagleBone Black images included MLO (and u-boot.img) on a FAT le-system in
the root directory of the active primary partition. The card would contain two partitions,
a FAT32 partition and Linux ext3/4. The full/second stage U-Boot would contain
hard-coded environment variables to load uEnv.txt as the environment variables couldn't
be saved using saveenv.

In more recent times, the RAW mode has been adopted. In RAW mode, the ROM code will
search sector #0 (oset 0x00000), sector #256 (0x20000), sector #512 (0x40000) and
sector #768 (0x60000) for a TOC structure/Conguration Header.

If you still want to use the MMC as a disk, then it must have a Master Boot Record (MBR)
containing one or more partition table entries at 0x00000. This prevents placing U-Boot
SPL/MLO there. As the ROM Code will search four sectors, it makes sense to place
U-Boot SPL/MLO at 0x20000 (sector #256).

U-boot SPL can then load the fully featured U-Boot second stage bootloader at 0x60000.
One of the advantages of running U-Boot from block memory is the environment
variables can be stored. This method means you can now modify and save the
environment variables, negating the need to load uEnv.txt.

Don't panic that you are encroaching into partitions on the disk. Most primary partitions
will start at sector 2048, and with 512B per sector you have an entire 1MB to play with:

Disk /dev/sdb: 7.4 GiB, 7948206080 bytes, 15523840 sectors


Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type


/dev/sdb1 * 2048 198655 196608 96M e W95 FAT16 (LBA)
/dev/sdb2 198656 7577599 7378944 3.5G 83 Linux

Compiling U-Boot for the BeagleBone Black

Download the latest version of U-Boot, extract the les to a working folder and patch:

wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjf u-boot-latest.tar.bz2
cd u-boot-2015.10
wget https://rcn-ee.com/repos/git/u-boot-patches/v2015.10/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

Now cross compile U-Boot using the am335x BeagleBone Black conguration:

2 of 4 25/05/17, 2:46 PM

Anda mungkin juga menyukai