Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux kernel 使用';dd';将二进制文件拆分并提取部分_Linux Kernel_Binary_Arm_Embedded Linux_U Boot - Fatal编程技术网

Linux kernel 使用';dd';将二进制文件拆分并提取部分

Linux kernel 使用';dd';将二进制文件拆分并提取部分,linux-kernel,binary,arm,embedded-linux,u-boot,Linux Kernel,Binary,Arm,Embedded Linux,U Boot,我有.bin格式的固件文件,但需要获取刷新一个bricked设备所需的romimage.img和内核uImage文件。 我使用Binwalk来识别固件二进制文件的不同部分,$Binwalk firmware.bin DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 392 0x188

我有.bin格式的固件文件,但需要获取刷新一个bricked设备所需的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"
   ... ... ... ...

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

我不知道如何计算要提取部分的偏移量和大小,但一旦找到它们,然后使用
dd bs=1 skip=THEOFFSET count=THELENGTH if=INPUTFILENAME of=OUTPUTFILENAME
。(
offset
length
需要用十进制。
binwalk
有一个
-e
选项来提取文件,还有一个
-dd
选项来提取文件。如果使用此选项,我想您不需要将偏移量和大小传递到
dd
。你必须小心。。linux可能附带了DT、initramfs(SQUSHFS等)。有时,您可能只获得代码。此外,u-boot将更好地使用。
手动拆分应该会对您有所帮助。我不知道如何计算要提取的部分的偏移量和大小,但一旦找到它们,请使用
dd bs=1 skip=THEOFFSET count=THELENGTH if=INPUTFILENAME of=OUTPUTFILENAME
。(
offset
length
需要用十进制。
binwalk
有一个
-e
选项来提取文件,还有一个
-dd
选项来提取文件。如果使用此选项,我想您不需要将偏移量和大小传递到
dd
。你必须小心。。linux可能附带了DT、initramfs(SQUSHFS等)。有时,您可能只获得代码。此外,u-boot将更好地使用。
man split
应该会对您有所帮助。