add --debug mode to kernel boot

This commit is contained in:
Bruce Leidl 2019-01-15 14:36:29 -05:00
parent 3f38af7379
commit 57ecd26eb6

View File

@ -1,13 +1,12 @@
#!/bin/bash #!/bin/bash
# build/tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/qemu-system-x86_64 EXTRA_KERNEL_CMDLINE=""
SCRIPT=$(realpath ${BASH_SOURCE}) SCRIPT=$(realpath ${BASH_SOURCE})
BUILD_ROOT=$(realpath $(dirname ${SCRIPT})/../build) BUILD_ROOT=$(realpath $(dirname ${SCRIPT})/../build)
SYSROOT=${BUILD_ROOT}/tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native SYSROOT=${BUILD_ROOT}/tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native
QEMU=${SYSROOT}/usr/bin/qemu-system-x86_64 QEMU=${SYSROOT}/usr/bin/qemu-system-x86_64
if [[ ! -f ${QEMU} ]]; then if [[ ! -f ${QEMU} ]]; then
>&2 printf "Qemu binary not found at: ${QEMU}\n" >&2 printf "Qemu binary not found at: ${QEMU}\n"
exit 1 exit 1
@ -45,7 +44,7 @@ exit 0
BOOT_TARGET="" BOOT_TARGET=""
MEMORY_ARG="-m 4G" MEMORY_ARG="-m 4G"
INSTALLER_DEBUG=0 DEBUG_MODE=0
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
key=${1} key=${1}
@ -55,7 +54,7 @@ while [[ $# -gt 0 ]]; do
shift shift
;; ;;
--debug) --debug)
INSTALLER_DEBUG=1 DEBUG_MODE=1
shift shift
;; ;;
--memory) --memory)
@ -92,25 +91,33 @@ COMMON_INSTALLER_ARGS="\
-smp 2" -smp 2"
boot_installer() { boot_installer() {
if [[ ${INSTALLER_DEBUG} -eq 1 ]]; then if [[ ${DEBUG_MODE} -eq 1 ]]; then
${QEMU} ${COMMON_INSTALLER_ARGS} \ ${QEMU} ${COMMON_INSTALLER_ARGS} \
-serial stdio \ -serial stdio \
-kernel ${BUILD_ROOT}/images/bzImage \ -kernel ${BUILD_ROOT}/images/bzImage \
-append "console=ttyS0 earlyprintk=ttyS0 root=/dev/mapper/rootfs citadel.verbose citadel.live fstab=no luks=no systemd.journald.forward_to_console=1" -append "console=ttyS0 earlyprintk=ttyS0 root=/dev/mapper/rootfs citadel.verbose citadel.install fstab=no luks=no systemd.journald.forward_to_console=1 ${EXTRA_KERNEL_CMDLINE}"
else else
${QEMU} ${COMMON_INSTALLER_ARGS} ${QEMU} ${COMMON_INSTALLER_ARGS}
fi fi
} }
boot_kernel() { boot_kernel() {
echo "kernel" EXTRA_OPTIONS=""
KERNEL_IMAGE="bzImage"
if [[ ${DEBUG_MODE} -eq 1 ]]; then
EXTRA_OPTIONS="-s -S"
KERNEL_IMAGE="bzImage-intel-corei7-64.bin"
fi
${QEMU} \ ${QEMU} \
${ENABLE_KVM} \ ${ENABLE_KVM} \
${MEMORY_ARG} \ ${MEMORY_ARG} \
${EXTRA_OPTIONS} \
-nographic \ -nographic \
-no-reboot \
-smp 2 \ -smp 2 \
-append "rd.emergency console=ttyS0 earlyprintk=ttyS0" \ -append "rd.emergency console=ttyS0 earlyprintk=ttyS0 ${EXTRA_KERNEL_CMDLINE}" \
-kernel ${BUILD_ROOT}/images/bzImage -kernel ${BUILD_ROOT}/images/${KERNEL_IMAGE}
} }
if [[ ${BOOT_TARGET} = "kernel" ]]; then if [[ ${BOOT_TARGET} = "kernel" ]]; then