【ZYNQ学习笔记】之uboot-xlnx_rebase_v2023.01_2023.2 移植到正点原子最小系统开发板

一、参考官方wiki

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841973/Build+U-Boot
从github上clone下uboot源码,cd到目录下
uboot版本:uboot-xlnx_rebase_v2023.01_2023.2
djx@ubuntu:~/u-boot/u-boot-xlnx$ make distclean
CLEAN dts/…/arch/arm/dts
CLEAN dts
CLEAN lib/efi_loader
CLEAN tools
CLEAN tools/lib tools/common
CLEAN spl/arch spl/board spl/boot spl/boot.bin spl/cmd spl/common spl/disk spl/drivers spl/dts spl/env spl/fs spl/lib spl/u-boot.cfg spl/u-boot-spl spl/u-boot-spl-align.bin spl/u-boot-spl.bin spl/u-boot-spl.dtb spl/u-boot-spl-dtb.bin spl/u-boot-spl.lds spl/u-boot-spl.map spl/u-boot-spl-nodtb.bin spl/u-boot-spl.sym
CLEAN include/generated/env.in include/generated/env.txt u-boot-nodtb.bin u-boot.lds u-boot.dtb u-boot.cfg.configs u-boot-dtb.img u-boot.map u-boot.elf u-boot.cfg u-boot.bin u-boot-elf.o u-boot.srec u-boot-dtb.bin u-boot u-boot-elf.lds u-boot.img u-boot.sym System.map
CLEAN scripts/basic
CLEAN scripts/dtc
CLEAN scripts/kconfig
CLEAN include/config include/generated spl
CLEAN .config .config.old include/autoconf.mk include/autoconf.mk.dep include/config.h
djx@ubuntu:~/u-boot/u-boot-xlnx$ make xilinx_zynq_virt_defconfig

configuration written to .config

djx@ubuntu:~/u-boot/u-boot-xlnx$ export DEVICE_TREE=“zynq-zc702”
djx@ubuntu:~/u-boot/u-boot-xlnx$ make

djx@ubuntu:~/u-boot/u-boot-xlnx$ l
api/ common/ drivers/ IDE.log Licenses/ oe-workdir@ spl/ u-boot.bin u-boot-dtb.img u-boot.lds uboot.tcl
arch/ config.mk dts/ include/ MAINTAINERS post/ System.map u-boot.cfg u-boot.elf* u-boot.map
board/ configs/ env/ Kbuild Makefile README test/ u-boot.cfg.configs u-boot-elf.lds u-boot-nodtb.bin*
boot/ disk/ examples/ Kconfig net/ RemoteSystemsTempFiles/ tools/ u-boot.dtb u-boot-elf.o u-boot.srec*
cmd/ doc/ fs/ lib/ oe-logs@ scripts/ u-boot* u-boot-dtb.bin u-boot.img u-boot.sym

二、xsct工具安装

正点原子 因为这种方法使用的工具是 Petalinux 自带的,XSDK 软件也有,这里我们使用 Petalinux
中的,所以需要配置 Petalinux 的环境变量,没有找到,xsct 是 Xilinx 软件命令行工具,基于 tcl 脚本,方便开发和调试,查找资料,发现可以按照好vivado后,在bin目录找到,请添加图片描述请添加图片描述

cd到对应目录下,执行./xsct /home/djx/xilinx/Vitis/2022.1/bin/xsct
在这里插入图片描述

三、实操,烧录

上面的操作是乱来,下面指令才是通过xsct工具下载编译后的uboot到板子上,记得连接上jtag,插上串口,新终端打开串口
/home/djx/xilinx/Vitis/2022.1/bin/xsct uboot.tcl
请添加图片描述

通过串口看到u-boot编译版本时间不是刚刚编译的时间,有点意思,
请添加图片描述
在查看报错信息,没有下载成功,提示couldn’t read file “hw-description/ps7_init.tcl”: no such file or directory
while executing
“source hw-description/ps7_init.tcl”
(file “uboot.tcl” line 2)
去用petalinux工具流程建立的工程里面,把板子的硬件描述新拷贝进来,看到tcl文件里面指定了路径,我打算不拷贝到uboot路径下,因为这样会污染源码,直接修改tcl指定的路径,尝试看看,改后的路径如下
connect
source /home/djx/fpga/mini_zynq/project-spec/hw-description/ps7_init.tcl
targets -set -filter {name =~“APU”}
loadhw /home/djx/fpga/mini_zynq/project-spec/hw-description/hw-description/system.hdf
stop
ps7_init
targets -set -nocase -filter {name =~ “ARM*#0”}
rst -processor
dow u-boot
con
查原因是未安装驱动,
/opt/pkg/petalinux/2023.2/tools/xsct/data/xicom/cable_drivers/lin64/install_script/install_drivers$ sudo ./install_drivers 到这个路径下执行安装驱动,
请添加图片描述
ps初始化和hdf路径不对,修改一下路径,重新拔插,烧录成功,uart打印看到编译版本时间是对的,至此初步OK,
请添加图片描述
请添加图片描述

四、简单修改uboot 参数,调试

简单修改一个uboot delay参数,由2改为5s,和正点原子不同,新版本delay参数在Kconfig的1155行内请添加图片描述
重新claen,编译,烧录,
make distclean
make xilinx_zynq_virt_defconfig
export DEVICE_TREE=“zynq-zc702”
make

请添加图片描述
拔插jatg,查看打印,还是2s,编译时间对了,但是没有修改成功,可能不是这个位置,在找找,请添加图片描述

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- xilinx_zynq_virt_defconfig
make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8
以为是指令问题,重新clean,编译,编译时间对了,但是仍然没有生效,通过uboot :env print 指令,搜索到是环境变量起作用导致的。尝试删除该项环境变量,可能是因为早期把uboot的参数写道了flash内导致的,
请添加图片描述
删除bootdelay 环境变量,输指令
Zynq> env set bootdelay
重新烧录,还是没变,仔细一想!忘记save了!!
请添加图片描述
然后终于成功了!!!!
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值