Monday, January 14, 2008

Step by step to create/modify ramdisk.img

Benno's blog has an article to change the ramdisk image, I tried it and give more details here.

ramdisk.img is included in the google android sdk, it exists in folder $SDK_ROOT/tools/lib/images/ramdisk.img. The ramdisk.img included in the google android sdk is a gzipped ramdisk.cpio file.

Here is the steps:
  1. Upload the ramdisk.img to your linux machine
  2. Change the ramdisk.img name to ramdisk.cpio.gz, and extract it by: # gzip -d ramdisk.cpio.gz
  3. Create a temporary folder, say tmp, copy ramdisk.cpio to tmp folder
  4. Extract the ramdisk.cpio in the tmp folder with command: # cpio -i -F ramdisk.cpio
  5. Remove the ramdisk.cpio in the tmp folder, and make any changes you want to the extracted ramdisk.cpio in tmp folder
  6. Recreate the ramdisk.cpio with command: # cpio -i -t -F ../ramdisk.cpio | cpio -o -H newc -O ../ramdisk_new.cpio
Some notes:
  1. I change ramdisk.img to ramdisk.cpio.gz, and unzip it. It is because I find the -z parameter is not supported with my cpio. I tried the latest cpio (2.9), it doesn't work too.
  2. Check cpio version by # cpio --version. I'm using cpio version 2.4.
  3. Find the latest cpio (v 2.9) on site: gnu cpio
  4. Notice that in step 6, the command includes two O's. First o is lower-case, second is up-case.
  5. Notice in step 6, please remain ramdisk.cpio in up folder of tmp folder. The command need it there.

9 comments:

Unknown said...

Hi RTM,

I want to modify the default splash image coming while Android is loading. That is, I want to have my image as the splash image instead of the splash image containing the letters "A n d r o i d" and 2 robots.

Can you please tell me how to do it?

Thanks,
Ram.li

rtm said...

You shall have the Google android open source on your disk. Look into the ANDROID_FOLDER/system/core/init/init.c, main(...) function, line 744. For the information to show initlogo.rle, reference the following: http://forum.xda-developers.com/showthread.php?t=443431

Unknown said...

Hi RTM,

I placed the initlogo.rle image in the root directory and flashed the image. It comes in the device but distorted though.
Any ideas? But its working.

Thank you much.
Ram

rtm said...

What kind of distortion? Not sure if you get noticed that the image shall be RGB 565 format.

Unknown said...

Hi RTM,

I just taken the image (initlogo.rle) from the above link and flashed into the device. Actually, it should display "Hackdroid". It displays but Hackdroid letters are overwritten by themselves. I use a freerunner.

Thanks,
Ram.

Unknown said...

Hi RTM,

Wish you a Happy New Year 2009.

Do you have any idea of changing the
splash screen containing the letters
Android adn 2 robots. Using the above
tip, i was able to modify the splash
coming from the Kernel. I also want
to modify the splash coming from Android.

Thanks,
Ram

rtm said...

I have mentioned in my previous comment, you can find your answer in android source code $ANDROID_FOLDER/system/core/init.c. The "ANDROID" is printed in line 744 of init.c.

trailmarky said...

whoa!!!, you had a passion in blogging, thumbs up for your work of love.. Hehe very inspiring ideas,


anyway I'm william
mind if I put a link back to you?


(clickable) ------> big and tall suits

venkat said...

if i need to extract system.img.

how to do in linux ubuntu machine