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

388 views
Skip to first unread message

Derek Selander

unread,
Aug 9, 2022, 10:59:07 AM8/9/22
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! 
-Derek  

Rakesh Gupta

unread,
Aug 9, 2022, 3:44:38 PM8/9/22
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

unread,
Aug 24, 2022, 5:50:29 PM8/24/22
to Android Building
Appreciate the clarification 
Reply all
Reply to author
Forward
0 new messages