Android root file system

1,125 views
Skip to first unread message

Vik

unread,
Apr 2, 2012, 8:57:16 PM4/2/12
to Android Building
Hi,

When I build my android from source, I get system.img, userdata.img
and ramdisk.img in
out/target/product/generic/
And I use these with my emulator...
I also have a root/ directory here.
Is this the directory used by android as its root file system when I
run the emulator?

I tried to replace the stripped version of 'init' file here with a non-
stripped version, but when I run the emulator it still picks up the
stripped version.
From the adb shell I was able to see '/' in the emulated machine and I
see the the init is indeed the one which was there before I replaced
it (size of the ELF file is different).

Where does the emulator see the root file system from? It would be
really helpful if someone could point me in the right direction.

Thanks,
Vik

Vik

unread,
Apr 2, 2012, 9:51:34 PM4/2/12
to Android Building
Ok, I guess I figured out that it is the ramdisk.img which is the
compressed files-system.
So I did the following:
gzip -dc ramdisk.img | cpio -i
cp -R out/target/product/generic/symbols/* .
find . | cpio -o -H nwec | gzip > ramdisk_new.img

Now if I try to boot using this ramdisk_new.img then emulator gets
stuck and does not startup :(.

Has anyone tried this (modify ramdisk.img re-run) and got the emulator
running successfully?

Thanks in advance,
Vik

mark gross

unread,
Apr 2, 2012, 10:24:59 PM4/2/12
to android-...@googlegroups.com
the emulator boots a ramdisk. 
The ramdisk is created from the root tree using a cpio derived like tool called mkbootfs (system/core/cpuio/Android.mk)

ramdisk.img is a cpio compressed file.
zcat ../ramdisk.img | cpio -i

Google " ramdisk cpio howto".  There are ways to repack them.

or mgrep ramdisk in the tree to see its built.  (build/core/Makefile)

--mark



--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en



--
create interesting things.

mark gross

unread,
Apr 3, 2012, 11:02:30 AM4/3/12
to android-...@googlegroups.com
That looks like ti should work.  BTW how *big* is your ramdisk_new.img?  are you exceeding the emulator's virtual memory size for a ram disk.

Try a simpler test.  copy *one* change into the ramdisk and rebuild that.  Check that your change is in your emulator.  I recommend you change the init.rc or add a file you can see from the console.

--mark

--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en



--
create interesting things.

Vik

unread,
Apr 3, 2012, 5:44:32 PM4/3/12
to Android Building
Thanks Mark!

Turns out the large size was the issue. It works fine when I try
individual files.

Thanks,
Vik
Reply all
Reply to author
Forward
0 new messages