qemu: build variants

This commit is contained in:
Ciro Santilli
2018-08-05 13:26:04 +01:00
parent a0d1cfcf20
commit fe7fcf69b5
5 changed files with 31 additions and 12 deletions

View File

@@ -8445,6 +8445,19 @@ This technique is implemented semi-hackishly by moving symlinks around inside th
==== gem5 build variants ==== gem5 build variants
Analogous to the <<linux-kernel-build-variants>> 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 <<linux-kernel-build-variants>> but with the `-M` option instead: Analogous to the <<linux-kernel-build-variants>> but with the `-M` option instead:
.... ....

4
build
View File

@@ -209,7 +209,9 @@ symlink_buildroot_variant() (
) )
symlink_buildroot_variant "$common_linux_custom_dir" "$common_linux_variant_dir" 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_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. # Manage gem5 variants.
if "$gem5"; then if "$gem5"; then

View File

@@ -35,6 +35,7 @@
on top of it. on top of it.
|`-M` |`VARIANT` |gem5 build variant. |`-M` |`VARIANT` |gem5 build variant.
|`-p` | |Pass extra arguments to the `rootfs_post_build_script`. |`-p` | |Pass extra arguments to the `rootfs_post_build_script`.
|`-Q` |`VARIANT` |QEMU build variant.
|`-S` | |Don't build QEMU with SDL support. |`-S` | |Don't build QEMU with SDL support.
Graphics such as X11 won't work, only the terminal. Graphics such as X11 won't work, only the terminal.
|`-s` | |Add a custom suffix to the build. |`-s` | |Add a custom suffix to the build.

7
common
View File

@@ -112,6 +112,12 @@ set_common_vars() {
;; ;;
esac esac
common_linux_image="${common_linux_variant_dir}/${common_linux_image}" 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. # Ports.
common_run_id_number="$(echo "$common_run_id" | cut -d . -f 2)" 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_non_default_src_root_dir="${data_dir}/gem5"
common_gem5_worktree= common_gem5_worktree=
common_gem5_variant=default common_gem5_variant=default
common_prebuilt=false
common_run_id=0 common_run_id=0
f="${data_dir}/cli" f="${data_dir}/cli"
if [ -f "$f" ]; then if [ -f "$f" ]; then

18
run
View File

@@ -26,7 +26,6 @@ initrd=false
initramfs=false initramfs=false
memory=256M memory=256M
nographic=true nographic=true
prebuilt=false
root= root=
tmux=false tmux=false
tmux_args= tmux_args=
@@ -35,7 +34,7 @@ trace_enabled=false
# just to prevent QEMU from emitting a warning that '' is not valid. # just to prevent QEMU from emitting a warning that '' is not valid.
trace_type=pr_manager_run trace_type=pr_manager_run
vnc= 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 case "$OPT" in
a) a)
arch="$OPTARG" 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" common_run_id="$OPTARG"
;; ;;
P) P)
prebuilt=true common_prebuilt=true
;;
Q)
common_qemu_variant="$OPTARG"
;; ;;
T) T)
trace_enabled=true trace_enabled=true
@@ -256,16 +258,10 @@ else
extra_flags_qemu="$extra_flags_qemu -serial 'tcp::${common_gdb_port},server,nowait' \\ extra_flags_qemu="$extra_flags_qemu -serial 'tcp::${common_gdb_port},server,nowait' \\
" "
fi 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}" extra_flags="${extra_flags_qemu} ${extra_flags}"
qemu_common="\ qemu_common="\
${debug_vm} \ ${debug_vm} \
${qemu_executable} \\ ${common_qemu_executable} \\
-device rtl8139,netdev=net0 \\ -device rtl8139,netdev=net0 \\
-gdb 'tcp::${common_gdb_port}' \\ -gdb 'tcp::${common_gdb_port}' \\
-kernel '${common_linux_image}' \\ -kernel '${common_linux_image}' \\
@@ -297,7 +293,7 @@ ${vnc}"
if "$kgdb"; then if "$kgdb"; then
extra_append="${extra_append} kgdboc=ttyS0,115200" extra_append="${extra_append} kgdboc=ttyS0,115200"
fi fi
if "$prebuilt"; then if "$common_prebuilt"; then
custom_devices= custom_devices=
else else
custom_devices="-device lkmc_pci_min \\ custom_devices="-device lkmc_pci_min \\