diff --git a/README.adoc b/README.adoc index 8ae6a8bd..c65d0952 100644 --- a/README.adoc +++ b/README.adoc @@ -15212,7 +15212,7 @@ However, for many types of crashes, it is trivial to bisect down to the offendin For example, when updating from QEMU `v2.12.0` to `v3.0.0-rc3`, the Linux kernel boot started to panic for `arm`. -We then bisected it as explained at: https://stackoverflow.com/questions/4713088/how-to-use-git-bisect/22592593#22592593 with the link:qemu-bisect-boot[] script: +We then bisected it as explained at: https://stackoverflow.com/questions/4713088/how-to-use-git-bisect/22592593#22592593 with the link:bisect-qemu-linux-boot[] script: .... root_dir="$(pwd)" @@ -15220,20 +15220,20 @@ cd "$(./getvar qemu_source_dir)" git bisect start # Check that our test script fails on v3.0.0-rc3 as expected, and mark it as bad. -"${root_dir}/qemu-bisect-boot" +"${root_dir}/bisect-qemu-linux-boot" # Should output 1. echo #? git bisect bad # Same for the good end. git checkout v2.12.0 -"${root_dir}/qemu-bisect-boot" +"${root_dir}/bisect-qemu-linux-boot" # Should output 0. echo #? git bisect good # This leaves us at the offending commit. -git bisect run ../bisect-qemu-linux-boot +git bisect run "${root_dir}/bisect-qemu-linux-boot" # Clean up after the bisection. git bisect reset @@ -15241,7 +15241,10 @@ git submodule update "${root_dir}/build-qemu" --clean --qemu-build-id bisect .... -TODO broken, fix: An example of Linux kernel commit bisection on gem5 boots can be found at: link:bisect-linux-boot-gem5[]. +Other bisection helpers include: + +* link:bisect-linux-boot-gem5[] +* link:bisect-gem5-linux-boot[] [[path-properties]] === path_properties diff --git a/bisect-gem5-linux-boot b/bisect-gem5-linux-boot new file mode 100755 index 00000000..42b1a7f2 --- /dev/null +++ b/bisect-gem5-linux-boot @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# https://github.com/cirosantilli/linux-kernel-module-cheat#bisection +set -eu +cd ../.. +./build-gem5 --gem5-build-id bisect +set +e +# Setup for quick failures: +# https://stackoverflow.com/questions/4713088/how-to-use-git-bisect/22592593#22592593 +timeout 5 ./run --emulator gem5 --gem5-build-id bisect --quit-after-boot +if [ $? -ne 124 ]; then + exit 1 +fi diff --git a/bisect-linux-boot-gem5 b/bisect-linux-boot-gem5 index 55fe1767..56370098 100755 --- a/bisect-linux-boot-gem5 +++ b/bisect-linux-boot-gem5 @@ -1,9 +1,10 @@ #!/usr/bin/env bash +# https://github.com/cirosantilli/linux-kernel-module-cheat#bisection set -eu ./build-linux --clean "$@" ./build-linux "$@" set +e -./run --eval 'm5 exit' "$@" || status=$? +./run --quit-after-boot "$@" || status=$? # https://stackoverflow.com/questions/4713088/how-to-use-git-bisect/22592593#22592593 if [ "$status" -eq 125 ] || [ "$status" -gt 127 ]; then status=1 diff --git a/bisect-qemu-linux-boot b/bisect-qemu-linux-boot index 51bcfa43..9d352e50 100755 --- a/bisect-qemu-linux-boot +++ b/bisect-qemu-linux-boot @@ -1,6 +1,7 @@ #!/usr/bin/env bash +# https://github.com/cirosantilli/linux-kernel-module-cheat#bisection set -eu git submodule update --recursive cd ../.. ./build-qemu --arch aarch64 --qemu-build-id bisect -./run --arch aarch64 --kernel-cli 'init=/lkmc/linux/poweroff.out' --qemu-build-id bisect +./run --arch aarch64 --qemu-build-id bisect --quit-after-boot