Use buildroot qemu

This commit is contained in:
Ciro Santilli
2017-06-02 08:58:53 +01:00
parent 81468eece9
commit 84c0492af2
6 changed files with 29 additions and 12 deletions

View File

@@ -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).

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

7
run
View File

@@ -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 "$@"

View File

@@ -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 \