Make persistent changes to init.rc

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

    Please note that it may be easier for you to use an app like Scripter to run a script at boot time than modify this file.

    Before following @tripler's instructions above you need a file called boot.img which can be extracted by (run on rooted Android device, untested without root):

    dd if=/dev/block/platform//by-name/boot of=/sdcard/boot.img
    

    Then connect your Android to your computer and copy the boot.img file from there.

    Script:

    http://linuxclues.blogspot.ca/2012/11/split-bootimg-python-android.html

    Here is a modified, easier to see version of tripler's instructions (assuming boot.img is in tmp):

    cd /tmp
    mkdir fs
    # Now use the linked script above to split the boot.img file into ramdisk.gz and kernel
    python split_boot_img.py -i boot.img -o parts
    cd fs
    gunzip -c ../parts/ramdisk.gz | cpio -id
    # make changes to init.rc
    

    At that point you will have to rebuild the boot.img back together before reflashing, which will be device-specific. Can't help you with that, sorry!

提交回复
热议问题