Created
September 16, 2021 15:07
-
-
Save kcxt/dcd23edebe3011cf5ce8b02f95fb2d65 to your computer and use it in GitHub Desktop.
Very hacky script for automatically bisecting kernel regressions on devices like the OnePlus 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # basically what at-to_bootloader_hard does, turns off the USB port the phone is connected to so that | |
| # VBUS is low and the device won't go to EDL (yay oneplus) | |
| # then sends a byte to the arduino to tell it to perform a hard reboot by pressing volume up and power | |
| # finally turn the usb port back on | |
| # sudo uhubctl -a off -p 2 -n 2109:2812 && printf "%b" "\0x01" > /dev/ttyACM0 && sleep 15 && sudo uhubctl -a on -p 2 -n 2109:2812 | |
| export TOOLSDIR=$HOME/pmos/tools | |
| . $HOME/pmos/tools/pmenv | |
| . $HOME/pmos/tools/automation.sh | |
| #set -x | |
| # mm clean | |
| # mm defconfig sdm845.config || exit 125 | |
| cat ../patches/*.patch | patch -p1 -N -f || : | |
| mm olddefconfig | |
| mm || exit 125 | |
| $TOOLSDIR/utils/mkbootimg.sh -c "earlycon earlyprintk console=ttyMSM0,115200n8 console=tty1 androidboot.console=ttyMSM0 androidboot.hardware=enchilada androidboot.boot_devices=soc@0/1d84000.ufshc firmware_class.path=/vendor/firmware/ init=/init printk.devkmsg=on deferred_probe_timeout=30 fw_devlink=permissive selinux=0 buildvariant=userdebug" -r /tmp/android-ramdisk.img | |
| at-to_bootloader_hard | |
| echo "flashing new boot image, state=$(at-state)" | |
| at-flash $HOME/pmos/mainline-boot.img | |
| # Cheeky one liner to read from serial until we find a match or timeout after 20 seconds | |
| ( cat /dev/ttyUSB1 & ) | timeout 25s grep -q "end Kernel panic" | |
| FAILED=$? | |
| echo "exit code $FAILED checking for kernel panic" | |
| git clean -f | |
| if [ $FAILED == 0 ]; then | |
| echo "wooooooooooooooooooo" | |
| exit 0 | |
| else | |
| exit 120 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment