Android 11 Pixel 4a adding to boot.img's ramdisk

Skip to first unread message

Derek Selander

Aug 9, 2022, 10:59:07 AMAug 9
to Android Building
Hey all, 

New to this exciting world of Android compiling so forgive the likely simple question:

I have been trying to prove to myself that I can create a directory or file by modifying a ramdisk, repackage it into a boot.img, and flash that image back up to the device.

However, when I make any changes to the ramdisk, I notice the changes are not reflected at all when I am looking at the filesystem while I am adb shell'd in the device. From reading the Magisk docs, I get that there's a 2 stage mount process going for my Pixel 4a. However, I would expect that if I were to simply tweak my ramdisk.cpio (extracted via magiskboot), add a file/directory, to say /system, I'd expect that to show up after doing a `fastboot flash boot /tmp/new-boot.img && fastboot reboot` as the /system partition mounts to the rootfs when booting up.

I get that there could be other gotchas as play, like A/B partitions for OTA updates and whatnot, but I have tried flashing both partitions, doing a hard reset, and to no avail. I can not get any file modifications to be picked up in my ramdisk... which boots and runs perfectly fine btw, but without the expected mods.

What (obvious?) component could I be overlooking? 

Thank you! 

Rakesh Gupta

Aug 9, 2022, 3:44:38 PMAug 9
to Android Building
Ramdisk is a small and temporary filesystem which only has critical files to setup the system and boot the device.
The /system partition where you are searching for new files actually gets its content from a separate read only system.img file which gets mounted at /system in non SAR devices and at / in SAR devices.

Derek Selander

Aug 24, 2022, 5:50:29 PMAug 24
to Android Building
Appreciate the clarification 
Reply all
Reply to author
0 new messages