From patchwork Tue Feb 19 15:30:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1044731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e1ky1sVX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="J1O3lgAF"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 443l856rkfz9sD4 for ; Wed, 20 Feb 2019 02:31:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=vnRXM2BgpJ1wEDgPXEKm3Vd0Q6XjvkrA7npxGVRMxTk=; b=e1ky1sVXcHZMbl ddBdJakyzpjQl6xNYQTVtShkj9D/VUOQRPYoUFa+9JUHRbHvaWtrLSPQTev9dkdY5IenF2TT6HUvp P+ZOQwo6/6yOVTmx2jAr0ee/4SSj2T57LO4RepN7G5iUR+2xer+jZ5RAdyJwwgexyr1tqKNy8D/ac 6OHh4EHZ6i8z9jpjc+BlIFkWKiFeCHKR1aW+toEmCFDJQd87QT0ARB6ulwy8TSm603cOPfOXPFlPE mpy1JyLtKSnK7NPR9Ntj8v9+FeWQ0xNl/HharsSdcc2FNEXWTJWhuoUTQlbvprYdmq/GrWsG48TEO qwJGDuQyQdH3Z98Fa2pg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gw7Me-00072J-KU; Tue, 19 Feb 2019 15:31:20 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gw7Ma-000720-So for openwrt-devel@lists.openwrt.org; Tue, 19 Feb 2019 15:31:18 +0000 Received: by mail-pl1-x642.google.com with SMTP id e5so10605212plb.5 for ; Tue, 19 Feb 2019 07:31:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KpzDY6+FBDsV08OWYxlArMrIOZa8iK0cF8lxloEY2NM=; b=J1O3lgAFDNxWxMDCvl/9lStQbPaeqgHA+GlNfMbgQdy/oASnfTZRDBPxQDvrV4b5/2 LtbIM24kN4FH0YZcSkMjppoOwjcjB7q/+ZSb1FmD+FmgPOlATVTP7UUfhcuXOQct4Dhw VfWXXZ/EasHr0A7sWZhUlr/z/B/W86jbCglrFSLt37rdZKDvauWXhNesBLfX61E+2RqU tiB2/V982R8nteKK9EUnivZwtHTHb8sOkdrUSrn7e2K3aAK50sIeVmO6uwJr/q/WCMc6 TdLt2P5WXf/I6SwcyadKe6NjDEe12PWqqfcoJZ17vW3DgofF/pwuPY37T/V0LKrgFPQE n2eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KpzDY6+FBDsV08OWYxlArMrIOZa8iK0cF8lxloEY2NM=; b=ZEMG61X6rrW1fIGxy7jnCsOWROuxWtxnPBsTGIWiGI1DCTL+5u5/eP8G07BP3gw73K nzO6RKO0osVJJAqxYzMYnqRM8EJxFMgvqA9hdQdvsh9yb2QbVhbM8v+292FJBC3YOPSY 6+78cwEuTXrTITZegaE5W1JAtYcIrm2RTxZtOXubhGfx1eio71QlDR0/RSnSwdrSbV9q hNB9dCz54DK/GVoTzAGziooDjSsknW0jtpVbcjwMpSiVokkqa7YkQ9bUfM/ulp7/QYl0 0oCaDZUGFLozAh97c2Kr4lbT3HVYxaHyjsEy0YZf93Gmag021fTZFaIGhEULQn6Wg/JB 8H6A== X-Gm-Message-State: AHQUAuZbCcnFnV2y6FYlNxDQBlbENG0yMl7qP6e8rJ92PcmFqR/tz1UM 6CIdthdnyNFpeP34wwPC6vCc0GmleRw= X-Google-Smtp-Source: AHgI3IYYng50UbTuNAQ/humJhZqpkEL80zhz23izDxzMKBsDeCF3K3eEytD7hUIko7W5c5h309uxwA== X-Received: by 2002:a17:902:290b:: with SMTP id g11mr2900904plb.269.1550590275079; Tue, 19 Feb 2019 07:31:15 -0800 (PST) Received: from titan.localdomain.hq.cloud.yunionyun.com ([47.52.22.109]) by smtp.gmail.com with ESMTPSA id z12sm17418917pgv.0.2019.02.19.07.31.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 07:31:13 -0800 (PST) From: Yousong Zhou To: openwrt-devel@lists.openwrt.org Date: Tue, 19 Feb 2019 15:30:56 +0000 Message-Id: <20190219153056.1054-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190219_073116_959904_F00AD0C8 X-CRM114-Status: UNSURE ( 9.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yszhou4tech[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain Subject: [OpenWrt-Devel] [PATCH] scripts/qemustart: add option --mach X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Value of the new option will be passed to qemu --machine verbatim. This can be used to set machine options like highmem=off for running old armvirt/32 kernel lacking LPAE support on QEMU version 3.0 or later Signed-off-by: Yousong Zhou --- scripts/qemustart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/qemustart b/scripts/qemustart index 5bb8ca5f3a..5efb1744a6 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -88,6 +88,7 @@ Usage: $SELF [-h|--help] [ []] [--kernel ] [--rootfs ] + [--mach ] will default to "generic" and must be specified if are present @@ -100,13 +101,14 @@ the actual in use. They will default to files under bin/targets/ Examples $SELF x86 64 - $SELF x86 64 -enable-kvm -device virtio-balloon-pci + $SELF x86 64 --mach q35,accel=kvm -device virtio-balloon-pci $SELF x86 64 -incoming tcp:0:4444 $SELF x86 64-glibc $SELF malta be -m 64 $SELF malta le64 $SELF malta be-glibc $SELF armvirt 32 \\ + --mach virt,highmem=off \\ --kernel bin/targets/armvirt/32/openwrt-armvirt-32-zImage \\ --rootfs bin/targets/armvirt/32/openwrt-armvirt-32-root.ext4 EOF @@ -122,6 +124,7 @@ parse_args() { case "$1" in --kernel) o_kernel="$2"; shift 2 ;; --rootfs) o_rootfs="$2"; shift 2 ;; + --mach) o_mach="$2"; shift 2 ;; --help|-h) usage exit 0 @@ -152,6 +155,7 @@ parse_args() { start_qemu_armvirt() { local kernel="$o_kernel" local rootfs="$o_rootfs" + local mach="${o_mach:-virt}" local cpu local qemu_exe @@ -181,7 +185,7 @@ start_qemu_armvirt() { ) } - "$qemu_exe" -machine virt -cpu "$cpu" -nographic \ + "$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \ -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \ -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \ -kernel "$kernel" \ @@ -193,6 +197,7 @@ start_qemu_malta() { local isel local qemu_exe local kernel="$o_kernel" + local mach="${o_mach:-malta}" # o_subtarget can be le, be, le64, be64, le-glibc, le64-glibc, etc.. is64="$(echo $o_subtarget | grep -o 64)" @@ -204,7 +209,7 @@ start_qemu_malta() { # 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 - "$qemu_exe" -machine malta -nographic \ + "$qemu_exe" -machine "$mach" -nographic \ -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" \ -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" \ -kernel "$kernel" \ @@ -213,6 +218,7 @@ start_qemu_malta() { start_qemu_x86() { local rootfs="$o_rootfs" + local mach="${o_mach:-pc}" local qemu_exe [ -n "$rootfs" ] || { @@ -227,7 +233,7 @@ start_qemu_x86() { # 64: 64-bit, kvm guest, virtio # case "${o_subtarget%-*}" in - legacy) qemu_exe="qemu-system-i386" ;; + legacy) qemu_exe="qemu-system-i386" ;; generic|64) qemu_exe="qemu-system-x86_64" ;; *) __errmsg "target $o_target: unknown subtarget $o_subtarget" @@ -247,7 +253,7 @@ start_qemu_x86() { # -drive "file=$rootfs,format=raw,id=drv0,if=none" \ # # [1] https://dev.openwrt.org/ticket/17947 - "$qemu_exe" -nographic \ + "$qemu_exe" --machine "$mach" -nographic \ -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device e1000,id=devlan,netdev=lan,mac="$MAC_LAN" \ -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device e1000,id=devwan,netdev=wan,mac="$MAC_WAN" \ -device ide-drive,drive=drv0 \ @@ -255,7 +261,7 @@ start_qemu_x86() { "${o_qemu_extra[@]}" ;; generic|64) - "$qemu_exe" -nographic \ + "$qemu_exe" --machine "$mach" -nographic \ -netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \ -netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \ -drive "file=$rootfs,format=raw,if=virtio" \