This pages provides information related to using the industry standard "distro boot" boot flow for U-boot as it's been implemented by Xilinx.
...
Using the boot.scr Method
Info |
---|
Starting in 2020.1, this the default method used by Petalinux. |
In the absence of a valid extlinux.conf file, U-Boot will scan the boot_targets list looking for a file named boot.scr.uimg or boot.scr (in that order) and run any commands located in the script file. An example of the script file syntax is seen below. If your environment requires a different sequence of commands or behavior, you can edit the boot.scr file to suit your needs.
...
It's important to note that this syntax is standard U-Boot HUSH scripting syntax. The only change being made here is that this script is loaded into the environment during the boot process rather than being compiled in to the binaries.
Packaging the boot.scr File
Prior to use in a distro boot environment, the boot script must be compiled using mkimage as noted in the examples below.
The recommended method for packaging the boot.scr image is to use the U-Boot FIT format with a script similar to:
Code Block | ||
---|---|---|
| ||
/dts-v1/; / { description = "Boot script"; images { default = "script"; script { description = "Boot script"; data = /incbin/("./boot.scr"); type = "script"; compression = "none"; hash { algo = "sha1"; }; }; }; }; |
...
Code Block | ||
---|---|---|
| ||
mkimage -C none -A arm -T script -d boot.scr boot.scr.uimg |
Modifying an Existing boot.scr.uimg/boot.scr File
If you need to edit an existing packaged boot.scr file (or boot.scr.uimg), you can extract the plain ASCII text format using the following mkimage command line:
...
For example, when booting from MMC devices (SD card or eMMC), the following script is run from the boot.scr file by default in the Xilinx-provided U-Boot environment. This can be modified based on your needs.
Code Block | ||
---|---|---|
| ||
if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" ; then if test -e ${devtype} ${devnum}:${distro_bootpart} /image.ub; then fatload ${devtype} ${devnum}:${distro_bootpart} 0x10000000 image.ub; bootm 0x10000000; exit; fi if test -e ${devtype} ${devnum}:${distro_bootpart} /Image; then fatload ${devtype} ${devnum}:${distro_bootpart} 0x00200000 Image;; fi if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then fatload ${devtype} ${devnum}:${distro_bootpart} 0x00100000 system.dtb; fi if test -e ${devtype} ${devnum}:${distro_bootpart} /rootfs.cpio.gz.u-boot; then fatload ${devtype} ${devnum}:${distro_bootpart} 0x04000000 rootfs.cpio.gz.u-boot; booti 0x00200000 0x04000000 0x00100000 exit; fi booti 0x00200000 - 0x00100000 exit; fi |
...
Component | File Name | Load Address |
U-Boot combined image file (image.ub) | image.ub | 0x10000000 |
Linux kernel image file (if image.ub is not found) | Image | 0x00200000 |
Linux device tree file (if image.ub is not found) | system.dtb | 0x00100000 |
Linux root filesystem image (if image.ub is not found) | rootfs.cpio.gz.u-boot | 0x04000000 |
Booting from QSPI
When the boot mode detected is QSPI, the following script is run from the boot.scr file by default in the Xilinx-provided U-Boot environment. This can be modified based on your needs.
Code Block | ||
---|---|---|
| ||
if test "${boot_target}" = "xspi0" || test "${boot_target}" = "qspi" || test "${boot_target}" = "qspi0"; then sf probe 0 0 0; if test "image.ub" = "image.ub"; then sf read 0x10000000 0xF00000 0x6400000; bootm 0x10000000; exit; fi if test "image.ub" = "Image"; then sf read 0x00200000 0xF00000 0x1D00000; sf read 0x04000000 0x4000000 0x4000000 booti 0x00200000 0x04000000 0x00100000 exit; fi exit; fi |
...
Component | Flash Address | Load Address |
U-Boot combined image file (image.ub) | 0xF00000 | 0x10000000 |
Linux kernel image file (if image.ub is not found) | 0xF00000 | 0x00200000 |
Linux device tree file (if image.ub is not found) | Pre-loaded by BOOT.BIN | 0x00100000 |
Linux root filesystem image (if image.ub is not found) | 0x4000000 | 0x04000000 |
Note: The table above presents default values as found in the pre-built collateral. The PetaLinux tools will automatically adjust the flash and load addresses as appropriate to fit the relative sizes of each payload partition.
...