source: umon/ports/beagleboneblack/README @ c900821

Last change on this file since c900821 was c900821, checked in by Jarielle Catbagan <jcatbagan93@…>, on Aug 21, 2015 at 5:06:00 PM

BBB: README: Add section on installing uMon into the eMMC from an SD card

  • Property mode set to 100644
File size: 9.8 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-----------------------------------------------------------------------
189eMMC:
190-----------------------------------------------------------------------
191Booting uMon from the onboard eMMC requires a multiple-step procedure
192that will be simplified in the future as the uMon port progresses.
193
194To transfer a uMon image into the onboard eMMC requires an SD card where
195uMon is configured to boot in RAW mode from a known offset.
196
197With uMon configured to boot in RAW mode from a known offset in the
198SD card, the next step is to determine the size of the uMon image in
199512-byte blocks.
200
201With all of this in place, the sequence of uMon commands required to
202transfer the uMon image are as follows:
203
204    sd init
205    mmc init
206    sd read <destination in RAM> <SD sector address> <# of 512-byte blocks>
207    mmc write <source in RAM> <eMMC sector address> <# of 512-byte blocks>
208
209With these steps, the uMon image is first transferred into DDR3 RAM
210and then written to the eMMC.  The reason for this appraoch is that
211there is currently no supported mechanism to write the eMMC directly
212from an SD card.
213
214The user must take care to transfer the uMon image in a location in
215RAM not currently owned by the uMon image currently in execution.
216
217As for the final destination in the eMMC, the uMon image must be stored
218in a locatation where the internal ROM-bootloader will be able to find
219and boot this image.
220
221
222-----------------------------------------------------------------------
223UART:
224-----------------------------------------------------------------------
225Unlike booting from SD, booting via UART does not require any GP
226Header, Configuration Header TOC Structure, or both to be prepended to
227the uMon image.  The uMon image that will be booted using UART is
228boot.bin which is located in ./build_BEAGLEBONEBLACK.
229
230In order to boot from UART, a 3.3V USB-to-Serial cable is required,
231e.g. the FTDI USB TTL Serial cable is a possible option.
232
233The last requirement is to have a terminal emulator
234(e.g. minicom/picocom/etc.) set up to perform XMODEM transfers using
2351K packets and 16-bit CRC.
236
237To initiate the UART booting procedure on the Beaglebone Black, ensure
238that there is no uSD card inserted and then hold the boot switch down
239while powering up the board.  Once the board is powered on, the boot
240switch can be released.
241
242If a terminal emulator is set up already and connected to the serial
243port of the Beaglebone Black, the character 'C' will be outputted
244continuously.  This indicates that the UART booting procedure has
245initiated and is waiting for an image to be transferred via UART.
246
247From here, the uMon image can now be transferred using the terminal
248emulator.
249
250For more information on the UART boot procedure, please refer to the
251AM335x TRM Section 26.1.8.5 "UART Boot Procedure".
252=======================================================================
Note: See TracBrowser for help on using the repository browser.