modify initramfs

显示  仅  | 搜索替代 

modify initramfs

15,498 次查看
Senior Contributor I


We are make board with iMX53, unfortunally initramfs.cpio.gz.uboot from MfgTool is not work on our board and I have to modify it.

$ file initramfs.cpio.gz.uboot

initramfs.cpio.gz.uboot: u-boot legacy uImage, uboot initramfs rootfs, Linux/ARM, RAMDisk Image (gzip), 4144518 bytes, Wed Mar 16 06:24:19 2011, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0x6548D031, Data CRC: 0xA090FD19

But I can't unpack it...

$ cp initramfs.cpio.gz.uboot initramfs.cpio.gz

`initramfs.cpio.gz.uboot' -> `initramfs.cpio.gz'

$ gunzip initramfs.cpio.gz > initramfs.cpio

gzip: initramfs.cpio.gz: not in gzip format

How can I unpack and modify it?

Thank you and excuse me my bad english.

标签 (2)
标记 (1)
2 回复数

3,317 次查看
NXP Employee
NXP Employee

You may also want to have a look at how LTIB builds "Manufacturing Firmware" profile as well. You can use this approach to build your own updater binary with own initramfs customized for your hardware and operations you want to run on it during manufacturing/programming/testing stage.


0 项奖励

3,317 次查看
NXP Employee
NXP Employee

I´m not sure if I know which image you´re trying to change, and I´m not sure if the change is needed. But, here is the commands I use in order to unpack initramfs images I need to change. Maybe you don´t need one or two steps, so, please, take this as a guidance only.

# dd if=uramdisk.img of=ramdisk.img.gz skip=64 bs=1

# gunzip ramdisk.img.gz

# mkdir ramdisk; cd ramdisk

# cpio -i < ../ramdisk.img

<make any changes needed>

If you need to repack it again:

# find . | cpio --create --format='newc' | gzip > ../ramdisk.img

# mkimage -A arm -O linux -T ramdisk -C none -a LOADADDRESS -n "Label you want" -d ./ramdisk.img ./uramdisk.img