<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.banana-pi.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dangku</id>
		<title>Banana Pi Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.banana-pi.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dangku"/>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/Special:Contributions/Dangku"/>
		<updated>2026-07-23T09:53:03Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17301</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17301"/>
				<updated>2024-07-25T08:06:54Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Linux Server Image Network Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: NetworkManager&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: no&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            mode: ap&lt;br /&gt;
            band: 2.4GHz&lt;br /&gt;
            channel: 6&lt;br /&gt;
            auth:&lt;br /&gt;
              key-management: psk&lt;br /&gt;
              password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: NetworkManager&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: no&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            mode: ap&lt;br /&gt;
            band: 5GHz&lt;br /&gt;
            channel: 36&lt;br /&gt;
            auth:&lt;br /&gt;
              key-management: psk&lt;br /&gt;
              password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   ethernets:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: no&lt;br /&gt;
       addresses:&lt;br /&gt;
         - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17300</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17300"/>
				<updated>2024-07-25T08:06:18Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Linux Server Image Network Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: NetworkManager&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: no&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            mode: ap&lt;br /&gt;
            band: 2.4GHz&lt;br /&gt;
            channel: 6&lt;br /&gt;
            auth:&lt;br /&gt;
              key-management: psk&lt;br /&gt;
              password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: NetworkManager&lt;br /&gt;
  wifis:&lt;br /&gt;
    wlan0:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      access-points:&lt;br /&gt;
        &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
           mode: ap&lt;br /&gt;
           band: 5GHz&lt;br /&gt;
           channel: 36&lt;br /&gt;
           auth:&lt;br /&gt;
             key-management: psk&lt;br /&gt;
             password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   ethernets:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: no&lt;br /&gt;
       addresses:&lt;br /&gt;
         - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17299</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17299"/>
				<updated>2024-07-25T08:05:46Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Linux Server Image Network Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: NetworkManager&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: no&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            mode: ap&lt;br /&gt;
            band: 2.4GHz&lt;br /&gt;
            channel: 6&lt;br /&gt;
            auth:&lt;br /&gt;
              key-management: psk&lt;br /&gt;
              password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: NetworkManager&lt;br /&gt;
  wifis:&lt;br /&gt;
    wlan0:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      access-points:&lt;br /&gt;
        &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
           mode: ap&lt;br /&gt;
           band: 5GHz&lt;br /&gt;
           channel: 36&lt;br /&gt;
           auth:&lt;br /&gt;
             key-management: psk&lt;br /&gt;
             password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    wlan0:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17298</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17298"/>
				<updated>2024-07-25T08:04:47Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Linux Server Image Network Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: NetworkManager&lt;br /&gt;
  wifis:&lt;br /&gt;
    wlan0:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      access-points:&lt;br /&gt;
        &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
           mode: ap&lt;br /&gt;
           band: 2.4GHz&lt;br /&gt;
           channel: 6&lt;br /&gt;
           auth:&lt;br /&gt;
             key-management: psk&lt;br /&gt;
             password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: NetworkManager&lt;br /&gt;
  wifis:&lt;br /&gt;
    wlan0:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      access-points:&lt;br /&gt;
        &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
           mode: ap&lt;br /&gt;
           band: 5GHz&lt;br /&gt;
           channel: 36&lt;br /&gt;
           auth:&lt;br /&gt;
             key-management: psk&lt;br /&gt;
             password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
network:&lt;br /&gt;
  version: 2&lt;br /&gt;
  renderer: networkd&lt;br /&gt;
  ethernets:&lt;br /&gt;
    wlan0:&lt;br /&gt;
      dhcp4: no&lt;br /&gt;
      addresses:&lt;br /&gt;
        - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17283</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17283"/>
				<updated>2024-07-05T08:16:41Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi2-Python */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17282</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17282"/>
				<updated>2024-07-05T08:16:28Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17281</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17281"/>
				<updated>2024-07-05T08:15:38Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17280</id>
		<title>Getting Started with CM4</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17280"/>
				<updated>2024-07-05T08:14:45Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi2-Python */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_1.jpg|thumb|[[Banana Pi BPI-CM4]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_2.jpg|thumb|[[BPI-CM4 Computer module and development Kit]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_1.jpg|thumb|[[Banana Pi BPI-CM5]] with A311D2 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_5.jpg|thumb|[[Banana Pi BPI-CM5]] with BPI-CM4 base board]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
&lt;br /&gt;
BananaPi BPI-CM4 new design with Amlogic A311D Quad core ARM Cortex-A73 and dual core ARM Cortex-A53 CPU ,ARM G52 MP4(6EE) GPU,NPU for AI at 5.0 TOPS, support Camera and MIPI-CSI interface ,HDMI output,2 Gigabit port . 4G RAM and 16 GB eMMC flash.&lt;br /&gt;
&lt;br /&gt;
[[Banana Pi BPI-CM4]]&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Short the usb boot test point on the main board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later,  the board will enter usb download mode and be identified correctly by PC. You can also enter usb download mode with adb command &amp;quot;adb reboot update&amp;quot; or console command &amp;quot;reboot update&amp;quot; if a bootable android already flashed, make sure typec usb connected to PC before doing this. &lt;br /&gt;
:[[File:cm4_usb_download.jpg]]&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi CM4 DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi CM4 DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  hifi_pcm5122.dtbo  pdmmic.dtbo        sdio.dtbo        waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo          pwm_c-beeper.dtbo  spi0.dtbo        waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo          pwm_cd-c.dtbo      spi0_flash.dtbo    wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
  i2s.dtbo           pwm_cd.dtbo        uart1_cts_rts.dtbo i2smic.dtbo    &lt;br /&gt;
  pwm_ef.dtbo        uart1.dtbo         os08a10.dtbo     pwm_ef-f.dtbo   uart2.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-CM4#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 26pins gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 26pins status.&lt;br /&gt;
[[File:cm4_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python setup.py clean --all&lt;br /&gt;
  $ sudo python setup.py build install&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
===EC20 LTE 4G Module===&lt;br /&gt;
:1. AT test&lt;br /&gt;
:After the module is connected and Linux OS bootup. several ttyUSB* device files are created in the directory /dev. For EC20, /dev/ttyUSB2 is the AT port.&lt;br /&gt;
&lt;br /&gt;
:2. Connect Network via qmi_wwan on Ubuntu Desktop&lt;br /&gt;
&lt;br /&gt;
:Click edit connections in network manager menu&lt;br /&gt;
:[[File:ec20_desktop_0.png]]&lt;br /&gt;
&lt;br /&gt;
:Add a new mobile broadband connection&lt;br /&gt;
:[[File:ec20_desktop_1.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose qmi channel device&lt;br /&gt;
::When the qmi_wwan_q driver has been installed in the module, a network device and a QMI channel are created. The network device is named as wwanX and the QMI channel is /dev/cdc-wdmX. The network device is used for data transmission, and QMI channel is used for QMI message interaction&lt;br /&gt;
:[[File:ec20_desktop_2.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider's country region&lt;br /&gt;
:[[File:ec20_desktop_3.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider.&lt;br /&gt;
:[[File:ec20_desktop_4.png]]&lt;br /&gt;
:[[File:ec20_desktop_5.png]]&lt;br /&gt;
:Set connection name, carrier connection username/password and APN if needed.&lt;br /&gt;
:[[File:ec20_desktop_6.png]]&lt;br /&gt;
&lt;br /&gt;
:Setup finished, now you can connect it.&lt;br /&gt;
:[[File:ec20_desktop_7.png]]&lt;br /&gt;
&lt;br /&gt;
:3. Connect Network via pppd on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:Install pppd&lt;br /&gt;
  $ sudo apt install ipppd&lt;br /&gt;
&lt;br /&gt;
:Change AT device, username and password to your local carrier in /etc/ppp/peers/quectel-ppp&lt;br /&gt;
:[[File:ec20_server_pppd_uname.png]]&lt;br /&gt;
&lt;br /&gt;
:Change APN to your local carrier in /etc/ppp/peers/quectel-chat-connect&lt;br /&gt;
:[[File:ec20_server_pppd_apn.png]]&lt;br /&gt;
&lt;br /&gt;
: Two ways command to start pppd, you can check the process of PPP calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_pppd.log here].&lt;br /&gt;
  # pppd call quectel-ppp &amp;amp;&lt;br /&gt;
::or&lt;br /&gt;
  # quectel-pppd.sh /dev/ttyUSB2 &amp;lt;apn&amp;gt; &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Terminate pppd process:&lt;br /&gt;
  # quectel-ppp-kill&lt;br /&gt;
&lt;br /&gt;
:4. Connect Network via qmi_wwan on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:[quectel-CM] is a connection manager program for you to set up data connection manually. You can check the process of qmi_wwan calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_qmiwwan.log here].&lt;br /&gt;
&lt;br /&gt;
  # quectel-CM &amp;amp;&lt;br /&gt;
&lt;br /&gt;
:Terminate quectel-CM process:&lt;br /&gt;
&lt;br /&gt;
  # killall quectel-CM&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from SSD===&lt;br /&gt;
:A311d soc rom and  [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp BPI-M2S-bsp] uboot are both not support nvme boot, so the only way for booting linux from SSD is create a bootable sdcard or emmc with bootloader and boot partition flashed, then load rootfs from SSD. After bootup, everything will run from SSD. You need a minipcie to nvme adapter board because bananapi cm4io has a minipcie slot onboard.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_CM4#Install_Image_to_SDcard flash the CM4 Linux image to sdcard or emmc] for bootable and also flash it to the nvme ssd for loading rootfs.&lt;br /&gt;
:2. Bootup the CM4 board with [https://wiki.banana-pi.org/Getting_Started_with_CM4#Boot_Sequence sdcard or emmc], modify /boot/boot.ini to load rootfs from nvme partition for kernel.&lt;br /&gt;
  diff a/boot/boot.ini b/boot/boot.ini&lt;br /&gt;
  index 2222e79..c485067 100755&lt;br /&gt;
  --- a/boot/boot.ini&lt;br /&gt;
  +++ b/boot/boot.ini&lt;br /&gt;
  @@ -20,6 +20,8 @@ fi;&lt;br /&gt;
 &lt;br /&gt;
   if test &amp;quot;${devtype}&amp;quot; = &amp;quot;usb&amp;quot;; then setenv rootfsdev &amp;quot;/dev/sda2&amp;quot;; fi&lt;br /&gt;
 &lt;br /&gt;
  +# force set root=/dev/nvme0n1p2&lt;br /&gt;
  +setenv rootfsdev &amp;quot;/dev/nvme0n1p2&amp;quot;&lt;br /&gt;
  +&lt;br /&gt;
   # Load env.txt&lt;br /&gt;
   fatload ${devtype} ${devno}:1 ${env_loadaddr} env.txt&lt;br /&gt;
   env import -t ${env_loadaddr} ${filesize};&lt;br /&gt;
:3. Reboot the system, kernel will load rootfs from nvme ssd.&lt;br /&gt;
:[[File:cm4_ssd_rootfs.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your SSD on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and nvme ssd (Samsung 970EVOPlus)&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Nvme SSD Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 60.67 MB/s || 148.80 MB/s || 351.29 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 56.71 MB/s || 141.02 MB/s || 347.03 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 14 MB/s || 51.0 MB/s || 244 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2176 IOPS (8704 KB/s) || 8438 IOPS (33753 KB/s) || 101386 IOPS (405544 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 932 IOPS (3729 KB/s) || 10876 IOPS (43505 KB/s) || 43206 IOPS (172827 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 8586 KB/s || 20311 KB/s || 119475 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 2385 KB/s || 19016 KB/s || 90619 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 6734 KB/s || 20807 KB/s || 51517 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 3737 KB/s || 22731 KB/s || 95139 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1076 || Score: 5446 || Score: 24550&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Disable SDcard UHS  mode===&lt;br /&gt;
:Add disableuhs option to kernel bootargs in /boot/env.txt to disable sdcard uhs capability&lt;br /&gt;
&lt;br /&gt;
  # User kernel args&lt;br /&gt;
  # Add customer kernel args here&lt;br /&gt;
  user_kernel_args=pci=pcie_bus_safe disableuhs&lt;br /&gt;
&lt;br /&gt;
===Enable Wifi and BT===&lt;br /&gt;
:CM4 has onboard wifi/bt RTL8822CS, and is not enabled in default image, you can enable it with the following procedure.&lt;br /&gt;
&lt;br /&gt;
:1. Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:2. Install bluetooth packages for server images&lt;br /&gt;
  $ sudo apt update&lt;br /&gt;
  $ sudo apt install bluez rfkill&lt;br /&gt;
&lt;br /&gt;
:3. Reboot system&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
&lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17279</id>
		<title>Getting Started with CM4</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17279"/>
				<updated>2024-07-05T08:14:23Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* RPi.GPIO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_1.jpg|thumb|[[Banana Pi BPI-CM4]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_2.jpg|thumb|[[BPI-CM4 Computer module and development Kit]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_1.jpg|thumb|[[Banana Pi BPI-CM5]] with A311D2 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_5.jpg|thumb|[[Banana Pi BPI-CM5]] with BPI-CM4 base board]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
&lt;br /&gt;
BananaPi BPI-CM4 new design with Amlogic A311D Quad core ARM Cortex-A73 and dual core ARM Cortex-A53 CPU ,ARM G52 MP4(6EE) GPU,NPU for AI at 5.0 TOPS, support Camera and MIPI-CSI interface ,HDMI output,2 Gigabit port . 4G RAM and 16 GB eMMC flash.&lt;br /&gt;
&lt;br /&gt;
[[Banana Pi BPI-CM4]]&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Short the usb boot test point on the main board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later,  the board will enter usb download mode and be identified correctly by PC. You can also enter usb download mode with adb command &amp;quot;adb reboot update&amp;quot; or console command &amp;quot;reboot update&amp;quot; if a bootable android already flashed, make sure typec usb connected to PC before doing this. &lt;br /&gt;
:[[File:cm4_usb_download.jpg]]&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi CM4 DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi CM4 DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  hifi_pcm5122.dtbo  pdmmic.dtbo        sdio.dtbo        waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo          pwm_c-beeper.dtbo  spi0.dtbo        waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo          pwm_cd-c.dtbo      spi0_flash.dtbo    wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
  i2s.dtbo           pwm_cd.dtbo        uart1_cts_rts.dtbo i2smic.dtbo    &lt;br /&gt;
  pwm_ef.dtbo        uart1.dtbo         os08a10.dtbo     pwm_ef-f.dtbo   uart2.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-CM4#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 26pins gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 26pins status.&lt;br /&gt;
[[File:cm4_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python setup.py clean --all&lt;br /&gt;
  $ sudo python setup.py build install&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
===EC20 LTE 4G Module===&lt;br /&gt;
:1. AT test&lt;br /&gt;
:After the module is connected and Linux OS bootup. several ttyUSB* device files are created in the directory /dev. For EC20, /dev/ttyUSB2 is the AT port.&lt;br /&gt;
&lt;br /&gt;
:2. Connect Network via qmi_wwan on Ubuntu Desktop&lt;br /&gt;
&lt;br /&gt;
:Click edit connections in network manager menu&lt;br /&gt;
:[[File:ec20_desktop_0.png]]&lt;br /&gt;
&lt;br /&gt;
:Add a new mobile broadband connection&lt;br /&gt;
:[[File:ec20_desktop_1.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose qmi channel device&lt;br /&gt;
::When the qmi_wwan_q driver has been installed in the module, a network device and a QMI channel are created. The network device is named as wwanX and the QMI channel is /dev/cdc-wdmX. The network device is used for data transmission, and QMI channel is used for QMI message interaction&lt;br /&gt;
:[[File:ec20_desktop_2.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider's country region&lt;br /&gt;
:[[File:ec20_desktop_3.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider.&lt;br /&gt;
:[[File:ec20_desktop_4.png]]&lt;br /&gt;
:[[File:ec20_desktop_5.png]]&lt;br /&gt;
:Set connection name, carrier connection username/password and APN if needed.&lt;br /&gt;
:[[File:ec20_desktop_6.png]]&lt;br /&gt;
&lt;br /&gt;
:Setup finished, now you can connect it.&lt;br /&gt;
:[[File:ec20_desktop_7.png]]&lt;br /&gt;
&lt;br /&gt;
:3. Connect Network via pppd on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:Install pppd&lt;br /&gt;
  $ sudo apt install ipppd&lt;br /&gt;
&lt;br /&gt;
:Change AT device, username and password to your local carrier in /etc/ppp/peers/quectel-ppp&lt;br /&gt;
:[[File:ec20_server_pppd_uname.png]]&lt;br /&gt;
&lt;br /&gt;
:Change APN to your local carrier in /etc/ppp/peers/quectel-chat-connect&lt;br /&gt;
:[[File:ec20_server_pppd_apn.png]]&lt;br /&gt;
&lt;br /&gt;
: Two ways command to start pppd, you can check the process of PPP calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_pppd.log here].&lt;br /&gt;
  # pppd call quectel-ppp &amp;amp;&lt;br /&gt;
::or&lt;br /&gt;
  # quectel-pppd.sh /dev/ttyUSB2 &amp;lt;apn&amp;gt; &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Terminate pppd process:&lt;br /&gt;
  # quectel-ppp-kill&lt;br /&gt;
&lt;br /&gt;
:4. Connect Network via qmi_wwan on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:[quectel-CM] is a connection manager program for you to set up data connection manually. You can check the process of qmi_wwan calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_qmiwwan.log here].&lt;br /&gt;
&lt;br /&gt;
  # quectel-CM &amp;amp;&lt;br /&gt;
&lt;br /&gt;
:Terminate quectel-CM process:&lt;br /&gt;
&lt;br /&gt;
  # killall quectel-CM&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from SSD===&lt;br /&gt;
:A311d soc rom and  [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp BPI-M2S-bsp] uboot are both not support nvme boot, so the only way for booting linux from SSD is create a bootable sdcard or emmc with bootloader and boot partition flashed, then load rootfs from SSD. After bootup, everything will run from SSD. You need a minipcie to nvme adapter board because bananapi cm4io has a minipcie slot onboard.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_CM4#Install_Image_to_SDcard flash the CM4 Linux image to sdcard or emmc] for bootable and also flash it to the nvme ssd for loading rootfs.&lt;br /&gt;
:2. Bootup the CM4 board with [https://wiki.banana-pi.org/Getting_Started_with_CM4#Boot_Sequence sdcard or emmc], modify /boot/boot.ini to load rootfs from nvme partition for kernel.&lt;br /&gt;
  diff a/boot/boot.ini b/boot/boot.ini&lt;br /&gt;
  index 2222e79..c485067 100755&lt;br /&gt;
  --- a/boot/boot.ini&lt;br /&gt;
  +++ b/boot/boot.ini&lt;br /&gt;
  @@ -20,6 +20,8 @@ fi;&lt;br /&gt;
 &lt;br /&gt;
   if test &amp;quot;${devtype}&amp;quot; = &amp;quot;usb&amp;quot;; then setenv rootfsdev &amp;quot;/dev/sda2&amp;quot;; fi&lt;br /&gt;
 &lt;br /&gt;
  +# force set root=/dev/nvme0n1p2&lt;br /&gt;
  +setenv rootfsdev &amp;quot;/dev/nvme0n1p2&amp;quot;&lt;br /&gt;
  +&lt;br /&gt;
   # Load env.txt&lt;br /&gt;
   fatload ${devtype} ${devno}:1 ${env_loadaddr} env.txt&lt;br /&gt;
   env import -t ${env_loadaddr} ${filesize};&lt;br /&gt;
:3. Reboot the system, kernel will load rootfs from nvme ssd.&lt;br /&gt;
:[[File:cm4_ssd_rootfs.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your SSD on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and nvme ssd (Samsung 970EVOPlus)&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Nvme SSD Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 60.67 MB/s || 148.80 MB/s || 351.29 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 56.71 MB/s || 141.02 MB/s || 347.03 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 14 MB/s || 51.0 MB/s || 244 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2176 IOPS (8704 KB/s) || 8438 IOPS (33753 KB/s) || 101386 IOPS (405544 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 932 IOPS (3729 KB/s) || 10876 IOPS (43505 KB/s) || 43206 IOPS (172827 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 8586 KB/s || 20311 KB/s || 119475 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 2385 KB/s || 19016 KB/s || 90619 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 6734 KB/s || 20807 KB/s || 51517 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 3737 KB/s || 22731 KB/s || 95139 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1076 || Score: 5446 || Score: 24550&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Disable SDcard UHS  mode===&lt;br /&gt;
:Add disableuhs option to kernel bootargs in /boot/env.txt to disable sdcard uhs capability&lt;br /&gt;
&lt;br /&gt;
  # User kernel args&lt;br /&gt;
  # Add customer kernel args here&lt;br /&gt;
  user_kernel_args=pci=pcie_bus_safe disableuhs&lt;br /&gt;
&lt;br /&gt;
===Enable Wifi and BT===&lt;br /&gt;
:CM4 has onboard wifi/bt RTL8822CS, and is not enabled in default image, you can enable it with the following procedure.&lt;br /&gt;
&lt;br /&gt;
:1. Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:2. Install bluetooth packages for server images&lt;br /&gt;
  $ sudo apt update&lt;br /&gt;
  $ sudo apt install bluez rfkill&lt;br /&gt;
&lt;br /&gt;
:3. Reboot system&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
&lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17278</id>
		<title>Getting Started with CM4</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17278"/>
				<updated>2024-07-05T08:14:02Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_1.jpg|thumb|[[Banana Pi BPI-CM4]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_2.jpg|thumb|[[BPI-CM4 Computer module and development Kit]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_1.jpg|thumb|[[Banana Pi BPI-CM5]] with A311D2 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_5.jpg|thumb|[[Banana Pi BPI-CM5]] with BPI-CM4 base board]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
&lt;br /&gt;
BananaPi BPI-CM4 new design with Amlogic A311D Quad core ARM Cortex-A73 and dual core ARM Cortex-A53 CPU ,ARM G52 MP4(6EE) GPU,NPU for AI at 5.0 TOPS, support Camera and MIPI-CSI interface ,HDMI output,2 Gigabit port . 4G RAM and 16 GB eMMC flash.&lt;br /&gt;
&lt;br /&gt;
[[Banana Pi BPI-CM4]]&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Short the usb boot test point on the main board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later,  the board will enter usb download mode and be identified correctly by PC. You can also enter usb download mode with adb command &amp;quot;adb reboot update&amp;quot; or console command &amp;quot;reboot update&amp;quot; if a bootable android already flashed, make sure typec usb connected to PC before doing this. &lt;br /&gt;
:[[File:cm4_usb_download.jpg]]&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi CM4 DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi CM4 DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  hifi_pcm5122.dtbo  pdmmic.dtbo        sdio.dtbo        waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo          pwm_c-beeper.dtbo  spi0.dtbo        waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo          pwm_cd-c.dtbo      spi0_flash.dtbo    wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
  i2s.dtbo           pwm_cd.dtbo        uart1_cts_rts.dtbo i2smic.dtbo    &lt;br /&gt;
  pwm_ef.dtbo        uart1.dtbo         os08a10.dtbo     pwm_ef-f.dtbo   uart2.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-CM4#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 26pins gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 26pins status.&lt;br /&gt;
[[File:cm4_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-adafruit, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python setup.py clean --all&lt;br /&gt;
  $ sudo python setup.py build install&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
===EC20 LTE 4G Module===&lt;br /&gt;
:1. AT test&lt;br /&gt;
:After the module is connected and Linux OS bootup. several ttyUSB* device files are created in the directory /dev. For EC20, /dev/ttyUSB2 is the AT port.&lt;br /&gt;
&lt;br /&gt;
:2. Connect Network via qmi_wwan on Ubuntu Desktop&lt;br /&gt;
&lt;br /&gt;
:Click edit connections in network manager menu&lt;br /&gt;
:[[File:ec20_desktop_0.png]]&lt;br /&gt;
&lt;br /&gt;
:Add a new mobile broadband connection&lt;br /&gt;
:[[File:ec20_desktop_1.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose qmi channel device&lt;br /&gt;
::When the qmi_wwan_q driver has been installed in the module, a network device and a QMI channel are created. The network device is named as wwanX and the QMI channel is /dev/cdc-wdmX. The network device is used for data transmission, and QMI channel is used for QMI message interaction&lt;br /&gt;
:[[File:ec20_desktop_2.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider's country region&lt;br /&gt;
:[[File:ec20_desktop_3.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider.&lt;br /&gt;
:[[File:ec20_desktop_4.png]]&lt;br /&gt;
:[[File:ec20_desktop_5.png]]&lt;br /&gt;
:Set connection name, carrier connection username/password and APN if needed.&lt;br /&gt;
:[[File:ec20_desktop_6.png]]&lt;br /&gt;
&lt;br /&gt;
:Setup finished, now you can connect it.&lt;br /&gt;
:[[File:ec20_desktop_7.png]]&lt;br /&gt;
&lt;br /&gt;
:3. Connect Network via pppd on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:Install pppd&lt;br /&gt;
  $ sudo apt install ipppd&lt;br /&gt;
&lt;br /&gt;
:Change AT device, username and password to your local carrier in /etc/ppp/peers/quectel-ppp&lt;br /&gt;
:[[File:ec20_server_pppd_uname.png]]&lt;br /&gt;
&lt;br /&gt;
:Change APN to your local carrier in /etc/ppp/peers/quectel-chat-connect&lt;br /&gt;
:[[File:ec20_server_pppd_apn.png]]&lt;br /&gt;
&lt;br /&gt;
: Two ways command to start pppd, you can check the process of PPP calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_pppd.log here].&lt;br /&gt;
  # pppd call quectel-ppp &amp;amp;&lt;br /&gt;
::or&lt;br /&gt;
  # quectel-pppd.sh /dev/ttyUSB2 &amp;lt;apn&amp;gt; &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Terminate pppd process:&lt;br /&gt;
  # quectel-ppp-kill&lt;br /&gt;
&lt;br /&gt;
:4. Connect Network via qmi_wwan on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:[quectel-CM] is a connection manager program for you to set up data connection manually. You can check the process of qmi_wwan calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_qmiwwan.log here].&lt;br /&gt;
&lt;br /&gt;
  # quectel-CM &amp;amp;&lt;br /&gt;
&lt;br /&gt;
:Terminate quectel-CM process:&lt;br /&gt;
&lt;br /&gt;
  # killall quectel-CM&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from SSD===&lt;br /&gt;
:A311d soc rom and  [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp BPI-M2S-bsp] uboot are both not support nvme boot, so the only way for booting linux from SSD is create a bootable sdcard or emmc with bootloader and boot partition flashed, then load rootfs from SSD. After bootup, everything will run from SSD. You need a minipcie to nvme adapter board because bananapi cm4io has a minipcie slot onboard.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_CM4#Install_Image_to_SDcard flash the CM4 Linux image to sdcard or emmc] for bootable and also flash it to the nvme ssd for loading rootfs.&lt;br /&gt;
:2. Bootup the CM4 board with [https://wiki.banana-pi.org/Getting_Started_with_CM4#Boot_Sequence sdcard or emmc], modify /boot/boot.ini to load rootfs from nvme partition for kernel.&lt;br /&gt;
  diff a/boot/boot.ini b/boot/boot.ini&lt;br /&gt;
  index 2222e79..c485067 100755&lt;br /&gt;
  --- a/boot/boot.ini&lt;br /&gt;
  +++ b/boot/boot.ini&lt;br /&gt;
  @@ -20,6 +20,8 @@ fi;&lt;br /&gt;
 &lt;br /&gt;
   if test &amp;quot;${devtype}&amp;quot; = &amp;quot;usb&amp;quot;; then setenv rootfsdev &amp;quot;/dev/sda2&amp;quot;; fi&lt;br /&gt;
 &lt;br /&gt;
  +# force set root=/dev/nvme0n1p2&lt;br /&gt;
  +setenv rootfsdev &amp;quot;/dev/nvme0n1p2&amp;quot;&lt;br /&gt;
  +&lt;br /&gt;
   # Load env.txt&lt;br /&gt;
   fatload ${devtype} ${devno}:1 ${env_loadaddr} env.txt&lt;br /&gt;
   env import -t ${env_loadaddr} ${filesize};&lt;br /&gt;
:3. Reboot the system, kernel will load rootfs from nvme ssd.&lt;br /&gt;
:[[File:cm4_ssd_rootfs.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your SSD on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and nvme ssd (Samsung 970EVOPlus)&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Nvme SSD Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 60.67 MB/s || 148.80 MB/s || 351.29 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 56.71 MB/s || 141.02 MB/s || 347.03 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 14 MB/s || 51.0 MB/s || 244 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2176 IOPS (8704 KB/s) || 8438 IOPS (33753 KB/s) || 101386 IOPS (405544 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 932 IOPS (3729 KB/s) || 10876 IOPS (43505 KB/s) || 43206 IOPS (172827 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 8586 KB/s || 20311 KB/s || 119475 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 2385 KB/s || 19016 KB/s || 90619 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 6734 KB/s || 20807 KB/s || 51517 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 3737 KB/s || 22731 KB/s || 95139 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1076 || Score: 5446 || Score: 24550&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Disable SDcard UHS  mode===&lt;br /&gt;
:Add disableuhs option to kernel bootargs in /boot/env.txt to disable sdcard uhs capability&lt;br /&gt;
&lt;br /&gt;
  # User kernel args&lt;br /&gt;
  # Add customer kernel args here&lt;br /&gt;
  user_kernel_args=pci=pcie_bus_safe disableuhs&lt;br /&gt;
&lt;br /&gt;
===Enable Wifi and BT===&lt;br /&gt;
:CM4 has onboard wifi/bt RTL8822CS, and is not enabled in default image, you can enable it with the following procedure.&lt;br /&gt;
&lt;br /&gt;
:1. Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:2. Install bluetooth packages for server images&lt;br /&gt;
  $ sudo apt update&lt;br /&gt;
  $ sudo apt install bluez rfkill&lt;br /&gt;
&lt;br /&gt;
:3. Reboot system&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
&lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17277</id>
		<title>Getting Started with CM4</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_CM4&amp;diff=17277"/>
				<updated>2024-07-05T08:10:56Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_1.jpg|thumb|[[Banana Pi BPI-CM4]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM4_2.jpg|thumb|[[BPI-CM4 Computer module and development Kit]] with A311D design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_1.jpg|thumb|[[Banana Pi BPI-CM5]] with A311D2 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-CM5_5.jpg|thumb|[[Banana Pi BPI-CM5]] with BPI-CM4 base board]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
&lt;br /&gt;
BananaPi BPI-CM4 new design with Amlogic A311D Quad core ARM Cortex-A73 and dual core ARM Cortex-A53 CPU ,ARM G52 MP4(6EE) GPU,NPU for AI at 5.0 TOPS, support Camera and MIPI-CSI interface ,HDMI output,2 Gigabit port . 4G RAM and 16 GB eMMC flash.&lt;br /&gt;
&lt;br /&gt;
[[Banana Pi BPI-CM4]]&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Short the usb boot test point on the main board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later,  the board will enter usb download mode and be identified correctly by PC. You can also enter usb download mode with adb command &amp;quot;adb reboot update&amp;quot; or console command &amp;quot;reboot update&amp;quot; if a bootable android already flashed, make sure typec usb connected to PC before doing this. &lt;br /&gt;
:[[File:cm4_usb_download.jpg]]&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi CM4 DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi CM4 DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-CM4#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-cm4-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  hifi_pcm5122.dtbo  pdmmic.dtbo        sdio.dtbo        waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo          pwm_c-beeper.dtbo  spi0.dtbo        waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo          pwm_cd-c.dtbo      spi0_flash.dtbo    wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
  i2s.dtbo           pwm_cd.dtbo        uart1_cts_rts.dtbo i2smic.dtbo    &lt;br /&gt;
  pwm_ef.dtbo        uart1.dtbo         os08a10.dtbo     pwm_ef-f.dtbo   uart2.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-CM4#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 26pins gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 26pins status.&lt;br /&gt;
[[File:cm4_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:[https://github.com/Dangku/amlogic-wiringPi/blob/master/examples/blinkall.c blinkall], blink all pin header gpios, no extend board.&lt;br /&gt;
:[https://github.com/Dangku/amlogic-wiringPi/blob/master/examples/lcd-bpi.c lcd1602-pi], [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:[https://github.com/Dangku/amlogic-wiringPi/blob/master/examples/52pi-bpi.c 52pi-bpi], [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:[https://github.com/Dangku/amlogic-wiringPi/blob/master/examples/matrixled-bpi.c matrixled-bpi], [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:[https://github.com/Dangku/amlogic-wiringPi/blob/master/examples/berryclip-bpi.c berryclip-bpi], [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python setup.py clean --all&lt;br /&gt;
  $ sudo python setup.py build install&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python python-dev python-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
===EC20 LTE 4G Module===&lt;br /&gt;
:1. AT test&lt;br /&gt;
:After the module is connected and Linux OS bootup. several ttyUSB* device files are created in the directory /dev. For EC20, /dev/ttyUSB2 is the AT port.&lt;br /&gt;
&lt;br /&gt;
:2. Connect Network via qmi_wwan on Ubuntu Desktop&lt;br /&gt;
&lt;br /&gt;
:Click edit connections in network manager menu&lt;br /&gt;
:[[File:ec20_desktop_0.png]]&lt;br /&gt;
&lt;br /&gt;
:Add a new mobile broadband connection&lt;br /&gt;
:[[File:ec20_desktop_1.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose qmi channel device&lt;br /&gt;
::When the qmi_wwan_q driver has been installed in the module, a network device and a QMI channel are created. The network device is named as wwanX and the QMI channel is /dev/cdc-wdmX. The network device is used for data transmission, and QMI channel is used for QMI message interaction&lt;br /&gt;
:[[File:ec20_desktop_2.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider's country region&lt;br /&gt;
:[[File:ec20_desktop_3.png]]&lt;br /&gt;
&lt;br /&gt;
:Choose carrier provider.&lt;br /&gt;
:[[File:ec20_desktop_4.png]]&lt;br /&gt;
:[[File:ec20_desktop_5.png]]&lt;br /&gt;
:Set connection name, carrier connection username/password and APN if needed.&lt;br /&gt;
:[[File:ec20_desktop_6.png]]&lt;br /&gt;
&lt;br /&gt;
:Setup finished, now you can connect it.&lt;br /&gt;
:[[File:ec20_desktop_7.png]]&lt;br /&gt;
&lt;br /&gt;
:3. Connect Network via pppd on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:Install pppd&lt;br /&gt;
  $ sudo apt install ipppd&lt;br /&gt;
&lt;br /&gt;
:Change AT device, username and password to your local carrier in /etc/ppp/peers/quectel-ppp&lt;br /&gt;
:[[File:ec20_server_pppd_uname.png]]&lt;br /&gt;
&lt;br /&gt;
:Change APN to your local carrier in /etc/ppp/peers/quectel-chat-connect&lt;br /&gt;
:[[File:ec20_server_pppd_apn.png]]&lt;br /&gt;
&lt;br /&gt;
: Two ways command to start pppd, you can check the process of PPP calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_pppd.log here].&lt;br /&gt;
  # pppd call quectel-ppp &amp;amp;&lt;br /&gt;
::or&lt;br /&gt;
  # quectel-pppd.sh /dev/ttyUSB2 &amp;lt;apn&amp;gt; &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Terminate pppd process:&lt;br /&gt;
  # quectel-ppp-kill&lt;br /&gt;
&lt;br /&gt;
:4. Connect Network via qmi_wwan on Ubuntu&amp;amp;Debian Server&lt;br /&gt;
&lt;br /&gt;
:[quectel-CM] is a connection manager program for you to set up data connection manually. You can check the process of qmi_wwan calling setup log [https://github.com/Dangku/readme/blob/master/cm4/ec20_qmiwwan.log here].&lt;br /&gt;
&lt;br /&gt;
  # quectel-CM &amp;amp;&lt;br /&gt;
&lt;br /&gt;
:Terminate quectel-CM process:&lt;br /&gt;
&lt;br /&gt;
  # killall quectel-CM&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from SSD===&lt;br /&gt;
:A311d soc rom and  [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp BPI-M2S-bsp] uboot are both not support nvme boot, so the only way for booting linux from SSD is create a bootable sdcard or emmc with bootloader and boot partition flashed, then load rootfs from SSD. After bootup, everything will run from SSD. You need a minipcie to nvme adapter board because bananapi cm4io has a minipcie slot onboard.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_CM4#Install_Image_to_SDcard flash the CM4 Linux image to sdcard or emmc] for bootable and also flash it to the nvme ssd for loading rootfs.&lt;br /&gt;
:2. Bootup the CM4 board with [https://wiki.banana-pi.org/Getting_Started_with_CM4#Boot_Sequence sdcard or emmc], modify /boot/boot.ini to load rootfs from nvme partition for kernel.&lt;br /&gt;
  diff a/boot/boot.ini b/boot/boot.ini&lt;br /&gt;
  index 2222e79..c485067 100755&lt;br /&gt;
  --- a/boot/boot.ini&lt;br /&gt;
  +++ b/boot/boot.ini&lt;br /&gt;
  @@ -20,6 +20,8 @@ fi;&lt;br /&gt;
 &lt;br /&gt;
   if test &amp;quot;${devtype}&amp;quot; = &amp;quot;usb&amp;quot;; then setenv rootfsdev &amp;quot;/dev/sda2&amp;quot;; fi&lt;br /&gt;
 &lt;br /&gt;
  +# force set root=/dev/nvme0n1p2&lt;br /&gt;
  +setenv rootfsdev &amp;quot;/dev/nvme0n1p2&amp;quot;&lt;br /&gt;
  +&lt;br /&gt;
   # Load env.txt&lt;br /&gt;
   fatload ${devtype} ${devno}:1 ${env_loadaddr} env.txt&lt;br /&gt;
   env import -t ${env_loadaddr} ${filesize};&lt;br /&gt;
:3. Reboot the system, kernel will load rootfs from nvme ssd.&lt;br /&gt;
:[[File:cm4_ssd_rootfs.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your SSD on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and nvme ssd (Samsung 970EVOPlus)&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Nvme SSD Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 60.67 MB/s || 148.80 MB/s || 351.29 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 56.71 MB/s || 141.02 MB/s || 347.03 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 14 MB/s || 51.0 MB/s || 244 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2176 IOPS (8704 KB/s) || 8438 IOPS (33753 KB/s) || 101386 IOPS (405544 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 932 IOPS (3729 KB/s) || 10876 IOPS (43505 KB/s) || 43206 IOPS (172827 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 8586 KB/s || 20311 KB/s || 119475 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 2385 KB/s || 19016 KB/s || 90619 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 6734 KB/s || 20807 KB/s || 51517 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 3737 KB/s || 22731 KB/s || 95139 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1076 || Score: 5446 || Score: 24550&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Disable SDcard UHS  mode===&lt;br /&gt;
:Add disableuhs option to kernel bootargs in /boot/env.txt to disable sdcard uhs capability&lt;br /&gt;
&lt;br /&gt;
  # User kernel args&lt;br /&gt;
  # Add customer kernel args here&lt;br /&gt;
  user_kernel_args=pci=pcie_bus_safe disableuhs&lt;br /&gt;
&lt;br /&gt;
===Enable Wifi and BT===&lt;br /&gt;
:CM4 has onboard wifi/bt RTL8822CS, and is not enabled in default image, you can enable it with the following procedure.&lt;br /&gt;
&lt;br /&gt;
:1. Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:2. Install bluetooth packages for server images&lt;br /&gt;
  $ sudo apt update&lt;br /&gt;
  $ sudo apt install bluez rfkill&lt;br /&gt;
&lt;br /&gt;
:3. Reboot system&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
&lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17276</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17276"/>
				<updated>2024-07-05T08:10:07Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Luma.Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17275</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17275"/>
				<updated>2024-07-05T08:09:46Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi2-Python */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17274</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17274"/>
				<updated>2024-07-05T08:09:24Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* RPi.GPIO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17273</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17273"/>
				<updated>2024-07-05T08:08:48Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17272</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17272"/>
				<updated>2024-07-05T08:08:17Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:oled, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17271</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17271"/>
				<updated>2024-07-05T08:07:40Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-bpi, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi-bpi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled-bpi, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip-bpi, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17270</id>
		<title>Getting Started with M2S</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M2S&amp;diff=17270"/>
				<updated>2024-07-05T08:07:18Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_S922_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic S922x chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_poe.jpg|thumb|BPI-M2S with [[BPI-9600 IEEE 802.3af PoE module]]]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_with_wifi_and_BT_module.jpg|thumb|BPI-M2S with Wifi&amp;amp;BT module]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]] Amlogic S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable, a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. Only A311D variant board have camera, mipi panel and npu support.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via type-c, only support windows.&lt;br /&gt;
:2. Download the latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Android android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold USB button on the board, plugin type-c usb cable to PC or press the RST button if power adapter already connected, about two seconds later, release the button, the board will be identified correctly.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_3.png]]&lt;br /&gt;
:[[File:m2s_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button of the download tool and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the type-c usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_install_5.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1rANGEB-1MLPCBXqOR5aYCg?pwd=8888 BaiduPan(pincode: 8888)] or [https://drive.google.com/drive/folders/1INIABp_MbB5UcwfqujTngGLOZN7YGuWp?usp=share_link GoogleDrive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-A311D-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M2S DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c1|| enable i2c 1&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m2s:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m2s:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m2s:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/bananapi/bananapi_m2s/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/bananapi/bananapi_m2s/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm64/boot/dts/amlogic/overlay/bananapi_m2s/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default android release image only support one mipi panel because hw has no detect logic for different panel at boot, so [800x1280 bpi panel] enabled as default, but you can change to [1200x1920 bpi panel] as defualt in Settings-&amp;gt;Panel Output&lt;br /&gt;
 &lt;br /&gt;
:[[File:m2s_panel_switch.png]]&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
The two 10&amp;quot; mipi panels are all portrait hw display, so the default android release image is portrait mode, but you can rotate it to 90/180/270 in two ways.&lt;br /&gt;
&lt;br /&gt;
:1. UI Rotation in Settings-&amp;gt;Display-&amp;gt;Screen rotation&lt;br /&gt;
:[[File:m2s-rotation.png]]&lt;br /&gt;
&lt;br /&gt;
:2. SurfaceFlinger rotation, need [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Build_Android_Source_Code modify android source code and build]&lt;br /&gt;
:Change the default sf rotation property&lt;br /&gt;
    diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    index 1f51703..d592a44 100644&lt;br /&gt;
    --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk&lt;br /&gt;
    @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
     else&lt;br /&gt;
     PRODUCT_PROPERTY_OVERRIDES += \&lt;br /&gt;
         ro.sf.lcd_density=213 \&lt;br /&gt;
     -    ro.sf.primary_display_orientation=0&lt;br /&gt;
    +    ro.sf.primary_display_orientation=90&lt;br /&gt;
     endif&lt;br /&gt;
&lt;br /&gt;
:Change the touch panel rotation in dts&lt;br /&gt;
    diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    index 4a698b0..3d41b63 100755&lt;br /&gt;
    --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts&lt;br /&gt;
    @@ -876,8 +876,8 @@&lt;br /&gt;
                    reg = &amp;lt;0x5d&amp;gt;;&lt;br /&gt;
                    reset-gpio = &amp;lt;&amp;amp;gpio GPIOA_6 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
                    irq-gpio = &amp;lt;&amp;amp;gpio GPIOA_5 GPIO_ACTIVE_HIGH&amp;gt;;&lt;br /&gt;
    -               rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
    -               //rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
   +               //rotation = &amp;lt;4&amp;gt;; /* sf_rotation 0 */&lt;br /&gt;
   +               rotation = &amp;lt;0&amp;gt;; /* sf_rotation 90*/&lt;br /&gt;
                    //rotation = &amp;lt;5&amp;gt;; /* sf_rotation 180 */&lt;br /&gt;
                    //rotation = &amp;lt;3&amp;gt;; /* sf_rotation 270 */&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 16bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Flogo_create_tools%2Fm2s_android_bootlogo_tool.zip m2s_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m2s_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m2s_android_bootlogo_tool/&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m2s_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:6. Download Linux latest [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:7. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:8. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M2S#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
::[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m2s-xxx.img.zip --drive /dev/disk2 --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install the linux image in udisk with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_M2S#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m2s-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m2s-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:5. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/khadas-g12b-v2015.01-m2s u-boot] the [https://github.com/Dangku/amlogic-linux/tree/khadas-g12b-4.9.y-m2s kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M2S-bsp/tree/master/aml-pack/g12b/bpi-m2s/linux BPI-M2S-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c2.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/env.txt to enable what you want.&lt;br /&gt;
&lt;br /&gt;
  # Device Tree Overlays&lt;br /&gt;
  #   uart1           -- Enable UART1 (uart_A, GPIO Header PIN8 &amp;amp; PIN10)&lt;br /&gt;
  #   pwm_c           -- Enable PWM_C (GPIO Header PIN7)&lt;br /&gt;
  #   i2c2            -- Enable i2c2 (GPIO Header PIN3 &amp;amp; PIN5)&lt;br /&gt;
  #   spi0            -- Enable SPI0 (GPIO Header PIN19 &amp;amp; PIN21 &amp;amp; PIN23 &amp;amp; PIN24)&lt;br /&gt;
  overlays=&amp;quot;i2c2 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===Enable Camera===&lt;br /&gt;
:The linux release image is camera disabled default, according to the following configuration, it can be enabled by yourself.&lt;br /&gt;
&lt;br /&gt;
:1. Update the [https://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlays] env in /boot/env.txt to enable camera dtbo.&lt;br /&gt;
&lt;br /&gt;
  overlays=&amp;quot;os08a10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:2. Add camera modules to /etc/modules&lt;br /&gt;
  iv009_isp_iq&lt;br /&gt;
  iv009_isp_lens&lt;br /&gt;
  iv009_isp_sensor&lt;br /&gt;
  iv009_isp&lt;br /&gt;
&lt;br /&gt;
:3. Create and add camera modules options to /etc/modprobe.d/os08a10.conf&lt;br /&gt;
  #choose camera calibration parameters&lt;br /&gt;
  options iv009_isp_iq cali_name=0&lt;br /&gt;
  #choose isp register sequence&lt;br /&gt;
  options iv009_isp_sensor isp_seq_num=0&lt;br /&gt;
&lt;br /&gt;
:4. Enable camera isp systemd service&lt;br /&gt;
  $ sudo systemctl enable camera_isp_3a_server.service&lt;br /&gt;
&lt;br /&gt;
:Camera device is /dev/video0 after reboot.&lt;br /&gt;
&lt;br /&gt;
===Switch Mipi Panel===&lt;br /&gt;
:The default linux release image only support one mipi panel because hw has no detect logic for different panel at boot, so 800x1280 bpi panel enabled as default, but you can change to [1200x1920 bpi panel] as defualt in /boot/lcd_env.txt&lt;br /&gt;
  # Mipi panel type&lt;br /&gt;
  #    Symbol    | Resolution&lt;br /&gt;
  # ----------------------+-------------&lt;br /&gt;
  #    &amp;quot;lcd_0&amp;quot;   | 10&amp;quot; 800x1280 panel&lt;br /&gt;
  #    &amp;quot;lcd_1&amp;quot;   | 10&amp;quot; 1200x1920 panel&lt;br /&gt;
  panel_type=lcd_0&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Dual display is not work on linux, so disconnect hdmi cable when mipi used.&lt;br /&gt;
&lt;br /&gt;
===Panel Rotation===&lt;br /&gt;
:The two 10&amp;quot; mipi panels are all portrait hw display, so the default release image is portrait mode, but you can rotate it to 90/180/270. &lt;br /&gt;
&lt;br /&gt;
:For Desktop image, create a xorg configuration file /usr/share/X11/xorg.conf.d/10-fbdev-rotate.conf with contents:&lt;br /&gt;
&lt;br /&gt;
  Section &amp;quot;Device&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Configured Video Device&amp;quot;&lt;br /&gt;
      # Rotate off&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;off&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees&lt;br /&gt;
      Option &amp;quot;Rotate&amp;quot; &amp;quot;CW&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;UD&amp;quot;&lt;br /&gt;
      # Rotate counter clockwise, 270 degrees&lt;br /&gt;
  #   Option &amp;quot;Rotate&amp;quot; &amp;quot;CCW&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
  &lt;br /&gt;
  Section &amp;quot;InputClass&amp;quot;&lt;br /&gt;
      Identifier &amp;quot;Coordinate Transformation Matrix&amp;quot;&lt;br /&gt;
      MatchIsTouchscreen &amp;quot;on&amp;quot;&lt;br /&gt;
      MatchProduct &amp;quot;goodix-ts&amp;quot;&lt;br /&gt;
      MatchDevicePath &amp;quot;/dev/input/event0&amp;quot;&lt;br /&gt;
      MatchDriver &amp;quot;libinput&amp;quot;&lt;br /&gt;
      # Rotate Right / clockwise, 90 degrees &lt;br /&gt;
      Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 1 0 -1 0 1 0 0 1&amp;quot;&lt;br /&gt;
      # Rotate upside down, 180 degrees&lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;-1 0 1 0 -1 1 0 0 1&amp;quot;&lt;br /&gt;
      # otate counter clockwise, 270 degrees &lt;br /&gt;
  #   Option &amp;quot;CalibrationMatrix&amp;quot; &amp;quot;0 -1 1 1 0 0 0 0 1&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  EndSection&lt;br /&gt;
&lt;br /&gt;
:For Server image, you can change the framebuffer rotation in two ways:&lt;br /&gt;
&lt;br /&gt;
:1. Sysfs dynamically change.&lt;br /&gt;
&lt;br /&gt;
  echo 0 &amp;gt; /sys/class/graphics/fbcon/rotate    //origin 0 degree&lt;br /&gt;
  echo 1 &amp;gt; /sys/class/graphics/fbcon/rotate    //90 degree&lt;br /&gt;
  echo 2 &amp;gt; /sys/class/graphics/fbcon/rotate    //180 degree&lt;br /&gt;
  echo 3 &amp;gt; /sys/class/graphics/fbcon/rotate    //270 degree&lt;br /&gt;
&lt;br /&gt;
:2. Boot Configuration change.&lt;br /&gt;
:change the fb_rotate env in /boot/env.txt&lt;br /&gt;
&lt;br /&gt;
  # Framebuffer Rotate&lt;br /&gt;
  # 0 - origin 0 degree&lt;br /&gt;
  # 1 - 90 degree&lt;br /&gt;
  # 2 - 180 degree&lt;br /&gt;
  # 3 - 270 degree&lt;br /&gt;
  fb_rotate=0&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input, pwm or software pwm, for io functions as i2c, spi, ..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m2s_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/amlogic-wiringPi/tree/master/examples amlogic-wiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-bpi, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi-bpi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled-bpi, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip-bpi, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
:build bananapi m2s RPi.GPIO with python3 instead of python because luma uses python3.&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M2S#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M2S Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/env.txt&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || hdmi_autodetect=no&lt;br /&gt;
hdmi=480x320p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1440x2560p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || hdmi_autodetect=no&lt;br /&gt;
hdmi=1536x2048p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || hdmi_autodetect=no&lt;br /&gt;
hdmi=2560x1600p60hz&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. copy the target file to /boot/firmware/ or /boot/ directory.&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the type-c usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m2s:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m2s_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    2453 bytes read in 3 ms (797.9 KiB/s)&lt;br /&gt;
    ## Executing script at 03080000&lt;br /&gt;
    Starting boot.ini...&lt;br /&gt;
    reading env.txt&lt;br /&gt;
    3483 bytes read in 7 ms (485.4 KiB/s)&lt;br /&gt;
    HDMI: Autodetect: 1080p60hz&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    10924573 bytes read in 611 ms (17.1 MiB/s)&lt;br /&gt;
    reading bananapi_m2s.dtb&lt;br /&gt;
    88054 bytes read in 12 ms (7 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/wifi_bt_rtl8822cs.dtbo&lt;br /&gt;
    729 bytes read in 6 ms (118.2 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m2s# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A '''extreme situation''' is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M2S#DTB_overlay dtb overlay]&lt;br /&gt;
    overlays=&amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17269</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17269"/>
				<updated>2024-07-05T08:06:26Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Luma.Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-bpi, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi-bpi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled-bpi, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip-bpi, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17268</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17268"/>
				<updated>2024-07-05T08:06:08Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Luma.Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-bpi, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi-bpi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled-bpi, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip-bpi, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17267</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17267"/>
				<updated>2024-07-05T08:05:06Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi2-Python */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-bpi, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi-bpi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled-bpi, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip-bpi, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi-Python.git&lt;br /&gt;
  $ cd WiringPi-Python&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17266</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17266"/>
				<updated>2024-07-05T08:04:21Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* RPi.GPIO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-bpi, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi-bpi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled-bpi, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip-bpi, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
  $ cd RPi.GPIO&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17265</id>
		<title>Getting Started with M5/M2Pro</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_M5/M2Pro&amp;diff=17265"/>
				<updated>2024-07-05T08:03:32Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* WiringPi */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_4.JPG|thumb|[[Banana Pi BPI-M5]]]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_2.jpg|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi M5 is a new generation single board computer design , use Amlogic S905X3 Quad-Core Cortex-A55 (2.0xxGHz) Processor. Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz). support 4GB LPDDR4 and 16G eMMC flash. it have 4 USB 3.0 port,1GbE LAN port, IR Reciver, Audio Jack, 1 HDMI Out and USB type-c power supply.&lt;br /&gt;
&lt;br /&gt;
Banana Pi M2Pro is the same SOC with M5, but different board layout. 2GB LPDDR4 and 16G eMMC flash, 2 USB 3.0 port,1GbE LAN port, rtl8821cu usb wifi/bt onboard, IR Reciver, 1 HDMI Out, 1 MicroUSB port,  DC power supply.&lt;br /&gt;
&lt;br /&gt;
=specifications=&lt;br /&gt;
&lt;br /&gt;
*SoC – Amlogic S905X3 quad-core Cortex-A55 processor @ up to 2.0 GHz with&lt;br /&gt;
*Mali-G31 MP2 GPU @ 650Mhz&lt;br /&gt;
*System Memory – 4GB LPDDR4&lt;br /&gt;
*Storage – 16GB eMMC flash (option up to 64GB), MicroSD slot up to 2TB&lt;br /&gt;
*Video Output – HDMI 2.1 up to 4Kp60 with HDR, CEC, EDID&lt;br /&gt;
*Audio – 3.5mm audio jack, digital HDMI audio&lt;br /&gt;
*Connectivity – Gigabit Ethernet&lt;br /&gt;
*USB – 4x USB 3.0 ports via VL817 hub controller, 1x USB-C port (for power only?)&lt;br /&gt;
*Expansion – 40-pin Raspberry Pi header with 28x GPIO, UART, I2C, SPI, PWM, and power signal (+5V, +3.3V, GND).&lt;br /&gt;
*Debugging – 3-pin debug header&lt;br /&gt;
*Misc – Reset, Power, and U-boot button; power and activity LED’s; IR receiver&lt;br /&gt;
*Power Supply – 5V @3A via USB Type-C port&lt;br /&gt;
*Dimensions – 92x60mm (Not the same as Raspberry Pi PCB size, but they probably included the connectors during measurement)&lt;br /&gt;
*Weight – 48grams&lt;br /&gt;
&lt;br /&gt;
=development=&lt;br /&gt;
&lt;br /&gt;
==Prepare==&lt;br /&gt;
:1. Prepare a usb-serial cable('''3.3V,Baud: 115200'''), a 5V/3A adaptor type-c power supply. The serial cable is used for console debug and type-c cable is used for android image download and ADB debug. M2pro is used Micro-usb port for android image download and ADB debug.&lt;br /&gt;
:2. Prepare a SDcard at least 8GB for linux development, android only support emmc boot.&lt;br /&gt;
:3. The SOC rom first boot media is emmc, so board can't bootup from SDcard if the emmc is bootable with any image flashed, more info please refer to board [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence].&lt;br /&gt;
:4. In Android SDcard is mmc0, emmc is mmc1, but in Linux SDcard is mmc1, emmc is mmc0.&lt;br /&gt;
:5. User name/password: '''pi/bananapi''' ,'''root/bananapi'''.&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download and install the [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Fimage_download_tools%2Faml_usb_burning_tool_V2_setup_v2.2.3.3.zip AML Usb Burning Tool] for android image download via USB type-c on M5 and Micro-usb on M2pro, only support windows.&lt;br /&gt;
:2. Download the latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Android_2 android image], and confirm that the md5 checksum is correct.&lt;br /&gt;
:3. M5 and M2pro are compatiable with same android image.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Usb Burning Tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open USB_Burning_Tool.exe, select menu File-&amp;gt;Import image, choose the android image file aml_upgrade_package.img.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. M5/M2pro board disconnect power, press and hold SW4 button beside 40pin header, plugin type-c usb cable(microUSB on m2pro) to PC&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:3. Click the Start button and wait for upgrade complete.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:4. After Burning successfull, Unplug the usb and connect to power supply adaptor to startup.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_install_4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:5. Click the Stop button to cancel the upgrade process and close the USB Buring Tool.&lt;br /&gt;
&lt;br /&gt;
===Install Image with Aml Flash Tool===&lt;br /&gt;
:[https://github.com/Dangku/aml-flash-tool aml-flash-tool] is a linux platform opensource image flash util for Amlogic android.&lt;br /&gt;
&lt;br /&gt;
  $ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
:1. Get Android 9.0 source code&lt;br /&gt;
&lt;br /&gt;
  $ git clone https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
:or you can get the source code tar archive from [https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888  Baidu Pan(pincode: 8888)] or [https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link  Google Drive]&lt;br /&gt;
&lt;br /&gt;
:2. Build the Android 9.0 Source code&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Android DTB overlay===&lt;br /&gt;
&lt;br /&gt;
:Bananapi M5/M2Pro DTBO idx value table, default idx value is 0 in release image.&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro DTBO idx value table'''&lt;br /&gt;
|-&lt;br /&gt;
|idx value|| device tree overlay || description&lt;br /&gt;
|-&lt;br /&gt;
| 0|| android_p_overlay|| default dtbo, no use&lt;br /&gt;
|-&lt;br /&gt;
| 1|| wifi_bt_rtl8822cs|| enable bpi rtl8822cs wifi/bt module&lt;br /&gt;
|-&lt;br /&gt;
| 2|| i2c2|| enable i2c 2&lt;br /&gt;
|-&lt;br /&gt;
| 3|| i2c3|| enable i2c 3&lt;br /&gt;
|-&lt;br /&gt;
| 4|| sdio|| enable sdio&lt;br /&gt;
|-&lt;br /&gt;
| 5|| uart1|| enable 2 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 6|| uart1_cts_rts|| enable 4 pins uart 1&lt;br /&gt;
|-&lt;br /&gt;
| 7|| uart2|| enable 2 pins uart 2&lt;br /&gt;
|-&lt;br /&gt;
| 8|| hifi_pcm5122|| enable i2s [https://shumeipai.nxez.com/hifidac-hat-for-raspberry-pi pcm5122 HiFi DAC]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:'''How to apply a new dtbo'''&lt;br /&gt;
&lt;br /&gt;
:1. ADB command via sysfs&lt;br /&gt;
&lt;br /&gt;
  root@dangku-desktop:/tmp# adb root&lt;br /&gt;
  restarting adbd as root&lt;br /&gt;
  root@dangku-desktop:/tmp# adb remount&lt;br /&gt;
  remount succeeded&lt;br /&gt;
  root@dangku-desktop:/tmp# adb shell&lt;br /&gt;
  bananapi_m5:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                                                &lt;br /&gt;
  bananapi_m5:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                                                &lt;br /&gt;
  bananapi_m5:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:2. Uart console command via sysfs&lt;br /&gt;
&lt;br /&gt;
  console:/ $ &lt;br /&gt;
  console:/ $ su&lt;br /&gt;
  console:/ # echo dtbo &amp;gt; /sys/class/unifykeys/name                              &lt;br /&gt;
  [  115.702781@0] unifykey: name_store() 1302, name dtbo, 4&lt;br /&gt;
  [  115.702856@0] unifykey: name_store() 1311&lt;br /&gt;
  console:/ #&lt;br /&gt;
  console:/ # echo &amp;quot;1&amp;quot; &amp;gt; /sys/class/unifykeys/write                              &lt;br /&gt;
  [  129.262659@0] unifykey: write_store()  is a string&lt;br /&gt;
  [  129.262733@0] unifykey: dtbo, 1, 1&lt;br /&gt;
  [  129.265312@0] unifykey: amlkey_write 393&lt;br /&gt;
  [  129.292347@1] emmc_key_write:149, write ok&lt;br /&gt;
  console:/ # &lt;br /&gt;
  console:/ # reboot&lt;br /&gt;
&lt;br /&gt;
:3. Settings App(To-Do)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:Check the bootup uart debug message and confirm which dtbo is loaded actually, here &amp;quot;1&amp;quot; means set idx=1 to apply wifi_bt_rtl8822cs dtbo.&lt;br /&gt;
&lt;br /&gt;
  load dtb from 0x1000000 ......&lt;br /&gt;
        Amlogic multi-dtb tool&lt;br /&gt;
        Single dtb detected&lt;br /&gt;
  find 2 dtbos&lt;br /&gt;
  dtbos to be applied: 1&lt;br /&gt;
  Apply dtbo 1&lt;br /&gt;
&lt;br /&gt;
:Unifykeys is stored in a specific emmc part, &amp;quot;Normal erase&amp;quot; selected in USB_Burning_Tool will not erase this data for next update, you must select &amp;quot;Erase all&amp;quot; if you want the default dtbo idx to be applied after image download.&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_android_erase_all.png]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:'''Build Android image with a specific DTBO default'''.&lt;br /&gt;
&lt;br /&gt;
:1. Default build-in overlays are defined in device/amlogic/bananapi_m5/Kernel.mk, you can add a new overlay dtbo here.&lt;br /&gt;
  DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c2 i2c3 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122&lt;br /&gt;
&lt;br /&gt;
:2. Default apply DTBO idx is defined in device/amlogic/bananapi_m5/BoardConfig.mk, you can change the idx value to set which overlay dtbo will be applied default.&lt;br /&gt;
  BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0&lt;br /&gt;
&lt;br /&gt;
:3. DTS files are in common/arch/arm/boot/dts/amlogic/overlay/bananapi_m5/&lt;br /&gt;
&lt;br /&gt;
:More info about android device tree overlays, please refer to [https://source.android.com/devices/architecture/dto google android offical site]&lt;br /&gt;
&lt;br /&gt;
===Install OpenGapps===&lt;br /&gt;
&lt;br /&gt;
:1. Download install package from [https://opengapps.org/ OpenGapps], Android release image is arm/android 9.0 variant.&lt;br /&gt;
&lt;br /&gt;
[[File:opengapps.PNG]]&lt;br /&gt;
&lt;br /&gt;
:2. Download [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fapps%2Fdevice_id_v1.3.2.apk device_id.apk].&lt;br /&gt;
:3. Copy the OpenGapp package to a udisk or sdcard root directory.&lt;br /&gt;
:4. Create a txt file named '''factory_update_param.aml''' in udisk or sdcard root directory with the following android recovery parameter content, and replace the file name with the actual downloaded package.  &lt;br /&gt;
::udisk:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
::sdcard:&lt;br /&gt;
  --wipe_cache&lt;br /&gt;
  --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip&lt;br /&gt;
&lt;br /&gt;
:5. Plugin the udisk or sdcard to the board and poweron.&lt;br /&gt;
&lt;br /&gt;
:6.OpenGapps install and certify.&lt;br /&gt;
:&amp;lt;youtube&amp;gt;fXOKmWfpqF8&amp;lt;/youtube&amp;gt;&lt;br /&gt;
:watch this video on [https://www.bilibili.com/video/BV13y4y1s77i/ bilibili]&lt;br /&gt;
&lt;br /&gt;
===IR Remote Control Custom===&lt;br /&gt;
:Before starting this work, some android basic concepts and knowledge need to be known.&lt;br /&gt;
&lt;br /&gt;
:*Linux kernel input key event.&lt;br /&gt;
:*Android keycode.&lt;br /&gt;
:*Linux keycode map to android keycode.&lt;br /&gt;
:*Android Adb function work on your PC&lt;br /&gt;
&lt;br /&gt;
:1. pull the remote files from device&lt;br /&gt;
  # adb pull /vendor/etc/remote.cfg&lt;br /&gt;
  # adb pull /vendor/etc/remote.tab &lt;br /&gt;
&lt;br /&gt;
:2. modify remote.cfg to enable remote debug message&lt;br /&gt;
:[[File:remotecfg.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.cfg back&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.cfg /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.cfg&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -d                                                  &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
&lt;br /&gt;
:3. Get the remote keycode&lt;br /&gt;
:Press your remote key one by one and then print the dmesg to get the remote custom_code and each remote key code.&lt;br /&gt;
&lt;br /&gt;
  # adb shell dmesg | grep framecode=&lt;br /&gt;
:[[File:keycode.png]]&lt;br /&gt;
&lt;br /&gt;
:custom_code = 0xfe01&lt;br /&gt;
:keycode = 0x00, 0x01, 0x09, 0x02, 0x0a, 0x05, 0x04 0x06, 0x03, 0x0b, 0x40, 0x48, 0x44&lt;br /&gt;
&lt;br /&gt;
:4. Modify remote.tab to map the scancode to android keycode&lt;br /&gt;
:[[File:remotetab.png]]&lt;br /&gt;
&lt;br /&gt;
:push remote.tab and test each key whether works&lt;br /&gt;
&lt;br /&gt;
  # adb root&lt;br /&gt;
  # adb remount&lt;br /&gt;
  # adb push remote.tab1 /vendor/etc/&lt;br /&gt;
  # adb shell&lt;br /&gt;
  m5_mbox:/ # chmod 644 /vendor/etc/remote.tab&lt;br /&gt;
  m5_mbox:/ # remotecfg -c /vendor/etc/remote.cfg -t /vendor/etc/remote.tab -d                                                                                                                               &lt;br /&gt;
  cfgdir = /vendor/etc/remote.cfg&lt;br /&gt;
  work_mode = 1&lt;br /&gt;
  repeat_enable = 0&lt;br /&gt;
  debug_enable = 1&lt;br /&gt;
  max_frame_time = 1000&lt;br /&gt;
  tabdir = /vendor/etc/remote.tab&lt;br /&gt;
  custom_name = nec-test&lt;br /&gt;
  fn_key_scancode = 0xffff&lt;br /&gt;
  cursor_left_scancode = 0xffff&lt;br /&gt;
  cursor_right_scancode = 0xffff&lt;br /&gt;
  cursor_up_scancode = 0xffff&lt;br /&gt;
  cursor_down_scancode = 0xffff&lt;br /&gt;
  cursor_ok_scancode = 0xffff&lt;br /&gt;
  custom_code = 0xfe01&lt;br /&gt;
  release_delay = 80&lt;br /&gt;
  map_size = 13&lt;br /&gt;
  key[0] = 0x74&lt;br /&gt;
  key[1] = 0x1008b&lt;br /&gt;
  key[2] = 0x90066&lt;br /&gt;
  key[3] = 0x20069&lt;br /&gt;
  key[4] = 0xa006a&lt;br /&gt;
  key[5] = 0x50067&lt;br /&gt;
  key[6] = 0x4006c&lt;br /&gt;
  key[7] = 0x6001c&lt;br /&gt;
  key[8] = 0x30072&lt;br /&gt;
  key[9] = 0xb0073&lt;br /&gt;
  key[10] = 0x40009e&lt;br /&gt;
  key[11] = 0x4800a4&lt;br /&gt;
  key[12] = 0x440071&lt;br /&gt;
&lt;br /&gt;
:5. Reboot the board&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, but you should read the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Boot_Sequence boot sequence] at first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. M5 and M2pro are compatiable with same Linux image.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure bootable EMMC is formatted if you want bootup from SDcard, more info refer to [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_EMMC_for_SDcard_Bootup Erase EMMC for SDcard Bootup]&lt;br /&gt;
&lt;br /&gt;
:5. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:6. Install bpi-tools on your Linux PC(if [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash image] with other tools, ignore this step). If you can't access this URL or any other install problem, please go to [https://github.com/bpi-sinovoip/bpi-tools bpi-tools] source repo, download and install this tools manually.&lt;br /&gt;
  $ apt-get install pv&lt;br /&gt;
  $ curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
&lt;br /&gt;
:7. Download latest [http://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux Linux Image], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:8. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:9. The wiki guide is only for [https://wiki.banana-pi.org/Banana_Pi_BPI-M5#Linux bananapi 4.9 bsp ubuntu/debian images].&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
:2. Install Image with Balena Cli on Windows, Linux and MacOS.&lt;br /&gt;
:[https://github.com/balena-io/balena-cli Balena CLI] is a Command Line Interface for balenaCloud or openBalena. It can be used to flash linux image. Download the installer or standalone package from [https://github.com/balena-io/balena-cli/releases balena-io] and [https://github.com/balena-io/balena-cli/blob/master/INSTALL.md install] it correctly to your PC, then you can use the &amp;quot;[https://docs.balena.io/reference/balena-cli/#local-flash-image local flash]&amp;quot; command option of balena to flash a linux image to sdcard or usb drive.&lt;br /&gt;
&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX&lt;br /&gt;
  $ sudo balena local flash path/to/xxx-bpi-m5-xxx.img.zip --drive /dev/sdX --yes&lt;br /&gt;
&lt;br /&gt;
:3. Install Image with dd command on Linux, umount SDcard device /dev/sdX partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
:4. Install image with bpi-tools on Linux, plug SDcard to Linux PC and run&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/sdX&lt;br /&gt;
&lt;br /&gt;
===Install Image to EMMC===&lt;br /&gt;
:1. Prepare a [https://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Install_Image_to_SDcard SDcard with Linux image] flashed and bootup board with this SDcard.&lt;br /&gt;
&lt;br /&gt;
:2. Copy Linux image to udisk, plug the udisk to board and mount it.&lt;br /&gt;
&lt;br /&gt;
:3. There are two ways to install the linux image to board.&lt;br /&gt;
  3.1 Install with dd command, umount mmcblk0p1 and mmcblk0p2 partition if mounted automatically. Actually bpi-copy is the same as this dd command.&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo unzip -p xxx-bpi-m5-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer&lt;br /&gt;
&lt;br /&gt;
  3.2 Install the linux image in udisk with bpi-tools command&lt;br /&gt;
  $ sudo apt-get install pv unzip&lt;br /&gt;
  $ sudo bpi-copy xxx-bpi-m5-xxx.img.zip /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
:4. After download complete, power off safely and eject the SDcard.&lt;br /&gt;
&lt;br /&gt;
===Build Linux Source Code===&lt;br /&gt;
:1. Get the Linux bsp source code&lt;br /&gt;
  $  git clone https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
:2. Build the bsp source code&lt;br /&gt;
&lt;br /&gt;
::Please read the source code [https://github.com/BPI-SINOVOIP/BPI-M5-bsp/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
:3. If you want build uboot and kernel separately, please download the [https://github.com/Dangku/amlogic-u-boot/tree/odroidg12-v2015.01-c4-m5 u-boot] the [https://github.com/Dangku/amlogic-linux/tree/odroidg12-4.9.y-c4-m5 kernel] only, get the toolchains, boot script and other configuration files from [https://github.com/BPI-SINOVOIP/BPI-M5-bsp BPI-M5-bsp]&lt;br /&gt;
&lt;br /&gt;
===DTB overlay===&lt;br /&gt;
:1. DTB overlay is used for 40pin gpios multi-function configuration and install in vfat boot partition, you can check the mount point with mount command.&lt;br /&gt;
  root@bananapi:~# ls /boot/overlays/&lt;br /&gt;
  custom_ir.dtbo      pwm_b-backlight.dtbo  spi0.dtbo&lt;br /&gt;
  ds3231.dtbo         pwm_c-beeper.dtbo     uart1_cts_rts.dtbo&lt;br /&gt;
  hifi_pcm5102a.dtbo  pwm_cd-c.dtbo         uart1.dtbo&lt;br /&gt;
  hifi_pcm5122.dtbo   pwm_cd.dtbo           uart2.dtbo&lt;br /&gt;
  i2c0.dtbo           pwm_ef.dtbo           waveshare_tft24_lcd.dtbo&lt;br /&gt;
  i2c1.dtbo           pwm_ef-f.dtbo         waveshare_tft35c_lcd.dtbo&lt;br /&gt;
  pwm_ab.dtbo         sdio.dtbo             waveshare_tft35c_rtp.dtbo&lt;br /&gt;
&lt;br /&gt;
:2. Update the overlays env in vfat /boot/boot.ini to enable what you want. Default i2c0, spi0 and uart1 enabled.&lt;br /&gt;
&lt;br /&gt;
  # Overlays to load&lt;br /&gt;
  # Example combinations:&lt;br /&gt;
  #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
  #   hktft32&lt;br /&gt;
  #   hktft35&lt;br /&gt;
  setenv overlays &amp;quot;i2c0 spi0 uart1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:3. Must be restart the board for overlay dtb loaded.&lt;br /&gt;
&lt;br /&gt;
===WiringPi===&lt;br /&gt;
: Note: This WiringPi only support set 40pin gpio to output, input or software pwm, for io functions as i2c, spi, pwm..., you must enable dtb overlay in boot.ini&lt;br /&gt;
&lt;br /&gt;
:1. Build and install wiringPi, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential git&lt;br /&gt;
  $ git clone https://github.com/Dangku/WiringPi&lt;br /&gt;
  $ cd WiringPi&lt;br /&gt;
  $ chmod a+x build&lt;br /&gt;
  $ sudo ./build&lt;br /&gt;
&lt;br /&gt;
:2. Run '''gpio readall''' to show all 40pins status.&lt;br /&gt;
[[File:m5_wiringpi.png]]&lt;br /&gt;
&lt;br /&gt;
:3. BPI GPIO Extend board and examples in [https://github.com/Dangku/WiringPi/tree/master/examples WiringPi/examples]&lt;br /&gt;
&lt;br /&gt;
:blinkall, blink all pin header gpios, no extend board.&lt;br /&gt;
:lcd-bpi, [http://wiki.banana-pi.org/BPI_LCD_1602_display_module BPI LCD 1602 display module] example.&lt;br /&gt;
:52pi-bpi, [http://wiki.banana-pi.org/BPI_OLED_Display_Module BPI OLED Display Module] example.&lt;br /&gt;
:matrixled-bpi, [http://wiki.banana-pi.org/BPI_RGB_LED_Matrix_Expansion_Module BPI RGB LED Matrix Expansion Module] example.&lt;br /&gt;
:berryclip-bpi, [http://wiki.banana-pi.org/BPI_BerryClip_Module BPI BerryClip Module]&lt;br /&gt;
&lt;br /&gt;
===RPi.GPIO===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-pip python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
: Create and install wheel package&lt;br /&gt;
  $ sudo python3 setup.py bdist_wheel&lt;br /&gt;
  $ sudo pip3 install dist/RPi.GPIO-XXX.whl&lt;br /&gt;
&lt;br /&gt;
: Install from git source directly without development&lt;br /&gt;
  $ sudo pip3 install git+https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
&lt;br /&gt;
: If the package is already installed, it should be uninstalled before installing the new one, or installing the new one with --force-reinstall option.&lt;br /&gt;
&lt;br /&gt;
===WiringPi2-Python===&lt;br /&gt;
&lt;br /&gt;
: Build and install, for debian, you must [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Enable_sudo_for_Debian install sudo] before build&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools swig git&lt;br /&gt;
  $ git clone --recursive  https://github.com/Dangku/WiringPi2-Python-Amlogic.git&lt;br /&gt;
  $ cd WiringPi2-Python-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
===Luma.Examples===&lt;br /&gt;
:[https://github.com/rm-hull/luma.examples luma.examples] use GPIO.BCM gpio mode default, so you should map 40pin header pins to bcm gpio number and connect the hardware correctly.&lt;br /&gt;
&lt;br /&gt;
:1. build and install RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install build-essential python3 python3-dev python3-setuptools git&lt;br /&gt;
  $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git&lt;br /&gt;
  $ cd RPi.GPIO-Amlogic&lt;br /&gt;
  $ sudo python3 setup.py clean --all&lt;br /&gt;
  $ sudo python3 setup.py install&lt;br /&gt;
&lt;br /&gt;
:you can change the bcmledpin variable in test/led.py to your hardware backlight gpio and run it to check RPi.GPIO works well.&lt;br /&gt;
&lt;br /&gt;
  $ sudo python3 test/led.py&lt;br /&gt;
&lt;br /&gt;
:hardware backlight will repeat on and off&lt;br /&gt;
&lt;br /&gt;
:2. luma.examples libs install&lt;br /&gt;
&lt;br /&gt;
  $ sudo usermod -a -G i2c,spi,gpio pi&lt;br /&gt;
&lt;br /&gt;
:if group does not exist, the following command will create it:&lt;br /&gt;
&lt;br /&gt;
  $ sudo groupadd --system xxx&lt;br /&gt;
&lt;br /&gt;
  $ sudo apt-get install python3-dev python3-pip libfreetype6-dev libjpeg-dev build-essential&lt;br /&gt;
  $ sudo apt-get install libsdl-dev libportmidi-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev&lt;br /&gt;
  $ git clone https://github.com/rm-hull/luma.examples.git&lt;br /&gt;
  $ cd luma.examples&lt;br /&gt;
&lt;br /&gt;
:install luma.core, luma.emulator, luma.lcd, luma.le-matrix, luma.oled pip libs, make sure this step without error or downloading interrupted, try again if get errors&lt;br /&gt;
  $ sudo -H pip install -e .&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:for debian buster(python 3.7) which does not include /usr/bin/pip in package python3-pip, and will get the following errors when install luma packages with pip3&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  WARNING, No &amp;quot;Setup&amp;quot; File Exists, Running &amp;quot;buildconfig/config.py&amp;quot;&lt;br /&gt;
  Using UNIX configuration...&lt;br /&gt;
  &lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  /bin/sh: 1: sdl2-config: not found&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:install sdl2 related packages to fix this issue, then install luma libs again with pip3&lt;br /&gt;
  $ sudo apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev&lt;br /&gt;
  $ sudo -H pip3 install -e .&lt;br /&gt;
&lt;br /&gt;
:check installed luma pip libs&lt;br /&gt;
  $ pip3 list | grep luma&lt;br /&gt;
    &lt;br /&gt;
    luma.core          2.4.0&lt;br /&gt;
    luma.emulator      1.4.0&lt;br /&gt;
    luma.lcd           2.10.0&lt;br /&gt;
    luma.led-matrix    1.7.0&lt;br /&gt;
    luma.oled          3.11.0&lt;br /&gt;
&lt;br /&gt;
:3. examples test&lt;br /&gt;
:Enable i2c or spi [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#DTB_overlay overlays] before running test examples&lt;br /&gt;
  $ cd examples&lt;br /&gt;
  $ sudo python3 bounce.py --config ../conf/ili9341.conf&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M5/M2pro Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || /boot/boot.ini&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd.htm Waveshare 3.5inch 480x320] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;480x320p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/3.5inch-hdmi-lcd-e.htm Waveshare 3.5inch 640x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720]&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-lcd-h.htm Waveshare 5inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1440x2560p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-b.htm Waveshare 7inch 800x480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7inch-hdmi-lcd-c.htm Waveshare 7inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/7.9inch-HDMI-LCD.htm Waveshare 7.9inch 400x1280] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;1536x2048p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/9inch-2560x1600-Monitor.htm Waveshare 9inch 2560x1600] || setenv display_autodetect &amp;quot;false&amp;quot;&lt;br /&gt;
setenv hdmimode &amp;quot;2560x1600p60hz&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-HDMI-LCD-E.htm Waveshare 10.1inch 1024x600] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/10.1inch-hdmi-lcd-b-with-case.htm Waveshare 10.1inch 1280x800] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/13.3inch-HDMI-LCD-H.htm Waveshare 13.3inch 1920x1080] ||&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/15.6inch-hdmi-lcd-h-with-case.htm Waveshare 15.6inch 1920x1080] ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
: backlight control&lt;br /&gt;
&lt;br /&gt;
  https://github.com/Dangku/Waveshare-USB-Brightness&lt;br /&gt;
&lt;br /&gt;
===Boot Linux from USB drive===&lt;br /&gt;
&lt;br /&gt;
:S905x3 is not support usb boot in soc rom, so the only way for booting linux from usb drive is create a bootable sdcard or emmc with bootloader flashed, then load boot and rootfs from usb drive. After bootup, everything will run from usb drive.&lt;br /&gt;
&lt;br /&gt;
:1. The simple way is [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Install_Image_to_SDcard flash the M5/M2Pro Linux image to sdcard or emmc] for bootable and also flash it to the usb drive for loading boot and rootfs.&lt;br /&gt;
:2. Bootup the M5/M2pro board with [https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Boot_Sequence sdcard or emmc], copy /boot/boot.ini to /boot/boot.ini.org so that bootloader load boot.ini fail and then try to load it from usb drive boot partition.&lt;br /&gt;
:3. Reboot the system, bootscript and rootfs will load from usb drive.&lt;br /&gt;
:[[File:m5_boot_from_usb.png]]&lt;br /&gt;
&lt;br /&gt;
:4. Test performance&lt;br /&gt;
:You can verify the performance of your usb drive on Pi Benchmarks using the following command:&lt;br /&gt;
  sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash&lt;br /&gt;
&lt;br /&gt;
:Test results for sd, emmc and usb drive&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Category || Test || Sdcard Test Result || Emmc Test Result || Usb Drive Test Result&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Disk Read || 67.91 MB/s || 156.64 MB/s || 253.40 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| HDParm || Cached Disk Read || 57.39 MB/s || 126.53 MB/s || 253.52 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| DD || Disk Write || 13.0 MB/s || 48.8 MB/s || 149 MB/s&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random read || 2456 IOPS (9826 KB/s) || 9701 IOPS (38806 KB/s) || 5474 IOPS (21897 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| FIO || 4k random write || 938 IOPS (3753 KB/s) || 12888 IOPS (51554 KB/s) || 6980 IOPS (27920 KB/s)&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k read || 10615 KB/s || 29568 KB/s || 23770 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k write || 4276 KB/s || 33585 KB/s || 18598 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random read || 8661 KB/s || 29637 KB/s || 19982 KB/s&lt;br /&gt;
|-&lt;br /&gt;
| IOZone || 4k random write || 4795 KB/s || 38177 KB/s || 22134 KB/s&lt;br /&gt;
|-&lt;br /&gt;
|  ||  || Score: 1300 || Score: 7811 || Score: 5879&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other Development==&lt;br /&gt;
&lt;br /&gt;
===Custom Linux Boot Logo===&lt;br /&gt;
:Linux uboot limit boot logo fb size to 1080p60hz/1920x1080 default, so oversize resolution will not be supported by default image, but you can modify uboot source code to support it.&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
:3. copy the target file to BPI-BOOT partition of linux image&lt;br /&gt;
  $ cp boot-logo.bmp.gz /media/xxx/BPI-BOOT/&lt;br /&gt;
&lt;br /&gt;
===Custom Android Boot Logo===&lt;br /&gt;
:Android bootloader limit boot logo fb display size is 1080p60hz/1920x1080 default, and android kernel dtb partition table limit boot logo partition size to 16MB default .&lt;br /&gt;
&lt;br /&gt;
:1. Prepare a 24bit bmp file and named boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:2. Compress the bmp file to boot-logo.bmp.gz&lt;br /&gt;
  $ gzip boot-logo.bmp&lt;br /&gt;
&lt;br /&gt;
:3. Download [https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FTools%2Flogo_create_tools%2Fm5_android_bootlogo_tool.zip m5_android_bootlogo_tool.zip]&lt;br /&gt;
&lt;br /&gt;
:4. Extract this tool&lt;br /&gt;
  $ unzip m5_android_bootlogo_tool.zip&lt;br /&gt;
  $ cd m5_android_bootlogo_tool/&lt;br /&gt;
  $ cp -a logo_img_files logo               //logo_img_files is the origin bootlogo resource in android source and copy from &amp;lt;android-source-dir&amp;gt;/devices/amlogic/bananapi_m5/log_img_files&lt;br /&gt;
  $ ls -l logo/&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_X3.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_bar.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_error.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_fail.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_logo.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_success.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku    184 May 19  2020 upgrade_unfocus.bmp&lt;br /&gt;
  -rwxr--r-- 1 dangku dangku 180072 May 19  2020 upgrade_upgrading.bmp&lt;br /&gt;
&lt;br /&gt;
:5. Copy the boot-logo.bmp.gz&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup.bmp&lt;br /&gt;
  $ cp boot-logo.bmp.gz logo/bootup_X3.bmp&lt;br /&gt;
&lt;br /&gt;
:6. Create target logo.img with img pack tool, the binary and related libs of m5_android_bootlogo_tool are copy from &amp;lt;android-source-dir&amp;gt;/out/host/linux-x86&lt;br /&gt;
  $ ./logo_img_packer -r logo logo.img&lt;br /&gt;
&lt;br /&gt;
:7. Flash boot logo with fastboot&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb reboot fastboot&lt;br /&gt;
:Wait few seconds and check whether fastboot connected&lt;br /&gt;
  $ fastboot device&lt;br /&gt;
  1234567890      fastboot&lt;br /&gt;
  $ fastboot flashing unlock_critical&lt;br /&gt;
  $ fastboot flashing unlock&lt;br /&gt;
  $ fastboot flash logo logo.img&lt;br /&gt;
  $ fastboot reboot&lt;br /&gt;
&lt;br /&gt;
===Boot Sequence===&lt;br /&gt;
&lt;br /&gt;
:[[File:m5_linux_boot_squence.png]]&lt;br /&gt;
&lt;br /&gt;
:Check bootloader loaded from SDcard or EMMC at the beginning of the console debug messages&lt;br /&gt;
&lt;br /&gt;
:1. Rom load bootloader from SDcard (Linux log example)&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from SD''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  fastboot data verify&lt;br /&gt;
  result: 255&lt;br /&gt;
  Cfg max: 12, cur: 1. Board id: 255. Force loop cfg&lt;br /&gt;
  DDR4 probe&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
:2. Rom load bootloader from EMMC(Android Log example)&lt;br /&gt;
&lt;br /&gt;
  ...&lt;br /&gt;
  &lt;br /&gt;
  Board ID = 1&lt;br /&gt;
  Set cpu clk to 24M&lt;br /&gt;
  Set clk81 to 24M&lt;br /&gt;
  Use GP1_pll as DSU clk.&lt;br /&gt;
  DSU clk: 1200 Mhz&lt;br /&gt;
  CPU clk: 1200 MHz&lt;br /&gt;
  Set clk81 to 166.6M&lt;br /&gt;
  eMMC boot @ 0&lt;br /&gt;
  sw8 s&lt;br /&gt;
  board id: 1&lt;br /&gt;
  '''Load FIP HDR DDR from eMMC''', src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0&lt;br /&gt;
  fw parse done&lt;br /&gt;
  PIEI prepare done&lt;br /&gt;
  00000000&lt;br /&gt;
  emmc switch 1 ok&lt;br /&gt;
  ddr saved addr:00016000&lt;br /&gt;
  Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0&lt;br /&gt;
  00000000&lt;br /&gt;
  &lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
===Erase EMMC for SDcard Bootup===&lt;br /&gt;
:There are four possible scenarios should be pay attention to, EMMC already flashed Android image, EMMC already flashed Linux image, boot process hangup in BL2 and EMMC empty.&lt;br /&gt;
&lt;br /&gt;
:1. Bootable EMMC with Android image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using usb burning tool, unplug the download usb cable while the download process at '''7% formatting'''&lt;br /&gt;
&lt;br /&gt;
::[[File:m5_android_format.png]]&lt;br /&gt;
&lt;br /&gt;
::b). Using Android Fastboot tool, make sure the adb/fastboot tools is work on your PC before doing this.&lt;br /&gt;
&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb root'''&lt;br /&gt;
    adbd is already running as root&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb remount'''&lt;br /&gt;
    remount succeeded&lt;br /&gt;
    root@dangku-desktop:/tmp# '''adb shell'''&lt;br /&gt;
    bananapi_m5:/ # '''reboot fastboot'''&lt;br /&gt;
::Wait a few seconds for board reboot to fastboot mode&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot devices'''&lt;br /&gt;
    1234567890	fastboot&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock_critical'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.044s]&lt;br /&gt;
    finished. total time: 0.044s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot flashing unlock'''&lt;br /&gt;
    ...&lt;br /&gt;
    OKAY [  0.047s]&lt;br /&gt;
    finished. total time: 0.047s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader'''&lt;br /&gt;
    erasing 'bootloader'...&lt;br /&gt;
    OKAY [  0.059s]&lt;br /&gt;
    finished. total time: 0.059s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot0'''&lt;br /&gt;
    erasing 'bootloader-boot0'...&lt;br /&gt;
    OKAY [  0.036s]&lt;br /&gt;
    finished. total time: 0.036s&lt;br /&gt;
    root@dangku-desktop:/tmp# '''fastboot erase bootloader-boot1'''&lt;br /&gt;
    erasing 'bootloader-boot1'...&lt;br /&gt;
    OKAY [  0.035s]&lt;br /&gt;
    finished. total time: 0.035s&lt;br /&gt;
&lt;br /&gt;
::c). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5_v1#'''amlmmc erase 1'''&lt;br /&gt;
    emmckey_is_protected(): protect&lt;br /&gt;
    start = 0,end = 57343&lt;br /&gt;
    start = 221184,end = 30535679&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot0&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    Erasing blocks 0 to 8192 @ boot1&lt;br /&gt;
    start = 0,end = 8191&lt;br /&gt;
    bananapi_m5_v1#'''reset'''&lt;br /&gt;
    resetting ...&lt;br /&gt;
    SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;&lt;br /&gt;
&lt;br /&gt;
::These two ways actually erase the bootloader part of EMMC android, After bootup from SDcard Linux, You'd better [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command].&lt;br /&gt;
&lt;br /&gt;
::d). The simplest way is insert the SDcard with Linux image flashed before power on, the Android bootloader will check boot.ini file whether exist in SDcard vfat partition, so that the SDcard Linux will bootup. After bootup, you can [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Erase_Emmc_Android_by_dd_command format the whole EMMC by dd command] and then flash the Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
    ...&lt;br /&gt;
    BPI: try boot from sdcard&lt;br /&gt;
    reading boot.ini&lt;br /&gt;
    5699 bytes read in 3 ms (1.8 MiB/s)&lt;br /&gt;
    ## Executing script at 01b00000&lt;br /&gt;
    ...&lt;br /&gt;
    reading Image.gz&lt;br /&gt;
    9143358 bytes read in 510 ms (17.1 MiB/s)&lt;br /&gt;
    reading meson64_bananapi_m5.dtb&lt;br /&gt;
    70850 bytes read in 8 ms (8.4 MiB/s)&lt;br /&gt;
    reading uInitrd&lt;br /&gt;
    11704481 bytes read in 655 ms (17 MiB/s)&lt;br /&gt;
    reading overlays/i2c0.dtbo&lt;br /&gt;
    223 bytes read in 6 ms (36.1 KiB/s)&lt;br /&gt;
    reading overlays/spi0.dtbo&lt;br /&gt;
    516 bytes read in 6 ms (84 KiB/s)&lt;br /&gt;
    reading overlays/uart1.dtbo&lt;br /&gt;
    225 bytes read in 5 ms (43.9 KiB/s)&lt;br /&gt;
&lt;br /&gt;
:2. Bootable EMMC with Linux image flashed&lt;br /&gt;
&lt;br /&gt;
::a). Using uboot command, connect a debug console cable and press ESC while power on to enter uboot command line&lt;br /&gt;
&lt;br /&gt;
    bananapi_m5# mmc erase 0 1000&lt;br /&gt;
&lt;br /&gt;
::b). Linux u-boot also check boot.ini file whether exist in SDcard vfat partition so that the SDcard Linux will bootup. After bootup, you can format the whole EMMC by dd command or flash the Linux image directly to EMMC.&lt;br /&gt;
&lt;br /&gt;
:3. A extreme situation is bootloader or uboot corrupted, Rom load it from EMMC but hangup in u-boot or BL2, for example the boot process will hangup in BL2 of EMMC if dram init failed,  The only way is format the EMMC with usb burning tool, or download the Android image completely and then try other ways to erase EMMC or flash Linux image to EMMC.&lt;br /&gt;
&lt;br /&gt;
:4. Rom will try to load bootloader from SDcard directly if EMMC is empty.&lt;br /&gt;
&lt;br /&gt;
===Erase Emmc Android by dd command===&lt;br /&gt;
:If the board is flashed android before, the whole emmc must be erased by these commands if you want bootup it with SDcard Linux image.&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer &lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer&lt;br /&gt;
  $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer &lt;br /&gt;
  $ sync&lt;br /&gt;
&lt;br /&gt;
===Wifi/BT support===&lt;br /&gt;
&lt;br /&gt;
:1. Android test and support.&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
  rtl8814au wifi(usb), please get the [https://github.com/aircrack-ng/rtl8814au aircrack-ng] driver and install.&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Android Wifi/BT'''&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and reboot the system, After bootup, you can enable or disable wifi and bluetooth in Settings app.&lt;br /&gt;
:SDIO/UART type: Connect the hardware module to 40pin header correctly and [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#Android_DTB_overlay configure the Android DTB overlay] to enable it.&lt;br /&gt;
&lt;br /&gt;
:'''Note''': Android is not support that ethernet and wifi are both connected at the same time, Ethernet have a higher prioprity than wifi, it means wifi can't connect network if ethernet already connected, and wifi will drop connection if ethernet cable plugin.&lt;br /&gt;
&lt;br /&gt;
:2. Linux test and support.&lt;br /&gt;
  rtl8188eu wifi(usb)&lt;br /&gt;
  rtl8192eu wifi(usb)&lt;br /&gt;
  rtl8723bu wifi/bt(usb)&lt;br /&gt;
  rtl8811au wifi(usb)&lt;br /&gt;
  rtl8812au wifi(usb)&lt;br /&gt;
  rtl8812bu wifi(usb)&lt;br /&gt;
  [http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162 rtl8821cu wifi/bt(usb)]&lt;br /&gt;
  [http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846 rtl8822cs wifi/bt(sdio/uart)]&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Wifi'''&lt;br /&gt;
&lt;br /&gt;
:Wifi module drivers are already prebuild in the release images.&lt;br /&gt;
&lt;br /&gt;
:USB type: Plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
:SDIO/UART type:&lt;br /&gt;
::1). Connect the hardware module to 40pin header correctly.&lt;br /&gt;
::2). Configure the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5/M2Pro#DTB_overlay dtb overlay]&lt;br /&gt;
   # Overlays to load&lt;br /&gt;
   # Example combinations:&lt;br /&gt;
   #   spi0 i2c0 i2c1 uart0&lt;br /&gt;
   #   hktft32&lt;br /&gt;
   #   hktft35&lt;br /&gt;
   setenv overlays &amp;quot;wifi_bt_rtl8822cs&amp;quot;&lt;br /&gt;
::3). Add the wifi module name to /etc/modules for loaded automatically next boot.&lt;br /&gt;
  # This file contains the names of kernel modules that should be loaded&lt;br /&gt;
  # at boot time, one per line. Lines beginning with &amp;quot;#&amp;quot; are ignored.&lt;br /&gt;
  88x2cs&lt;br /&gt;
&lt;br /&gt;
:'''How to enable Linux Bluetooth'''&lt;br /&gt;
&lt;br /&gt;
::1). Please download [https://github.com/Dangku/m5-rtk-linux-bt-driver rtk-linux-bt-driver] source code, build and install usb or uart rtk linux bluetooth drivers/firmwares to your image.&lt;br /&gt;
::2). For USB type, plug-in the usb dongle to usb host port and driver will be loaded automatically.&lt;br /&gt;
::3). For UART type, Configure the dtb overlay as the same as wifi before install the bluetooth drivers/firmwares. hci_uart driver will be loaded when rtk-hciuart.service start.&lt;br /&gt;
&lt;br /&gt;
===Linux Server Image Network Configuration===&lt;br /&gt;
&lt;br /&gt;
:[https://netplan.io Netplan]&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi STA mode'''&lt;br /&gt;
&lt;br /&gt;
:A sample wifi sta mode netplan configuration file, 01-wlan0-sta.yaml&lt;br /&gt;
 network:&lt;br /&gt;
   version: 2&lt;br /&gt;
   renderer: networkd&lt;br /&gt;
   wifis:&lt;br /&gt;
     wlan0:&lt;br /&gt;
       dhcp4: true&lt;br /&gt;
       access-points:&lt;br /&gt;
         &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:'''Linux Wifi AP mode'''&lt;br /&gt;
&lt;br /&gt;
:1. Prepare the setup the [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Wifi.2FBT_support wifi adater] correctly.&lt;br /&gt;
&lt;br /&gt;
:2. Get the wifi adapter Band, Frequencies, Channel, HT Capability, VHT Capability or other properties&lt;br /&gt;
 $ iw list&lt;br /&gt;
&lt;br /&gt;
:3. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Network-Manager.&lt;br /&gt;
&lt;br /&gt;
:Install NetworkManager because ap is only supported with NetworkManager renderer&lt;br /&gt;
 $ sudo apt install network-manager&lt;br /&gt;
&lt;br /&gt;
:A sample 2.4G wifi ap mode netplan configuration file, 01-wlan0-ap-2.4g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 2.4GHz&lt;br /&gt;
          channel: 6&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:A sample 5G wifi ap mode netplan configuration file, 01-wlan0-ap-5g.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: NetworkManager&lt;br /&gt;
 wifis:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     access-points:&lt;br /&gt;
       &amp;quot;bananapi&amp;quot;:&lt;br /&gt;
          mode: ap&lt;br /&gt;
          band: 5GHz&lt;br /&gt;
          channel: 36&lt;br /&gt;
          auth:&lt;br /&gt;
            key-management: psk&lt;br /&gt;
            password: &amp;quot;123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:4. Manage wifi access point mode with [http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux_Server_Image_Network_Configuration Netplan] and Hostapd.&lt;br /&gt;
&lt;br /&gt;
:1). Create a netplan configuration file, 01-wlan0-ap-hostapd.yaml&lt;br /&gt;
 network:&lt;br /&gt;
 version: 2&lt;br /&gt;
 renderer: networkd&lt;br /&gt;
 ethernets:&lt;br /&gt;
   wlan0:&lt;br /&gt;
     dhcp4: no&lt;br /&gt;
     addresses:&lt;br /&gt;
       - 192.168.11.1/24&lt;br /&gt;
&lt;br /&gt;
:2). Install hostapd&lt;br /&gt;
 $ sudo apt install hostapd&lt;br /&gt;
&lt;br /&gt;
:Create hostapd configuration file /etc/hostapd/hostapd.conf, for example&lt;br /&gt;
 interface=wlan0&lt;br /&gt;
 ssid=bananapi&lt;br /&gt;
 &lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 &lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 wpa=2&lt;br /&gt;
 wpa_passphrase=123456789&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 &lt;br /&gt;
 #bridge=br0&lt;br /&gt;
 beacon_int=500&lt;br /&gt;
 #SSID not hidden&lt;br /&gt;
 ignore_broadcast_ssid=0&lt;br /&gt;
 &lt;br /&gt;
 hw_mode=a&lt;br /&gt;
 channel=36&lt;br /&gt;
 max_num_sta=8&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11n&lt;br /&gt;
 ieee80211n=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]&lt;br /&gt;
 &lt;br /&gt;
 ### IEEE 802.11ac&lt;br /&gt;
 ieee80211ac=1&lt;br /&gt;
 #require_vht=0&lt;br /&gt;
 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]&lt;br /&gt;
 #vht_oper_chwidth=1&lt;br /&gt;
 #vht_oper_centr_freq_seg0_idx=42&lt;br /&gt;
 &lt;br /&gt;
 ### WMM&lt;br /&gt;
 wmm_enabled=1&lt;br /&gt;
&lt;br /&gt;
:3). To support 80MHz channel width you need load driver with '''rtw_vht_enable=2''' option, Or you can create /etc/modprobe.d/8822cs.conf with content&lt;br /&gt;
 options 88x2cs rtw_vht_enable=2&lt;br /&gt;
&lt;br /&gt;
:4). Install and configure dhcp server service, use isc-dhcp-server for example&lt;br /&gt;
&lt;br /&gt;
 $ sudo apt install isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp server interface in /etc/default/isc-dhcp-server&lt;br /&gt;
 # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?&lt;br /&gt;
 #       Separate multiple interfaces with spaces, e.g. &amp;quot;eth0 eth1&amp;quot;.&lt;br /&gt;
 INTERFACESv4=&amp;quot;wlan0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:Configure dhcp subnet and dns in /etc/dhcp/dhcpd.conf&lt;br /&gt;
 ...&lt;br /&gt;
 option domain-name &amp;quot;example.org&amp;quot;;&lt;br /&gt;
 option domain-name-servers 8.8.8.8, 114.114.114.114;&lt;br /&gt;
 ...&lt;br /&gt;
 # No service will be given on this subnet, but declaring it helps the &lt;br /&gt;
 # DHCP server to understand the network topology.&lt;br /&gt;
 subnet 192.168.11.0 netmask 255.255.255.0 {&lt;br /&gt;
   range dynamic-bootp 192.168.11.1 192.168.11.100;&lt;br /&gt;
   option broadcast-address 192.168.11.255;&lt;br /&gt;
   option routers 192.168.11.1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
:5). Start Service&lt;br /&gt;
 $ sudo hostapd /etc/hostapd/hostapd.conf -B&lt;br /&gt;
 $ sudo systemctl restart isc-dhcp-server&lt;br /&gt;
&lt;br /&gt;
:6). Routing configuration.&lt;br /&gt;
 sysctl net.ipv4.ip_forward=1&lt;br /&gt;
 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE&lt;br /&gt;
&lt;br /&gt;
===Disable Cloud-init&amp;amp;Snap===&lt;br /&gt;
:Cloud-init and Snap service are enabled default, you can disable or remove them.&lt;br /&gt;
&lt;br /&gt;
:1. disable or remove cloud-init&lt;br /&gt;
  $ sudo touch /etc/cloud/cloud-init.disabled&lt;br /&gt;
:or&lt;br /&gt;
  $ sudo apt purge cloud-init&lt;br /&gt;
&lt;br /&gt;
:2. disable or remove snap&lt;br /&gt;
  $ sudo apt purge snapd&lt;br /&gt;
&lt;br /&gt;
===Enable rc-local===&lt;br /&gt;
:The systemd service rc-local.service already exists in release image, but there is no [Install] part in the unit file. As a result, Systemd is unable to enable it. First, we must update the file.&lt;br /&gt;
&lt;br /&gt;
  $ sudo nano /lib/systemd/system/rc-local.service&lt;br /&gt;
&lt;br /&gt;
  [Unit]&lt;br /&gt;
  Description=/etc/rc.local Compatibility&lt;br /&gt;
  Documentation=man:systemd-rc-local-generator(8)&lt;br /&gt;
  ConditionFileIsExecutable=/etc/rc.local&lt;br /&gt;
  After=network.target&lt;br /&gt;
  &lt;br /&gt;
  [Service]&lt;br /&gt;
  Type=forking&lt;br /&gt;
  ExecStart=/etc/rc.local start&lt;br /&gt;
  TimeoutSec=0&lt;br /&gt;
  RemainAfterExit=yes&lt;br /&gt;
  GuessMainPID=no&lt;br /&gt;
  &lt;br /&gt;
  [Install]&lt;br /&gt;
  WantedBy=multi-user.target&lt;br /&gt;
  Alias=rc-local.service&lt;br /&gt;
&lt;br /&gt;
:Create /etc/rc.local file.&lt;br /&gt;
&lt;br /&gt;
  sudo nano /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  #&lt;br /&gt;
  # rc.local&lt;br /&gt;
  #&lt;br /&gt;
  # This script is executed at the end of each multiuser runlevel.&lt;br /&gt;
  # Make sure that the script will &amp;quot;exit 0&amp;quot; on success or any other&lt;br /&gt;
  # value on error.&lt;br /&gt;
  #&lt;br /&gt;
  # In order to enable or disable this script just change the execution&lt;br /&gt;
  # bits.&lt;br /&gt;
  #&lt;br /&gt;
  # By default this script does nothing.&lt;br /&gt;
  &lt;br /&gt;
  exit 0&lt;br /&gt;
&lt;br /&gt;
:Add executable permission to /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
  $ sudo chmod +x /etc/rc.local&lt;br /&gt;
&lt;br /&gt;
:Enable rc-local.service and reboot&lt;br /&gt;
&lt;br /&gt;
  $ sudo systemctl enable rc-local.service&lt;br /&gt;
  $ sudo reboot&lt;br /&gt;
&lt;br /&gt;
===Enable sudo for Debian===&lt;br /&gt;
:The release Debian image do not install sudo default, with &amp;quot;su -&amp;quot; command, user can change to root. If you like sudo, you can install it.&lt;br /&gt;
&lt;br /&gt;
  $ su root&lt;br /&gt;
  Password:(enter bananapi)&lt;br /&gt;
  &lt;br /&gt;
  # apt-get update&lt;br /&gt;
  # apt-get install sudo&lt;br /&gt;
  # adduser pi sudo&lt;br /&gt;
&lt;br /&gt;
: Then please do logout and login again&lt;br /&gt;
&lt;br /&gt;
===Install Docker Engine===&lt;br /&gt;
:Install Docker Engine on Ubuntu 20.04 Server&lt;br /&gt;
  &lt;br /&gt;
:1. Set up the repository&lt;br /&gt;
&lt;br /&gt;
:Update the apt package index and install packages to allow apt to use a repository over HTTPS:&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release&lt;br /&gt;
&lt;br /&gt;
:Add Docker’s official GPG key:&lt;br /&gt;
  $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg&lt;br /&gt;
&lt;br /&gt;
:Set up the stable repository&lt;br /&gt;
  $  echo \&lt;br /&gt;
     &amp;quot;deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \&lt;br /&gt;
     $(lsb_release -cs) stable&amp;quot; | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null&lt;br /&gt;
&lt;br /&gt;
:2. Install Docker Engine&lt;br /&gt;
  $ sudo apt-get update&lt;br /&gt;
  $ sudo apt-get install docker-ce docker-ce-cli containerd.io&lt;br /&gt;
&lt;br /&gt;
:3. Verify the Docker Engine is installed correctly by running the hello-world image.&lt;br /&gt;
  $ sudo docker run hello-world&lt;br /&gt;
&lt;br /&gt;
:[[File:docker-test.png]]&lt;br /&gt;
&lt;br /&gt;
Install docker with a simple command&lt;br /&gt;
&lt;br /&gt;
  $ curl -sSL get.docker.com | sudo sh&lt;br /&gt;
&lt;br /&gt;
[https://docs.docker.com/engine/install/ Install Docker Engine] on other Linux distributions&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17225</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17225"/>
				<updated>2024-05-06T13:00:00Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Custom Logo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]] and confirm that the checksum is correct before flashing.&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V/3A power supply.&lt;br /&gt;
&lt;br /&gt;
:4. It's recommended that 4GB+32GB spec at least works well for M4 Berry/Zero android12.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
:Change boot logo and bootanimation by adb command&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Prepare a 24bit bootlogo.bmp file, resolution limited to 1280x720, then push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push bootlogo.bmp /Reserve0/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Create a folder named media, copy bootanimation.zip to media folder and push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push media /system/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by building android source code&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M4 Berry Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || Test Video&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720] || https://youtu.be/CRcjx6_29rA&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] || https://youtu.be/0wZ3lWQQTkQ&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || https://youtu.be/z9gTHa3i8Ag&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || https://youtu.be/Qjwo4vVBQmo&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] || https://youtu.be/SP9-HGrY6-M&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] || https://youtu.be/WA1yBGcYZds&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] || https://youtu.be/OJfqtHlgDvk&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17224</id>
		<title>Getting Started with BPI-M4 Zero</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17224"/>
				<updated>2024-05-06T12:58:13Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Custom Logo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Zero]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Zero#System_image | Android image]] and confirm that the checksum is correct before flashing.&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V/3A power supply.&lt;br /&gt;
&lt;br /&gt;
:4. It's recommended that 4GB+32GB spec at least works well for M4 Berry/Zero android12.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 FEL button on M4 Zero while connecting CN2 OTG port to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by adb command&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Prepare a 24bit bootlogo.bmp file, resolution limited to 1280x720, then push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push bootlogo.bmp /Reserve0/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Create a folder named media, copy bootanimation.zip to media folder and push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push media /system/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by building android source code&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Zero#Linux | Linux Image]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Zero#Linux | bananapi 4.9 bsp ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
:1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
:2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface, an HDMI cable, and a mini HDMI to HDMI adapter.&lt;br /&gt;
:3. Use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor and BPI-M4 Zero, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Zero UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Zero, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Zero on the router management interface, or use the following command on the BPI-M4 Zero UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Zero is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Zero user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Zero in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Zero in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4zero:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Zero board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Zero.If it is a USB disk with a type-A plug, you also need a type-A to type-C adapter.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Zero Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4zero:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4zero:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Zero in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17196</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17196"/>
				<updated>2024-04-30T04:58:39Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Prepare */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]] and confirm that the checksum is correct before flashing.&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V/3A power supply.&lt;br /&gt;
&lt;br /&gt;
:4. It's recommended that 4GB+32GB spec at least works well for M4 Berry/Zero android12.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
:Change boot logo and bootanimation by adb command&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Prepare a 24bit bootlogo.bmp file, resolution limited to 1280x720, then push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push bootlogo.bmp /Reserve0/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Create a folder named media, put bootanimation.zip to it and push to android by adb&lt;br /&gt;
  $ mkdir media&lt;br /&gt;
  $ cp bootanimation.zip media/&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push media /system/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by building android source code&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M4 Berry Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || Test Video&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720] || https://youtu.be/CRcjx6_29rA&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] || https://youtu.be/0wZ3lWQQTkQ&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || https://youtu.be/z9gTHa3i8Ag&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || https://youtu.be/Qjwo4vVBQmo&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] || https://youtu.be/SP9-HGrY6-M&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] || https://youtu.be/WA1yBGcYZds&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] || https://youtu.be/OJfqtHlgDvk&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17195</id>
		<title>Getting Started with BPI-M4 Zero</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17195"/>
				<updated>2024-04-30T04:58:25Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Prepare */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Zero]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Zero#System_image | Android image]] and confirm that the checksum is correct before flashing.&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V/3A power supply.&lt;br /&gt;
&lt;br /&gt;
:4. It's recommended that 4GB+32GB spec at least works well for M4 Berry/Zero android12.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 FEL button on M4 Zero while connecting CN2 OTG port to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by adb command&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Prepare a 24bit bootlogo.bmp file, resolution limited to 1280x720, then push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push bootlogo.bmp /Reserve0/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Create a folder named media, put bootanimation.zip to it and push to android by adb&lt;br /&gt;
  $ mkdir media&lt;br /&gt;
  $ cp bootanimation.zip media/&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push media /system/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by building android source code&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Zero#Linux | Linux Image]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Zero#Linux | bananapi 4.9 bsp ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
:1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
:2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface, an HDMI cable, and a mini HDMI to HDMI adapter.&lt;br /&gt;
:3. Use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor and BPI-M4 Zero, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Zero UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Zero, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Zero on the router management interface, or use the following command on the BPI-M4 Zero UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Zero is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Zero user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Zero in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Zero in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4zero:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Zero board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Zero.If it is a USB disk with a type-A plug, you also need a type-A to type-C adapter.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Zero Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4zero:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4zero:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Zero in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17194</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17194"/>
				<updated>2024-04-30T04:56:27Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Prepare */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]] and confirm that the checksum is correct before flashing.&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V/3A power supply.&lt;br /&gt;
&lt;br /&gt;
:4. It's recommended that 4GB+32GB spec works well for M4 Berry/Zero android12.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
:Change boot logo and bootanimation by adb command&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Prepare a 24bit bootlogo.bmp file, resolution limited to 1280x720, then push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push bootlogo.bmp /Reserve0/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Create a folder named media, put bootanimation.zip to it and push to android by adb&lt;br /&gt;
  $ mkdir media&lt;br /&gt;
  $ cp bootanimation.zip media/&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push media /system/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by building android source code&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M4 Berry Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || Test Video&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720] || https://youtu.be/CRcjx6_29rA&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] || https://youtu.be/0wZ3lWQQTkQ&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || https://youtu.be/z9gTHa3i8Ag&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || https://youtu.be/Qjwo4vVBQmo&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] || https://youtu.be/SP9-HGrY6-M&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] || https://youtu.be/WA1yBGcYZds&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] || https://youtu.be/OJfqtHlgDvk&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17193</id>
		<title>Getting Started with BPI-M4 Zero</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17193"/>
				<updated>2024-04-30T04:41:57Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Custom Logo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Zero]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Zero#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 FEL button on M4 Zero while connecting CN2 OTG port to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by adb command&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Prepare a 24bit bootlogo.bmp file, resolution limited to 1280x720, then push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push bootlogo.bmp /Reserve0/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Create a folder named media, put bootanimation.zip to it and push to android by adb&lt;br /&gt;
  $ mkdir media&lt;br /&gt;
  $ cp bootanimation.zip media/&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push media /system/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by building android source code&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Zero#Linux | Linux Image]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Zero#Linux | bananapi 4.9 bsp ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
:1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
:2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface, an HDMI cable, and a mini HDMI to HDMI adapter.&lt;br /&gt;
:3. Use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor and BPI-M4 Zero, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Zero UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Zero, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Zero on the router management interface, or use the following command on the BPI-M4 Zero UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Zero is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Zero user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Zero in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Zero in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4zero:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Zero board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Zero.If it is a USB disk with a type-A plug, you also need a type-A to type-C adapter.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Zero Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4zero:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4zero:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Zero in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17192</id>
		<title>Getting Started with BPI-M4 Zero</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17192"/>
				<updated>2024-04-30T04:41:01Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Image with USB tool */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Zero]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Zero#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 FEL button on M4 Zero while connecting CN2 OTG port to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Zero#Linux | Linux Image]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Zero#Linux | bananapi 4.9 bsp ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
:1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
:2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface, an HDMI cable, and a mini HDMI to HDMI adapter.&lt;br /&gt;
:3. Use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor and BPI-M4 Zero, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Zero UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Zero, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Zero on the router management interface, or use the following command on the BPI-M4 Zero UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Zero is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Zero user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Zero in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Zero in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4zero:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Zero board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Zero.If it is a USB disk with a type-A plug, you also need a type-A to type-C adapter.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Zero Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4zero:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4zero:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Zero in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17191</id>
		<title>Getting Started with BPI-M4 Zero</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=17191"/>
				<updated>2024-04-30T04:38:11Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Image with USB tool */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Zero]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Zero#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Zero while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Zero#Linux | Linux Image]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Zero#Linux | bananapi 4.9 bsp ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
:1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
:2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface, an HDMI cable, and a mini HDMI to HDMI adapter.&lt;br /&gt;
:3. Use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor and BPI-M4 Zero, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Zero UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Zero, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Zero on the router management interface, or use the following command on the BPI-M4 Zero UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Zero is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Zero user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Zero in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Zero in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4zero:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Zero board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Zero.If it is a USB disk with a type-A plug, you also need a type-A to type-C adapter.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Zero Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4zero:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4zero:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Zero in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_5.jpg&amp;diff=17190</id>
		<title>File:M4-berry android 5.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_5.jpg&amp;diff=17190"/>
				<updated>2024-04-30T04:35:27Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_4.jpg&amp;diff=17187</id>
		<title>File:M4-berry android 4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_4.jpg&amp;diff=17187"/>
				<updated>2024-04-30T04:30:13Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: Dangku uploaded a new version of File:M4-berry android 4.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_4.jpg&amp;diff=17186</id>
		<title>File:M4-berry android 4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_4.jpg&amp;diff=17186"/>
				<updated>2024-04-30T04:04:54Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_3.jpg&amp;diff=17184</id>
		<title>File:M4-berry android 3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_3.jpg&amp;diff=17184"/>
				<updated>2024-04-30T04:02:44Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_1.jpg&amp;diff=17182</id>
		<title>File:M4-berry android 1.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=File:M4-berry_android_1.jpg&amp;diff=17182"/>
				<updated>2024-04-30T03:58:40Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17180</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=17180"/>
				<updated>2024-04-30T03:04:18Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Custom Logo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
:Change boot logo and bootanimation by adb command&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Prepare a 24bit bootlogo.bmp file, resolution limited to 1280x720, then push it to android by adb&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push bootlogo.bmp /Reserve0/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Create a folder named media, put bootanimation.zip to it and push to android by adb&lt;br /&gt;
  $ mkdir media&lt;br /&gt;
  $ cp bootanimation.zip media/&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push media /system/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:Change boot logo and bootanimation by building android source code&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M4 Berry Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || Test Video&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720] || https://youtu.be/CRcjx6_29rA&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] || https://youtu.be/0wZ3lWQQTkQ&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || https://youtu.be/z9gTHa3i8Ag&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || https://youtu.be/Qjwo4vVBQmo&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] || https://youtu.be/SP9-HGrY6-M&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] || https://youtu.be/WA1yBGcYZds&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] || https://youtu.be/OJfqtHlgDvk&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Banana_Pi_BPI-M5&amp;diff=17130</id>
		<title>Banana Pi BPI-M5</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Banana_Pi_BPI-M5&amp;diff=17130"/>
				<updated>2024-03-15T02:45:23Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Armbian */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:香蕉派_BPI-M5]]&lt;br /&gt;
=BPI-M5 Introduction=&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|Amlogic S905X3 Processor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:BPI-M5_case_1.jpg|thumb|BPI-M5 case design]]&lt;br /&gt;
[[File:Wifibt_module_1.jpeg|thumb|WiFi&amp;amp;BT board, 802.11 a/b/g/n/ac 2T2R WiFi and Bluectooch 5.0]]&lt;br /&gt;
&lt;br /&gt;
Banana Pi BPI-M5 is the next generation single board computer from Banana Pi in 2020. It is powered by Amlogic S905X3 quad-core Cortex-A55 (2.0 XXGHz) processor.Onboard 4GB LPDDR4 memory and 16GB EMMC storage, and supports 4 USB 3.0 interface, a gigabit network port.&lt;br /&gt;
&lt;br /&gt;
[[File:Banana_Pi_BPI-M5.jpg]]&lt;br /&gt;
&lt;br /&gt;
=Key Features=&lt;br /&gt;
* Amlogic S905X3 64-bit Quad core Cortex-A55 (2.0xxGHz)&lt;br /&gt;
* Mali-G31 GPU &lt;br /&gt;
* 4GB LPDDR4&lt;br /&gt;
* 16GB eMMC flash&lt;br /&gt;
* 4 USB 3.0 &lt;br /&gt;
* 1 GbE ethernet&lt;br /&gt;
* HDMI output&lt;br /&gt;
&lt;br /&gt;
==Getting Start==&lt;br /&gt;
*[[Getting Started with M5/M2Pro]]&lt;br /&gt;
&lt;br /&gt;
=Hardware=&lt;br /&gt;
==Hardware interface==&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_interface1.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Hardware spec==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''HardWare  Specification of Banana pi BPI-M5'''&lt;br /&gt;
|-&lt;br /&gt;
|CPU|| Amlogic S905X3 64-bit Quad-Core Cortex-A55 (2.0xxGHz)&lt;br /&gt;
|-&lt;br /&gt;
| GPU||Mali-G31 MP2 GPU with 4 x Execution Engines (650Mhz)&lt;br /&gt;
|-&lt;br /&gt;
| Memory|| 4 GB LPDDR4 &lt;br /&gt;
|-&lt;br /&gt;
| Storage|| MicroSD slot with support for up to 256GB expansion and 16G eMMC flash with support for up to 64GB&lt;br /&gt;
|-&lt;br /&gt;
| Network|| 10/100/1000 Mbit/s Ethernet ,Optional WiFi USB dongle&lt;br /&gt;
|-&lt;br /&gt;
|Video Output(s)|| 1 x HDMI 2.1 (up to 4K@60Hz with HDR, CEC, EDID)&lt;br /&gt;
|-&lt;br /&gt;
| Audio Output(s)|| 3.5mm jack and 1 x HDMI digital output&lt;br /&gt;
|-&lt;br /&gt;
| USB ports|| USB 3.0 PORT (x4)&lt;br /&gt;
|-&lt;br /&gt;
|GPIO|| 40 Pin Header : GPIO (x28) and Power (+5V, +3.3V and GND). GPIO pins can be used for UART, I2C, SPI or PWM &lt;br /&gt;
|-&lt;br /&gt;
|Switches|| Reset, Power and U-boot &lt;br /&gt;
|-&lt;br /&gt;
| LED|| Power Status and Activity status&lt;br /&gt;
|-&lt;br /&gt;
| Power Source|| 5 volt @3A via Micro USB (TYPE C) &lt;br /&gt;
|-&lt;br /&gt;
|Size &amp;amp; Weight|| 85x56 mm, 48g&lt;br /&gt;
|-&lt;br /&gt;
|OS|| Android and Linux&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Wifi &amp;amp; BT support via expansion board==&lt;br /&gt;
&lt;br /&gt;
===SDIO interface Wifi&amp;amp;BT===&lt;br /&gt;
&lt;br /&gt;
* WiFi&amp;amp;BT board, 802.11 a/b/g/n/ac 2T2R WiFi and Bluetooth 5.0 , support BPI-M5 and BPI-F2P&lt;br /&gt;
[[File:Wifibt_module1_.jpeg]]&lt;br /&gt;
*how to use : https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Wifi.2FBT_support&lt;br /&gt;
*discuss on forum : http://forum.banana-pi.org/t/bpi-m5-wifi-bt-board-sdio-interface-802-11-a-b-g-n-ac-2t2r-wifi-and-bluectooch-5-0/11846&lt;br /&gt;
*RT8822CS Bluetooth and WiFi adapter for Banana Pi BPI-M5：https://www.magazinmehatronika.com/en/rt8822cs-bluetooth-and-wifi-adapter-for-banana-pi-m5/?fbclid=IwAR0Oqm4TCa2SAXBTMJgRmWMJI-VQREqFxLh1-LnT_XzA5MAvYh_BL9-L7Xk&lt;br /&gt;
*easy to buy sample : https://www.aliexpress.com/item/1005002550783568.html?spm=5261.ProductManageOnline.0.0.34ed4edfgdV59j&lt;br /&gt;
&lt;br /&gt;
===standard USB interface Wifi&amp;amp;BT===&lt;br /&gt;
&lt;br /&gt;
*Banana Pi Wifi&amp;amp;BT 4.2 expansion Board, standard USB interface, so support all open source boards via USB port.IEEE 802.11b/g/n/ac(1T1R) USB WLANAnd BT Module&lt;br /&gt;
&lt;br /&gt;
[[File:Usb_wifi_bt_board_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
*how to use : https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Wifi.2FBT_support&lt;br /&gt;
*discuss on forum : http://forum.banana-pi.org/t/banana-pi-wifi-bt-4-2-expansion-board-standard-usb-interface/12162&lt;br /&gt;
&lt;br /&gt;
==BPI-M2 Pro VS BPI-M5 VS Odroid C4 VS RPI 4 ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''BPI-M2 Pro VS BPI-M5 VS Odroid C4 VS RPI 4'''&lt;br /&gt;
|-&lt;br /&gt;
|||[[Banana Pi BPI-M2 Pro]]||[[Banana Pi BPI-M5]]|| Odroid C4|| Raspberry Pi 4||&lt;br /&gt;
|-&lt;br /&gt;
|Processor||Amlogic S905X3 Quad-Core Cortex-A55 ARMv8.2-A 64-bit 1.5GHz	 ||Amlogic S905X3 Quad-Core Cortex-A55 ARMv8.2-A 64-bit 1.5GHz ||	Amlogic S905X3 Quad-Core Cortex-A55 ARMv8.2-A 64-bit 1.5GHz || 	Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz&lt;br /&gt;
|-&lt;br /&gt;
|GPU	||Mali-G31 MP2 GPU ||Mali-G31 MP2 GPU ||	Mali-G31 MP2 GPU ||	Broadcom VideoCore VI&lt;br /&gt;
|-&lt;br /&gt;
|RAM	||2GB LPDDR4	 ||4GB LPDDR4	 ||DDR4 4GiB with 32-bit bus width ||2GB, 4GB or 8GB LPDDR4-3200 SDRAM&lt;br /&gt;
|-&lt;br /&gt;
|Storage ||	micro SD card slot &amp;amp; 16GB eMMC flash on board||	micro SD card slot &amp;amp; 16GB eMMC flash on board	 ||micro SD card slot , eMMC connector for option ||micro SD card slot, non EMMC &lt;br /&gt;
|-&lt;br /&gt;
|Network ||1 GbE ,WiFi&amp;amp;BT5.0 onbard||	GbE ,Optional WiFi USB dongle ||	GbE	 ||GbE, 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE&lt;br /&gt;
|-&lt;br /&gt;
|Video Output ||	1 x HDMI 2.1 (up to 4K@60Hz with HDR, CEC, EDID)||	1 x HDMI 2.1 (up to 4K@60Hz with HDR, CEC, EDID) ||	1 x HDMI 2.1 (up to 4K@60Hz with HDR, CEC, EDID) ||	2 × micro-HDMI 2.0&lt;br /&gt;
|-&lt;br /&gt;
|Audio Output	|| 1 x HDMI digital output ||3.5mm jack and 1 x HDMI digital output ||	Optional SPDIF optical output || 3.5 mm analogue audio-video jack&lt;br /&gt;
|-&lt;br /&gt;
|DSI	 ||N/A	||N/A	 ||N/A ||	2-lane MIPI DSI display port&lt;br /&gt;
|-&lt;br /&gt;
|CSI	 ||N/A	||N/A	 ||N/A	 ||2-lane MIPI CSI camera port&lt;br /&gt;
|-&lt;br /&gt;
|USB	 ||USB 3.0 x 2	1 Micro USB 2.0||USB 3.0 x 4	TYPE C ||USB 3.0 x 4, 1 x Micro USB 2.0 port (OTG) ||	2 USB 3.0 ports; 2 USB 2.0 ports;&lt;br /&gt;
|-&lt;br /&gt;
|Power	 ||5 volt @3A via DC power	||5 volt @3A via Micro USB (TYPE C)	 ||1 x DC power jack (Outer diameter : 5.5mm, inner diameter : 2.1mm) ||	5V DC via USB-C connector (minimum 3A*)&lt;br /&gt;
|-&lt;br /&gt;
|IR	 ||Yes||Yes	 ||Yes	 ||N/A&lt;br /&gt;
|-&lt;br /&gt;
|GPIO	 ||40 Pin Header : GPIO (x28) and Power (+5V, +3.3V and GND).||40 Pin Header : GPIO (x28) and Power (+5V, +3.3V and GND). ||	40 x GPIO pins	 ||40-pin GPIO header, populated&lt;br /&gt;
|-&lt;br /&gt;
|Button	 ||Reset, user and U-boot ||Reset, user and U-boot ||	N/A ||	N/A ||&lt;br /&gt;
|-&lt;br /&gt;
|LED	 || Power Status and Activity status|| Power Status and Activity status ||	 Power Status and Activity status ||	 Power Status and Activity status&lt;br /&gt;
|-&lt;br /&gt;
|Dimensions &amp;amp; weight||65mm x 65mm,58g	 ||85mm x 56mm, 48g	 ||85mm x 56mm 59g	 ||88 mm × 58 mm, 46 g&lt;br /&gt;
|-&lt;br /&gt;
|System Support||	Linux &amp;amp; Android	 ||	Linux &amp;amp; Android	 ||Linux &amp;amp; Android ||Linux &amp;amp; Android&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==GPIO PIN define ==&lt;br /&gt;
&lt;br /&gt;
===BPI-M5 40PIN GPIO (CON2)===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-		&lt;br /&gt;
|GPIO Pin Name	||Default Function	||Function2||	Function3&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P01	||VCC-3V3||	||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P02||	VCC5V	||	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P03||	GPIOX_17	||I2C_M2_SDA||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P04||	VCC5V	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P05||	GPIOX_18||	I2C_M2_SCL	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P06||	GND	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P07||	GPIOX_5	SDIO_CMD||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P08||	GPIOX_12||	UART_A_TX	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P09||	GND	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P10||	GPIOX_13	||UART_A_RX	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P11||	GPIOX_3	SDIO_D3	||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P12||	GPIOAO_8||	TDMB_SCLK	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P13||	GPIOX_4	SDIO_CLK||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P14||	GND	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P15||	GPIOX_7	PWM_F	||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P16||	GPIOX_0	SDIO_D0	||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P17||	VCC-3V3		||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P18||	GPIOX_1	SDIO_D1	||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P19||	GPIOX_8	PCM_DIN	||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P20||	GND		||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P21||	GPIOX_9	PCM_DOUT||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P22||	GPIOX_2	SDIO_D2	||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P23||	GPIOX_11||	PCM_CLK	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P24||	GPIOX_10	||PCM_SYNC	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P25||	GND	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P26||	GPIOX_16	||PWM_E	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P27||	GPIOA_14||	I2C_M3_SDA	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P28||	GPIOA_15||	I2C_M3_SCL||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P29||	GPIOX_14||	UART_A_CTS	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P30||	GND	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P31||	GPIOX_15	||UART_A_RTS	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P32||	GPIOX_19||	PWM_B	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P33||	GPIOX_6	PWM_A	||||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P34||	GND	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P35||	GPIOAO_7||	TDMB_FS	||&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P36||	GPIOH_5	SPDIF_IN||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P37||	GPIOAO_9||	I2S_MCLK||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P38||	GPIOAO_10||	TDMB_DIN||	SPDIF_OUT&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P39||	GND	||||	&lt;br /&gt;
|-&lt;br /&gt;
|CON1-P40||	GPIOAO_4||	TDMB_DOUT||	&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===BPI-M5 Debug UART(CON1)	===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|CON2-P1||	GND&lt;br /&gt;
|-&lt;br /&gt;
|CON2-P2||	UART0-RX&lt;br /&gt;
|-&lt;br /&gt;
|CON2-P3||	UART0-TX&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
==Source code==&lt;br /&gt;
&lt;br /&gt;
=== BPI-M5 runs wiringpi gpio===&lt;br /&gt;
*https://github.com/BPI-SINOVOIP/amlogic-wiringPi&lt;br /&gt;
===Android===&lt;br /&gt;
android 9 source code: https://github.com/BPI-SINOVOIP/BPI-S905X3-Android9&lt;br /&gt;
&lt;br /&gt;
[http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Build_Android_Source_Code How to build the Android Source Code]&lt;br /&gt;
&lt;br /&gt;
*BPI-M5/M2 PRO Android9 source code: &lt;br /&gt;
:Baidu Cloud: https://pan.baidu.com/s/1TmmR_075b49lPSt1Phq0ag?pwd=8888 (pincode: 8888)&lt;br /&gt;
:Google Drive:https://drive.google.com/drive/folders/1RuvazYcr46HKMvNBxSqQftdyWa0tK9f7?usp=share_link&lt;br /&gt;
&lt;br /&gt;
===Linux BSP source code===&lt;br /&gt;
Linux BSP source code: https://github.com/BPI-SINOVOIP/BPI-M5-bsp&lt;br /&gt;
&lt;br /&gt;
[http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Build_Linux_Source_Code How to build the Linux BSP Source Code]&lt;br /&gt;
&lt;br /&gt;
== Resources==&lt;br /&gt;
*Because of the Google security update some of the old links will not work if the images you want to use cannot be downloaded from the [https://drive.google.com/drive/folders/0B_YnvHgh2rwjVjNyS2pheEtWQlk?resourcekey=0-U4TI84zIBdId7bHHjf2qKA new link bpi-image Files]&lt;br /&gt;
*All banana pi [https://drive.google.com/drive/folders/0B4PAo2nW2Kfndjh6SW9MS2xKSWs?resourcekey=0-qXGFXKmd7AVy0S81OXM1RA&amp;amp;usp=sharing  docement(SCH file,DXF file,and doc)]&lt;br /&gt;
*[https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FDocuments%2FBPI-M5%2FBPI-M5-SCH-V10-Release.pdf BPI-M5 schematic diagram]&lt;br /&gt;
*[https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FDocuments%2FBPI-M5%2FBPI-M5-PCB-V10-DXF.rar BPI-M5 PCB DXF file]&lt;br /&gt;
*[https://download.banana-pi.dev/d/3ebbfa04265d4dddb81b/files/?p=%2FDocuments%2FBPI-M5%2FS905X3_Public_Datasheet_Hardkernel.pdf Amlogic S905x3 datasheet]&lt;br /&gt;
*[http://wiki.banana-pi.org/Product_certification Banana Pi BPI-M5 CE,FCC,RoHS Certification]&lt;br /&gt;
*Install OpenGapps on Bananapi BPI-M5 Android 9.0:https://www.youtube.com/watch?v=fXOKmWfpqF8&lt;br /&gt;
*BANANA Pi BPI-M5 REVIEW &amp;amp; BENCHMARKS：https://bret.dk/banana-pi-m5-review/&lt;br /&gt;
*BANANA Pi M5 VS RASPBERRY Pi 4 – BENCHMARKS ： https://bret.dk/banana-pi-m5-vs-raspberry-pi-4/&lt;br /&gt;
*BPI-M5 How to install Ubuntu server on external USB-disk:https://forum.banana-pi.org/t/bpi-m5-howto-install-ubuntu-server-on-external-usb-disk/15259&lt;br /&gt;
*Install Armbian, OctoPrint and Klipper on the emmc of a Banana pi M5 - Linux and windows : https://www.youtube.com/watch?v=q5I6pzWCTrg&lt;br /&gt;
*CoreELEC for Banana Pi BPI-M2 Pro and BPI-M5:https://wiki.coreelec.org/coreelec:bpi&lt;br /&gt;
*U-Boot for BananaPi BPI-M2-PRO (S905X3):https://u-boot.readthedocs.io/en/latest/board/amlogic/bananapi-m2pro.html&lt;br /&gt;
*How to flash Armbian to the eMMc of the Banana-Pi BPi-M5:https://uglyscale.press/2023/08/31/how-to-flash-armbian-to-emmc-of-banana-pi-bpi-m5/&lt;br /&gt;
&lt;br /&gt;
=System image=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
:[http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Android How to flash Android Image]&lt;br /&gt;
&lt;br /&gt;
*2023-03-01 release, tablet variant image&lt;br /&gt;
:Baidu Cloud:https://pan.baidu.com/s/1cjzNgiE0-XJhvZgY0tQuHg?pwd=8888 （pincode: 8888)&lt;br /&gt;
:Google Drive:https://drive.google.com/drive/folders/144OU7NMTxLUqxNN2tXESgAoE3VXYgA_F?usp=share_link&lt;br /&gt;
&lt;br /&gt;
*2023-03-01 release, box variant image&lt;br /&gt;
:Baidu Cloud:https://pan.baidu.com/s/1SAfGM0WxOHW0vYCkjQUfbQ?pwd=8888  (pincode: 8888)&lt;br /&gt;
:Google Drive:https://drive.google.com/drive/folders/1Ipg8vZvKN_0xX0Fu24BW5UcDAHGhP7oH?usp=share_link&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
:[http://wiki.banana-pi.org/Getting_Started_with_BPI-M5#Linux How to flash Linux Image]&lt;br /&gt;
===Ubuntu===&lt;br /&gt;
*2023-08-30-ubuntu-20.04-server-bpi-m5-m2pro-aarch64-sd-emmc.img&lt;br /&gt;
:Baidu Cloud: https://pan.baidu.com/s/16nAyyW0IfTJqoYat2Qfcag?pwd=8888 (pincode:8888)&lt;br /&gt;
:Google Drive:https://drive.google.com/drive/folders/1y3i9uUgzmp03r9zzeuJkNszPZNl7D0OR?usp=sharing&lt;br /&gt;
&lt;br /&gt;
*2023-08-30-ubuntu-20.04-mate-desktop-bpi-m5-m2pro-aarch64-sd-emmc.img&lt;br /&gt;
:Baidu Cloud: https://pan.baidu.com/s/1UgfUDdNE-SQHka64mrNAYw?pwd=8888 (pincode:8888)&lt;br /&gt;
:Google Drive:https://drive.google.com/drive/folders/1RMX8F1PMLO-UcPPJL4QwYvdPVhk-a_c_?usp=sharing&lt;br /&gt;
&lt;br /&gt;
===Debian===&lt;br /&gt;
*2023-08-30-debian-10-buster-xfce-bpi-m5-m2pro-aarch64-sd-emmc.img&lt;br /&gt;
:Baidu Cloud: https://pan.baidu.com/s/15XHAZKDFqJLA3BH1b9Slqw?pwd=8888 (pincode:8888)&lt;br /&gt;
:Google Drive:https://drive.google.com/drive/folders/1EDXxJs23xV5Je91ZhfPYDvBubhhmJN1n?usp=sharing&lt;br /&gt;
&lt;br /&gt;
*2023-08-30-debian-10-buster-bpi-m5-m2pro-aarch64-sd-emmc.img&lt;br /&gt;
:Baidu Cloud: https://pan.baidu.com/s/1tFUbyPbrTJ5UGgM05w2k6A?pwd=8888 (pincode:8888)&lt;br /&gt;
:Google Drive:https://drive.google.com/drive/folders/1Y-GuZYovWRgBvt0z7FLnIuBJufVFflvv?usp=sharing&lt;br /&gt;
&lt;br /&gt;
==Third part image==&lt;br /&gt;
&lt;br /&gt;
===Raspbian===&lt;br /&gt;
*BPI-M5 BPI-M2 Pro new image:Raspbian image, 2023-05-03 update,please choose the right image&lt;br /&gt;
:Google driver: https://drive.google.com/drive/folders/1Rvr1l3LhnVcss0FD0_bAm3Jbi84vZBkT&lt;br /&gt;
:Baidu Cloud : https://pan.baidu.com/s/1T2DT3ruTRvRdFgIUrR1obg?pwd=8888 (pincode：8888)&lt;br /&gt;
*BPI-M5 BPI-M2 Pro new image:Raspbian image, 2022-4-09 update, Raspbian image for linux kernel 4.9 and 5.17. support 32bit and 64 bit,please choose the right image&lt;br /&gt;
:Google driver: https://drive.google.com/drive/folders/1VoiHH0IMU5iZRRdGg1-SpSu8pmwnjkmX&lt;br /&gt;
:Baidu Cloud: https://pan.baidu.com/s/1Y1S05nGQDOP8Pxu9eE6k_Q?pwd=8888 &lt;br /&gt;
:discuss on forum : https://forum.banana-pi.org/t/bpi-m5-bpi-m2-pro-new-image-rasbian-image-2022-4-09-update/13246&lt;br /&gt;
&lt;br /&gt;
===Armbian===&lt;br /&gt;
*Image From Armbian Official website&lt;br /&gt;
::https://www.armbian.com/bananapi-m5/&lt;br /&gt;
&lt;br /&gt;
*Image From Bananapi Released on 2023-03-13, build from Armbian main branch source code, fix some bugs and support i2c, uart, spi and rtl8822cs overlays, you can enable the overlay in /boot/armbianEnv.txt&lt;br /&gt;
::Baidu Cloud: https://pan.baidu.com/s/1Wgg_0Z7Db6DSKqoIjf16PQ?pwd=8888  (pincode: 8888)&lt;br /&gt;
::Google Drive: https://drive.google.com/drive/folders/1Yds8Rru_26S0wN2B-pIM6XkyxUXiceNl?usp=share_link&lt;br /&gt;
&lt;br /&gt;
*Armbian legacy build with bananapi kernel 4.9&lt;br /&gt;
&lt;br /&gt;
===EmuELEC===&lt;br /&gt;
*This is a porting of EmuELEC v4.5 for BPI-M5. I ported from odroid c4 official EmuELEC image. PS3 a XBOX ONE S gamepad controllers were tested and work fine.&lt;br /&gt;
*https://forum.banana-pi.org/t/emuelec-for-bpi-m5/12095&lt;br /&gt;
===CoreELEC===&lt;br /&gt;
:[https://coreelec.org/ CoreELEC] official support Bananapi M5 and M2Pro since 19.2-Matrix_rc1&lt;br /&gt;
::Download: https://coreelec.org/#download&lt;br /&gt;
::Install Guide: https://coreelec.org/#install&lt;br /&gt;
::Source Code: https://github.com/CoreELEC/CoreELEC&lt;br /&gt;
::how to install: https://wiki.coreelec.org/coreelec:bpim2pro&lt;br /&gt;
&lt;br /&gt;
===Volumio===&lt;br /&gt;
:Download:&lt;br /&gt;
::Google drive: https://drive.google.com/drive/folders/1B7nsy4Jxt2lBgXoA6XEnaamEQvZyHI8f&lt;br /&gt;
::Baidu cloud : https://pan.baidu.com/s/1mj9OC8P2VSI5GAMnIKGBqA PinCode: mrrb &lt;br /&gt;
:User Guide: https://cdn.volumio.org/wp-content/uploads/2019/01/Quick-Start-Guide-Volumio.pdf&lt;br /&gt;
:Source code: https://github.com/Dangku/volumio-build&lt;br /&gt;
:Platform prebuild package: https://github.com/Dangku/volumio-platform-bananapi&lt;br /&gt;
:Development guilde: https://volumio.github.io/docs/User_Manual/Quick_Start_Guide.html&lt;br /&gt;
&lt;br /&gt;
===Odroid Android image===&lt;br /&gt;
*Base on Odroid android source code and build for bananapi m5/m2pro&lt;br /&gt;
:Download: &lt;br /&gt;
::Google Drive: https://drive.google.com/drive/folders/1u_CddlHvpAMu2VZJfIfUKTsFFyigCWig&lt;br /&gt;
:Install Guide: https://forum.odroid.com/viewtopic.php?f=204&amp;amp;t=38579&lt;br /&gt;
&lt;br /&gt;
*Odroid ubuntu IMG for BPI-M5：&lt;br /&gt;
::https://forum.banana-pi.org/t/odroid-ubuntu-img-for-bpi-m5/12169&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Core 20===&lt;br /&gt;
:Ubuntu Core 20 demo image for bananapi m5/m2pro.&lt;br /&gt;
:Download:&lt;br /&gt;
::Google drive: https://drive.google.com/drive/folders/1TdAQ-HdggKrOPmWi0chpHDJY0SMWlUaC&lt;br /&gt;
::Baidu cloud :&lt;br /&gt;
:Install Guide: https://ubuntu.com/core/docs/uc20/install&lt;br /&gt;
&lt;br /&gt;
===Archlinux===&lt;br /&gt;
*Archlinux xfce and minimal demo image, kernel 4.9, image build refer to [https://archdroid.org/ Archdroid]&lt;br /&gt;
:login: alarm/alarm, or root/root&lt;br /&gt;
:Download:&lt;br /&gt;
::Google drive:https://drive.google.com/drive/folders/1rSSNgbseY2mwTMIauGR1yrXN8RPKzuk6&lt;br /&gt;
::Baidu link :  https://pan.baidu.com/s/1Ck_H51jPUyAv98o73I8oAw Pincode: rbv2&lt;br /&gt;
::discuss on forum : https://forum.banana-pi.org/t/bpi-m5-bpi-m2-pro-new-image-archlinux-2021-9-14/12595&lt;br /&gt;
&lt;br /&gt;
===HuaWei OpenEuler===&lt;br /&gt;
*OpenEuler demo image, bpi kernel 4.9&lt;br /&gt;
:Download:&lt;br /&gt;
::Baidu link ：https://pan.baidu.com/s/12b7q3y-m3YRyD7GwhKE0QA Pincode：lv50 &lt;br /&gt;
:SIG gitee link :  https://gitee.com/openeuler/raspberrypi&lt;br /&gt;
:Discuss on fourm : http://forum.banana-pi.org/&lt;br /&gt;
&lt;br /&gt;
===Manjaro for BPI-M5===&lt;br /&gt;
&lt;br /&gt;
Manjaro porting for BPI-M5 from Official Image for Odroid C4, the ported image use kernel 5.10. If anyone is interested on give it a try, the download link is below.&lt;br /&gt;
*Download Link: https://mega.nz/folder/BuZWkLhC#phC9KSsassB4bmkAegYykA&lt;br /&gt;
*discuss on forum : https://forum.banana-pi.org/t/manjaro-for-bpi-m5/12726&lt;br /&gt;
&lt;br /&gt;
==How to install Ubuntu Server 20.04 to M5 EMMC==&lt;br /&gt;
[[How to install Ubuntu Server 20.04 to M5 EMMC]]&lt;br /&gt;
&lt;br /&gt;
=Easy to buy=&lt;br /&gt;
&lt;br /&gt;
*SINOVOIP Aliexpress shop: https://www.aliexpress.us/item/3256801685527943.html?&lt;br /&gt;
*Bipai Aliexpress shop: https://www.aliexpress.us/item/3256803496172400.html&lt;br /&gt;
*Taobao Shop: https://item.taobao.com/item.htm?spm=a1z10.1-c-s.w4004-25059194388.8.13c23a90voeqk3&amp;amp;id=636199832159&lt;br /&gt;
&lt;br /&gt;
*easy to buy RTL8822 wifi module sample : https://www.aliexpress.com/item/1005002550783568.html?spm=5261.ProductManageOnline.0.0.34ed4edfgdV59j&lt;br /&gt;
&lt;br /&gt;
* Mass order,please contact : judyhuang@banana-pi.com&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=16991</id>
		<title>Getting Started with BPI-M4 Zero</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=16991"/>
				<updated>2024-01-26T10:32:37Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Play Store */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Zero]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Zero#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_1.jpg]]&lt;br /&gt;
:[[File:m4-zero_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Zero while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Zero#Linux | Linux Image]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Zero#Linux | bananapi 4.9 bsp ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
:1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
:2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface, an HDMI cable, and a mini HDMI to HDMI adapter.&lt;br /&gt;
:3. Use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor and BPI-M4 Zero, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Zero UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Zero, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Zero on the router management interface, or use the following command on the BPI-M4 Zero UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Zero is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Zero user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Zero in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Zero in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4zero:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Zero board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Zero.If it is a USB disk with a type-A plug, you also need a type-A to type-C adapter.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Zero Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4zero:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4zero:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Zero in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16990</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16990"/>
				<updated>2024-01-26T10:31:39Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Play Store */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
:Install Play Store with Magisk, it's not recommended.&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M4 Berry Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || Test Video&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720] || https://youtu.be/CRcjx6_29rA&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] || https://youtu.be/0wZ3lWQQTkQ&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || https://youtu.be/z9gTHa3i8Ag&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || https://youtu.be/Qjwo4vVBQmo&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] || https://youtu.be/SP9-HGrY6-M&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] || https://youtu.be/WA1yBGcYZds&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] || https://youtu.be/OJfqtHlgDvk&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16989</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16989"/>
				<updated>2024-01-26T10:27:57Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Play Store */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy Magisk apk file and LiteGapps zip package to SDcard and plugin it to the board.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M4 Berry Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || Test Video&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720] || https://youtu.be/CRcjx6_29rA&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] || https://youtu.be/0wZ3lWQQTkQ&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || https://youtu.be/z9gTHa3i8Ag&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || https://youtu.be/Qjwo4vVBQmo&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] || https://youtu.be/SP9-HGrY6-M&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] || https://youtu.be/WA1yBGcYZds&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] || https://youtu.be/OJfqtHlgDvk&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16988</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16988"/>
				<updated>2024-01-26T10:25:48Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Play Store */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:1. Download the latest [https://magiskmanager.com/ Magisk app] &lt;br /&gt;
:2. Download [https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/ LiteGapps arm package]  &lt;br /&gt;
:4. Copy download apps and package to SDcard and plugin it to Bananapi R2pro.&lt;br /&gt;
:5. Follow the process in the video to Install Google Play store.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;youtube&amp;gt;pMKBVcJhsx4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Another way, you can build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===HDMI LCD===&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background: PaleTurquoise; color: black&amp;quot; colspan=&amp;quot;4&amp;quot;| '''Bananapi M4 Berry Tested HDMI LCD'''&lt;br /&gt;
|-&lt;br /&gt;
|panel || Test Video&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/4inch-hdmi-lcd-c.htm Waveshare 4inch 720x720] || https://youtu.be/CRcjx6_29rA&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5inch-hdmi-amoled.htm Waveshare 5inch 960x544] || https://youtu.be/0wZ3lWQQTkQ&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/5.5inch-1440x2560-lcd.htm Waveshare 5.5inch 1440x2560] || https://youtu.be/z9gTHa3i8Ag&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8inch-1536x2048-LCD.htm Waveshare 8inch 1536x2048] || https://youtu.be/Qjwo4vVBQmo&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/8.8inch-Side-Monitor.htm Waveshare 8.8inch 480x1920] || https://youtu.be/SP9-HGrY6-M&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/11.9inch-HDMI-LCD.htm Waveshare 11.9inch 320x1480] || https://youtu.be/WA1yBGcYZds&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.waveshare.com/12.3inch-hdmi-lcd.htm Waveshare 12.3inch 1920x720] || https://youtu.be/OJfqtHlgDvk&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=16982</id>
		<title>Getting Started with BPI-M4 Zero</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Zero&amp;diff=16982"/>
				<updated>2024-01-22T03:52:52Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Image with USB tool */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Zero]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Zero#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_1.jpg]]&lt;br /&gt;
:[[File:m4-zero_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Zero while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-zero_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Zero#Linux | Linux Image]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Zero#Linux | bananapi 4.9 bsp ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
:1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
:2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
::[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface, an HDMI cable, and a mini HDMI to HDMI adapter.&lt;br /&gt;
:3. Use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor and BPI-M4 Zero, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Zero UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Zero, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Zero on the router management interface, or use the following command on the BPI-M4 Zero UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Zero is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Zero user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Zero in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Zero in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4zero:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Zero board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Zero.If it is a USB disk with a type-A plug, you also need a type-A to type-C adapter.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Zero Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, use an HDMI cable and a mini HDMI to HDMI adapter to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4zero:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4zero:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Zero in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=File:M4b_audio_switch.jpg&amp;diff=16981</id>
		<title>File:M4b audio switch.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=File:M4b_audio_switch.jpg&amp;diff=16981"/>
				<updated>2024-01-22T03:37:31Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16980</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16980"/>
				<updated>2024-01-22T03:36:34Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Switch Audio Output */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
: The default audio output channel is hdmi, switch it to jack output in Settings-&amp;gt;Sound-&amp;gt;Audio output channel&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_audio_switch.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16979</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16979"/>
				<updated>2024-01-22T03:33:11Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Install Play Store */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
===Switch Audio Output===&lt;br /&gt;
&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16978</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16978"/>
				<updated>2024-01-22T03:11:22Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Custom Logo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
===Install Play Store===&lt;br /&gt;
&lt;br /&gt;
:Build the android source code with OpenGApps google play include.&lt;br /&gt;
&lt;br /&gt;
:1. Apply this patch to source code.&lt;br /&gt;
  diff --git a/device/softwinner/apollo/common/opengapps/config.mk &lt;br /&gt;
  b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  index 4c2a7f3..c7ff30e 100644&lt;br /&gt;
  --- a/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  +++ b/device/softwinner/apollo/common/opengapps/config.mk&lt;br /&gt;
  @@ -1,4 +1,4 @@&lt;br /&gt;
  -BOARD_BUILD_OPENGAPPS := false&lt;br /&gt;
  +BOARD_BUILD_OPENGAPPS := true&lt;br /&gt;
 &lt;br /&gt;
   ifeq ($(BOARD_BUILD_OPENGAPPS), true)&lt;br /&gt;
   GAPPS_VARIANT := pico&lt;br /&gt;
&lt;br /&gt;
:3. Create /vendor/opengapps folder&lt;br /&gt;
&lt;br /&gt;
:4. Download [https://github.com/opengapps/aosp_build OpenGApps aosp_build] project to /vendor/opengapps/build&lt;br /&gt;
&lt;br /&gt;
:5. Create /vendor/opengapps/sources folder, download [https://gitlab.opengapps.org/opengapps OpenGApps projects] to /vendor/opengapps/sources/&lt;br /&gt;
&lt;br /&gt;
:6. Build the source code and flash image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16977</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16977"/>
				<updated>2024-01-22T03:03:19Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Custom IR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16976</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16976"/>
				<updated>2024-01-22T03:03:04Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Build Android Source Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16975</id>
		<title>Getting Started with BPI-M4 Berry</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_BPI-M4_Berry&amp;diff=16975"/>
				<updated>2024-01-22T03:02:22Z</updated>
		
		<summary type="html">&lt;p&gt;Dangku: /* Custom IR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手_BPI-M4_Berry]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M4_Berry_1.jpg|thumb|[[Banana Pi BPI-M4 Berry]] H618 design]]&lt;br /&gt;
[[File:Banana_pi_BPI-M2_Berry_5.JPG|thumb|[[Banana Pi BPI-M2 Berry]] A40i-H design]]&lt;br /&gt;
[[File:BPI-M2_Pro_2.jpg|thumb|[[Banana Pi BPI-M2 Pro]] S905x3 design]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M2S_1.jpg|thumb|[[Banana Pi BPI-M2S]] Amlogic A311D/S922 chip]]&lt;br /&gt;
[[File:Banana_Pi_BPI-M5_1.JPG|thumb|[[Banana Pi BPI-M5]] with S905x3 design]]&lt;br /&gt;
&lt;br /&gt;
=Development=&lt;br /&gt;
&lt;br /&gt;
==Android==&lt;br /&gt;
===Prepare===&lt;br /&gt;
&lt;br /&gt;
:1. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | Android image]].&lt;br /&gt;
&lt;br /&gt;
:2. Download and Install [https://download.banana-pi.dev/d/ca025d76afd448aabc63/files/?p=%2FTools%2Fimage_download_tools%2Fphoenixsuit_V1.1.0_20150325.rar Allwinner Image Download Tools], PhoenixSuit is for window. &lt;br /&gt;
&lt;br /&gt;
:3. Type-C cable, 5V power supply.&lt;br /&gt;
&lt;br /&gt;
===Install Image with USB tool===&lt;br /&gt;
&lt;br /&gt;
:1. Open PhoenixSuit, click the Firmware icon to switching to firmware download panel, then click Image button and choose the Android Image file.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_1.jpg]]&lt;br /&gt;
:[[File:m4-berry_android_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:2. Press and hold the SW2 button on M4 Berry while connecting to the computer using type-c, popup a warning dialog.Press Yes.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. Download&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:4. Download finish&lt;br /&gt;
&lt;br /&gt;
:[[File:m4-berry_android_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Custom IR===&lt;br /&gt;
:Wiki images support NEC protocol default.&lt;br /&gt;
&lt;br /&gt;
:1. Execute getevent -l | grep MSC_SCAN in the serial port or adb shell, then press the corresponding button on the remote control to obtain the device ID and scancode.&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:The MSC_SCAN data is 32 bits.&lt;br /&gt;
:Bits [31:24] represent the key press status, where 0 indicates release, and 1 indicates press.&lt;br /&gt;
:Bits [23:8] represent the device ID. Use this ID to generate a keylayout file named customer_ir_xxxx.kl. For example, in this case, it would be customer_ir_fe01.kl.&lt;br /&gt;
:Bits [7:0] represent the scancode.&lt;br /&gt;
&lt;br /&gt;
:2. Based on the results of step one, create a new file named customer_ir_xxxx.kl with the following content:&lt;br /&gt;
&lt;br /&gt;
:[[File:m4b_custom_ir_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Map the scancodes in the second column to Android keycodes.&lt;br /&gt;
&lt;br /&gt;
:3. Use the adb command to push customer_ir_xxxx.kl to the system.&lt;br /&gt;
&lt;br /&gt;
  $ adb root&lt;br /&gt;
  $ adb remount&lt;br /&gt;
  $ adb push customer_ir_xxxx.kl  /system/usr/keylayout/&lt;br /&gt;
  $ adb reboot&lt;br /&gt;
&lt;br /&gt;
:For source code porting, put the customer_ir_xxxx.kl to vendor/w/common/hardware/input/multi_ir/keylayout/ directory and build the source code.&lt;br /&gt;
&lt;br /&gt;
===Build Android Source Code===&lt;br /&gt;
&lt;br /&gt;
:Please read the source code [https://github.com/BPI-SINOVOIP/BPI-H618-Android12/blob/master/README.md README.md]&lt;br /&gt;
&lt;br /&gt;
===Custom Logo===&lt;br /&gt;
&lt;br /&gt;
:1. Boot logo&lt;br /&gt;
&lt;br /&gt;
:Rename the logo file to bootlogo.bmp and put it in longan/device/config/chips/h618/boot-resource/boot-resource/ directory.&lt;br /&gt;
&lt;br /&gt;
:2. Bootanimation logo&lt;br /&gt;
&lt;br /&gt;
:Put bootanimation.zip to device/softwinner/apollo/common/media/bootanimation/ directory.&lt;br /&gt;
&lt;br /&gt;
:3. Launcher logo for Box variant image&lt;br /&gt;
&lt;br /&gt;
:Create a 270x110, 32 bit depth, png image and rename it to aw_logo.png, put it in vendor/aw/common/package/TVLauncher/res/drawable-xhdpi/ directory.&lt;br /&gt;
&lt;br /&gt;
:Then build the source code and flash the image to your board.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
===Prepare===&lt;br /&gt;
:1. Linux image support SDcard or EMMC bootup, and will boot from the SD card first.&lt;br /&gt;
&lt;br /&gt;
:2. It’s recommended to use A1 rated cards, 8GB at least.&lt;br /&gt;
&lt;br /&gt;
:3. Make sure bootable EMMC is formatted if you want bootup from SDcard.&lt;br /&gt;
&lt;br /&gt;
:4. Make sure SDcard is formatted without Linux image flashed if you want bootup from EMMC and use Sdcard as storage.&lt;br /&gt;
&lt;br /&gt;
:5. Download latest [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]], and confirm that the md5 checksum is correct.&lt;br /&gt;
&lt;br /&gt;
:6. Default login: pi/bananapi or root/bananapi&lt;br /&gt;
&lt;br /&gt;
:7. The wiki guide is only for [[Banana_Pi_BPI-M4_Berry#System_image | bananapi ubuntu/debian images]].&lt;br /&gt;
&lt;br /&gt;
:8. USB-Serial (3.3V). Baud: 115200.&lt;br /&gt;
&lt;br /&gt;
===Install Image to SDcard===&lt;br /&gt;
:1. Install Image with Balena Etcher on Windows, Linux and MacOS.&lt;br /&gt;
:[https://balena.io/etcher Balena Etcher] is an opensource GUI flash tool by Balena, Flash OS images to SDcard or USB drive.&lt;br /&gt;
&lt;br /&gt;
:[[File:m2s_linux_flash.png]]&lt;br /&gt;
&lt;br /&gt;
===Install Image to eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure that the Linux image has been burned into an SD card and started normally.&lt;br /&gt;
&lt;br /&gt;
2. Enter the following command in the terminal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo bananapi-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. By default, select the first item continuously and press the Enter key to install the Linux system image on the eMMC.&lt;br /&gt;
&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_12.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_13.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_14.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_15.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_16.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_17.jpg]]&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_18.jpg]]&lt;br /&gt;
&lt;br /&gt;
4. The last step is to shut down the computer. At this time, disconnect the power supply, remove the SD card, and power on again to boot from eMMC.&lt;br /&gt;
&lt;br /&gt;
===Erase eMMC===&lt;br /&gt;
&lt;br /&gt;
1. Make sure the Linux image has been burned into an SD card and insert the SD card. By default it will boot from the SD card.&lt;br /&gt;
&lt;br /&gt;
2. Enter the command lsblk in the terminal to list the block device information in the system, such as hard disks, partitions, disks, etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ lsblk&lt;br /&gt;
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
mmcblk0 179:0 0 7.4G 0 disk&lt;br /&gt;
└─mmcblk0p1 179:1 0 7.2G 0 part /var/log.hdd&lt;br /&gt;
                                        /&lt;br /&gt;
mmcblk1 179:32 0 7.3G 0 disk&lt;br /&gt;
└─mmcblk1p1 179:33 0 7.3G 0 part&lt;br /&gt;
mmcblk1boot0 179:64 0 4M 1 disk&lt;br /&gt;
mmcblk1boot1 179:96 0 4M 1 disk&lt;br /&gt;
zram0 252:0 0 993.2M 0 disk [SWAP]&lt;br /&gt;
zram1 252:1 0 50M 0 disk /var/log&lt;br /&gt;
zram2 252:2 0 0B 0 disk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. mmcblk0 is the SD card and mmcblk1 is the eMMC. Enter the following command in the terminal to erase the eMMC. This process takes several minutes and is irreversible. Be careful to back up important data.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo dd if=/dev/zero of=/dev/mmcblk1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Ubuntu Desktop===&lt;br /&gt;
&lt;br /&gt;
:1. Using the Ubuntu desktop version system image, you can get a graphical operation interface.&lt;br /&gt;
:2. You need to prepare a monitor with an HDMI interface and an HDMI cable.&lt;br /&gt;
:3. Use an HDMI cable to connect the monitor and BPI-M4 Berry, switch the monitor input interface to the corresponding HDMI interface, power on, and wait a moment to see the desktop.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Debug UART===&lt;br /&gt;
:1. Prepare a 3.3v USB to TTL module.&lt;br /&gt;
:2. Use the USB to TTL module to connect the PC USB port and the Debug UART port on the board.&lt;br /&gt;
:3. Open a serial terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:4. Taking mobaxterm as an example, after setting the serial port number and 115200 baud rate, you can open the BPI-M4 Berry UART terminal.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===SSH===&lt;br /&gt;
:1. Prepare a network cable and a router.&lt;br /&gt;
:2. Use a network cable to connect the LAN port of the router to the BPI-M4 Berry, and also connect the PC to another LAN port.&lt;br /&gt;
:3. Check the IP address of BPI-M4 Berry on the router management interface, or use the following command on the BPI-M4 Berry UART terminal to check the IP address.&lt;br /&gt;
   ifconfig&lt;br /&gt;
&lt;br /&gt;
   eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt; mtu 1500&lt;br /&gt;
         inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255&lt;br /&gt;
         inet6 fe80::3e1f:688f:81ab:d8b7 prefixlen 64 scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
         ether 02:00:54:a0:d6:a6 txqueuelen 1000 (Ethernet)&lt;br /&gt;
         RX packets 553 bytes 92549 (92.5 KB)&lt;br /&gt;
         RX errors 0 dropped 0 overruns 0 frame 0&lt;br /&gt;
         TX packets 329 bytes 26023 (26.0 KB)&lt;br /&gt;
         TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0&lt;br /&gt;
         device interrupt 42&lt;br /&gt;
:4. Open an SSH terminal software on the PC, such as [https://mobaxterm.mobatek.net/ mobaxterm] or [https://www.putty.org/ putty].&lt;br /&gt;
:5. Taking mobaxterm as an example, fill in the obtained IP address, such as 192.168.3.10 above, in the IP address column and 22 in the Port port.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:6. Open the SSH terminal and enter the login username/password: pi/bananapi or root/bananapi. There will be no prompt when entering the password. Please enter it normally and press Enter when finished.&lt;br /&gt;
&lt;br /&gt;
[[File:bpi_m4_berry_mobaxterm_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
===NoMachine Remote Desktop===&lt;br /&gt;
:1. Make sure BPI-M4 Berry is connected to the Internet and use the following command to download the nomachine DEB installation package in the system.&lt;br /&gt;
&lt;br /&gt;
   wget https://download.nomachine.com/download/8.9/Arm/nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:2. Or open [https://downloads.nomachine.com/download/?id=117&amp;amp;distro=ARM NoMachine for ARM - arm64 download page] in a PC browser, download the DEB installation package, and then copy it to BPI-M4 Berry user directory through SSH or USB disk.&lt;br /&gt;
&lt;br /&gt;
:3. After the download is completed, install it through the following command. Note that the file name is based on the actual downloaded file name.&lt;br /&gt;
&lt;br /&gt;
   sudo dpkg -i nomachine_8.9.1_1_arm64.deb&lt;br /&gt;
&lt;br /&gt;
:4. PC side also needs to download and install NoMachine. [https://download.nomachine.com NoMachine download page] Select the installation package suitable for the PC operating system, download it locally and complete the installation.&lt;br /&gt;
&lt;br /&gt;
:5. Pay attention to keeping the PC and BPI-M4 Berry in the same LAN. You can try SSH connection first to ensure normal communication within the LAN.&lt;br /&gt;
&lt;br /&gt;
:6. Open NoMachine on the PC, click the Add button, enter the IP address of BPI-M4 Berry in the Host bar in the window after the jump, and then click the Add button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
:7. Click the recognized port icon, enter the username/password in the new window that pops up, and then click the OK button.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_2.jpg]]&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:8. After completing the subsequent settings, you can see the desktop.&lt;br /&gt;
[[File:Bpi_m4_berry_nomachine_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
:9. If no device is connected to the HDMI interface, the NoMachine remote desktop will display a black screen. It is recommended to keep the HDMI connection or connect an HDMI decoy device.&lt;br /&gt;
&lt;br /&gt;
===WiFi===&lt;br /&gt;
: Use the nmcli command to scan WiFi hotspots, connect to hotspots, and create AP hotspots.&lt;br /&gt;
&lt;br /&gt;
   nmcli device #List devices&lt;br /&gt;
   nmcli device wifi list # List available wifi access points, list can be omitted&lt;br /&gt;
   nmcli device wifi connect [SSID] password [PASSWORD] # Connect to the hotspot mySSID. After the connection is successful, the configuration file will be automatically generated. If you want to connect again in the future, you can use the nmcli connection up [SSID] command.&lt;br /&gt;
   nmcli device disconnect [device name] # Disconnect wifi, use the wifi device name displayed in the nmcli device command&lt;br /&gt;
   nmcli device wifi hotspot con-name [NAME] ifname [device name] ssid [SSID] password [PASSWORD] # Create AP hotspot&lt;br /&gt;
&lt;br /&gt;
   nmcli connection show #List network connection configuration&lt;br /&gt;
   nmcli connection down [NAME] # Deactivate a connection&lt;br /&gt;
   nmcli connection up [NAME] # Activate a connection&lt;br /&gt;
   nmcli connection delete [SSID] #Delete a configuration and no longer save information and automatically connect&lt;br /&gt;
&lt;br /&gt;
   nmcli radio wifi off # Turn off wifi&lt;br /&gt;
   nmcli radio wifi on # Turn on wifi&lt;br /&gt;
&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html nmcli command reference document]&lt;br /&gt;
:* [https://developer-old.gnome.org/NetworkManager/unstable/nmcli-examples.html nmcli command reference examples]&lt;br /&gt;
&lt;br /&gt;
===Set static IP, DNS===&lt;br /&gt;
:1. To set a static IP, you need to maintain the connection first. If you want to set an Ethernet static IP, you must first maintain the Ethernet connection; if you want to set a wireless network static IP, you must first maintain a connection to a WIFI.&lt;br /&gt;
:2. If the upper-level router has assigned the IP address you want to set to other devices, please change it to an idle IP, or ask other devices to give up the IP.&lt;br /&gt;
:3. Use the nmcli connection show command to display all connections, for example:&lt;br /&gt;
   pi@bpi-m4berry:~$ nmcli connection show&lt;br /&gt;
   NAME UUID TYPE DEVICE&lt;br /&gt;
   TP-LINK_5G_7747 e4a49726-adf1-44d7-a621-0e3af96cc390 wifi wlx2cc3e6acd5d7&lt;br /&gt;
   Wired connection 1 612eda94-55dc-3c85-b05e-f16c41775b4e ethernet --&lt;br /&gt;
:4. Use the nmcli connection show [NAME] command to display all the properties of a specific connection, such as:&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747 #If you want to see Ethernet, change to Wired connection 1&lt;br /&gt;
&lt;br /&gt;
   #Only list three common items&lt;br /&gt;
   ipv4.dns: 192.168.3.1 #The default is the gateway address&lt;br /&gt;
   ipv4.addresses: 192.168.3.10/24 #The default is the IP address assigned by the router DHCP&lt;br /&gt;
   ipv4.gateway: 192.168.3.1 #Gateway address, the default is the IP address of the router&lt;br /&gt;
&lt;br /&gt;
:5.Set static IP:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.addresses 192.168.3.2&lt;br /&gt;
:6.Set DNS:&lt;br /&gt;
   nmcli connection modify TP-LINK_5G_7747 ipv4.dns 8.8.8.8 #Google DNS&lt;br /&gt;
:7.Reset:&lt;br /&gt;
   reboot&lt;br /&gt;
:8. After restarting, check whether the modification is successful:&lt;br /&gt;
   ifconfig&lt;br /&gt;
   nmcli connection show TP-LINK_5G_7747&lt;br /&gt;
&lt;br /&gt;
===Network time synchronization===&lt;br /&gt;
:Chrony is an open source free Network Time Protocol NTP client and server software. It allows the computer to keep the system clock synchronized with the clock server (NTP), thus allowing your computer to maintain accurate time. Chrony can also be used as a server software to provide time synchronization services for other computers.&lt;br /&gt;
&lt;br /&gt;
   timedatectl set-ntp false #Disable NTP-based network time synchronization&lt;br /&gt;
&lt;br /&gt;
   sudo apt install chrony #Install chrony&lt;br /&gt;
   systemctl start chrony #Start chrony&lt;br /&gt;
   systemctl enable chrony&lt;br /&gt;
   systemctl status chrony&lt;br /&gt;
   systemctl restart chrony #Restart service&lt;br /&gt;
&lt;br /&gt;
   timedatectl status #View time synchronization status&lt;br /&gt;
   timedatectl list-timezones #View time zone list&lt;br /&gt;
   timedatectl set-timezone Asia/Shanghai #Modify time zone&lt;br /&gt;
   timedatectl set-ntp true #Enable NTP network time synchronization&lt;br /&gt;
&lt;br /&gt;
   date #View time&lt;br /&gt;
   sudo hwclock -r #View hardware clock&lt;br /&gt;
&lt;br /&gt;
:* [https://chrony-project.org/documentation.html Chrony reference documentation]&lt;br /&gt;
&lt;br /&gt;
===View hardware temperature===&lt;br /&gt;
Enter the following command to view the temperature data returned by the sensor built into the chip on the BPI-M4 Berry board.&lt;br /&gt;
   sensors&lt;br /&gt;
&lt;br /&gt;
===Modify HDMI output resolution===&lt;br /&gt;
:When using the Ubuntu desktop operating system, you can find the Displays column in Settings and modify the resolution.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Use USB disk===&lt;br /&gt;
:1. Prepare a USB disk that has been partitioned normally and insert it into the USB interface of BPI-M4 Berry.&lt;br /&gt;
:2. In the Ubuntu desktop version, you can see that the USB disk has been recognized and can be opened in the file manager, or partition management can be performed through the GParted tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:3. In the terminal, mount the USB disk to the local directory:&lt;br /&gt;
   mkdir mnt #Create a separate directory in the ~/user directory for mounting for easy management&lt;br /&gt;
   cat /proc/partitions | grep &amp;quot;sd*&amp;quot; #List partitions starting with sd&lt;br /&gt;
   sudo mount /dev/sda1 ~/mnt/ #Mount /dev/sda1 to ~/mnt/&lt;br /&gt;
   ls ~/mnt/ #After mounting, you can list the files in the USB disk&lt;br /&gt;
   sudo umount -v /dev/sda1 #umount, then you can remove the USB disk&lt;br /&gt;
&lt;br /&gt;
===Use Audio Devices===&lt;br /&gt;
: Prepare an audio file and copy it to the BPI-M4 Berry Ubuntu desktop system through a USB flash drive or SSH.&lt;br /&gt;
====HDMI audio====&lt;br /&gt;
:1. Prepare a monitor with HDMI audio input function, turn on the relevant functions in the monitor settings, and use an HDMI cable to connect the monitor.&lt;br /&gt;
:2. Set the output device to HDMI Audio in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_4.jpg]]&lt;br /&gt;
:3.Play audio.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====3.5mm audio jack====&lt;br /&gt;
:1. Prepare a headset or other audio device that uses a 3.5mm plug, insert the plug into the 3.5mm jack of BPI-M4 Berry.&lt;br /&gt;
:2. Set the output device to Audio Codec in the Sound column of the settings.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_6.jpg]]&lt;br /&gt;
:3. Play audio.&lt;br /&gt;
&lt;br /&gt;
====Terminal command to play audio files====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aplay -l #List devices&lt;br /&gt;
aplay -D hw:0,0 [path] #Play the audio file of the specified path&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Bluetooth===&lt;br /&gt;
:1. Open settings in the Ubuntu desktop and connect a Bluetooth device, such as a Bluetooth mouse or keyboard, in the Bluetooth bar.&lt;br /&gt;
[[File:Bpi_m4_berry_ubuntu_7.jpg]]&lt;br /&gt;
:2. The method to connect the Bluetooth device through the command line in the terminal is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi@bpi-m4berry:~$ sudo bluetoothctl #Open the Bluetooth device management tool&lt;br /&gt;
[sudo] password for pi:&lt;br /&gt;
Agent registered&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Pairable: yes&lt;br /&gt;
[bluetooth]# power on #Start the Bluetooth function, power off to turn it off&lt;br /&gt;
Changing power on succeeded&lt;br /&gt;
[bluetooth]# discoverable on #Allow this device to be discovered&lt;br /&gt;
Changing discoverable on succeeded&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discoverable: yes&lt;br /&gt;
[bluetooth]# pairable on #Allow device pairing&lt;br /&gt;
Changing pairable on succeeded&lt;br /&gt;
[bluetooth]# scan on #Start scanning&lt;br /&gt;
Discovery started&lt;br /&gt;
[CHG] Controller 2C:C3:E6:AC:D5:D8 Discovering: yes&lt;br /&gt;
[NEW] Device D4:C4:85:A5:C6:B1 Logitech Pebble #The MAC address and device name of a Bluetooth mouse&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 TxPower: 4&lt;br /&gt;
[bluetooth]# pair D4:C4:85:A5:C6:B1 #Pair the MAC address of the Bluetooth device you want to connect to&lt;br /&gt;
Attempting to pair with D4:C4:85:A5:C6:B1&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Connected: yes&lt;br /&gt;
[DEL] Device A4:C1:38:9B:F6:FD SLPO20N20200059&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001800-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001801-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180a-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00001812-0000-1000-8000-00805f9b34fb&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 UUIDs: 00010000-0000-1000-8000-011f2000046d&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 ServicesResolved: yes&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Paired: yes&lt;br /&gt;
Pairing successful #pairing successfully&lt;br /&gt;
[CHG] Device D4:C4:85:A5:C6:B1 Modalias: usb:v046DpB021d0007&lt;br /&gt;
[bluetooth]# exit #Exit the Bluetooth device management tool&lt;br /&gt;
pi@bpi-m4berry:~$&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:[https://wiki.archlinux.org/title/bluetooth archlinux bluetooth reference document]&lt;br /&gt;
&lt;br /&gt;
===Use IR Receiver===&lt;br /&gt;
:1. You need to prepare an infrared remote control using NEC format.&lt;br /&gt;
:2. Enter the following command in the terminal to start receiving infrared signals.&lt;br /&gt;
   sudo ir-keytable -c -p NEC -t&lt;br /&gt;
&lt;br /&gt;
   Old keytable cleared&lt;br /&gt;
   Protocols changed to nec&lt;br /&gt;
   Testing events. Please, press CTRL-C to abort.&lt;br /&gt;
   258.553895: lirc protocol(nec): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_MSC(0x04): scancode = 0x45&lt;br /&gt;
   258.553926: event type EV_SYN(0x00).&lt;br /&gt;
   260.667648: lirc protocol(nec): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.667671: event type EV_SYN(0x00).&lt;br /&gt;
   260.719552: lirc protocol(nec): scancode = 0x46 repeat&lt;br /&gt;
   260.719568: event type EV_MSC(0x04): scancode = 0x46&lt;br /&gt;
   260.719568: event type EV_SYN(0x00).&lt;br /&gt;
   273.263728: lirc protocol(nec): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.263753: event type EV_SYN(0x00).&lt;br /&gt;
   273.315591: lirc protocol(nec): scancode = 0x47 repeat&lt;br /&gt;
   273.315608: event type EV_MSC(0x04): scancode = 0x47&lt;br /&gt;
   273.315608: event type EV_SYN(0x00).&lt;br /&gt;
&lt;br /&gt;
For other commands and specific application methods, please see [https://manpages.ubuntu.com/manpages/focal/en/man1/ir-keytable.1.html ir-keytable reference document]&lt;br /&gt;
&lt;br /&gt;
===Transfer files===&lt;br /&gt;
====scp====&lt;br /&gt;
scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. &lt;br /&gt;
&lt;br /&gt;
The SCP command or secure copy allows the secure transferring of files between the local host and the remote host or between two remote hosts. &lt;br /&gt;
&lt;br /&gt;
It uses the same authentication and security as it is used in the Secure Shell (SSH) protocol.&lt;br /&gt;
&lt;br /&gt;
You can copy files from a Windows terminal to a Linux system on the same LAN. Just make sure the Open SSH client is turned on and can be viewed in Settings &amp;gt; Applications &amp;gt; Optional Features.&lt;br /&gt;
&lt;br /&gt;
If you want to copy files from Windows systems to Linux systems, you also need to enable the Open SSH server.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
The scp command format is:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;pre&amp;gt;scp [optionals] file_source file_target&amp;lt;/pre&amp;gt;&lt;br /&gt;
::1.&amp;lt;nowiki&amp;gt;[optionals]&amp;lt;/nowiki&amp;gt; is an optional parameter, such as -r, which can be used to copy the entire directory recursively.&lt;br /&gt;
&lt;br /&gt;
::2.file_source The file or directory to be copied.&lt;br /&gt;
&lt;br /&gt;
::3.file_target will copy the past path and rename it if a specific file name is entered at the end.&lt;br /&gt;
&lt;br /&gt;
Take copying local files from a Windows system to a Linux system as an example. In the Windows terminal, enter:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp &amp;quot;.\hello.txt&amp;quot; pi@192.168.3.12:&amp;quot;/home/pi/Downloads/&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also copy files in the Linux system to the local computer in the Windows terminal:&lt;br /&gt;
:&amp;lt;pre&amp;gt;PS D:\temp\temp_4&amp;gt; scp pi@192.168.3.12:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot; &amp;quot;D:\temp\temp_4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
:: Where pi@192.168.3.12 is the user name in the Linux system and the IP address of the BPI-M4 Berry in the LAN.&lt;br /&gt;
:: Where &amp;lt;nowiki&amp;gt;:&amp;quot;/home/pi/Downloads/hello.txt&amp;quot;&amp;lt;/nowiki&amp;gt; is the file path in the Linux system.&lt;br /&gt;
:: Where &amp;quot;D:\temp\temp_4&amp;quot; is the path in Windows system.&lt;br /&gt;
&lt;br /&gt;
[https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/ scp reference document]&lt;br /&gt;
&lt;br /&gt;
====mobaxterm====&lt;br /&gt;
Files can be managed through a graphical interface using mobaxterm or other similar software.&lt;br /&gt;
:[https://mobaxterm.mobatek.net/download.html mobaxterm download]&lt;br /&gt;
:[https://download.mobatek.net/mobaxterm-on-linux.html mobaxterm-linux preview version]&lt;br /&gt;
&lt;br /&gt;
As shown in the figure below, after establishing an SSH connection in mobaxterm, a file management window will appear on the left side of the interface, which supports copying and pasting by dragging and dropping files.&lt;br /&gt;
:[[File:Bpi_m4_berry_mobaxterm_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
===40 pin interface GPIO, I2C, UART, SPI, and PWM testing===&lt;br /&gt;
====GPIO====&lt;br /&gt;
Control the GPIO port to light up the LED light.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set the high and low levels of GPIO'''&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio.jpg]]&lt;br /&gt;
&lt;br /&gt;
The following is a demonstration using 7 pin.&lt;br /&gt;
&lt;br /&gt;
Insert the LED light and you can see that it is not lit up.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
 gpio mode 2 out&lt;br /&gt;
:to set it to output mode.&lt;br /&gt;
&lt;br /&gt;
: 2.Execute&lt;br /&gt;
 gpio write 2 1&lt;br /&gt;
:You can see that the LED light has been turned on.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Execute&lt;br /&gt;
 gpio write 2 0&lt;br /&gt;
:You can see that the LED light has been turned off.&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Set pull-up and pull-down resistors'''&lt;br /&gt;
: 1.Firstly, it is necessary to set the GPIO port to input mode&lt;br /&gt;
 gpio mode 2 in&lt;br /&gt;
&lt;br /&gt;
: 2.Then set the GPIO port as an pull-up resistor&lt;br /&gt;
 gpio mode 2 up&lt;br /&gt;
:The LED light is lit up again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Finally, set the GPIO port to dropdown mode&lt;br /&gt;
 gpio mode 2 down&lt;br /&gt;
:The LED light goes out again&lt;br /&gt;
:[[File:M4_Berry_gpio_led_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====I2C====&lt;br /&gt;
&lt;br /&gt;
According to the schematic diagram, the available i2cs are i2c3 and i2c4&lt;br /&gt;
:[[File:M4_Berry_gpio_i2c.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;pg-i2c3&amp;quot;and&amp;quot;pg-i2c4&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_i2c.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are i2c-3 and i2c-4 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-3&lt;br /&gt;
 /dev/i2c-3&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/i2c-4&lt;br /&gt;
 /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
: 8. Execute&lt;br /&gt;
&lt;br /&gt;
 cd /usr/src/wiringPi/examples/&lt;br /&gt;
 gcc ./oled_demo.c -o oled -lwiringPi&lt;br /&gt;
&lt;br /&gt;
: 9.Connect the i2c device to the pin of i2c3. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-3&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_3_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 10.Connect the i2c device to the pin of i2c4. Execute&lt;br /&gt;
&lt;br /&gt;
 sudo ./oled /dev/i2c-4&lt;br /&gt;
&lt;br /&gt;
:[[File:M4_Berry_i2c_4_led.jpg]]&lt;br /&gt;
&lt;br /&gt;
====UART====&lt;br /&gt;
By reviewing the schematic, it can be found that the available uart are uart1 and uart5.&lt;br /&gt;
:[[File:M4_Berry_gpio_uart.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Uart1 and Uart5 is closed by default and needs to be opened. Execute&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.If you want to use uart1,select&amp;quot;pg-uart1&amp;quot;.If you want to use uart5,select&amp;quot;ph-uart5&amp;quot;&lt;br /&gt;
:[[File:M4_Berry_bananapi_config_uart.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are ttyS5 nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/ttyS5&lt;br /&gt;
 /dev/ttyS5&lt;br /&gt;
&lt;br /&gt;
: 8:Short circuit uart1 pin or uart5 and execute&lt;br /&gt;
 gpio serial /dev/ttyS1&lt;br /&gt;
:[[File:M4_Berry_gpio_uart1.jpg]]&lt;br /&gt;
:[[File:M4_Berry_gpio_uart5.jpg]]&lt;br /&gt;
&lt;br /&gt;
====SPI====&lt;br /&gt;
By reviewing the schematic, it can be found that the available spi is spi1.&lt;br /&gt;
:[[File:M4 Berry-sch-gpio-spi.png]]&lt;br /&gt;
&lt;br /&gt;
: 1.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo bananapi-config&lt;br /&gt;
&lt;br /&gt;
: 2.Select &amp;quot;System&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 3.Select &amp;quot;Hardware&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 4.Use the keyboard directional keys to move, then use the spacebar to select.Select &amp;quot;spi1-cs1-spidev&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 5.Select &amp;quot;Save&amp;quot;, then select &amp;quot;Back&amp;quot;&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 6.Finally, choose Reboot.&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-4.jpg]]&lt;br /&gt;
&lt;br /&gt;
: 7.After restarting, check if there are SPI nodes.&lt;br /&gt;
 pi@bpi-m4berry:~$ ls /dev/spidev1.1&lt;br /&gt;
 /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
: 8.Execute&lt;br /&gt;
&lt;br /&gt;
 sudo spidev_test -v -D /dev/spidev1.1&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:It can be seen that TX and RX are different. So, we need to short-circuit MOSI and MISO and execute the command again.&lt;br /&gt;
&lt;br /&gt;
:[[File:M4 Berry-bananapi-config-spi-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
====PWM====&lt;/div&gt;</summary>
		<author><name>Dangku</name></author>	</entry>

	</feed>