Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This This pages provides information related to using the industry standard "distro boot" boot flow for U-boot as it's been implemented by Xilinx. 

...


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.


Code Block
themeMidnight
for boot_target in ${boot_targets};
do
        if test "${boot_target}" = "jtag" ; then
. . .
<COMMANDS>
. . .
        fi
        if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" ; then
. . .
<COMMANDS>
. . .
        fi
        if test "${boot_target}" = "xspi0"; then
. . .
<COMMANDS>
. . .
        fi
done

...

Prior to use in a distro boot environment, the boot script must be compiled using mkimage as noted in the examples below.

For a legacy U-Boot image, the image can be packaged simply with the mkimage command directly:

Code Block
themeMidnight
mkimage -C none -A arm -T script -d boot.scr boot.scr.uimg

...

 


The recommended method for packaging the boot.scr image is to use the U-Boot FIT format with a script similar to:

...

Code Block
themeMidnight
mkimage -f boot.fit boot.scr.uimg boot.scr.uimg


If your design does not require the additional features provided in the FIT description method seen above, the image can be packaged simply with the mkimage command directly:

Code Block
themeMidnight
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:

Code Block
themeMidnight
mkimage -c+65 < boot.scr.uimg > out

Remember that the boot.scr file will need be re-packaged with mkimage after the edits are complete.

How Xilinx Uses Distro Boot

...


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
themeMidnight
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.file by default in the Xilinx-provided U-Boot environment.  This can be modified based on your needs. 

Code Block
themeMidnight
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.

...