From 633939a92604aad733ee6632e5c7573ea994ff6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20H=C3=B6glund?= <jonas.hoglund@embeddednation.com> Date: Tue, 6 Apr 2021 10:06:27 +0200 Subject: [PATCH] Change name to fdtextract. --- .gitignore | 3 +- Makefile | 4 +- README.md | 75 +++++++++---------------------------- dumpimage.c => fdtextract.c | 2 +- 4 files changed, 23 insertions(+), 61 deletions(-) rename dumpimage.c => fdtextract.c (98%) diff --git a/.gitignore b/.gitignore index 3e2dbf5..7b41149 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 ed0d446..cebe384 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 688eae5..26cd852 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 90921fe..e030f86 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'}, -- GitLab