Make persistent changes to init.rc

后端 未结 8 2110
没有蜡笔的小新
没有蜡笔的小新 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:12

    A number of Android devices include code to prevent root modifications to the system files. The way this is done is by using the recovery partition. On reboot, they basically restore the system partition using the recovery image. If your system is doing that then you cannot make persistent changes - the best you could do would be to hook up something to run after reboot to re-apply your change. In CyanogenMod they had hooks in the init.rc to run sdcard scripts if found. Perhaps you can create an app or widget to then launch a script to make the mods required using a setuid root script from the data partition. Without building your own ROM you are quite restricted in this area.

    Possibly you could fetch the recovery image and try unpacking that, making your changes and repacking and flashing it. But make sure you can recover with fastboot before you try this.

提交回复
热议问题