From patchwork Thu Mar 28 23:00:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1068806 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=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ElDSVc1D"; 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 44VgMs3qGXz9sQp for ; Fri, 29 Mar 2019 10:01:13 +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:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6RPMF7a+BifA6ELnB4CH9vdw7L1iM3InnXheuZxXwOA=; b=ElDSVc1DMlPVv7 vsqMpy4nyg7MDt/SjbgAL1kxobIwEmid+V0caxqSdzFBo1WqkbkIE1ennWS2snCvMuITkJWNgbkcF 4PAx6DXLJVM0GIyI27SXj4e2beflmEm2JnYx3n7R7rTa4BILdw29KZeUw15nDbtK2jU8uWS0e9/Lq HF7CLv0pZ0nt8EQeCsqNVmT/9Py9Dl2fSSy4EmMg3+pnwloja7Ybfo2U8EpVTz0lQBpz9K0Gv7Hoa qgzP+98Jnc3DY0R6hvWrTNpRE5U0/ko4CPP/a6+Fh4q+Q5eWgqFi14j3C/T2E9LyzcS80GQMKdjTr SBDxdHtXZoi5QoUPP6eg==; 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 1h9e13-00064T-Vu; Thu, 28 Mar 2019 23:00:58 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9e0Z-0005Fl-45 for openwrt-devel@lists.openwrt.org; Thu, 28 Mar 2019 23:00:30 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 22B5F441F; Fri, 29 Mar 2019 00:00:24 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 6778f9f8; Fri, 29 Mar 2019 00:00:22 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Fri, 29 Mar 2019 00:00:01 +0100 Message-Id: <1553814003-11339-2-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1553814003-11339-1-git-send-email-ynezz@true.cz> References: <1553814003-11339-1-git-send-email-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190328_160027_498795_6CED2CC8 X-CRM114-Status: GOOD ( 10.31 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] Subject: [OpenWrt-Devel] [PATCH 1/3] scripts/qemustart: Allow usage without networking 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 , =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org For basic tests it's not necessary to have the networking setup and this allows testing as a normal user as well, without root privileges. So this patch adds `--no-network` long option or `-n` short option, which allows starting QEMU without network. Cc: Yousong Zhou Signed-off-by: Petr Štetiar --- scripts/qemustart | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/scripts/qemustart b/scripts/qemustart index b68e8bb..3b47986 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -74,6 +74,7 @@ check_setup_() { } check_setup() { + [ -z $o_nonetwork ] || return 0 check_setup_ || { __errmsg "please check the script content to see the environment requirement" return 1 @@ -122,6 +123,7 @@ parse_args() { o_qemu_extra=() while [ "$#" -gt 0 ]; do case "$1" in + --no-network|-n) o_nonetwork=1; shift ;; --kernel) o_kernel="$2"; shift 2 ;; --rootfs) o_rootfs="$2"; shift 2 ;; --machine|-machine|-M) o_mach="$2"; shift 2 ;; @@ -185,9 +187,16 @@ start_qemu_armvirt() { ) } + [ -n $o_nonetwork ] || { + o_qemu_extra+=( \ + "-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" \ + ) + } + "$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" \ "${o_qemu_extra[@]}" } @@ -209,9 +218,16 @@ 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 + [ -n $o_nonetwork ] || { + o_qemu_extra+=( \ + "-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" "-device" \ + "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \ + "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \ + "-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \ + ) + } + "$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" \ "${o_qemu_extra[@]}" } @@ -241,6 +257,15 @@ start_qemu_x86() { ;; esac + [ -n $o_nonetwork ] || { + o_qemu_extra+=( \ + "-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" \ + ) + } + case "${o_subtarget%-*}" in legacy) # use IDE (PATA) disk instead of AHCI (SATA). Refer to link @@ -254,16 +279,12 @@ start_qemu_x86() { # # [1] https://dev.openwrt.org/ticket/17947 "$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 \ -drive "file=$rootfs,format=raw,id=drv0,if=none" \ "${o_qemu_extra[@]}" ;; generic|64) "$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" \ "${o_qemu_extra[@]}" ;; @@ -282,6 +303,6 @@ start_qemu() { esac } -check_setup \ - && parse_args "$@" \ +parse_args "$@" \ + && check_setup \ && start_qemu From patchwork Thu Mar 28 23:00:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1068804 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=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DMB7fXbj"; 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 44VgMc1XKjz9sPq for ; Fri, 29 Mar 2019 10:01:00 +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:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SL3i2/yRsyq69piazrQyZsp4OiD2STp/yQxnVleJgGs=; b=DMB7fXbjZDcFEc l7OflQYWZrnpt9NBl3VTM8tdg692735s63t9JzDiFJV+e+PtQ/9XHznE+rQRlnNTFJlpYd8/eBDxL IkEeHTPsG+fzCTxwiUvdmEU9P3sGSGfmlhBBDL9+N/qDXGmQt7FZy5lg0KI+o8VY2u/q9VzzCOZ6v K0b44QAkSYwLk6TgX6x4OpGm8nFJIzLOApVs+MHw9CA7nM0NWfTvsLlVQ9Ondm+YAYDdF7u0EWkba RUEWzWXZMY2Mfg3xvZXF89cgSz3RO1exchKY63gJgOJhsnTWw9hxyZt406u6CNqmTmmMThxxMpm1o 8Pn6tPTH3p7ZssVdpxRQ==; 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 1h9e0j-0005XK-BD; Thu, 28 Mar 2019 23:00:37 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9e0Z-0005Fn-45 for openwrt-devel@lists.openwrt.org; Thu, 28 Mar 2019 23:00:29 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 6E5164421; Fri, 29 Mar 2019 00:00:25 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 78ef1224; Fri, 29 Mar 2019 00:00:24 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Fri, 29 Mar 2019 00:00:02 +0100 Message-Id: <1553814003-11339-3-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1553814003-11339-1-git-send-email-ynezz@true.cz> References: <1553814003-11339-1-git-send-email-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190328_160027_319897_D1FB47B0 X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] Subject: [OpenWrt-Devel] [PATCH 2/3] scripts/qemustart: Allow specifying custom kernel for x86 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 , =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/qemustart b/scripts/qemustart index 3b47986..2012d43 100755 --- a/scripts/qemustart +++ b/scripts/qemustart @@ -233,9 +233,10 @@ start_qemu_malta() { } start_qemu_x86() { + local qemu_exe + local kernel="$o_kernel" local rootfs="$o_rootfs" local mach="${o_mach:-pc}" - local qemu_exe [ -n "$rootfs" ] || { rootfs="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-combined-ext4.img" @@ -257,6 +258,13 @@ start_qemu_x86() { ;; esac + [ -n "$kernel" ] && { + o_qemu_extra+=( \ + "-kernel" "$kernel" \ + "-append" "root=/dev/vda console=ttyS0 rootwait" \ + ) + } + [ -n $o_nonetwork ] || { o_qemu_extra+=( \ "-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \ From patchwork Thu Mar 28 23:00:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1068805 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=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Z6Ym7yaF"; 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 44VgMd051fz9sPq for ; Fri, 29 Mar 2019 10:01:01 +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:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kw8U+8vpnHXreMtrxvsMgJ+2JH5qxNXBc7DfwGeN9xo=; b=Z6Ym7yaFSUApfe KuurBtoVv7MYMCFKU2CQoq+tNpQzpJaYMdVtD1TfnMdjjFvtuUoXn0ehqpndD2elnzXIbLqiY+W3L R3zQU+hUoKjegWS9K9KhR5o+aSCiLxwiYh3uAWjXo9M1dxBEaAsauYcBWyUxEAJsdT+goUSAZwlQW QaHmAKoyXkHk5CiCBxq35QWeEJKbiP8JG36iccA/MPbJJgfjMjxc2zIsLT27R8h9wqTzU6h6Il7PS uW6Q+1fYLZ90f6FAmLvKRCZ+RMztc87kqjRAimZyaaHnJhSAo2RpQHHeA7tWI5SOHoPdb2L+oZeqH 84SQTPoi/2KZG7YtSVSg==; 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 1h9e0t-0005oT-Oi; Thu, 28 Mar 2019 23:00:47 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9e0a-0005GQ-VT for openwrt-devel@lists.openwrt.org; Thu, 28 Mar 2019 23:00:30 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id A1D354425; Fri, 29 Mar 2019 00:00:27 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id dbb0d8e5; Fri, 29 Mar 2019 00:00:25 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Fri, 29 Mar 2019 00:00:03 +0100 Message-Id: <1553814003-11339-4-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1553814003-11339-1-git-send-email-ynezz@true.cz> References: <1553814003-11339-1-git-send-email-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190328_160029_233892_8B36E076 X-CRM114-Status: UNSURE ( 8.84 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] Subject: [OpenWrt-Devel] [PATCH 3/3] scripts/qemustart: Allow specifying custom rootfs for malta 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 , =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 2012d43..951f225 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