diff --git a/README.md b/README.md index 67122fc..3a3cfa3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Run one command, get into QEMU Buildroot BusyBox with several minimal Linux kern Usage: - sudo apt-get install qemu + sudo apt-get build-dep qemu ./run First build will take a while (GCC, Linux kernel). diff --git a/buildroot_config_fragment b/buildroot_config_fragment index f1652a7..cc2640c 100644 --- a/buildroot_config_fragment +++ b/buildroot_config_fragment @@ -15,13 +15,10 @@ 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 +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. diff --git a/buildroot_patches/README.md b/buildroot_patches/README.md new file mode 100644 index 0000000..40bfdd4 --- /dev/null +++ b/buildroot_patches/README.md @@ -0,0 +1,5 @@ +# Buildroot patches + +Ideally, this directory should be empty, and we should use only built-in Buildroot configuration mechanisms. + +But alas, life is sometimes not ideal. diff --git a/buildroot_patches/qemu_sdl.patch b/buildroot_patches/qemu_sdl.patch new file mode 100644 index 0000000..67ebfcc --- /dev/null +++ b/buildroot_patches/qemu_sdl.patch @@ -0,0 +1,12 @@ +diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk +index 66efcba..1e09ea4 100644 +--- a/package/qemu/qemu.mk ++++ b/package/qemu/qemu.mk +@@ -74,6 +74,7 @@ HOST_QEMU_SYS_ARCH ?= $(HOST_QEMU_ARCH) + + ifeq ($(BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE),y) + HOST_QEMU_TARGETS += $(HOST_QEMU_SYS_ARCH)-softmmu ++HOST_QEMU_OPTS += --enable-sdl --with-sdlabi=2.0 + HOST_QEMU_OPTS += --enable-system --enable-fdt + HOST_QEMU_DEPENDENCIES += host-dtc + else diff --git a/run b/run index d477d4a..4662e96 100755 --- a/run +++ b/run @@ -19,10 +19,15 @@ case "$arch" in defconfig=qemu_arm_versatile_defconfig ;; esac +for p in ../buildroot_patches/*.patch; do + patch -N -p1 <"../buildroot_patches/${p}" || : +done make BR2_EXTERNAL="$(pwd)/../kernel_module" "$defconfig" -# Can't get rid of this for now. +# TODO 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 +# TODO there is no make host_qemu-rebuild ? +rm -f output/build/host-qemu-2.7.0/.stamp_built env -u LD_LIBRARY_PATH make BR2_JLEVEL="$(($(nproc) - 2))" kernel_module-rebuild all cd .. ./runqemu "$@" diff --git a/runqemu b/runqemu index 893ad56..eda92cf 100755 --- a/runqemu +++ b/runqemu @@ -42,9 +42,7 @@ case "$arch" in if $kgdb; then extra_append="$extra_append kgdboc=ttyS0,115200" fi - # 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="./buildroot/output/host/usr/bin/qemu-system-x86_64 \ -M pc \ -append 'root=/dev/vda $extra_append' \ -drive file=${images_dir}/rootfs.ext2,if=virtio,format=raw \