zynqmp 您所在的位置:网站首页 uboot启动顺序 zynqmp

zynqmp

2023-12-24 20:11| 来源: 网络整理| 查看: 265

uboot环境变量

以下为uboot的所有环境变量,当启动linux系统时,启动入口为bootcmd所指向的命令

执行顺序参考数字标号。

主要程序流程为判断启动模式,更据启动模式,从不通存储介质扫描加载boot.src启动脚本。在boot.src中根据启动模式以及linux内核打包类型,加载启动linux,分为booti和bootm两种方式

ZynqMP> env print

arch=arm

baudrate=115200

board=zynqmp

board_name=zynqmp

8.1:boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}

9.1:boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi

7.1:boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}

boot_net_usb_start=usb start

boot_prefixes=/ /boot/

boot_script_dhcp=boot.scr.uimg

boot_scripts=boot.scr.uimg boot.scr

boot_syslinux_conf=extlinux/extlinux.conf

boot_targets=qspi0 jtag mmc0 mmc1 qspi0 nand0 usb0 usb1 scsi0 pxe dhcp

###如果设置为emmc启动,boot_targets第一个元素为mmc0,如果为qspi启动第一个元素为qspi0,以下为emmc启动的boot_targets=mmc0 jtag mmc0 mmc1 qspi0 nand0 usb0 usb1 scsi0 pxe dhcp

1:bootcmd=run distro_bootcmd

bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;

 

bootcmd_jtag=source $scriptaddr; echo SCRIPT FAILED: continuing...;

3:bootcmd_mmc0=devnum=0; run mmc_boot

bootcmd_mmc1=devnum=1; run mmc_boot

bootcmd_nand0= nand info && nand read $scriptaddr $script_offset_f $script_size_f && source ${scriptaddr}; echo SCRIPT FAILED: continuing...;

bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi

bootcmd_qspi0=sf probe 0 0 0 && sf read $scriptaddr $script_offset_f $script_size_f && source ${scriptaddr}; echo SCRIPT FAILED: continuing...;

bootcmd_scsi0=devnum=0; run scsi_boot

bootcmd_usb0=devnum=0; run usb_boot

bootcmd_usb1=devnum=1; run usb_boot

 

bootdelay=2

bootfile=boot.scr.uimg

bootfstype=fat

cpu=armv8

dfu_ram=run dfu_ram_info && dfu 0 ram 0

dfu_ram_info=setenv dfu_alt_info Image ram $kernel_addr $kernel_size\\;system.dtb ram $fdt_addr $fdt_size

###这里应该是distro_bootcmd与scsi_need_init这两个变量都赋值为空。。

2:distro_bootcmd=scsi_need_init=; for target in ${boot_targets}; do run bootcmd_${target}; done

efi_dtb_prefixes=/ /dtb/ /dtb/current/

ethact=ethernet@ff0c0000

ethaddr=00:0a:35:00:22:01

fdt_addr_r=0x40000000

fdt_high=10000000

fdtcontroladdr=7ddc35c8

fdtfile=xilinx/zynqmp.dtb

fileaddr=20000000

filesize=7d7

initrd_high=79000000

kernel_addr_r=0x18000000

load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}

4:mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi

pxefile_addr_r=0x10000000

ramdisk_addr_r=0x02100000

reset_reason=EXTERNAL

6:scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;//这里对应三种格式的启动镜像存放的文件系统类型,ext、fat、efi三种,三种选其一执行

5:scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist

9:scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile

7:scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi

8:scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done

GWJ:scan_dev_for_scripts换行显示为

for script in ${boot_scripts};

do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then

echo Found U-Boot script ${prefix}${script};

run boot_a_script;

echo SCRIPT FAILED: continuing...;

fi;

done

script_offset_f=3e80000

script_size_f=0x80000

scriptaddr=0x20000000

scsi_boot=run scsi_init; if scsi dev ${devnum}; then devtype=scsi; run scan_dev_for_boot_part; fi

scsi_init=if ${scsi_need_init}; then scsi_need_init=false; scsi scan; fi

soc=zynqmp

stderr=serial@ff000000

stdin=serial@ff000000

stdout=serial@ff000000

thor_ram=run dfu_ram_info && thordown 0 ram 0

usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi

vendor=xilinx

 

Environment size: 4699/32764 bytes

 

boot.scr启动文件

'Vo\9E\8C\9F_\BD\D1\00\00 \97\00\00\00\00\00\00\00\00\B5J]\00Boot script\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 \8F\00\00\00\00# This is a boot script for U-Boot

# Generate boot.scr:

# mkimage -c none -A arm -T script -d boot.cmd.default boot.scr

#

################

 

 

for boot_target in ${boot_targets};

do

if test "${boot_target}" = "jtag" ; then

booti 0x00200000 0x04000000 0x00100000

exit;

fi

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

//

booti [addr [initrd [:size]] [fdt]]-引导Linux'Image'存储在'addr',参数'initrd'是可选的,它指定initrd在内存中的地址。 可选参数':size'允许指定RAW initrd的大小。

           由于引导Linux内核需要平坦的设备树,因此需要提供设备树blob地址的第三个参数。 要引导带有设备树blob但没有initrd映像的内核,请对initrd参数使用'-'。

//

exit;

fi

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

if test "${boot_target}" = "nand" || test "${boot_target}" = "nand0"; then

nand info

if test "image.ub" = "image.ub"; then

nand read 0x10000000 0x4100000 0x6400000;

bootm 0x10000000;

exit;

fi

if test "image.ub" = "Image"; then

nand read 0x00200000 0x4100000 0x3200000;

nand read 0x04000000 0x7800000  0x3200000;

booti 0x00200000 0x04000000 0x00100000

exit;

fi

fi

done

更改boot.scr后,出现crc校验错误

mmc1 is current device

Scanning mmc 1:1...

Found U-Boot script /boot.scr

2074 bytes read in 16 ms (126 KiB/s)

## Executing script at 20000000

Bad data crc

SCRIPT FAILED: continuing...

 

制作一个boot.scr文件 1. 编写一个boot.cmd文本文件,内容如下

setenv bootdelay 2

saveenv

2. 制作一个boot.scr文件

mkimage -C none -A arm -T script -d boot.cmd boot.scr



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有