h0ch5tr4355
h0ch5tr4355

Reputation: 2192

Can you partition a U-Boot FIT Image back into its components?

I recently found out how to create an FIT Image for U-Boot.

According to the *.its file, which is needed for creation, the image can contain Kernel, Root File System and Device Tree Blobs.

My question is if there is way to separate a prebuilt FIT Image back into its components (maybe even get a *its file back).

Upvotes: 3

Views: 1358

Answers (1)

Jun Ge
Jun Ge

Reputation: 420

Install device-tree-compiler(apt-get install) and download a script split_bootimg.pl(github). Run the script to extract kernel image, ramdisk and the dtb file. Then you got every components. And you can use the device-tree-compiler to extract the device tree file from the dtb.

If you have the "Android Magic not found in image. Giving up." problem, then:

From the split_bootimg.pl, the format of a FIT image should be:

=format (from bootimg.h)

** +-----------------+

** | boot header | 1 page

** +-----------------+

** | kernel | n pages

** +-----------------+

** | ramdisk | m pages

** +-----------------+

** | second stage | o pages

** +-----------------+

boot-header contains a magic-number field, the script will check the field to verify whether the image is android or not. Below code check the magic number:

# Read the Magic
read(INF, $buf, BOOT_MAGIC_SIZE);
unless ($buf eq BOOT_MAGIC) {
die "Android Magic not found in $fn. Giving up.\n";
}

So maybe you can comment out the code, or check what the magic number is in your image and modify the script.

Upvotes: 2

Related Questions