这里我们使用lf-6.1.55-2.2.2
分支开始
首先通过硬件原理图找出 ZLG imx287 和 官方开发板 mx28evk 的差异
- 调试串口
这里可以看到官方板用的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!
=>
能正常识别NAND和RAM,到这里其实Uboot已差不多OK了,可以再对照原理图做一些适配修改。