我有一个 ARM 开发板(STM32MP157A-DK1),我正在四处寻找 Linux 映像是如何构建的。
我boot.scr.uimg
在引导分区中有文件。据我所知boot.scr.uimg
是压缩版boot.scr
。
有什么方法可以解压缩/提取原始boot.scr
文件boot.scr.uimg
吗?
这是结果file boot.scr.uimg
:
boot.scr.uimg: u-boot legacy uImage, , Linux/ARM, Script File (Not compressed), 1489 bytes, Thu Jan 1 00:00:00 1970, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0xC80D8B27, Data CRC: 0x62B32EA2
printenv
U-Boot CLI 中的结果:
STM32MP> printenv
altbootcmd=run bootcmd
arch=arm
autoload=no
baudrate=115200
board=stm32mp1
board_name=stm32mp157c-dk2
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_device=mmc
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_instance=0
boot_net_usb_start=true
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=mmc0
bootcmd=run distro_bootcmd
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_mmc1=setenv devnum 1; run mmc_boot
bootcmd_mmc2=setenv devnum 2; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_ubifs0=setenv devnum 0; run ubifs_boot
bootcount=2
bootdelay=1
bootlimit=0
cpu=armv7
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
ethaddr=00:80:e1:42:5d:63
fdt_addr_r=0xc4000000
fdt_high=0xffffffff
fdtcontroladdr=ddc3c4f8
initrd_high=0xffffffff
kernel_addr_r=0xc2000000
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
mtdparts_nand0=2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI)
mtdparts_nor0=256k(fsbl1),256k(fsbl2),2m(ssbl),256k(logo),-(nor_user)
preboot=echo "Boot over ${boot_device}${boot_instance}!"; if test ${boot_device} = serial; then stm32prog serial ${boot_instance}; else if test ${boot_device} = usb; then stm32prog usb ${boot_instance}; else if test ${boot_device} = mmc; then env set boot;
pxefile_addr_r=0xc4200000
ramdisk_addr_r=0xc4400000
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;
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
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
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
scriptaddr=0xc4100000
serial#=0038001A3338510A39303435
serverip=192.168.1.1
soc=stm32mp
splashimage=0xc4300000
stderr=serial
stdin=serial
stdout=serial
ubifs_boot=env exists bootubipart || env set bootubipart UBI; env exists bootubivol || env set bootubivol boot; if ubi part ${bootubipart} && ubifsmount ubi${devnum}:${bootubivol}; then setenv devtype ubi; run scan_dev_for_boot; fi
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
usb_pgood_delay=2000
vendor=st
Environment size: 3053/4092 bytes
STM32MP>
我对 U-Boot 还没有太多经验,所以我不确定它是否与boot.scr
. 我仍然想知道如何在不访问 U-Boot CLI的情况下boot.scr
从中提取。boot.scr.uimg
安装
u-boot-tools
:检查图像的标题:
boot.scr
从图像中提取文件:提取的文件比
Contents
标题中的表显示的大 8 字节,1489 字节与预期的 1481 字节相比。如果您愿意,可以使用以下命令修剪这些字节:编辑:关于 OP @Bumsik Kim 和专家审阅者 @Kusalananda,建议将
dumpimage
语法更改为:我将在此处包含该注释以防它对某些人有帮助,但在 Ubuntu 18.04 系统上,该命令成功,但什么也不做:
上面的原始语法适用于 Ubuntu 18:
尽管如此,我希望包括并承认他们建议的语法。