Bootstrapping process¶
Objective¶
Provide information as to what is involved in the boot-strap process which gets the board from the power-off state into the linux kernel running.
Information¶
Reference information about the board initialization and bootstrap process can be found in:
- The Initialization chapter (Chapter 33) of the AM57xx Technical Reference Manual
- Chapter 4.6 Boot of AM57xx Processor-SDK-rtos
The Bootstrap process involves multiple stages:
- ROM Bootloader
- This bootloader does some platform initialization, determines the boot device, loads the secondary bootloader from the boot device, and starts the secondary bootloader.
- Secondary Bootloader
- The secondary bootloader does further initialization of the board (like the peripherals), loads the third-stage bootloader (usually U-boot) and transfers control to the third-stage bootloader.
- Third-stage bootloader (U-Boot)
- The final stage of the bootstrap process is usually U-boot. This is a fairly sophisticated program which can be scripted to perform a variety of tasks. These tasks can do further initialization of the board (e.g. load the fpga), load the application image and then transfer control to the application.
Most applications will probably be able to use the secondary bootloader and u-boot as provided in the development kit. Most customizations can be done within the scripting within u-boot. This scripting is performed by defining environment variables and then running the variables as commands. The attached pdf file (Uboot_Flowchart.pdf) contains a flowchart of the u-boot environment as provided in the default image for the development kit. This demonstrates how several environment variables are stitched together to create the bootstrap script. Some environment variables are commands to be executed and others are data to be used by the commands.
Many customizations can be made by changing the environment variables which are used as data.
More complicated customizations can be made by changing the environment variables which contain commands.
In some cases, changes to the u-boot program are needed. Instructions for building u-boot are provided at: Building U-boot
If you need to debug U-boot, see: Debugging U-boot
There may even be a case where the secondary bootloader needs to be changed. The secondary bootloader is built at the same time that u-boot is built.
Stopping in U-boot¶
When the board is booting up, there is a window in U-boot during which if no key is hit, then the application is loaded and started. If a key is hit, then U-boot stops and issues the u-boot prompt. This lets you look at or make changes to the environment variables if you wish. When you are finished, you can simply type boot and then u-boot will run the "bootcmd" environment variable. The length of the window is the value of the "bootdelay" environment variable in seconds and is 2 by default. You can change the value of the bootdelay to make the window longer if you wish.
To look at the environment variables, use printenv.
After making changes to the environment variables, use saveenv to save the changes.
Use "help" to see what other commands are available. Additional information about the commands can be found on the internet.
The Bootloader Files¶
In the development kit, the bootloader files are in the first partition on the SD card and can be accessed from Linux, U-boot, or anything that can access the SD card. The application files are in the second partition of the SD card.
First Partition¶
- From U-boot
=> ls mmc 0:1 2192012 fpga_7a15t.bin 1241804 fpga_7a25t.bin 2192012 fpga_7a35t.bin 2192012 fpga_7a50t.bin 150619 MLO 648176 u-boot.img System Volume Information/ 6 file(s), 1 dir(s)
A description of each of these files:
Name | Description |
MLO | Secondary boot loader |
System Volume Information | A directory of Boot device volume information |
fpga_7a15t.bin | fpga image for Xilinx XC7A15T FPGA |
fpga_7a25t.bin | fpga image for Xilinx XC7A25T FPGA |
fpga_7a35t.bin | fpga image for Xilinx XC7A35T FPGA |
fpga_7a50t.bin | fpga image for Xilinx XC7A50T FPGA |
u-boot.img | u-boot program |
- From Linux
root@mitysom-am57x:~# ls -l /run/media/mmcblk0p1/ -rwxrwx--- 1 root disk 150619 Sep 10 2021 MLO drwxrwx--- 2 root disk 2048 Nov 8 11:21 System Volume Information -rwxrwx--- 1 root disk 2192012 Sep 10 2021 fpga_7a15t.bin -rwxrwx--- 1 root disk 1241804 Sep 10 2021 fpga_7a25t.bin -rwxrwx--- 1 root disk 2192012 Sep 10 2021 fpga_7a35t.bin -rwxrwx--- 1 root disk 2192012 Sep 10 2021 fpga_7a50t.bin -rwxrwx--- 1 root disk 648176 Sep 10 2021 u-boot.img root@mitysom-am57x:~#
If you rebuild u-boot or the secondary bootloader, you can copy the files to the SD-card using whatever method you are most comfortable with (save the originals just in case) and then try the new programs. If you need to go back to the original files, you can remove the SD-card, restore the original files, insert the SD-card back in, and then reboot.
Second Partition¶
- From U-boot
=> ls mmc 0:2 <DIR> 4096 . <DIR> 4096 .. <DIR> 16384 lost+found <DIR> 4096 run <SYM> 19 linuxrc <DIR> 4096 opt <DIR> 4096 boot <DIR> 4096 dev <DIR> 4096 proc <DIR> 4096 bin <DIR> 4096 mnt <DIR> 4096 include <DIR> 4096 sbin <DIR> 4096 srv <DIR> 4096 etc <DIR> 4096 media <DIR> 4096 usr <DIR> 4096 var <DIR> 4096 lib <DIR> 4096 tmp <DIR> 4096 sys <DIR> 4096 www <DIR> 4096 home (The linux images and device tree are in the boot directory) => ls mmc 0:2 boot <DIR> 4096 . <DIR> 4096 .. <SYM> 26 uImage 4457024 uImage-4.19.94-g9ce96ed7a5 90014 am57xx-mitysom-devkit.dtb <SYM> 26 zImage 4456960 zImage-4.19.94-g9ce96ed7a5 16404196 vmlinux-4.19.94-g9ce96ed7a5 92744 am57xx-mitysom-devkit-fpga.dtb =>
- From Linux
root@mitysom-am57x:~# ls -l / drwxr-xr-x 2 root root 4096 Sep 10 2021 bin drwxr-xr-x 2 root root 4096 Dec 8 19:01 boot drwxr-xr-x 11 root root 14240 Dec 9 18:21 dev drwxr-xr-x 62 root root 4096 Dec 7 21:15 etc drwxr-xr-x 3 root root 4096 Sep 9 2021 home drwxr-xr-x 2 root root 4096 Sep 9 2021 include drwxr-xr-x 10 root root 4096 Sep 10 2021 lib lrwxrwxrwx 1 root root 19 Sep 10 2021 linuxrc -> /bin/busybox.nosuid drwx------ 2 root root 16384 Sep 10 2021 lost+found drwxr-xr-x 3 root root 4096 Sep 9 2021 media drwxr-xr-x 3 root root 4096 Sep 10 2021 mnt drwxr-xr-x 5 root root 4096 Sep 10 2021 opt dr-xr-xr-x 103 root root 0 Jan 1 1970 proc drwxr-xr-x 13 root root 500 Dec 9 19:11 run drwxr-xr-x 3 root root 4096 Sep 10 2021 sbin drwxr-xr-x 3 root root 4096 Sep 10 2021 srv dr-xr-xr-x 12 root root 0 Jan 1 1970 sys drwxrwxrwt 13 root root 300 Dec 9 19:11 tmp drwxr-xr-x 11 root root 4096 Sep 10 2021 usr drwxr-xr-x 9 root root 4096 Sep 9 2021 var drwxr-xr-x 3 root root 4096 Sep 10 2021 www root@mitysom-am57x:~# ls -l /boot -rw-r--r-- 1 root root 92744 Sep 9 2021 am57xx-mitysom-devkit-fpga.dtb -rw-r--r-- 1 root root 90014 Sep 9 2021 am57xx-mitysom-devkit.dtb lrwxrwxrwx 1 root root 26 Sep 9 2021 uImage -> uImage-4.19.94-g9ce96ed7a5 -rw-r--r-- 1 root root 4457024 Sep 9 2021 uImage-4.19.94-g9ce96ed7a5 -rw-r--r-- 1 root root 16404196 Sep 9 2021 vmlinux-4.19.94-g9ce96ed7a5 lrwxrwxrwx 1 root root 26 Sep 9 2021 zImage -> zImage-4.19.94-g9ce96ed7a5 -rw-r--r-- 1 root root 4456960 Sep 9 2021 zImage-4.19.94-g9ce96ed7a5 root@mitysom-am57x:~#
Summary¶
An overview of the bootstrap process has been given with links to references for more information. U-boot has been indicated as the spot for most customizations in either the environment variables used as data or in the variables used as commands.
The location of the secondary and third-stage bootloaders on the SD-card has been indicated with access from both Linux and from U-boot demonstrated.
A flowchart of the default u-boot script has been attached. Uboot_Flowchart.pdf
Go to top