From 9133fe023cb3faf23e997943acc0095e7d2b5845 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sat, 8 Jul 2017 09:17:36 +0100 Subject: [PATCH] qemu and linux as submodlues, S98 vs S99, readme benefits of Ctrl + C --- .gitignore | 2 ++ .gitmodules | 6 ++++++ README.md | 8 +++++++- buildroot_config_fragment | 1 + buildroot_override | 2 ++ linux | 1 + qemu | 1 + rootfs_overlay/etc/init.d/S98 | 6 ++++++ rootfs_overlay/etc/init.d/S99 | 4 ---- run | 1 - 10 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 buildroot_override create mode 160000 linux create mode 160000 qemu create mode 100755 rootfs_overlay/etc/init.d/S98 delete mode 100755 rootfs_overlay/etc/init.d/S99 diff --git a/.gitignore b/.gitignore index 32d3ca5..3a977e5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ *.o *.out *.tmp +*~ .tmp_versions +/rootfs_overlay/etc/init.d/S99 Module.symvers modules.order diff --git a/.gitmodules b/.gitmodules index b9ab2a0..afce496 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ [submodule "buildroot"] path = buildroot url = https://github.com/buildroot/buildroot +[submodule "qemu"] + path = qemu + url = https://github.com/cirosantilli/qemu +[submodule "linux"] + path = linux + url = https://github.com/cirosantilli/linux diff --git a/README.md b/README.md index 010f4bc..7d017de 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,8 @@ TODO: Ctrl + C kills the emulator, it is not sent to guest processes. See: - - +This is however fortunate when running QEMU with GDB, as the Ctrl + C reaches GDB and breaks. + ## Automatic startup commands When debugging a module, it becomes tedious to wait for build and re-type: @@ -131,10 +133,14 @@ When debugging a module, it becomes tedious to wait for build and re-type: Instead, you can add your test commands to: - rootfs_overlay/etc/init.d/S99 + cd rootfs_overlay/etc/init.d + cp S98 S99 + vim S99 and they will be run automatically before the login prompt. +`S99` is already gitignored for you. + ## Debugging To GDB the Linux kernel, first run: diff --git a/buildroot_config_fragment b/buildroot_config_fragment index 9be8177..a01000a 100644 --- a/buildroot_config_fragment +++ b/buildroot_config_fragment @@ -2,6 +2,7 @@ BR2_GLOBAL_PATCH_DIR="../global_patch_dir" BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="../kernel_config_fragment" BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment" BR2_PACKAGE_KERNEL_MODULE=y +BR2_PACKAGE_OVERRIDE_FILE=../buildroot_override BR2_PACKAGE_STRACE=y BR2_ROOTFS_OVERLAY="../rootfs_overlay" diff --git a/buildroot_override b/buildroot_override new file mode 100644 index 0000000..501ffc3 --- /dev/null +++ b/buildroot_override @@ -0,0 +1,2 @@ +HOST_QEMU_OVERRIDE_SRCDIR = ../qemu +LINUX_OVERRIDE_SRCDIR = ../linux diff --git a/linux b/linux new file mode 160000 index 0000000..54e66cc --- /dev/null +++ b/linux @@ -0,0 +1 @@ +Subproject commit 54e66cc228125e6c223214bac7ada398401e7b90 diff --git a/qemu b/qemu new file mode 160000 index 0000000..144ea94 --- /dev/null +++ b/qemu @@ -0,0 +1 @@ +Subproject commit 144ea94d710c666babd06ed733007377e132ed4a diff --git a/rootfs_overlay/etc/init.d/S98 b/rootfs_overlay/etc/init.d/S98 new file mode 100755 index 0000000..685fc2e --- /dev/null +++ b/rootfs_overlay/etc/init.d/S98 @@ -0,0 +1,6 @@ +#!/bin/sh +# For temparary test commands, first copy this file to to +# S99 which is already gitignored. +echo 'S98' +# insmod /hello.ko +exit 0 diff --git a/rootfs_overlay/etc/init.d/S99 b/rootfs_overlay/etc/init.d/S99 deleted file mode 100755 index 28ee2ab..0000000 --- a/rootfs_overlay/etc/init.d/S99 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -echo 'S99' -# insmod /hello.ko -exit 0 diff --git a/run b/run index feaaa73..cb034a2 100755 --- a/run +++ b/run @@ -43,7 +43,6 @@ env \ HOST_QEMU_OPTS="--enable-debug --enable-sdl --extra-cflags='-DDEBUG_PL061=1' --with-sdlabi=2.0" \ host-qemu-rebuild \ linux-rebuild \ - kernel_module-rebuild \ all \ ; cd ..