| 1 | Banana Pi BPI-M2U (``bpim2u``) |
| 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 3 | |
| 4 | Banana Pi BPI-M2 Ultra is a quad-core mini single board computer built with |
| 5 | Allwinner A40i/R40/V40 SoC. It features 2GB of RAM and 8GB eMMC. It also |
| 6 | has onboard WiFi and BT. On the ports side, the BPI-M2 Ultra has 2 USB A |
| 7 | 2.0 ports, 1 USB OTG port, 1 HDMI port, 1 audio jack, a DC power port, |
| 8 | and last but not least, a SATA port. |
| 9 | |
| 10 | Supported devices |
| 11 | """"""""""""""""" |
| 12 | |
| 13 | The Banana Pi M2U machine supports the following devices: |
| 14 | |
| 15 | * SMP (Quad Core Cortex-A7) |
| 16 | * Generic Interrupt Controller configuration |
| 17 | * SRAM mappings |
| 18 | * SDRAM controller |
| 19 | * Timer device (re-used from Allwinner A10) |
| 20 | * UART |
| 21 | * SD/MMC storage controller |
| 22 | * EMAC ethernet |
| 23 | * GMAC ethernet |
| 24 | * Clock Control Unit |
| 25 | * SATA |
| 26 | * TWI (I2C) |
| 27 | * USB 2.0 |
| 28 | * Hardware Watchdog |
| 29 | |
| 30 | Limitations |
| 31 | """"""""""" |
| 32 | |
| 33 | Currently, Banana Pi M2U does *not* support the following features: |
| 34 | |
| 35 | - Graphical output via HDMI, GPU and/or the Display Engine |
| 36 | - Audio output |
| 37 | - Real Time Clock |
| 38 | |
| 39 | Also see the 'unimplemented' array in the Allwinner R40 SoC module |
| 40 | for a complete list of unimplemented I/O devices: ``./hw/arm/allwinner-r40.c`` |
| 41 | |
| 42 | Boot options |
| 43 | """""""""""" |
| 44 | |
| 45 | The Banana Pi M2U machine can start using the standard -kernel functionality |
| 46 | for loading a Linux kernel or ELF executable. Additionally, the Banana Pi M2U |
| 47 | machine can also emulate the BootROM which is present on an actual Allwinner R40 |
| 48 | based SoC, which loads the bootloader from a SD card, specified via the -sd |
| 49 | argument to qemu-system-arm. |
| 50 | |
| 51 | Running mainline Linux |
| 52 | """""""""""""""""""""" |
| 53 | |
| 54 | To build a Linux mainline kernel that can be booted by the Banana Pi M2U machine, |
| 55 | simply configure the kernel using the sunxi_defconfig configuration: |
| 56 | |
| 57 | .. code-block:: bash |
| 58 | |
| 59 | $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make mrproper |
| 60 | $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make sunxi_defconfig |
| 61 | |
| 62 | To boot the newly build linux kernel in QEMU with the Banana Pi M2U machine, use: |
| 63 | |
| 64 | .. code-block:: bash |
| 65 | |
| 66 | $ qemu-system-arm -M bpim2u -nographic \ |
| 67 | -kernel /path/to/linux/arch/arm/boot/zImage \ |
| 68 | -append 'console=ttyS0,115200' \ |
| 69 | -dtb /path/to/linux/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dtb |
| 70 | |
| 71 | Banana Pi M2U images |
| 72 | """""""""""""""""""" |
| 73 | |
| 74 | Note that the mainline kernel does not have a root filesystem. You can choose |
| 75 | to build you own image with buildroot using the bananapi_m2_ultra_defconfig. |
| 76 | Also see https://buildroot.org for more information. |
| 77 | |
| 78 | Another possibility is to run an OpenWrt image for Banana Pi M2U which |
| 79 | can be downloaded from: |
| 80 | |
| 81 | https://downloads.openwrt.org/releases/22.03.3/targets/sunxi/cortexa7/ |
| 82 | |
| 83 | When using an image as an SD card, it must be resized to a power of two. This can be |
| 84 | done with the ``qemu-img`` command. It is recommended to only increase the image size |
| 85 | instead of shrinking it to a power of two, to avoid loss of data. For example, |
| 86 | to prepare a downloaded Armbian image, first extract it and then increase |
| 87 | its size to one gigabyte as follows: |
| 88 | |
| 89 | .. code-block:: bash |
| 90 | |
| 91 | $ qemu-img resize \ |
| 92 | openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img \ |
| 93 | 1G |
| 94 | |
| 95 | Instead of providing a custom Linux kernel via the -kernel command you may also |
| 96 | choose to let the Banana Pi M2U machine load the bootloader from SD card, just like |
| 97 | a real board would do using the BootROM. Simply pass the selected image via the -sd |
| 98 | argument and remove the -kernel, -append, -dbt and -initrd arguments: |
| 99 | |
| 100 | .. code-block:: bash |
| 101 | |
| 102 | $ qemu-system-arm -M bpim2u -nic user -nographic \ |
| 103 | -sd openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-sdcard.img |
| 104 | |
| 105 | Running U-Boot |
| 106 | """""""""""""" |
| 107 | |
| 108 | U-Boot mainline can be build and configured using the Bananapi_M2_Ultra_defconfig |
| 109 | using similar commands as describe above for Linux. Note that it is recommended |
| 110 | for development/testing to select the following configuration setting in U-Boot: |
| 111 | |
| 112 | Device Tree Control > Provider for DTB for DT Control > Embedded DTB |
| 113 | |
| 114 | The BootROM of allwinner R40 loading u-boot from the 8KiB offset of sdcard. |
| 115 | Let's create an bootable disk image: |
| 116 | |
| 117 | .. code-block:: bash |
| 118 | |
| 119 | $ dd if=/dev/zero of=sd.img bs=32M count=1 |
| 120 | $ dd if=u-boot-sunxi-with-spl.bin of=sd.img bs=1k seek=8 conv=notrunc |
| 121 | |
| 122 | And then boot it. |
| 123 | |
| 124 | .. code-block:: bash |
| 125 | |
| 126 | $ qemu-system-arm -M bpim2u -nographic -sd sd.img |
| 127 | |
| 128 | Banana Pi M2U functional tests |
| 129 | """""""""""""""""""""""""""""" |
| 130 | |
| 131 | The Banana Pi M2U machine has several functional tests included. |
| 132 | To run the whole set of tests, build QEMU from source and simply |
| 133 | provide the following command: |
| 134 | |
| 135 | .. code-block:: bash |
| 136 | |
| 137 | $ cd qemu-build-dir |
| 138 | $ QEMU_TEST_ALLOW_LARGE_STORAGE=1 \ |
| 139 | pyvenv/bin/meson test --suite thorough func-arm-arm_bpim2u |