1

Where does the root file system (ie, / not /system) come from on Android? I can see that /system is mounted

cat /proc/mounts

rootfs / rootfs ro,relatime 0 0
  ...
/dev/block/mtdblock8 /system ext4 ro,noatime,nodiratime,barrier=1,data=ordered,noauto_da_alloc 0 0
/dev/block/mtdblock6 /data ext4 rw,nosuid,nodev,noatime,nodiratime,barrier=1,data=ordered,noauto_da_alloc 0 0

I can see that /system and /data are mounted from mtdblockX devices. And that / is mounted on the 'virtual' type 'rootfs'.

There are a bunch of files and directories in / (I'm interested in /sbin) that don't seem to be mounted on a mount point over /. Where do those files come from? (I want to get RW access to /sbin) Is this done with some 'chroot' magic? -- it it from some 'boot' image? (In this specific example I'm using a Minix Neo X5 with Android)

migrated from superuser.com Dec 23 '13 at 15:20

This question came from our site for computer enthusiasts and power users.

  • Before anyone votes to close - while this may be more appropriate on Android Enthusiasts as it is, perhaps it could be generalised to Linux as a whole, which would be on-topic on Super User. (And remember that Android as an OS is not off-topic, just questions relating purely to phones with no computer involved - so Android x86 on a traditional computer would also be on-topic.) – Bob Dec 23 '13 at 13:46
  • This isn't a 'how to you program this' sort of question. The purpose is to understand where the data/files come from so I can write the program to manipulate the contents (of /sbin) on various systems. – Ribo Dec 23 '13 at 13:58
-1

The rootfs is setup by kernel and init, /sbin is part of initrd.img aka ramdisk. Initrd.img is part of boot partition, and needs to be unpacked to be edited.

Here is some good info on boot process and editing boot partition http://www.slideshare.net/chrissimmonds/android-bootslides20 XDA forum HOWTO: Unpack, Edit, and Repack Boot Images

Also, newer devices are requiring boot partition to be signed, and unless bootloader is unlocked, any editing will cause device not to boot.

  • Quote from ibm.com/developerworks/library/l-initrd > The Linux® initial RAM disk (initrd) is a temporary root file system that is mounted during system boot to support the two-state boot process. The initrd contains various executables and drivers that permit the real root file system to be mounted, after which the initrd RAM disk is unmounted and its memory freed. In many embedded Linux systems, the initrd is the final root file system – Jcfunk Apr 27 '15 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.