Skip to content

Instantly share code, notes, and snippets.

@tallero
Created April 23, 2020 18:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tallero/69d79b354fc280f7e600212e9ef92811 to your computer and use it in GitHub Desktop.
Save tallero/69d79b354fc280f7e600212e9ef92811 to your computer and use it in GitHub Desktop.
HOW TO: Modify boot.img to allow usb debugging from recovery adb
ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1
persist.sys.usb.config=adb
ro.adb.secure=0
# Create a folder where you can work with the boot image
mkdir bootedit; cd bootedit
adb shell
su
# Create copy of boot image on sdcard
cat /dev/block/bootdevice/by-name/boot > /sdcard/boot.img
# exit from su and adb
exit;exit
# Copy boot image to desktop
adb pull /sdcard/boot.img
# Extract boot image contents (needs abootimg installed)
abootimg -x boot.img
# create initrd folder where you can work with initrd image
mkdir initrd;cd initrd
# change extension to gz (for gunzip tool)
mv ../initrd.img initrd.gz
# extract initrd contents
gunzip initrd.gz; cpio -id < initrd
# Change some default.prop values to the same as the attached default.prop file
nano default.prop
# Add binary files to path (needs to be changed to where you have them)
export PATH=$PATH:/home/gregor/Android/AOSPA/out/host/linux-x86/bin
mkbootfs . | gzip > ../newinitramfs.cpio.gz
cd ..
ls
# Create new bootimage, change all flags to the ones for your device
mkbootimg --kernel zImage --ramdisk newinitramfs.cpio.gz --base 0x80000000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 vmalloc=350M androidboot.selinux=permissive' -o newboot.img
adb push ./newboot.img /sdcard/newboot.img
cd ..
# Install newboot.img in TWRP and enjoy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment