首页 > 解决方案 > 使用 'dd' 将二进制文件分开并提取部分

问题描述

我有 .bin 格式的固件文件,但需要获取刷新砖设备所需的 romimage.img 和内核 uImage 文件。我使用 Binwalk 来识别固件二进制文件的不同部分,$ binwalk firmware.bin

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
392           0x188           uImage header, header size: 64 bytes, header CRC: 0xEF73A583, created: 1969-12-31 23:59:59, image size: 1572736 bytes, Data Address: 0x20008000, Entry Point: 0x20008000, data CRC: 0x3661C6EC, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: "SP2Xcybertan_rom_bin"
13596         0x351C          gzip compressed data, maximum compression, from Unix, last modified: 2019-04-03 05:25:36
1573192       0x180148        uImage header, header size: 64 bytes, header CRC: 0x9053B22D, created: 1969-12-31 23:59:59, image size: 8474624 bytes, Data Address: 0x0, Entry Point: 0x0, data CRC: 0xFC8655E0, OS: Linux, CPU: ARM, image type: Filesystem Image, compression type: none, image name: "SP2Xcybertan_rom_bin"
1573256       0x180188        Squashfs filesystem, little endian, non-standard signature, version 3.1, size: 8473072 bytes, 1028 inodes, blocksize: 131072 bytes, created: 2019-04-03 05:36:06

从引导日志:

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
    ... ... ... ...

Creating 11 MTD partitions on "gen_nand":
0x00000000-0x00060000 : "u-boot"
0x00060000-0x00080000 : "u-bootenv"
0x00080000-0x01460000 : "ROMIMAGE"
0x01460000-0x01b60000 : "HALFIMAGE"
0x00200000-0x01460000 : "LINUX_ROOTFS"
   ... ... ... ...

现在我需要将固件映像分开并从固件.bin 中提取 Rom 映像 romimage.img 和内核 uImage:如何正确使用 linuxdd命令?

标签: linux-kernelbinaryarmembedded-linuxu-boot

解决方案


推荐阅读