1

Here is my problem:

I have a uImage file, which has kernel + dtb + initramfs in it. The initramfs has some proprietary binaries, hence I cannot rebuild it from source. But I need to change the Linux kernel for different reasons.

Hence I thought if following steps would solve my problem:

  1. extract the above uImage file,
  2. replace kernel and dtb files with newly built files,
  3. recreate a newer version of uImage file with new-kernel, new-dtb but old-initramfs.

Is there a tool available to do this? If not, I appreciate any inputs to develop the same.

Aananth C N
  • 428
  • 7
  • 14
  • There is some related information in this page: http://buffalo.nas-central.org/wiki/How_to_Extract_an_uImage But, the script generates a zImage from it. Doesn't really extract files as I expect. – Aananth C N Jun 18 '16 at 06:17
  • Another useful [link](http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html) – Aananth C N Jun 18 '16 at 08:36
  • What you want to do doesn't make sense with the information provided. The uImage file is simply a wrapper on a file. You convert the uImage file into its original file(s) by simply removing the wrapper (and decompress the file only if the wrapper indicates it). The kernel image and dtb in that uImage should be handled in the same manner as the initramfs. So *"extracting"* one but keeping another *"as is"* makes no sense. See http://stackoverflow.com/questions/22322304/image-vs-zimage-vs-uimage/22338835#22338835 – sawdust Jun 18 '16 at 19:05
  • @sawdust, I have provided few more information / background. Let me know if that helps. The [link](http://stackoverflow.com/questions/22322304/image-vs-zimage-vs-uimage/22338835#22338835) you provided helps me to understand how the uImage is structured. With that I am able to remove the uImage wrapper alone. Any inputs on how to extract the filesystems part and the dtb part? – Aananth C N Jun 25 '16 at 14:06
  • 1
    What you have inside the uImage was combined independently of the **mkimage** utility. You may have to inspect the makefiles and/or the U-Boot **bootcmd** to see how the parts were combined and/or then used. I'm aware that the DTB can be appended to the kernel zImage (see pg 8 of https://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf), and that the initramfs is typically append to the zImage, but not sure how *both* can be appended. Could a **.itb** be involved? (see https://casper.berkeley.edu/svn/trunk/roach/sw/uboot/doc/uImage.FIT/howto.txt) – sawdust Jun 27 '16 at 20:40
  • Or maybe you have a multi-file image or a Flattened Image Tree. See http://www.denx.de/wiki/pub/U-Boot/Documentation/multi_image_booting_scenarios.pdf The U-Boot log of this uImage in actual use could be helpful. – sawdust Jun 27 '16 at 20:55

1 Answers1

3

Try this command:

mkimage -l kernel.uImage

For details have a look at this link.

Hercules dd
  • 215
  • 1
  • 5
  • 2
    The example in the link is about extracting 2 uImages packed as single image. In my case, kernel + dtb + filesystem is packed as one uImage. And when I do 'mkimage -l ', the output say as if there is only one image – Aananth C N Aug 18 '18 at 10:17
  • 1
    @AananthCN I'm also receiving an output indicating having only one image. Did you managed to find a way to extract it's content? – Abozanona Feb 15 '19 at 21:47
  • @AananthCN, if you extract that one image and run `mkimage -l` again (i.e. nested images), what do you get? – duanev Jun 24 '20 at 21:44