2

Is it possible to mount a ramdisk in Android before the Android framework starts, but after the underlying Linux kernel has started? If so, what commands should I use?

Thanks!

user1118764
  • 9,255
  • 18
  • 61
  • 113
  • can you explain why you want to do that? Unless you are making your own kernel and startup scripts and flashing the inage, you cannot do that. – Durairaj Packirisamy Oct 15 '12 at 05:15
  • What is wrong with the existing filesystem mounting mechanism, i.e. `/etc/fstab`? See http://linux.die.net/man/5/fstab. BTW "ramdisk" has essentially been replaced by *ramfs* and *tmpfs*. See http://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt – sawdust Oct 15 '12 at 19:11

2 Answers2

2

Based on some reference books I read, an Android system starts up in following main steps:

  1. CPU reads a hard-coded address which usually points to some bootloader program
  2. The bootloader initializes the RAM, puts basic hardware in a quiescent state, loads the the kernel and RAM disk, and jumps to the kernel.
  3. start_kernel() initializes subsystems and proceeds to call the init function of built-in drivers.
  4. The kernel mount its root system (from ramdisk.img).
  5. init.rc is then called to set up the environment variables such as system path, mount other filesystems, start native daemons and so on.

Now, to answer your question: "Is it possible to mount a ramdisk in Android before the Android framework starts, but after the underlying Linux kernel has started?" -- I think this is exactly what android did.

Da Ha Song
  • 398
  • 5
  • 11
0

You have to write shell script which you invoke from init.rc files. Another approach could be write a C program which gets launched from init.rc as daemon.

The init is the middle place where linux has booted almost while android frameowrk is about to begin booting.

samuel05051980
  • 369
  • 2
  • 2