mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 03:31:36 +01:00
Use buildroot host gdb, consider QEMU and target GDB but give up for now
This commit is contained in:
@@ -1,4 +1,35 @@
|
|||||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="../kernel_config_fragment"
|
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="../kernel_config_fragment"
|
||||||
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment"
|
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment"
|
||||||
BR2_PACKAGE_KERNEL_MODULE=y
|
BR2_PACKAGE_KERNEL_MODULE=y
|
||||||
|
BR2_PACKAGE_STRACE=y
|
||||||
BR2_ROOTFS_OVERLAY="../rootfs_overlay"
|
BR2_ROOTFS_OVERLAY="../rootfs_overlay"
|
||||||
|
|
||||||
|
## Host GDB
|
||||||
|
BR2_GDB_VERSION="7.11.1"
|
||||||
|
BR2_GDB_VERSION_7_10=n
|
||||||
|
BR2_GDB_VERSION_7_11=y
|
||||||
|
BR2_GDB_VERSION_7_12=n
|
||||||
|
BR2_PACKAGE_HOST_GDB=y
|
||||||
|
BR2_PACKAGE_HOST_GDB_PYTHON=y
|
||||||
|
BR2_PACKAGE_HOST_GDB_SIM=y
|
||||||
|
BR2_PACKAGE_HOST_GDB_TUI=y
|
||||||
|
|
||||||
|
## QEMU.
|
||||||
|
# Buildroot can also build QEMU, but it does not have SDL support,
|
||||||
|
# so you have to mess around with a VNC, so let's not use that for now.
|
||||||
|
# Someone should patch this, and add a SDL support option to the QEMU package! :-)
|
||||||
|
#BR2_PACKAGE_HOST_QEMU=y
|
||||||
|
#BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE=n
|
||||||
|
#BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
|
||||||
|
#BR2_PACKAGE_HOST_QEMU_VDE2=y
|
||||||
|
|
||||||
|
## Target GDB
|
||||||
|
# This is preparation for target GDB / gdbserver.
|
||||||
|
# But those options require a toolchain with threads like glibc,
|
||||||
|
# which I'm afraid will make compilation slower, so let's leave it
|
||||||
|
# at that for now since our focus is kernel debug.
|
||||||
|
#BR2_DEBUG_1=n
|
||||||
|
#BR2_DEBUG_2=n
|
||||||
|
#BR2_DEBUG_3=y
|
||||||
|
#BR2_ENABLE_DEBUG=y
|
||||||
|
#BR2_OPTIMIZE_0=y
|
||||||
|
|||||||
2
run
2
run
@@ -2,6 +2,8 @@
|
|||||||
set -e
|
set -e
|
||||||
cd buildroot
|
cd buildroot
|
||||||
make BR2_EXTERNAL="$(pwd)/../kernel_module" qemu_x86_64_defconfig
|
make BR2_EXTERNAL="$(pwd)/../kernel_module" qemu_x86_64_defconfig
|
||||||
|
# Can't get rid of this for now.
|
||||||
|
# http://stackoverflow.com/questions/44078245/is-it-possible-to-use-config-fragments-with-buildroots-config
|
||||||
cat ../buildroot_config_fragment >> .config
|
cat ../buildroot_config_fragment >> .config
|
||||||
env -u LD_LIBRARY_PATH make BR2_JLEVEL="$(($(nproc) - 2))" kernel_module-rebuild all
|
env -u LD_LIBRARY_PATH make BR2_JLEVEL="$(($(nproc) - 2))" kernel_module-rebuild all
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
3
rungdb
3
rungdb
@@ -4,8 +4,9 @@ if [ "$#" -gt 0 ]; then
|
|||||||
else
|
else
|
||||||
brk=""
|
brk=""
|
||||||
fi
|
fi
|
||||||
|
gdb="$(pwd)/buildroot/output/host/usr/bin/x86_64-linux-gdb"
|
||||||
cd buildroot/output/build/linux-*.*.*/
|
cd buildroot/output/build/linux-*.*.*/
|
||||||
cmd="gdb \
|
cmd="$gdb \
|
||||||
-q \
|
-q \
|
||||||
-ex 'add-auto-load-safe-path $(pwd)' \
|
-ex 'add-auto-load-safe-path $(pwd)' \
|
||||||
-ex 'file vmlinux' \
|
-ex 'file vmlinux' \
|
||||||
|
|||||||
2
runqemu
2
runqemu
@@ -21,6 +21,8 @@ while getopts dn OPT; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# If we turn on buildroot host QEMU some day.
|
||||||
|
#cmd="./buildroot/output/host/usr/bin/qemu-system-x86_64 \
|
||||||
cmd="qemu-system-x86_64 \
|
cmd="qemu-system-x86_64 \
|
||||||
-M pc \
|
-M pc \
|
||||||
-append 'root=/dev/vda $extra_append' \
|
-append 'root=/dev/vda $extra_append' \
|
||||||
|
|||||||
Reference in New Issue
Block a user