From fe7fcf69b50125de77a0e52ec7ea440bc8dc83ea Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sun, 5 Aug 2018 13:26:04 +0100 Subject: [PATCH] qemu: build variants --- README.adoc | 13 +++++++++++++ build | 4 +++- build-usage.adoc | 1 + common | 7 +++++++ run | 18 +++++++----------- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/README.adoc b/README.adoc index a60ca45..9a3b5fe 100644 --- a/README.adoc +++ b/README.adoc @@ -8445,6 +8445,19 @@ This technique is implemented semi-hackishly by moving symlinks around inside th ==== gem5 build variants +Analogous to the <> but with the `-Q` option instead: + +.... +./build +git -C qemu checkout v2.12.0 +./build -Q v4.16 +git -C qemu checkout - +./run +./run -Q v4.16 +.... + +==== gem5 build variants + Analogous to the <> but with the `-M` option instead: .... diff --git a/build b/build index b790ec0..679947f 100755 --- a/build +++ b/build @@ -209,7 +209,9 @@ symlink_buildroot_variant() ( ) symlink_buildroot_variant "$common_linux_custom_dir" "$common_linux_variant_dir" symlink_buildroot_variant "$common_qemu_custom_dir" "$common_qemu_variant_dir" -symlink_buildroot_variant "$common_qemu_guest_custom_dir" "$common_qemu_guest_variant_dir" +# TODO: this breaks the build. But then I noticed that it wouldn't make sense, +# because this is a guest tool, and we don't have image variants yet. Some other day maybe. +#symlink_buildroot_variant "$common_qemu_guest_custom_dir" "$common_qemu_guest_variant_dir" # Manage gem5 variants. if "$gem5"; then diff --git a/build-usage.adoc b/build-usage.adoc index 5d0c5c0..e62954d 100644 --- a/build-usage.adoc +++ b/build-usage.adoc @@ -35,6 +35,7 @@ on top of it. |`-M` |`VARIANT` |gem5 build variant. |`-p` | |Pass extra arguments to the `rootfs_post_build_script`. +|`-Q` |`VARIANT` |QEMU build variant. |`-S` | |Don't build QEMU with SDL support. Graphics such as X11 won't work, only the terminal. |`-s` | |Add a custom suffix to the build. diff --git a/common b/common index c5d79d1..b8679c6 100644 --- a/common +++ b/common @@ -112,6 +112,12 @@ set_common_vars() { ;; esac common_linux_image="${common_linux_variant_dir}/${common_linux_image}" + if "$common_prebuilt"; then + common_mkdir + common_qemu_executable="qemu-system-${arch}" + else + common_qemu_executable="${common_qemu_variant_dir}/${arch}-softmmu/qemu-system-${arch}" + fi # Ports. common_run_id_number="$(echo "$common_run_id" | cut -d . -f 2)" @@ -150,6 +156,7 @@ common_gem5_default_src_dir="${root_dir}/gem5/gem5" common_gem5_non_default_src_root_dir="${data_dir}/gem5" common_gem5_worktree= common_gem5_variant=default +common_prebuilt=false common_run_id=0 f="${data_dir}/cli" if [ -f "$f" ]; then diff --git a/run b/run index 88a782e..b650571 100755 --- a/run +++ b/run @@ -26,7 +26,6 @@ initrd=false initramfs=false memory=256M nographic=true -prebuilt=false root= tmux=false tmux_args= @@ -35,7 +34,7 @@ trace_enabled=false # just to prevent QEMU from emitting a warning that '' is not valid. trace_type=pr_manager_run vnc= -while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:N:n:PT:t:U:uVX:x OPT; do +while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:N:n:PQ:T:t:U:uVX:x OPT; do case "$OPT" in a) arch="$OPTARG" @@ -106,7 +105,10 @@ while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:N:n:PT:t:U:uVX:x OPT; do common_run_id="$OPTARG" ;; P) - prebuilt=true + common_prebuilt=true + ;; + Q) + common_qemu_variant="$OPTARG" ;; T) trace_enabled=true @@ -256,16 +258,10 @@ else extra_flags_qemu="$extra_flags_qemu -serial 'tcp::${common_gdb_port},server,nowait' \\ " fi - if "$prebuilt"; then - common_mkdir - qemu_executable="qemu-system-${arch}" - else - qemu_executable="${buildroot_out_dir}/host/usr/bin/qemu-system-${arch}" - fi extra_flags="${extra_flags_qemu} ${extra_flags}" qemu_common="\ ${debug_vm} \ -${qemu_executable} \\ +${common_qemu_executable} \\ -device rtl8139,netdev=net0 \\ -gdb 'tcp::${common_gdb_port}' \\ -kernel '${common_linux_image}' \\ @@ -297,7 +293,7 @@ ${vnc}" if "$kgdb"; then extra_append="${extra_append} kgdboc=ttyS0,115200" fi - if "$prebuilt"; then + if "$common_prebuilt"; then custom_devices= else custom_devices="-device lkmc_pci_min \\