Modifying initramfs for JHJP4 (and any other version)

In this tutorial i will guide you how to modify an existing initramfs with your own changes – and inject it back into the zImage file, ready to be distributed and flashed.

I assume the followings:
(a) You are familiar with Linux CLI.
(b) Your zImage file is extracted and in your current directory.


1. Use the following script to extract initramfs.img from zImage

2. As noted in the previous link, to extract your newly created initramfs.img, use:

cpio -i --no-absolute-filenames < initramfs.img

3. Make whatever changes you like – copy su/busybox/etc, patch startup script, etc.

4. Delete initramfs.img (so it won’t be included when generating a new initramfs.img from the current directory)

5. To create a new initramfs.img use:

find . | cpio -H newc -o > ../initramfs.img

This will create initramfs.img in the directory above your current one.

6. Use the following script to replace your newly created initramfs.img with the original one.
A new file named new_zImage will be created – thats your new kernel+initramfs.img. rename it to zImage.

7. Use either method to flash your new zImage:
(a) Create to flash your kernel
(b) tar the zImage and flash using Odin on Windows.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s