Samsung Galaxy Note II (N7100) auto boot on charger - laurynas/volvo_hid GitHub Wiki

Steps

  • Download boot.img from Android device
  • Unpack the boot.img
  • Edit init.rc
  • Repack the boot.img
  • Replace the boot.img with new boot image

Download boot.img

Go to Android shell as root

adb root
adb shell

List partitions by name

ls -l /dev/block/platform/dw_mmc/by-name/

In results look for BOOT partition:

lrwxrwxrwx 1 root root 20 2017-07-15 11:02 BOOT -> /dev/block/mmcblk0p8

Dump boot image

cat /dev/block/platform/dw_mmc/by-name/BOOT > /data/local/tmp/boot.img

Download image

adb pull /data/local/tmp/boot.img /tmp/boot.img

Unpack boot.img

On Ubuntu / Debian install abootimg

sudo apt-get install abootimg

Extract boot image

mkdir boot
cd boot
abootimg -x /tmp/boot.img

Extract ram disk

mkdir initrd
cd initrd
cat ../initrd.img | gunzip | cpio -vid

Modify rc files

Change init.rc on charger section

on charger
    #class_start charger
    trigger late-init

Disable init.smdk4x12.rc on charger power options

on charger
# CPU Frequency Governor
    #write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave

# EHCI runtime enable for LPA
    #write /sys/devices/platform/s5p-ehci/power/control auto

Repack boot.img

Recreate ramdisk

cd initrd
find . | cpio --create --format='newc' | gzip > ../myinitrd.img
cd ..
abootimg --create myboot.img -f bootimg.cfg -k zImage -r myinitrd.img

Create new boot image

abootimg --create /tmp/myboot.img -f bootimg.cfg -k zImage -r myinitrd.img

Upload boot.img

Upload new boot image to the device

adb push /tmp/myboot.img /data/local/tmp/
adb shell
cat /data/local/tmp/myboot.img > /dev/block/platform/dw_mmc/by-name/BOOT

Resources