Skip to content

Commit

Permalink
BBB: Added a README that currently elaborates how to boot from SD and…
Browse files Browse the repository at this point in the history
… UART.
  • Loading branch information
jrcatbagan committed Jul 6, 2015
1 parent 2e564a6 commit 7f75148
Showing 1 changed file with 158 additions and 0 deletions.
158 changes: 158 additions & 0 deletions ports/beagleboneblack/README
@@ -0,0 +1,158 @@
Getting Started with uMon for the Beaglebone Black

=======================================================================
Booting:
=======================================================================

-----------------------------------------------------------------------
SD Card:
-----------------------------------------------------------------------
The Beaglebone Black can boot uMon from an SD card using two different
boot modes. The first boot mode is to boot using "raw" mode. The
second boot mode is to boot from a FAT primary partition marked as
bootable. The details and the steps required to set up the SD card
for each of the boot modes are elaborated in the following 2 sections
on SD card booting. For more information on "raw" mode and FAT mode,
please refer to the AM335s TRM Sections 26.1.7.5.5 and 26.1.7.5.6
respectively.

In order to boot uMon from an SD card using FAT mode, a GP Header must
be prepended to the uMon image. In the case of booting uMon using
"raw" mode, both a Configuration Header TOC Structure followed by a
GP Header must be prepended to the uMon image.

The GP Header is 8 bytes long where the first 4 bytes specify the size
of the uMon image that will be transferred while the last 4 bytes
specify both the destination address where the uMon image will be
transferred to and the entry point.

For information on the layout of the Configuration Header TOC Structure
required for "raw" mode booting, please refer to the AM335x TRM
Section 26.1.7.5.5.1.

One thing worth mentioning is that the Beaglebone Black is connected to
the SD card using MMC0 and as a result the size of the SD card must not
be greater than 4GB. This is indicated in the AM335x TRM Section
26.1.7.5.2.

In order to configure the Beaglebone Black to boot from an SD card,
a uSD must be inserted and the boot switch held down while the board
is powered up. Once the board is powered on, the boot switch can
be released. If the attempt to boot from the uSD fails, the
Beaglebone Black will fall back and attempt to boot using UART.
As a result, this will provide a way to indicate whether the boot
from SD succeeds or not.


RAW MODE:

In order to boot from an SD card using "raw" mode, the uMon image
must be prepended with a Configuration Header TOC Structure and a
GP Header. The GP Header is placed right after the Configuration
Header TOC Structure.

With the proper headers prepended, the image is ready to be booted.
In order for the Beaglebone Black/AM335x to boot the image from an
SD card, the image must be placed at one of the offsets
0x00000/0x20000/0x40000/0x60000.

Assuming the SD card is /dev/sdc, to place the uMon image at the first
offset of the SD card

# Get the size of the uMon image to transfer into the SD card
export UMON_IMG_SIZE=`wc --bytes <uMon image> | cut -f 1 -d ' '`

# Transfer the uMon image at offset 0x00000
dd if=<uMon image> bs=1 count=$UMON_IMG_SIZE of=/dev/sdc


FAT MODE:

In FAT Mode, an "MLO" file is searched for in the root directory of
a primary partition formatted as FAT12/FAT16 or FAT32 and marked
bootable. This "MLO" file must contain a GP Header followed by the
uMon image. When uMon is built, an "MLO" file is already created and
is located in ./build_BEAGLEBONEBLACK.

The next sequence of steps detail how to prepare an SD card for
FAT Mode booting for the Beaglebone Black to boot from.

Assuming that the SD card has not been formatted yet...

The first step is to create a primary partition with the filesystem
type set to FAT32. This primary partition will be placed as an entry
in an MBR and will be located in the first sector of the SD card.
Fortunately, these intial steps are taken care of by the fdisk utility.

To allocate a partition that will be formatted as FAT32 and to create
an entry for the partition in an MBR,

fdisk <device>

where device is the SD card. Suppose the SD card is registered
under /dev as "sdc", this would be

fdisk /dev/sdc

fdisk will then present a command-line dialog.

From here, a new partition must be created using 'n'. This partition
must have a type of 0x0C for FAT32 which is set with 't' and with the
the number of sectors allocated to this partition to be set to at least
100, which is enough to hold the size of the current uMon image and to
allow for future expansion. It is recommended that not all the sectors
of the SD card be allocated to the FAT32 primary partition in order to
provide room for the possibility of storing user data or perhaps
a kernel.

Once that is done, the next step is to mark the primary partition as
bootable. This is done using the 'a' option.

With all that in place, the partition can be verified before writing
it to the SD card with 'p'. Once the partition has been verified,
it can be written to the SD card using 'w'.

After using fdisk to set up the partition, this should present the
newly created partition as /dev/sdc1.

The next step is to format this partition as FAT32:

mkfs.fat -f 2 -F 32 -M 0xF8 -R 32 -s 64 -S 512 /dev/sdc1

The final step is to place the "MLO" file in the root directory
of the FAT32 primary partition.

cd ~
mkdir mnt
mount /dev/sdc1 mnt
cp <path_to_umon>/ports/beagleboneblack/build_BEAGLEBONEBLACK/MLO mnt
umount mnt
rmdir mnt

The SD card is now ready.


-----------------------------------------------------------------------
UART:
-----------------------------------------------------------------------

In order to boot from UART, a 3.3V USB-to-Serial cable is required,
e.g. the FTDI USB TTL Serial cable is a possible option.

The last requirement is to have a terminal emulator
(e.g. minicom/picocom/etc.) set up to perform XMODEM transfers using
1K packets and 16-bit CRC.

To initiate the UART booting procedure on the Beaglebone Black, ensure
that there is no uSD card inserted and then hold the boot switch down
while powering up the board. Once the board is powered on, the boot
switch can be released.

If a terminal emulator is set up already and connected to the serial
port of the Beaglebone Black, the character 'C' will be outputted
continuously. This indicates that the UART booting procedure has
initiated and is waiting for an image to be transferred via UART.

From here, the uMon image can now be transferred using the terminal
emulator.
=======================================================================

0 comments on commit 7f75148

Please sign in to comment.