source: umon/ports/beagleboneblack/README @ 2945559

Last change on this file since 2945559 was 2945559, checked in by Jarielle Catbagan <jcatbagan93@…>, on Jul 8, 2015 at 9:28:42 PM

BBB: Add sd_setup.sh to create a bootable SD and README to document SD and UART booting

sd_setup.sh is a script that automates the process of setting up
an SD card with the appropriate uMon image to boot using either
"raw" or FAT mode.

README currently documents the steps required to boot the
Beaglebone Black from an SD card or via UART.

  • Property mode set to 100644
File size: 8.5 KB
Line 
1Getting Started with uMon for the Beaglebone Black
2
3=======================================================================
4Booting:
5=======================================================================
6
7-----------------------------------------------------------------------
8SD Card:
9-----------------------------------------------------------------------
10The Beaglebone Black can boot uMon from an SD card using two different
11boot modes.  The first boot mode is to boot using "raw" mode.  The
12second boot mode is to boot from a FAT primary partition marked as
13bootable.  The details and the steps required to set up the SD card
14for each of the boot modes are elaborated in the following two sections
15on SD card booting.  For more information on "raw" mode and FAT mode,
16please refer to the AM335s TRM Sections 26.1.7.5.5 "MMC/SD Read Sector
17Procedure in Raw Mode" and 26.1.7.5.6 "MMC/SD Read Sector Procedure
18in FAT Mode" respectively.
19
20In order to boot uMon from an SD card using FAT mode, a GP Header must
21be prepended to the uMon image.  In the case of booting uMon using
22"raw" mode, both a Configuration Header TOC Structure followed by a
23GP Header must be prepended to the uMon image.
24
25The GP Header is 8 bytes long where the first 4 bytes specify the size
26of the uMon image that will be transferred while the last 4 bytes
27specify both the destination address where the uMon image will be
28transferred to and the entry point.
29
30For information on the layout of the Configuration Header TOC Structure
31required for "raw" mode booting, please refer to the AM335x TRM
32Section 26.1.7.5.5.1 "Configuration Header".
33
34One thing worth mentioning is that the Beaglebone Black is connected to
35the SD card using MMC0 and as a result the size of the SD card must not
36be greater than 4GB.  This is indicated in the AM335x TRM Section
3726.1.7.5.2 "System Interconnection".
38
39In order to configure the Beaglebone Black to boot from an SD card,
40a uSD must be inserted and the boot switch held down while the board
41is powered up.  Once the board is powered on, the boot switch can
42be released.  If the attempt to boot from the uSD fails, the
43Beaglebone Black will fall back and attempt to boot using UART.
44As a result, this will provide a way to determine whether the boot
45from SD has succeeded or not.
46
47Before starting, it is recommended that the device that will be
48manipulated is verified to be the right device.  An approach to
49determine the right device name assigned to the SD card is by
50observing the output of
51
52        cat /proc/partitions
53
54before and after inserting the SD card.
55
56
57RAW MODE:
58
59In order to boot from an SD card using "raw" mode, the uMon image
60must be prepended with a Configuration Header TOC Structure and a
61GP Header.  The GP Header is placed right after the Configuration
62Header TOC Structure.
63
64When uMon is built, a uMon image containing the necessary headers
65is already created and is located under ./build_BEAGLEBONEBLACK.
66
67The next step is to setup the SD card.  Fortunately, the script
68./sd_setup.sh can be used to automate the process of setting up
69an SD card for "raw" mode booting.  To do so, invoke the script as
70
71        ./sd_setup.sh RAW <device>
72
73<device> shown above and for the remainder of this document will
74refer to the SD card.
75
76The following information specify how to manually set up the SD
77card.
78
79With the proper headers prepended, the image is ready to be booted.
80In order for the Beaglebone Black/AM335x to boot the image, the
81image must be placed at one of the offsets
820x00000/0x20000/0x40000/0x60000.
83
84As an example, to place the uMon image at the first offset
85
86        # Get the size of the uMon image to transfer into the SD card
87        export UMON_IMG_SIZE=`wc --bytes <uMon image> | cut -f 1 -d ' '`
88
89        # Transfer the uMon image at offset 0x00000
90        dd if=<uMon image> bs=1 count=$UMON_IMG_SIZE of=/dev/<device>
91
92where <uMon image> is the path to the uMon image prepended with a
93Configuration Header TOC Structure and a GP Header.
94
95
96FAT MODE:
97
98In FAT Mode, an "MLO" file is searched for in the root directory of
99a primary partition formatted as FAT12/FAT16 or FAT32 and marked
100bootable.  This "MLO" file must contain a GP Header followed by the
101uMon image.  When uMon is built, an "MLO" file is already created and
102is located in ./build_BEAGLEBONEBLACK.
103
104For convenience, preparing the SD card for FAT Mode booting has
105been automated through the use of the same aforementioned script,
106./sd_setup.sh.
107
108Invoking the script in order to create an SD card for FAT mode booting
109is as follows:
110
111        ./sd_setup.sh FAT <device>
112
113The script simply sets up a primary partition on the SD card, marks
114it as bootable, formats it as FAT16 and then transfers the MLO file
115under ./build_BEAGLEBONEBLACK to the root directory of the primary
116partition on the SD card.
117
118The following elaborates the sequence of steps on how exactly an SD
119card is prepared for FAT Mode booting for the Beaglebone Black
120to boot from.
121
122Assuming that the SD card has not been formatted yet...
123
124Just to be safe, clear out the partition table at the base of the SD
125card to start fresh.
126
127        dd if=/dev/zero of=<device> bs=1M count=1
128
129The next step is to create a primary partition with the filesystem
130type set to FAT16.  This primary partition will be placed as an entry
131in an MBR located in the first sector of the SD card.  Fortunately,
132these intial steps are taken care of by the fdisk utility.
133
134To allocate a partition that will be formatted as FAT16 and to create
135an entry for the partition in the MBR,
136
137        fdisk <device>
138
139Suppose the SD card is registered under /dev as "sdc", this would be
140
141        fdisk /dev/sdc
142
143fdisk will then present a command-line dialog.
144
145From here, a new partition must be created using 'n'.  This partition
146must have a type of 0x06 for FAT16 which is set with 't' and with the
147size allocated to the partition to be at least 3MB.  This size is the
148minimum size required and is more than enough to hold a uMon image and
149to allow for future expansion.  It is recommended that not all of the
150sectors of the SD card are allocated to the FAT16 primary partition
151in order to provide room for the possibility of storing user data or
152perhaps a kernel.
153
154Once that is done, the next step is to mark the primary partition as
155bootable.  This is done using the 'a' option.
156
157With all that in place, the partition can be verified before writing
158it to the SD card with 'p'.  Once the partition has been verified,
159it can be written to the SD card using 'w'.
160
161After using fdisk to set up the partition, the new partition can be
162viewed under /dev.  So for example, if the base of the SD card is given
163as /dev/sdc, then the newly created FAT16 partition will be given as
164/dev/sdc1.
165
166The next step is to format this partition as FAT16:
167
168        mkfs.fat -f 2 -F 16 -M 0xF8 -s 1 -S 512 <device>
169
170with <device> set to the primary partition of the SD card.
171
172The final step is to place the "MLO" file in the root directory
173of the FAT16 primary partition.
174
175        cd ~
176        mkdir mnt
177        mount <device> mnt
178        cp <path_to_umon>/ports/beagleboneblack/build_BEAGLEBONEBLACK/MLO mnt
179        umount mnt
180        rmdir mnt
181
182In the previous set of commands, <device> is set to the primary
183partition of the SD card that was recently formatted as FAT16.
184
185The SD card is now ready.
186
187
188-----------------------------------------------------------------------
189UART:
190-----------------------------------------------------------------------
191Unlike booting from SD, booting via UART does not require any GP
192Header, Configuration Header TOC Structure, or both to be prepended to
193the uMon image.  The uMon image that will be booted using UART is
194boot.bin which is located in ./build_BEAGLEBONEBLACK.
195
196In order to boot from UART, a 3.3V USB-to-Serial cable is required,
197e.g. the FTDI USB TTL Serial cable is a possible option.
198
199The last requirement is to have a terminal emulator
200(e.g. minicom/picocom/etc.) set up to perform XMODEM transfers using
2011K packets and 16-bit CRC.
202
203To initiate the UART booting procedure on the Beaglebone Black, ensure
204that there is no uSD card inserted and then hold the boot switch down
205while powering up the board.  Once the board is powered on, the boot
206switch can be released.
207
208If a terminal emulator is set up already and connected to the serial
209port of the Beaglebone Black, the character 'C' will be outputted
210continuously.  This indicates that the UART booting procedure has
211initiated and is waiting for an image to be transferred via UART.
212
213From here, the uMon image can now be transferred using the terminal
214emulator.
215
216For more information on the UART boot procedure, please refer to the
217AM335x TRM Section 26.1.8.5 "UART Boot Procedure".
218=======================================================================
Note: See TracBrowser for help on using the repository browser.