Created
April 5, 2022 13:34
-
-
Save kcxt/966354d85aa76837d219f645d8682a1b to your computer and use it in GitHub Desktop.
Caleb's hacky bisect script
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 | |
# 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 | |
. ~/pmos/pmbootstrap/helpers/envkernel.sh | |
export MAKECMD="pmbootstrap -q chroot --user -- ARCH=arm64 CROSS_COMPILE=/usr/bin/aarch64-alpine-linux-musl- make -C /mnt/linux O=/mnt/linux/.output CC=aarch64-alpine-linux-musl-gcc HOSTCC=gcc" | |
echo; echo "====================="; echo | |
#set -x | |
# mm clean | |
# mm defconfig sdm845.config || exit 125 | |
cat ../patches/*.patch | patch -p1 -N -f || : | |
$MAKECMD olddefconfig | |
$MAKECMD -j16 2>&1 > /dev/null | |
MAKE_EXIT=$? | |
if [ "$MAKE_EXIT" != "0" ]; then | |
echo "Failed to build, skipping this commit: $MAKE_EXIT" | |
git clean -f | |
git reset --hard HEAD | |
exit 125 | |
fi | |
pmbootstrap build --envkernel linux-postmarketos-qcom-sdm845 && \ | |
pmbootstrap chroot -r apk upgrade && pmbootstrap install --password 147147 | |
if [ "$?" != "0" ]; then | |
echo "Failed to install, something is very wrong!!!" | |
while true; do sleep 10; done | |
fi | |
[[ -d /tmp/postmarketOS-export ]] || pmbootstrap export | |
echo "Rebooting to bootloader" | |
#set -x | |
at-to_bootloader_hard 2>&1 > /dev/null | |
#set +x | |
echo "flashing new boot image, state=$(at-state)" | |
#at-flash $HOME/pmos/mainline-boot.img | |
pmbootstrap flasher flash_rootfs --partition userdata | |
pmbootstrap flasher flash_kernel | |
fastboot reboot | |
# Cheeky one liner to read from serial until we find a match or timeout after 20 seconds | |
( tail -F -n0 /tmp/dmesg.log & ) | timeout 25s grep -q "end Kernel panic" | |
FAILED=$? | |
echo "" > /tmp/dmesg.log | |
git clean -f | |
git reset --hard HEAD | |
date | |
echo; echo "===================== $FAILED ==========="; echo | |
# If we found a match, that means it's a bad kernel | |
if [ $FAILED == 0 ]; then | |
exit 120 | |
else | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment