2-EasyARM i.MX287A开发板 imx-uboot 主线移植
https://github.com/nxp-imx/linux-imx
这里我们使用 lf-6.1.55-2.2.2 分支开始
首先通过硬件原理图找出 ZLG imx287 和 官方开发板 mx28evk 的差异
- 调试串口
mx28evk
ZLG287
这里可以看到官方板用的GPIO3_16/17作为调试串口,ZLG287 GPIO3_16/17被用作I2C,没有接口引出,DUART使用的GPIO3_2/3
boot-imx 主线移植
下载 https://github.com/nxp-imx/uboot-imx 中的 https://github.com/nxp-imx/uboot-imx/archive/refs/tags/lf-6.1.55-2.2.2.tar.gz
修改源码中的调试串口 board/freescale/mx28evk/iomux.c
const iomux_cfg_t iomux_setup[] = {
/* DUART */
// MX28_PAD_PWM0__DUART_RX,
// MX28_PAD_PWM1__DUART_TX,
MX28_PAD_AUART0_CTS__DUART_RX,
MX28_PAD_AUART0_RTS__DUART_TX,
直接编译
make ARCH=arm CROSS_COMPILE=arm-linux- mx28evk_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux- -j8
make ARCH=arm CROSS_COMPILE=arm-linux- u-boot.sb
使用uuu烧录
.\uuu.exe .\u-boot.sb
串口打印
H0x80501006
看起来直接寄了,经查
error '0x80501006' error (Key dictionary lookup failed).
H0x80501006,H表示固件已读取,0x80501006为固件签名校验不过,NXP论坛找到以下信息:
error '0x80501006' error (Key dictionary lookup failed).
NXP Employee
"In default build, the '-z' option is passed to the elftosb utility and a default zero key is
added to the boot image. It is because the default zero key does not match with the
CRYPTO_KEY OTP fuses on your device, this firmware will not boot.
After ENABLE_UNENCRYPTED_BOOT fuse is blown, the ROM expects an image either is encrypted
with a correct crypto key or not encrypted by any key. Thus both encrypted/unencrypted images are
valid to boot when this fuse is blown.
To generate an unencrypted image, please remove the "-z" option [...] of elftosb."
要求使用正确的加密密钥加密
或者未使用任何密钥加密
,在elftosb
生成sb文件时取消-z
选项,即不使用加密签名:
查看ZLG imx287的imx-bootlets-src
脚本中确实也去掉了-z
:
找到老版本的ZLG资料显示,开发板出厂已使能未签名固件启动
,并且密钥不为 0,不能再使用零密钥
签名固件:
找到 uboot-imx-lf-6.1.55-2.2.2
中的 tools/mxsimage.c
函数 sb_prefill_image_header
显示:
/* FIXME -- We support only default key */
hdr->key_count = 1;
mxsimage只支持default key
签名方式,只能换到elftosb
打开 arch/arm/cpu/arm926ejs/mxs/u-boot-imx28.bd
修改为如下:
sources {
u_boot_spl="spl/u-boot-spl.bin";
u_boot="u-boot.bin";
}
section (0) {
load u_boot_spl > 0x1000;
load ivt (entry = 0x1000) > 0xE000;
hab call 0xE000;
load u_boot > 0x40002000;
load ivt (entry = 0x40002000) > 0xE000;
hab call 0xE000;
}
使用elftosb
生成烧录文件
elftosb -f imx28 -c arch/arm/cpu/arm926ejs/mxs/u-boot-imx28.bd -o u-boot.sb
烧录运行打印如下:
U-Boot 2023.04-g0a35287a-dirty (Feb 14 2025 - 20:38:06 +0800)
CPU: Freescale i.MX28 rev1.2 at 454 MHz
BOOT: USB #0
DRAM: 128 MiB
Core: 88 devices, 11 uclasses, devicetree: separate
NAND: 128 MiB
MMC: MXS MMC: 0
Loading Environment from MMC... MMC: no card present
*** Warning - No block device, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
MMC: no card present
MMC: no card present
Booting from net ...
Unknown command 'dhcp' - try 'help'
zimage: Bad magic!
=>
到这里其实Uboot已差不多OK了,可以再对照原理图做一些适配修改
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律