diff --git a/.gitignore b/.gitignore index 3e2dbf561fbbdc926e0a1e4c23c03edd74ebe461..7b41149b1777da9f80d9e27b511895fca1d30fbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -dumpimage +fdtextract *.o .built .built_check @@ -7,3 +7,4 @@ dumpimage .git_update .prepared_* .pkgdir +ipkg-arm_xscale diff --git a/Makefile b/Makefile index ed0d4462114d999ebf5047031daea797b9119439..cebe38436a4f358cfb30e0c2da14ce33b80939b6 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,10 @@ CFLAGS += -Wextra -std=gnu99 LIBS += -lfdt -dumpimage: dumpimage.o util.o +fdtextract: fdtextract.o util.o $(CC) $(CFLAGS) $(INCLUDE_PATHS) -o $@ $^ $(LIBS) clean: rm -rf *.o - rm -rf dumpimage + rm -rf fdtextract diff --git a/README.md b/README.md index 688eae588f9f31c63afe3a00bdcd20c106d61565..26cd852503f1bd5195d5518b6170a38346357028 100644 --- a/README.md +++ b/README.md @@ -1,65 +1,26 @@ Command to extract sub images from FIT images. -Dump Images -In the same way that FIT images are generated, the containing sub images can be extracted as well using dumpimage tool. -The image header files can be listed with the following command: +The sub images of the FIT image can be extracted using the fdtextract +tool. -dumpimage -l image.itb +Usage: fdtextract [options] <file> -FIT description: U-Boot fitImage for plnx_aarch64 kernel -Created: Thu Sep 14 17:05:07 2017 - Image 0 (kernel@0) - Description: Linux Kernel - Created: Thu Sep 14 17:05:07 2017 - Type: Kernel Image - Compression: uncompressed - Data Size: 12263936 Bytes = 11976.50 kB = 11.70 MB - Architecture: AArch64 - OS: Linux - Load Address: 0x00080000 - Entry Point: 0x00080000 - Hash algo: sha1 - Hash value: 7e1178ec42f6ae6e39275a04234b0c7d73140f2a - Image 1 (fdt@0) - Description: Flattened Device Tree blob - Created: Thu Sep 14 17:05:07 2017 - Type: Flat Device Tree - Compression: uncompressed - Data Size: 30150 Bytes = 29.44 kB = 0.03 MB - Architecture: AArch64 - Hash algo: sha1 - Hash value: 7f6bd3d535b8b214df392ffd6b2b2bcea058a485 - Image 2 (ramdisk@0) - Description: ramdisk - Created: Thu Sep 14 17:05:07 2017 - Type: RAMDisk Image - Compression: uncompressed - Data Size: 23563776 Bytes = 23011.50 kB = 22.47 MB - Architecture: AArch64 - OS: Linux - Load Address: unavailable - Entry Point: unavailable - Hash algo: sha1 - Hash value: c4f32910b03776481e2997e6e86a1a1d26f33a8f - Default Configuration: 'conf@1' - Configuration 0 (conf@1) - Description: Boot Linux kernel with FDT blob + ramdisk - Kernel: kernel@0 - Init Ramdisk: ramdisk@0 - FDT: fdt@0 +Options: -[le:o:hV] + -l, --list List images embedded in FIT + -e, --extract <arg> Extract image from FIT + -o, --out <arg> Outpute image name + -h, --help Print this help and exit + -V, --version Print version and exit -An image can be extracted from the ITB using the following command: +The image header files can be listed with the following +command: -dumpimage -T flat_dt -p 1 -i image.itb outputfile +fdtextract -l /tmp/last.pkgtb +[0]: bootfs_6858_b0+ +[1]: nand_squashfs -Extracted: - Image 1 (fdt@0) - Description: Flattened Device Tree blob - Created: Thu Sep 14 17:05:07 2017 - Type: Flat Device Tree - Compression: uncompressed - Data Size: 30150 Bytes = 29.44 kB = 0.03 MB - Architecture: AArch64 - Hash algo: sha1 - Hash value: 7f6bd3d535b8b214df392ffd6b2b2bcea058a485 +An image can be extracted from the FIT using the following command: + +fdtextract -e bootfs_6858_b0+ /tmp/last.pkgtb -o /tmp/bootfs +Extracting: bootfs_6858_b0+ to /tmp/bootfs diff --git a/dumpimage.c b/fdtextract.c similarity index 98% rename from dumpimage.c rename to fdtextract.c index 90921fe7531630a18c98ac86340f5686a7e0db86..e030f86fcdca52b40b39c2a93e2df58b64fbb54e 100644 --- a/dumpimage.c +++ b/fdtextract.c @@ -38,7 +38,7 @@ #define MAX_PATH_LEN 100 /* Usage related data. */ -static const char usage_synopsis[] = "dumpimage [options] <file>"; +static const char usage_synopsis[] = "fdtextract [options] <file>"; static const char usage_short_opts[] = "le:o:" USAGE_COMMON_SHORT_OPTS; static struct option const usage_long_opts[] = { {"list", no_argument, NULL, 'l'},