带有 ARM926EJ CPU 的板,运行嵌入式 Linux v2.6.26.5,在 NAND 闪存设备上,NAND 32MiB。Linux 位于 NAND 设备上的 MTD 分区上。
如何从串行接口备份 Linux 内核映像 (SP2Xcybertan_rom_bin)?由于没有通过 tftp 将文件从电路板传输到主机 PC 的 TFTP 选项。我可以将 nand 读取到某个内存地址,将输出转储到终端并保存,然后将十六进制转换为二进制:
nand read 0x20000000 0x80000 0x0017FF80
md.b 0x20000000 0x0017FF80
从启动过程日志:
U-Boot 2009.03 (Oct 06 2011 - 20:04:03)
Stack:->21F1EC74 U-Boot code: 21FC4D00->21FF9454 BSS:->21FFFF3B
CPU: PNX8181-2B OM6xxx-ARM926EJ-S(ARMv5TEJ) @ 221MHz(armclk), 110MHz(hclk)
Board: Vega_PNX8181_BaseStation Platform IV (LC)
I2C: ready
RAM Configuration:
Bank #0: 20000000 32 MB
NAND: 32 MiB
In: serial
Out: serial
Err: serial
Use Full Image's Kernel
Net: VLAN Mode
L2 switch present
ETN1
Hit any key to stop autoboot: 0
Loading from NAND 32MiB 3,3V 8-bit, offset 0x80000
Image Name: SP2Xcybertan_rom_bin
Created: 1970-01-01 0:00:-1 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1572736 Bytes = 1.5 MB
Load Address: 20008000
Entry Point: 20008000
## Booting kernel from Legacy Image at 20200000 ...
Image Name: SP2Xcybertan_rom_bin
Created: 1970-01-01 0:00:-1 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1572736 Bytes = 1.5 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux.........
环境变量
firetux # printenv
baudrate=115200
ethaddr=FF:FF:FF:FF:FF:FF
netmask=255.255.255.0
ipaddr=192.168.1.1
serverip=192.168.1.100
bootfile=firetux.kernel
bootcmd1=setenv bootargs ${bootargs} && nboot 0x20200000 0 ${image_addr} && bootm 0x20200000
bootcmd2=setenv bootargs ${bootargs} && tftpboot 20200000 firetux.kernel && bootm 20200000
phymode=auto
mtdids=nand0=gen_nand
unlock=yes
verify=y
update.uboot=echo Update u-boot && tftpboot 0x20000000 nandboot.flash && nand erase 0x0 0x03ffff && nand write.jffs2 0x20000000 0x0 ${filesize}
update.kernel=echo Update kernel && tftpboot 0x20000000 uImage && nand erase 0x80000 0x180000 && nand write.jffs2 20000000 0x80000 0x180000
update.romimg=echo Update RomImage && tftpboot 0x20000000 romimage.img && nand erase 0x80000 0x13e0000&& nand write.jffs2 20000000 0x80000 ${filesize}
update.halfimg=echo Update HalfImage && tftpboot 0x20000000 recovery.img && nand erase 0x1460000 0x700000&& nand write.jffs2 20000000 0x1460000 ${filesize}
eraseenv=echo Erase Environment && nand erase 0x60000 0x20000
HwModel=Hw_Model=SPA122
bootcmd=run bootcmd1
halfImage=half_image=0
cy_boot_code_ver=1.0.1 (Oct 6 2011 - 20:04:00)
RouterMode=Router_Mode=0
stdin=serial
stdout=serial
stderr=serial
bootcmd=run bootcmd1
image_addr=0x80000
bootargs=console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=SPA122 Router_Mode=0
ethact=ETN1
bootdelay=3
内核(uImage)和romimage(romimg.img)在启动过程方面有什么区别?
执行此操作的步骤如下:
首先假设更新uImage是正确的
update.kernel=echo Update kernel && tftpboot 0x20000000 uImage && nand erase 0x80000 0x180000 && nand write.jffs2 20000000 0x80000 0x180000
然后:
所以:
然后,您需要找到一种方法来记录串行上的输入并使用脚本对其进行解析以获取十六进制字节并将它们以二进制形式输出到文件中。