* [PATCH v2 11/11] docs: system: arm: Introduce bananapi_m2u
@ 2023-03-28 5:48 qianfanguijin
2023-03-28 5:48 ` [PATCH v2 11/12] tests: avocado: boot_linux_console: Add test case for bpim2u qianfanguijin
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: qianfanguijin @ 2023-03-28 5:48 UTC (permalink / raw)
To: qemu-arm, qemu-devel
Cc: Strahinja Jankovic, Peter Maydell, Beniamino Galvani,
Philippe Mathieu-Daudé, Niek Linnenbank, qianfan Zhao
From: qianfan Zhao <qianfanguijin@163.com>
Add documents for Banana Pi M2U
Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
docs/system/arm/bananapi_m2u.rst | 138 +++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
create mode 100644 docs/system/arm/bananapi_m2u.rst
diff --git a/docs/system/arm/bananapi_m2u.rst b/docs/system/arm/bananapi_m2u.rst
new file mode 100644
index 0000000000..ae7194a9df
--- /dev/null
+++ b/docs/system/arm/bananapi_m2u.rst
@@ -0,0 +1,138 @@
+Banana Pi BPI-M2U (``bpim2u``)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Banana Pi BPI-M2 Ultra is a quad-core mini single board computer built with
+Allwinner A40i/R40/V40 SoC. It features 2GB of RAM and 8GB eMMC. It also
+has onboard WiFi and BT. On the ports side, the BPI-M2 Ultra has 2 USB A
+2.0 ports, 1 USB OTG port, 1 HDMI port, 1 audio jack, a DC power port,
+and last but not least, a SATA port.
+
+Supported devices
+"""""""""""""""""
+
+The Banana Pi M2U machine supports the following devices:
+
+ * SMP (Quad Core Cortex-A7)
+ * Generic Interrupt Controller configuration
+ * SRAM mappings
+ * SDRAM controller
+ * Timer device (re-used from Allwinner A10)
+ * UART
+ * SD/MMC storage controller
+ * EMAC ethernet
+ * GMAC ethernet
+ * Clock Control Unit
+ * TWI (I2C)
+
+Limitations
+"""""""""""
+
+Currently, Banana Pi M2U does *not* support the following features:
+
+- Graphical output via HDMI, GPU and/or the Display Engine
+- Audio output
+- Hardware Watchdog
+- Real Time Clock
+- USB 2.0 interfaces
+
+Also see the 'unimplemented' array in the Allwinner R40 SoC module
+for a complete list of unimplemented I/O devices: ``./hw/arm/allwinner-r40.c``
+
+Boot options
+""""""""""""
+
+The Banana Pi M2U machine can start using the standard -kernel functionality
+for loading a Linux kernel or ELF executable. Additionally, the Banana Pi M2U
+machine can also emulate the BootROM which is present on an actual Allwinner R40
+based SoC, which loads the bootloader from a SD card, specified via the -sd
+argument to qemu-system-arm.
+
+Running mainline Linux
+""""""""""""""""""""""
+
+To build a Linux mainline kernel that can be booted by the Banana Pi M2U machine,
+simply configure the kernel using the sunxi_defconfig configuration:
+
+.. code-block:: bash
+
+ $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make mrproper
+ $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make sunxi_defconfig
+
+To boot the newly build linux kernel in QEMU with the Banana Pi M2U machine, use:
+
+.. code-block:: bash
+
+ $ qemu-system-arm -M bpim2u -nographic \
+ -kernel /path/to/linux/arch/arm/boot/zImage \
+ -append 'console=ttyS0,115200' \
+ -dtb /path/to/linux/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dtb
+
+Banana Pi M2U images
+""""""""""""""""""""
+
+Note that the mainline kernel does not have a root filesystem. You can choose
+to build you own image with buildroot using the bananapi_m2_ultra_defconfig.
+Also see https://buildroot.org for more information.
+
+Another possibility is to run an OpenWrt image for Banana Pi M2U which
+can be downloaded from:
+
+ https://downloads.openwrt.org/releases/22.03.3/targets/sunxi/cortexa7/
+
+When using an image as an SD card, it must be resized to a power of two. This can be
+done with the ``qemu-img`` command. It is recommended to only increase the image size
+instead of shrinking it to a power of two, to avoid loss of data. For example,
+to prepare a downloaded Armbian image, first extract it and then increase
+its size to one gigabyte as follows:
+
+.. code-block:: bash
+
+ $ qemu-img resize \
+ openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img \
+ 1G
+
+Instead of providing a custom Linux kernel via the -kernel command you may also
+choose to let the Banana Pi M2U machine load the bootloader from SD card, just like
+a real board would do using the BootROM. Simply pass the selected image via the -sd
+argument and remove the -kernel, -append, -dbt and -initrd arguments:
+
+.. code-block:: bash
+
+ $ qemu-system-arm -M bpim2u -nic user -nographic \
+ -sd openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img
+
+Running U-Boot
+""""""""""""""
+
+U-Boot mainline can be build and configured using the Bananapi_M2_Ultra_defconfig
+using similar commands as describe above for Linux. Note that it is recommended
+for development/testing to select the following configuration setting in U-Boot:
+
+ Device Tree Control > Provider for DTB for DT Control > Embedded DTB
+
+The BootROM of allwinner R40 loading u-boot from the 8KiB offset of sdcard.
+Let's create an bootable disk image:
+
+.. code-block:: bash
+
+ $ dd if=/dev/zero of=sd.img bs=32M count=1
+ $ dd if=u-boot-sunxi-with-spl.bin of=sd.img bs=1k seek=8 conv=notrunc
+
+And then boot it.
+
+.. code-block:: bash
+ $ qemu-system-arm -M bpim2u -nographic -sd sd.img
+
+Banana Pi M2U integration tests
+""""""""""""""""""""""""""""""
+
+The Banana Pi M2U machine has several integration tests included.
+To run the whole set of tests, build QEMU from source and simply
+provide the following command:
+
+.. code-block:: bash
+
+ $ cd qemu-build-dir
+ $ AVOCADO_ALLOW_LARGE_STORAGE=yes tests/venv/bin/avocado \
+ --verbose --show=app,console run -t machine:bpim2u \
+ ../tests/avocado/boot_linux_console.py
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 11/12] tests: avocado: boot_linux_console: Add test case for bpim2u
2023-03-28 5:48 [PATCH v2 11/11] docs: system: arm: Introduce bananapi_m2u qianfanguijin
@ 2023-03-28 5:48 ` qianfanguijin
2023-04-06 20:21 ` Niek Linnenbank
2023-03-28 5:48 ` [PATCH v2 12/12] docs: system: arm: Introduce bananapi_m2u qianfanguijin
2023-04-06 19:26 ` [PATCH v2 11/11] " Niek Linnenbank
2 siblings, 1 reply; 5+ messages in thread
From: qianfanguijin @ 2023-03-28 5:48 UTC (permalink / raw)
To: qemu-arm, qemu-devel
Cc: Strahinja Jankovic, Peter Maydell, Beniamino Galvani,
Philippe Mathieu-Daudé, Niek Linnenbank, qianfan Zhao
From: qianfan Zhao <qianfanguijin@163.com>
Add test case for booting from initrd and sd card.
Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
tests/avocado/boot_linux_console.py | 176 ++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
index 574609bf43..d17417828c 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -760,6 +760,182 @@ def test_arm_quanta_gsj_initrd(self):
self.wait_for_console_pattern(
'Give root password for system maintenance')
+ def test_arm_bpim2u(self):
+ """
+ :avocado: tags=arch:arm
+ :avocado: tags=machine:bpim2u
+ :avocado: tags=accel:tcg
+ """
+ deb_url = ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
+ 'linux-image-current-sunxi_21.02.2_armhf.deb')
+ deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
+ deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+ kernel_path = self.extract_from_deb(deb_path,
+ '/boot/vmlinuz-5.10.16-sunxi')
+ dtb_path = ('/usr/lib/linux-image-current-sunxi/'
+ 'sun8i-r40-bananapi-m2-ultra.dtb')
+ dtb_path = self.extract_from_deb(deb_path, dtb_path)
+
+ self.vm.set_console()
+ kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+ 'console=ttyS0,115200n8 '
+ 'earlycon=uart,mmio32,0x1c28000')
+ self.vm.add_args('-kernel', kernel_path,
+ '-dtb', dtb_path,
+ '-append', kernel_command_line)
+ self.vm.launch()
+ console_pattern = 'Kernel command line: %s' % kernel_command_line
+ self.wait_for_console_pattern(console_pattern)
+
+ def test_arm_bpim2u_initrd(self):
+ """
+ :avocado: tags=arch:arm
+ :avocado: tags=accel:tcg
+ :avocado: tags=machine:bpim2u
+ """
+ deb_url = ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
+ 'linux-image-current-sunxi_21.02.2_armhf.deb')
+ deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
+ deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+ kernel_path = self.extract_from_deb(deb_path,
+ '/boot/vmlinuz-5.10.16-sunxi')
+ dtb_path = ('/usr/lib/linux-image-current-sunxi/'
+ 'sun8i-r40-bananapi-m2-ultra.dtb')
+ dtb_path = self.extract_from_deb(deb_path, dtb_path)
+ initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
+ '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
+ 'arm/rootfs-armv7a.cpio.gz')
+ initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
+ initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
+ initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
+ archive.gzip_uncompress(initrd_path_gz, initrd_path)
+
+ self.vm.set_console()
+ kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+ 'console=ttyS0,115200 '
+ 'panic=-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')
+ # Wait for VM to shut down gracefully
+ self.vm.wait()
+
+ def test_arm_bpim2u_gmac(self):
+ """
+ :avocado: tags=arch:arm
+ :avocado: tags=accel:tcg
+ :avocado: tags=machine:bpim2u
+ :avocado: tags=device:sd
+ """
+ self.require_netdev('user')
+
+ deb_url = ('https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
+ 'linux-image-current-sunxi_21.02.2_armhf.deb')
+ deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
+ deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+ kernel_path = self.extract_from_deb(deb_path,
+ '/boot/vmlinuz-5.10.16-sunxi')
+ dtb_path = ('/usr/lib/linux-image-current-sunxi/'
+ 'sun8i-r40-bananapi-m2-ultra.dtb')
+ dtb_path = self.extract_from_deb(deb_path, dtb_path)
+ rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/'
+ 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz')
+ rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a'
+ rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
+ rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
+ archive.lzma_uncompress(rootfs_path_xz, rootfs_path)
+ image_pow2ceil_expand(rootfs_path)
+
+ self.vm.set_console()
+ kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+ 'console=ttyS0,115200 '
+ 'root=/dev/mmcblk0 rootwait rw '
+ 'panic=-1 noreboot')
+ self.vm.add_args('-kernel', kernel_path,
+ '-dtb', dtb_path,
+ '-drive', 'file=' + rootfs_path + ',if=sd,format=raw',
+ '-net', 'nic,model=gmac,netdev=host_gmac',
+ '-netdev', 'user,id=host_gmac',
+ '-append', kernel_command_line,
+ '-no-reboot')
+ self.vm.launch()
+ shell_ready = "/bin/sh: can't access tty; job control turned off"
+ self.wait_for_console_pattern(shell_ready)
+
+ exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
+ 'Allwinner sun8i Family')
+ exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
+ 'mmcblk0')
+ exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
+ 'eth0: Link is Up')
+ exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
+ 'udhcpc: lease of 10.0.2.15 obtained')
+ exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
+ '3 packets transmitted, 3 packets received, 0% packet loss')
+ exec_command_and_wait_for_pattern(self, 'reboot',
+ 'reboot: Restarting system')
+ # Wait for VM to shut down gracefully
+ self.vm.wait()
+
+ @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
+ def test_arm_bpim2u_openwrt_22_03_3(self):
+ """
+ :avocado: tags=arch:arm
+ :avocado: tags=machine:bpim2u
+ :avocado: tags=device:sd
+ """
+
+ # This test download a 8.9 MiB compressed image and expand it
+ # to 127 MiB.
+ image_url = ('https://downloads.openwrt.org/releases/22.03.3/targets/'
+ 'sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-'
+ 'sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz')
+ image_hash = ('5b41b4e11423e562c6011640f9a7cd3b'
+ 'dd0a3d42b83430f7caa70a432e6cd82c')
+ image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash,
+ algorithm='sha256')
+ image_path = archive.extract(image_path_gz, self.workdir)
+ image_pow2ceil_expand(image_path)
+
+ self.vm.set_console()
+ self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw',
+ '-nic', 'user',
+ '-no-reboot')
+ self.vm.launch()
+
+ kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+ 'usbcore.nousb '
+ 'noreboot')
+
+ self.wait_for_console_pattern('U-Boot SPL')
+
+ interrupt_interactive_console_until_pattern(
+ self, 'Hit any key to stop autoboot:', '=>')
+ exec_command_and_wait_for_pattern(self, "setenv extraargs '" +
+ kernel_command_line + "'", '=>')
+ exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...');
+
+ self.wait_for_console_pattern(
+ 'Please press Enter to activate this console.')
+
+ exec_command_and_wait_for_pattern(self, ' ', 'root@')
+
+ 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')
+
def test_arm_orangepi(self):
"""
:avocado: tags=arch:arm
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 12/12] docs: system: arm: Introduce bananapi_m2u
2023-03-28 5:48 [PATCH v2 11/11] docs: system: arm: Introduce bananapi_m2u qianfanguijin
2023-03-28 5:48 ` [PATCH v2 11/12] tests: avocado: boot_linux_console: Add test case for bpim2u qianfanguijin
@ 2023-03-28 5:48 ` qianfanguijin
2023-04-06 19:26 ` [PATCH v2 11/11] " Niek Linnenbank
2 siblings, 0 replies; 5+ messages in thread
From: qianfanguijin @ 2023-03-28 5:48 UTC (permalink / raw)
To: qemu-arm, qemu-devel
Cc: Strahinja Jankovic, Peter Maydell, Beniamino Galvani,
Philippe Mathieu-Daudé, Niek Linnenbank, qianfan Zhao
From: qianfan Zhao <qianfanguijin@163.com>
Add documents for Banana Pi M2U
Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
docs/system/arm/bananapi_m2u.rst | 138 +++++++++++++++++++++++++++++++
1 file changed, 138 insertions(+)
create mode 100644 docs/system/arm/bananapi_m2u.rst
diff --git a/docs/system/arm/bananapi_m2u.rst b/docs/system/arm/bananapi_m2u.rst
new file mode 100644
index 0000000000..ae7194a9df
--- /dev/null
+++ b/docs/system/arm/bananapi_m2u.rst
@@ -0,0 +1,138 @@
+Banana Pi BPI-M2U (``bpim2u``)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Banana Pi BPI-M2 Ultra is a quad-core mini single board computer built with
+Allwinner A40i/R40/V40 SoC. It features 2GB of RAM and 8GB eMMC. It also
+has onboard WiFi and BT. On the ports side, the BPI-M2 Ultra has 2 USB A
+2.0 ports, 1 USB OTG port, 1 HDMI port, 1 audio jack, a DC power port,
+and last but not least, a SATA port.
+
+Supported devices
+"""""""""""""""""
+
+The Banana Pi M2U machine supports the following devices:
+
+ * SMP (Quad Core Cortex-A7)
+ * Generic Interrupt Controller configuration
+ * SRAM mappings
+ * SDRAM controller
+ * Timer device (re-used from Allwinner A10)
+ * UART
+ * SD/MMC storage controller
+ * EMAC ethernet
+ * GMAC ethernet
+ * Clock Control Unit
+ * TWI (I2C)
+
+Limitations
+"""""""""""
+
+Currently, Banana Pi M2U does *not* support the following features:
+
+- Graphical output via HDMI, GPU and/or the Display Engine
+- Audio output
+- Hardware Watchdog
+- Real Time Clock
+- USB 2.0 interfaces
+
+Also see the 'unimplemented' array in the Allwinner R40 SoC module
+for a complete list of unimplemented I/O devices: ``./hw/arm/allwinner-r40.c``
+
+Boot options
+""""""""""""
+
+The Banana Pi M2U machine can start using the standard -kernel functionality
+for loading a Linux kernel or ELF executable. Additionally, the Banana Pi M2U
+machine can also emulate the BootROM which is present on an actual Allwinner R40
+based SoC, which loads the bootloader from a SD card, specified via the -sd
+argument to qemu-system-arm.
+
+Running mainline Linux
+""""""""""""""""""""""
+
+To build a Linux mainline kernel that can be booted by the Banana Pi M2U machine,
+simply configure the kernel using the sunxi_defconfig configuration:
+
+.. code-block:: bash
+
+ $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make mrproper
+ $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make sunxi_defconfig
+
+To boot the newly build linux kernel in QEMU with the Banana Pi M2U machine, use:
+
+.. code-block:: bash
+
+ $ qemu-system-arm -M bpim2u -nographic \
+ -kernel /path/to/linux/arch/arm/boot/zImage \
+ -append 'console=ttyS0,115200' \
+ -dtb /path/to/linux/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dtb
+
+Banana Pi M2U images
+""""""""""""""""""""
+
+Note that the mainline kernel does not have a root filesystem. You can choose
+to build you own image with buildroot using the bananapi_m2_ultra_defconfig.
+Also see https://buildroot.org for more information.
+
+Another possibility is to run an OpenWrt image for Banana Pi M2U which
+can be downloaded from:
+
+ https://downloads.openwrt.org/releases/22.03.3/targets/sunxi/cortexa7/
+
+When using an image as an SD card, it must be resized to a power of two. This can be
+done with the ``qemu-img`` command. It is recommended to only increase the image size
+instead of shrinking it to a power of two, to avoid loss of data. For example,
+to prepare a downloaded Armbian image, first extract it and then increase
+its size to one gigabyte as follows:
+
+.. code-block:: bash
+
+ $ qemu-img resize \
+ openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img \
+ 1G
+
+Instead of providing a custom Linux kernel via the -kernel command you may also
+choose to let the Banana Pi M2U machine load the bootloader from SD card, just like
+a real board would do using the BootROM. Simply pass the selected image via the -sd
+argument and remove the -kernel, -append, -dbt and -initrd arguments:
+
+.. code-block:: bash
+
+ $ qemu-system-arm -M bpim2u -nic user -nographic \
+ -sd openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img
+
+Running U-Boot
+""""""""""""""
+
+U-Boot mainline can be build and configured using the Bananapi_M2_Ultra_defconfig
+using similar commands as describe above for Linux. Note that it is recommended
+for development/testing to select the following configuration setting in U-Boot:
+
+ Device Tree Control > Provider for DTB for DT Control > Embedded DTB
+
+The BootROM of allwinner R40 loading u-boot from the 8KiB offset of sdcard.
+Let's create an bootable disk image:
+
+.. code-block:: bash
+
+ $ dd if=/dev/zero of=sd.img bs=32M count=1
+ $ dd if=u-boot-sunxi-with-spl.bin of=sd.img bs=1k seek=8 conv=notrunc
+
+And then boot it.
+
+.. code-block:: bash
+ $ qemu-system-arm -M bpim2u -nographic -sd sd.img
+
+Banana Pi M2U integration tests
+""""""""""""""""""""""""""""""
+
+The Banana Pi M2U machine has several integration tests included.
+To run the whole set of tests, build QEMU from source and simply
+provide the following command:
+
+.. code-block:: bash
+
+ $ cd qemu-build-dir
+ $ AVOCADO_ALLOW_LARGE_STORAGE=yes tests/venv/bin/avocado \
+ --verbose --show=app,console run -t machine:bpim2u \
+ ../tests/avocado/boot_linux_console.py
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 11/11] docs: system: arm: Introduce bananapi_m2u
2023-03-28 5:48 [PATCH v2 11/11] docs: system: arm: Introduce bananapi_m2u qianfanguijin
2023-03-28 5:48 ` [PATCH v2 11/12] tests: avocado: boot_linux_console: Add test case for bpim2u qianfanguijin
2023-03-28 5:48 ` [PATCH v2 12/12] docs: system: arm: Introduce bananapi_m2u qianfanguijin
@ 2023-04-06 19:26 ` Niek Linnenbank
2 siblings, 0 replies; 5+ messages in thread
From: Niek Linnenbank @ 2023-04-06 19:26 UTC (permalink / raw)
To: qianfanguijin
Cc: qemu-arm, qemu-devel, Strahinja Jankovic, Peter Maydell,
Beniamino Galvani, Philippe Mathieu-Daudé
[-- Attachment #1: Type: text/plain, Size: 6023 bytes --]
On Tue, Mar 28, 2023 at 7:48 AM <qianfanguijin@163.com> wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
>
> Add documents for Banana Pi M2U
>
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
>
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
> ---
> docs/system/arm/bananapi_m2u.rst | 138 +++++++++++++++++++++++++++++++
> 1 file changed, 138 insertions(+)
> create mode 100644 docs/system/arm/bananapi_m2u.rst
>
> diff --git a/docs/system/arm/bananapi_m2u.rst
> b/docs/system/arm/bananapi_m2u.rst
> new file mode 100644
> index 0000000000..ae7194a9df
> --- /dev/null
> +++ b/docs/system/arm/bananapi_m2u.rst
> @@ -0,0 +1,138 @@
> +Banana Pi BPI-M2U (``bpim2u``)
> +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +
> +Banana Pi BPI-M2 Ultra is a quad-core mini single board computer built
> with
> +Allwinner A40i/R40/V40 SoC. It features 2GB of RAM and 8GB eMMC. It also
> +has onboard WiFi and BT. On the ports side, the BPI-M2 Ultra has 2 USB A
> +2.0 ports, 1 USB OTG port, 1 HDMI port, 1 audio jack, a DC power port,
> +and last but not least, a SATA port.
> +
> +Supported devices
> +"""""""""""""""""
> +
> +The Banana Pi M2U machine supports the following devices:
> +
> + * SMP (Quad Core Cortex-A7)
> + * Generic Interrupt Controller configuration
> + * SRAM mappings
> + * SDRAM controller
> + * Timer device (re-used from Allwinner A10)
> + * UART
> + * SD/MMC storage controller
> + * EMAC ethernet
> + * GMAC ethernet
> + * Clock Control Unit
> + * TWI (I2C)
> +
> +Limitations
> +"""""""""""
> +
> +Currently, Banana Pi M2U does *not* support the following features:
> +
> +- Graphical output via HDMI, GPU and/or the Display Engine
> +- Audio output
> +- Hardware Watchdog
> +- Real Time Clock
> +- USB 2.0 interfaces
> +
> +Also see the 'unimplemented' array in the Allwinner R40 SoC module
> +for a complete list of unimplemented I/O devices:
> ``./hw/arm/allwinner-r40.c``
> +
> +Boot options
> +""""""""""""
> +
> +The Banana Pi M2U machine can start using the standard -kernel
> functionality
> +for loading a Linux kernel or ELF executable. Additionally, the Banana Pi
> M2U
> +machine can also emulate the BootROM which is present on an actual
> Allwinner R40
> +based SoC, which loads the bootloader from a SD card, specified via the
> -sd
> +argument to qemu-system-arm.
> +
> +Running mainline Linux
> +""""""""""""""""""""""
> +
> +To build a Linux mainline kernel that can be booted by the Banana Pi M2U
> machine,
> +simply configure the kernel using the sunxi_defconfig configuration:
> +
> +.. code-block:: bash
> +
> + $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make mrproper
> + $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make sunxi_defconfig
> +
> +To boot the newly build linux kernel in QEMU with the Banana Pi M2U
> machine, use:
> +
> +.. code-block:: bash
> +
> + $ qemu-system-arm -M bpim2u -nographic \
> + -kernel /path/to/linux/arch/arm/boot/zImage \
> + -append 'console=ttyS0,115200' \
> + -dtb
> /path/to/linux/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dtb
> +
> +Banana Pi M2U images
> +""""""""""""""""""""
> +
> +Note that the mainline kernel does not have a root filesystem. You can
> choose
> +to build you own image with buildroot using the
> bananapi_m2_ultra_defconfig.
> +Also see https://buildroot.org for more information.
> +
> +Another possibility is to run an OpenWrt image for Banana Pi M2U which
> +can be downloaded from:
> +
> + https://downloads.openwrt.org/releases/22.03.3/targets/sunxi/cortexa7/
> +
> +When using an image as an SD card, it must be resized to a power of two.
> This can be
> +done with the ``qemu-img`` command. It is recommended to only increase
> the image size
> +instead of shrinking it to a power of two, to avoid loss of data. For
> example,
> +to prepare a downloaded Armbian image, first extract it and then increase
> +its size to one gigabyte as follows:
> +
> +.. code-block:: bash
> +
> + $ qemu-img resize \
> +
> openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img \
> + 1G
> +
> +Instead of providing a custom Linux kernel via the -kernel command you
> may also
> +choose to let the Banana Pi M2U machine load the bootloader from SD card,
> just like
> +a real board would do using the BootROM. Simply pass the selected image
> via the -sd
> +argument and remove the -kernel, -append, -dbt and -initrd arguments:
> +
> +.. code-block:: bash
> +
> + $ qemu-system-arm -M bpim2u -nic user -nographic \
> + -sd
> openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img
> +
> +Running U-Boot
> +""""""""""""""
> +
> +U-Boot mainline can be build and configured using the
> Bananapi_M2_Ultra_defconfig
> +using similar commands as describe above for Linux. Note that it is
> recommended
> +for development/testing to select the following configuration setting in
> U-Boot:
> +
> + Device Tree Control > Provider for DTB for DT Control > Embedded DTB
> +
> +The BootROM of allwinner R40 loading u-boot from the 8KiB offset of
> sdcard.
> +Let's create an bootable disk image:
> +
> +.. code-block:: bash
> +
> + $ dd if=/dev/zero of=sd.img bs=32M count=1
> + $ dd if=u-boot-sunxi-with-spl.bin of=sd.img bs=1k seek=8 conv=notrunc
> +
> +And then boot it.
> +
> +.. code-block:: bash
> + $ qemu-system-arm -M bpim2u -nographic -sd sd.img
> +
> +Banana Pi M2U integration tests
> +""""""""""""""""""""""""""""""
> +
> +The Banana Pi M2U machine has several integration tests included.
> +To run the whole set of tests, build QEMU from source and simply
> +provide the following command:
> +
> +.. code-block:: bash
> +
> + $ cd qemu-build-dir
> + $ AVOCADO_ALLOW_LARGE_STORAGE=yes tests/venv/bin/avocado \
> + --verbose --show=app,console run -t machine:bpim2u \
> + ../tests/avocado/boot_linux_console.py
> --
> 2.25.1
>
>
--
Niek Linnenbank
[-- Attachment #2: Type: text/html, Size: 7936 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 11/12] tests: avocado: boot_linux_console: Add test case for bpim2u
2023-03-28 5:48 ` [PATCH v2 11/12] tests: avocado: boot_linux_console: Add test case for bpim2u qianfanguijin
@ 2023-04-06 20:21 ` Niek Linnenbank
0 siblings, 0 replies; 5+ messages in thread
From: Niek Linnenbank @ 2023-04-06 20:21 UTC (permalink / raw)
To: qianfanguijin
Cc: qemu-arm, qemu-devel, Strahinja Jankovic, Peter Maydell,
Beniamino Galvani, Philippe Mathieu-Daudé
[-- Attachment #1: Type: text/plain, Size: 11170 bytes --]
Hi Qianfan,
The tests look good to me and are working OK:
ARMBIAN_ARTIFACTS_CACHED=yes AVOCADO_ALLOW_LARGE_STORAGE=yes
./build/tests/venv/bin/avocado --show=app,console run -t machine:bpim2u
tests/avocado/boot_linux_console.py
(1/4)
tests/avocado/boot_linux_console.py:BootLinuxConsole.test_arm_bpim2u:
/console: [ 0.000000] Booting Linux on physical CPU 0x0
console: [ 0.000000] Linux version 5.10.16-sunxi (root@beast)
(arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture
8.3-2019.03 (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile
Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #21.02.2 SMP Sun
Feb 14 21:12:17 CET 2021
console: [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7),
cr=50c5387d
...
PASS (15.77 s)
RESULTS : PASS 4 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 |
CANCEL 0
JOB TIME : 62.90 s
So for me:
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
On Tue, Mar 28, 2023 at 7:49 AM <qianfanguijin@163.com> wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
>
> Add test case for booting from initrd and sd card.
>
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
> ---
> tests/avocado/boot_linux_console.py | 176 ++++++++++++++++++++++++++++
> 1 file changed, 176 insertions(+)
>
> diff --git a/tests/avocado/boot_linux_console.py
> b/tests/avocado/boot_linux_console.py
> index 574609bf43..d17417828c 100644
> --- a/tests/avocado/boot_linux_console.py
> +++ b/tests/avocado/boot_linux_console.py
> @@ -760,6 +760,182 @@ def test_arm_quanta_gsj_initrd(self):
> self.wait_for_console_pattern(
> 'Give root password for system maintenance')
>
> + def test_arm_bpim2u(self):
> + """
> + :avocado: tags=arch:arm
> + :avocado: tags=machine:bpim2u
> + :avocado: tags=accel:tcg
> + """
> + deb_url = ('
> https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
> + 'linux-image-current-sunxi_21.02.2_armhf.deb')
> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> + kernel_path = self.extract_from_deb(deb_path,
> + '/boot/vmlinuz-5.10.16-sunxi')
> + dtb_path = ('/usr/lib/linux-image-current-sunxi/'
> + 'sun8i-r40-bananapi-m2-ultra.dtb')
> + dtb_path = self.extract_from_deb(deb_path, dtb_path)
> +
> + self.vm.set_console()
> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> + 'console=ttyS0,115200n8 '
> + 'earlycon=uart,mmio32,0x1c28000')
> + self.vm.add_args('-kernel', kernel_path,
> + '-dtb', dtb_path,
> + '-append', kernel_command_line)
> + self.vm.launch()
> + console_pattern = 'Kernel command line: %s' % kernel_command_line
> + self.wait_for_console_pattern(console_pattern)
> +
> + def test_arm_bpim2u_initrd(self):
> + """
> + :avocado: tags=arch:arm
> + :avocado: tags=accel:tcg
> + :avocado: tags=machine:bpim2u
> + """
> + deb_url = ('
> https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
> + 'linux-image-current-sunxi_21.02.2_armhf.deb')
> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> + kernel_path = self.extract_from_deb(deb_path,
> + '/boot/vmlinuz-5.10.16-sunxi')
> + dtb_path = ('/usr/lib/linux-image-current-sunxi/'
> + 'sun8i-r40-bananapi-m2-ultra.dtb')
> + dtb_path = self.extract_from_deb(deb_path, dtb_path)
> + initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
> + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
> + 'arm/rootfs-armv7a.cpio.gz')
> + initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c'
> + initrd_path_gz = self.fetch_asset(initrd_url,
> asset_hash=initrd_hash)
> + initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
> + archive.gzip_uncompress(initrd_path_gz, initrd_path)
> +
> + self.vm.set_console()
> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> + 'console=ttyS0,115200 '
> + 'panic=-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')
> + # Wait for VM to shut down gracefully
> + self.vm.wait()
> +
> + def test_arm_bpim2u_gmac(self):
> + """
> + :avocado: tags=arch:arm
> + :avocado: tags=accel:tcg
> + :avocado: tags=machine:bpim2u
> + :avocado: tags=device:sd
> + """
> + self.require_netdev('user')
> +
> + deb_url = ('
> https://apt.armbian.com/pool/main/l/linux-5.10.16-sunxi/'
> + 'linux-image-current-sunxi_21.02.2_armhf.deb')
> + deb_hash = '9fa84beda245cabf0b4fa84cf6eaa7738ead1da0'
> + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> + kernel_path = self.extract_from_deb(deb_path,
> + '/boot/vmlinuz-5.10.16-sunxi')
> + dtb_path = ('/usr/lib/linux-image-current-sunxi/'
> + 'sun8i-r40-bananapi-m2-ultra.dtb')
> + dtb_path = self.extract_from_deb(deb_path, dtb_path)
> + rootfs_url = ('
> http://storage.kernelci.org/images/rootfs/buildroot/'
> +
> 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz')
> + rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a'
> + rootfs_path_xz = self.fetch_asset(rootfs_url,
> asset_hash=rootfs_hash)
> + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
> + archive.lzma_uncompress(rootfs_path_xz, rootfs_path)
> + image_pow2ceil_expand(rootfs_path)
> +
> + self.vm.set_console()
> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> + 'console=ttyS0,115200 '
> + 'root=/dev/mmcblk0 rootwait rw '
> + 'panic=-1 noreboot')
> + self.vm.add_args('-kernel', kernel_path,
> + '-dtb', dtb_path,
> + '-drive', 'file=' + rootfs_path +
> ',if=sd,format=raw',
> + '-net', 'nic,model=gmac,netdev=host_gmac',
> + '-netdev', 'user,id=host_gmac',
> + '-append', kernel_command_line,
> + '-no-reboot')
> + self.vm.launch()
> + shell_ready = "/bin/sh: can't access tty; job control turned off"
> + self.wait_for_console_pattern(shell_ready)
> +
> + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
> + 'Allwinner sun8i Family')
> + exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
> + 'mmcblk0')
> + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up',
> + 'eth0: Link is Up')
> + exec_command_and_wait_for_pattern(self, 'udhcpc eth0',
> + 'udhcpc: lease of 10.0.2.15 obtained')
> + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
> + '3 packets transmitted, 3 packets received, 0% packet loss')
> + exec_command_and_wait_for_pattern(self, 'reboot',
> + 'reboot: Restarting
> system')
> + # Wait for VM to shut down gracefully
> + self.vm.wait()
> +
> + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage
> limited')
> + def test_arm_bpim2u_openwrt_22_03_3(self):
> + """
> + :avocado: tags=arch:arm
> + :avocado: tags=machine:bpim2u
> + :avocado: tags=device:sd
> + """
> +
> + # This test download a 8.9 MiB compressed image and expand it
> + # to 127 MiB.
> + image_url = ('
> https://downloads.openwrt.org/releases/22.03.3/targets/'
> + 'sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-'
> + 'sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz')
> + image_hash = ('5b41b4e11423e562c6011640f9a7cd3b'
> + 'dd0a3d42b83430f7caa70a432e6cd82c')
> + image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash,
> + algorithm='sha256')
> + image_path = archive.extract(image_path_gz, self.workdir)
> + image_pow2ceil_expand(image_path)
> +
> + self.vm.set_console()
> + self.vm.add_args('-drive', 'file=' + image_path +
> ',if=sd,format=raw',
> + '-nic', 'user',
> + '-no-reboot')
> + self.vm.launch()
> +
> + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> + 'usbcore.nousb '
> + 'noreboot')
> +
> + self.wait_for_console_pattern('U-Boot SPL')
> +
> + interrupt_interactive_console_until_pattern(
> + self, 'Hit any key to stop autoboot:', '=>')
> + exec_command_and_wait_for_pattern(self, "setenv extraargs '" +
> + kernel_command_line +
> "'", '=>')
> + exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel
> ...');
> +
> + self.wait_for_console_pattern(
> + 'Please press Enter to activate this console.')
> +
> + exec_command_and_wait_for_pattern(self, ' ', 'root@')
> +
> + 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')
> +
> def test_arm_orangepi(self):
> """
> :avocado: tags=arch:arm
> --
> 2.25.1
>
>
--
Niek Linnenbank
[-- Attachment #2: Type: text/html, Size: 15170 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-06 20:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-28 5:48 [PATCH v2 11/11] docs: system: arm: Introduce bananapi_m2u qianfanguijin
2023-03-28 5:48 ` [PATCH v2 11/12] tests: avocado: boot_linux_console: Add test case for bpim2u qianfanguijin
2023-04-06 20:21 ` Niek Linnenbank
2023-03-28 5:48 ` [PATCH v2 12/12] docs: system: arm: Introduce bananapi_m2u qianfanguijin
2023-04-06 19:26 ` [PATCH v2 11/11] " Niek Linnenbank
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).