From nobody Wed May  7 20:54:43 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1584032228; cv=none;
	d=zohomail.com; s=zohoarc;
	b=QpjLAd02B7sp9Q2FWTxmVt1eH/1z3G4iKVXDyNc/sBwEPHJ9cKQIQt1joKBA+BS9w15q+NVwcdy0oOrcgUxu5csphI6bWh9jBLQLrhtXtzfiTsF8Qjtz7RpZohuiTWB2ETPadCFo/O2Xr2EAnzm7ips1LTqhU8Yj63GMbIVZbJ0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1584032228;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=5ksM30KOiL6B3w3Ibj4iZDBxW/8zMypNGRBzovgg05s=;
	b=ZeeSk0uWPg89baDwlBTqrXuSv9sNX2oZmbMLpeHI//1UVBILQocZQcW9i/JMUVuomWByFwIQojNk/femgKtWvZC4SEDTkKFVPP9H+/ZPtyhm7HrPO81CrwuX5EV2ZV1ElvW85rl/ZGRfEWmhUQiKEQPYvLAuN5ZH3rjBicsHXpU=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1584032228974394.2570927350266;
 Thu, 12 Mar 2020 09:57:08 -0700 (PDT)
Received: from localhost ([::1]:45802 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1jCR8t-0004gr-S5
	for importer@patchew.org; Thu, 12 Mar 2020 12:57:07 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35824)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1jCQxk-0000Zo-L4
 for qemu-devel@nongnu.org; Thu, 12 Mar 2020 12:45:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1jCQxi-0005EZ-8L
 for qemu-devel@nongnu.org; Thu, 12 Mar 2020 12:45:36 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:50646)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1jCQxi-0005EG-1E
 for qemu-devel@nongnu.org; Thu, 12 Mar 2020 12:45:34 -0400
Received: by mail-wm1-x32f.google.com with SMTP id a5so6858841wmb.0
 for <qemu-devel@nongnu.org>; Thu, 12 Mar 2020 09:45:33 -0700 (PDT)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id j15sm36838640wrp.85.2020.03.12.09.45.31
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 12 Mar 2020 09:45:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=5ksM30KOiL6B3w3Ibj4iZDBxW/8zMypNGRBzovgg05s=;
 b=Ov6634ztuE2HeMgity+Y8he/WfF15dg/1vlBDz8KRtg2yLFiA9ZrnwY0O+zIqFAQgJ
 xKj/sXzfkoVWUfC3MbVA0bHKH/Kk8EvpEvXpAlzICY/Dpa/8OVcBbSHipEGHdoe2KAsq
 RaO/zFWGn6P5QTmXpuhtuotyd2F4Ls2FipaxrsxjPotaMwy4QUAf/1wfVHQiEKPmkaNa
 lLuM3qv0LdUPuFtG4UtdLszJdL6Nj/2qfvMWFr7IN2l7LY3wj5MM4zkNciG60LQ0Znj7
 +tgzbs8FIGW9EUTnr2Chqg/qreYdAPYsAbBBGNJNETv761A3wPjI0FF756T7Ql9TuFE2
 fNRg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=5ksM30KOiL6B3w3Ibj4iZDBxW/8zMypNGRBzovgg05s=;
 b=YJ07J4QjlavGOjp51bW86JvH5adW/HdUj1xlMMlj88+3ZHxvAP61iOKBUO44kgUXmN
 zaWaSMcVF1yubm7KT++3uDBSMuKDOnUvHtS4bo4dWlYqcf1XRuICqr90sXGsLKEcxawO
 ur8p+D6jXu9WOwBe9UscE56GEobfpI0BzQJ6efVfmciXCFTZIvH0jezBpxKt0PKRFhSS
 p5aXjWh+CaEKDNbVswG4gIcQl++93wRM3/zLkMHzglwjoKLjnG3tLL7tRvowk9s7I2ou
 GOxrOD/cCAqYeaUjYwwX/xp7KriDQ9XnQmJKb4t/9myoN4ZOp2idmfqAGOIn62o2sVA6
 vGjQ==
X-Gm-Message-State: ANhLgQ03nNZ0cJeWCgipVvoFxuTDw7z1Y4LYUJcTxeyq2RDsBgB2LbxM
 +6m48hdIJmlSnhXrxMrGjs8Pd7IoUdcHgQ==
X-Google-Smtp-Source: 
 ADFU+vt1WcUw+WnCd+g2dcHfnrPUd1uGV0a3EqSQAA08nX98u83DFjU+d6OsGbrF+sVPNQpjSG8mYw==
X-Received: by 2002:a1c:6885:: with SMTP id d127mr5700263wmc.33.1584031532616;
 Thu, 12 Mar 2020 09:45:32 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 25/36] tests/boot_linux_console: Add initrd test for the Orange
 Pi PC board
Date: Thu, 12 Mar 2020 16:44:48 +0000
Message-Id: <20200312164459.25924-26-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200312164459.25924-1-peter.maydell@linaro.org>
References: <20200312164459.25924-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::32f
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

From: Philippe Mathieu-Daud=C3=A9 <f4bug@amsat.org>

This test boots a Linux kernel on a OrangePi PC board and verify
the serial output is working.

The kernel image and DeviceTree blob are built by the Armbian
project (based on Debian):
https://www.armbian.com/orange-pi-pc/

The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test

If ARM is a target being built, "make check-acceptance" will
automatically include this test by the use of the "arch:arm" tags.

Alternatively, this test can be run using:

  $ avocado --show=3Dconsole run -t machine:orangepi-pc tests/acceptance/bo=
ot_linux_console.py
  console: Uncompressing Linux... done, booting the kernel.
  console: Booting Linux on physical CPU 0x0
  console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1=
 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
  console: CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=3D50c5387d
  console: CPU: div instructions available: patching division code
  console: CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instructi=
on cache
  console: OF: fdt: Machine model: Xunlong Orange Pi PC
  [...]
  console: Trying to unpack rootfs image as initramfs...
  console: Freeing initrd memory: 3256K
  console: Freeing unused kernel memory: 1024K
  console: Run /init as init process
  console: mount: mounting devtmpfs on /dev failed: Device or resource busy
  console: Starting logging: OK
  console: Initializing random number generator... random: dd: uninitialize=
d urandom read (512 bytes read)
  console: done.
  console: Starting network: OK
  console: Found console ttyS0
  console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1=
 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
  console: Boot successful.
  console: cat /proc/cpuinfo
  console: / # cat /proc/cpuinfo
  console: processor      : 0
  console: model name     : ARMv7 Processor rev 5 (v7l)
  console: BogoMIPS       : 125.00
  console: Features       : half thumb fastmult vfp edsp neon vfpv3 tls vfp=
v4 idiva idivt vfpd32 lpae evtstrm
  console: CPU implementer        : 0x41
  console: CPU architecture: 7
  console: CPU variant    : 0x0
  console: CPU part       : 0xc07
  console: CPU revision   : 5
  [...]
  console: processor      : 3
  console: model name     : ARMv7 Processor rev 5 (v7l)
  console: BogoMIPS       : 125.00
  console: Features       : half thumb fastmult vfp edsp neon vfpv3 tls vfp=
v4 idiva idivt vfpd32 lpae evtstrm
  console: CPU implementer        : 0x41
  console: CPU architecture: 7
  console: CPU variant    : 0x0
  console: CPU part       : 0xc07
  console: CPU revision   : 5
  console: Hardware       : Allwinner sun8i Family
  console: Revision       : 0000
  console: Serial         : 0000000000000000
  console: cat /proc/iomem
  console: / # cat /proc/iomem
  console: 01000000-010fffff : clock@1000000
  console: 01c00000-01c00fff : system-control@1c00000
  console: 01c02000-01c02fff : dma-controller@1c02000
  [...]
  console: reboot
  console: / # reboot
  console: / # Found console ttyS0
  console: Stopping network: OK
  console: hrtimer: interrupt took 21852064 ns
  console: Saving random seed... random: dd: uninitialized urandom read (51=
2 bytes read)
  console: done.
  console: Stopping logging: OK
  console: umount: devtmpfs busy - remounted read-only
  console: umount: can't unmount /: Invalid argument
  console: The system is going down NOW!
  console: Sent SIGTERM to all processes
  console: Sent SIGKILL to all processes
  console: Requesting system reboot
  console: reboot: Restarting system
  PASS (48.32 s)
  JOB TIME   : 49.16 s

Signed-off-by: Philippe Mathieu-Daud=C3=A9 <philmd@redhat.com>
Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Reviewed-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Tested-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Message-id: 20200311221854.30370-15-nieklinnenbank@gmail.com
[NL: rename in commit message Raspbian to Armbian, remove vm.set_machine()]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot=
_linux_console.py
index 6f5af582f3b..dabc8ef2afb 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -532,6 +532,46 @@ class BootLinuxConsole(Test):
         console_pattern =3D 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
=20
+    def test_arm_orangepi_initrd(self):
+        """
+        :avocado: tags=3Darch:arm
+        :avocado: tags=3Dmachine:orangepi-pc
+        """
+        deb_url =3D ('https://apt.armbian.com/pool/main/l/'
+                   'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.de=
b')
+        deb_hash =3D '1334c29c44d984ffa05ed10de8c3361f33d78315'
+        deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash)
+        kernel_path =3D self.extract_from_deb(deb_path,
+                                            '/boot/vmlinuz-4.20.7-sunxi')
+        dtb_path =3D '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.=
dtb'
+        dtb_path =3D self.extract_from_deb(deb_path, dtb_path)
+        initrd_url =3D ('https://github.com/groeck/linux-build-test/raw/'
+                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
+                      'arm/rootfs-armv7a.cpio.gz')
+        initrd_hash =3D '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
+        initrd_path_gz =3D self.fetch_asset(initrd_url, asset_hash=3Dinitr=
d_hash)
+        initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio')
+        archive.gzip_uncompress(initrd_path_gz, initrd_path)
+
+        self.vm.set_console()
+        kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE +
+                               'console=3DttyS0,115200 '
+                               'panic=3D-1 noreboot')
+        self.vm.add_args('-kernel', kernel_path,
+                         '-dtb', dtb_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        self.wait_for_console_pattern('Boot successful.')
+
+        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
+                                                'Allwinner sun8i Family')
+        exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
+                                                'system-control@1c00000')
+        exec_command_and_wait_for_pattern(self, 'reboot',
+                                                'reboot: Restarting system=
')
+
     def test_s390x_s390_ccw_virtio(self):
         """
         :avocado: tags=3Darch:s390x
--=20
2.20.1