From 4953b3891ad32bae9cbe3843fb42017a156c1a6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Thu, 28 Mar 2019 21:13:26 +0000 Subject: [PATCH] scripts/qemustart: Allow specifying custom rootfs for malta MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently it's not possible to test boot squashfs root images, so this patch now allows this use case as well. Cc: Yousong Zhou Signed-off-by: Petr Å tetiar --- scripts/qemustart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/qemustart b/scripts/qemustart index 2012d43a8528..951f2252722e 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -205,6 +205,7 @@ start_qemu_malta() { local is64 local isel local qemu_exe + local rootfs="$o_rootfs" local kernel="$o_kernel" local mach="${o_mach:-malta}" @@ -215,6 +216,16 @@ start_qemu_malta() { [ -n "$kernel" ] || kernel="$o_bindir/openwrt-malta-${o_subtarget%-*}-vmlinux-initramfs.elf" + [ -z "$rootfs" ] || { + if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then + gunzip "$rootfs.gz" + fi + o_qemu_extra+=( \ + "-drive" "file=$rootfs,format=raw" \ + "-append" "root=/dev/sda rootwait" \ + ) + } + # NOTE: order of wan, lan -device arguments matters as it will affect which # one will be actually used as the wan, lan network interface inside the # guest machine -- 2.30.2