Make persistent changes to init.rc

后端 未结 8 2118
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 22:39

I want to change the init.rc file of an android pad. But after I change it and reboot the system, the original init.rc comes back.

How can

8条回答
  •  难免孤独
    2020-12-07 23:06

    Your root partition (where /init.rc lives) is a ramdisk which is unpacked from an initrd file and mounted every time your device boots. Any changes you make are to the ramdisk only, and will be lost on the next reboot.

    If you can get the initrd file, you can mount it on your Linux host system, modify the files there, unmount it, and write it back to your Android.

    The initrd file exists in its own partition on the device. If you can figure out which partition it is, you can grab it from the device onto your host, mount it, modify it, and write it back to the device. This is what tripler was talking about above.

    In general, modifying boot.img is something that only system developers do. If you're building the entire Android system, you'll have access to the necessary source code. My workflow for this looks like this:

    # Modify init.rc
    m -j8 bootimage_signed
    adb reboot bootloader
    fastboot flash boot $OUT/boot.img
    fastboot reboot
    

提交回复
热议问题