In many cases, we need to modify init. RC to meet different application requirements. Here we provide two ways to modify it:
I. general modification method
In the device/Samsung/smdkv210 directory, there are two files: init. RC and init_sdmmc.rc. If the image is stored in
In the SD card, you need to modify init_sdmmc.rc. If the image is stored in NAND, You need to modify the init. RC file.
After the modification, run./MK-S. The modified file will be packaged into out/target/product/smdkv210/Android. IMG. cpio
File. Copy Android. IMG. cpio to the root directory of the kernel, and then execute./MK-K-X, Android. IMG. cpio
It will be packaged into xboot, update the xboot. binfile, And the init. RC file will be modified.
If you use the modified script MK, you can directly modify the file in the device/Samsung/smdkv210 directory and execute the command
./MK-S-K-X, you can complete the modification in one step.
Ii. Temporary modification method
Sometimes we need to modify the init. RC file during debugging. If we compile the system image every time, it will be a waste of time. We know that init. RC is
In the Android. IMG. cpio file, can we modify this file and update it to xboot?
The following is a script for modifying android_cpio.sh:
#!/bin/bash# create: armeasy# date: 2011-12-16# mail: phosphor88@163.comecho "Modify the android.img.cpio"echo "1.unzip the image"echo "2.Create the image"echo "3.exit"SOURCE_DIR=$(cd `dirname $0` ; pwd)TOOLS_DIR=${SOURCE_DIR}/tools/TARGET_DIR=${SOURCE_DIR}/out/release/read -p "Choose:" CHOOSEif [ "1" = ${CHOOSE} ];thenecho "unzip android.img.cpio"cd ${TARGET_DIR}[ -e "tmp" ] ||{ echo "mkdir tmp"; mkdir tmp;}[ -e "android.img.cpio" ] || { echo "error!can't find andaroid.img.cpio!"; exit; }cd tmpcpio -idmv --no-absolute-filenames < ../android.img.cpioecho "^_^ unzip android.img.cpio finished!"exitelif [ "2" = ${CHOOSE} ];thenecho "create android.img.cpio test"[ -e "${TARGET_DIR}/tmp" ] || { echo "can't find [tmp],please unzip android.img.cpio first!"; exit; }rm -f ${TARGET_DIR}/cpio_listrm -f ${TARGET_DIR}/android.img.cpio$TOOLS_DIR/gen_initramfs_list.sh ${TARGET_DIR}/tmp > ${TARGET_DIR}/cpio_list || { exit; }$TOOLS_DIR/gen_init_cpio ${TARGET_DIR}/cpio_list > ${TARGET_DIR}/android.img.cpio || { exit; }rm -rf ${TARGET_DIR}/tmpecho "^_^ Create android.img.cpio finished!"exitelif [ "3" = ${CHOOSE} ];thenexitfi
Put it in the android root directory, that is, run it in the same directory as Mk. When input 1, the android. IMG. cpio file under the out/release directory will be decompressed
In the out/release/tmp directory, manually modify the out/release/tmp/init. RC file, run the script again, input 3, and then package the decompressed file
The android. IMG. cpio file is stored in the out/release directory.
Copy Android. IMG. cpio to the kernel root directory and execute./MK-K-X to update xboot. Bin, which completes the modification of init. RC.
Appendix: script:
Http://xboot.org/thread-347-1-1.html