Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
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.
$ ./flash-tool.sh --img=/path/to/aml_upgrade_package.img --parts=all --wipe --soc=g12a --reset=y
$ https://github.com/BPI-SINOVOIP/BPI-A311D-Android9
Bananapi CM4 DTBO idx value table | |||
idx value | device tree overlay | description | |
0 | android_p_overlay | default dtbo, no use | |
1 | wifi_bt_rtl8822cs | enable bpi rtl8822cs wifi/bt module | |
2 | i2c1 | enable i2c 1 | |
3 | i2c2 | enable i2c 2 | |
4 | sdio | enable sdio | |
5 | uart1 | enable 2 pins uart 1 | |
6 | uart1_cts_rts | enable 4 pins uart 1 | |
7 | uart2 | enable 2 pins uart 2 | |
8 | hifi_pcm5122 | enable i2s pcm5122 HiFi DAC |
root@dangku-desktop:/tmp# adb root restarting adbd as root root@dangku-desktop:/tmp# adb remount remount succeeded root@dangku-desktop:/tmp# adb shell bananapi_m2s:/ # echo dtbo > /sys/class/unifykeys/name bananapi_m2s:/ # echo "1" > /sys/class/unifykeys/write bananapi_m2s:/ # reboot
console:/ $ console:/ $ su console:/ # echo dtbo > /sys/class/unifykeys/name [ 115.702781@0] unifykey: name_store() 1302, name dtbo, 4 [ 115.702856@0] unifykey: name_store() 1311 console:/ # console:/ # echo "1" > /sys/class/unifykeys/write [ 129.262659@0] unifykey: write_store() is a string [ 129.262733@0] unifykey: dtbo, 1, 1 [ 129.265312@0] unifykey: amlkey_write 393 [ 129.292347@1] emmc_key_write:149, write ok console:/ # console:/ # reboot
load dtb from 0x1000000 ...... Amlogic multi-dtb tool Single dtb detected find 2 dtbos dtbos to be applied: 1 Apply dtbo 1
DTBO_DEVICETREE := android_p_overlay wifi_bt_rtl8822cs i2c1 i2c2 sdio uart1 uart1_cts_rts uart2 hifi_pcm5122
BOARD_KERNEL_CMDLINE += androidboot.dtbo_idx=0
--wipe_cache --update_package=/udisk/open_gapps-arm-9.0-pico-20210327.zip
--wipe_cache --update_package=/sdcard/open_gapps-arm-9.0-pico-20210327.zip
The two 10" 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.
diff --git a/device/bananapi/bananapi_m2s/bananapi_m2s.mk b/device/bananapi/bananapi_m2s/bananapi_m2s.mk index 1f51703..d592a44 100644 --- a/device/bananapi/bananapi_m2s/bananapi_m2s.mk +++ b/device/bananapi/bananapi_m2s/bananapi_m2s.mk @@ -579,6 +579,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ else PRODUCT_PROPERTY_OVERRIDES += \ ro.sf.lcd_density=213 \ - ro.sf.primary_display_orientation=0 + ro.sf.primary_display_orientation=90 endif
diff --git a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts index 4a698b0..3d41b63 100755 --- a/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts +++ b/common/arch/arm64/boot/dts/amlogic/bananapi_m2s.dts @@ -876,8 +876,8 @@ reg = <0x5d>; reset-gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>; irq-gpio = <&gpio GPIOA_5 GPIO_ACTIVE_HIGH>; - rotation = <4>; /* sf_rotation 0 */ - //rotation = <0>; /* sf_rotation 90*/ + //rotation = <4>; /* sf_rotation 0 */ + rotation = <0>; /* sf_rotation 90*/ //rotation = <5>; /* sf_rotation 180 */ //rotation = <3>; /* sf_rotation 270 */
$ gzip boot-logo.bmp
$ unzip m2s_android_bootlogo_tool.zip $ cd m2s_android_bootlogo_tool/ $ ls -l logo/ -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup.bmp -rwxr--r-- 1 dangku dangku 525054 Sep 25 16:54 bootup_secondary.bmp -rwxr--r-- 1 dangku dangku 184 May 19 2020 upgrade_bar.bmp -rwxr--r-- 1 dangku dangku 180072 May 19 2020 upgrade_error.bmp -rwxr--r-- 1 dangku dangku 180072 May 19 2020 upgrade_fail.bmp -rwxr--r-- 1 dangku dangku 180072 May 19 2020 upgrade_logo.bmp -rwxr--r-- 1 dangku dangku 180072 May 19 2020 upgrade_success.bmp -rwxr--r-- 1 dangku dangku 184 May 19 2020 upgrade_unfocus.bmp -rwxr--r-- 1 dangku dangku 180072 May 19 2020 upgrade_upgrading.bmp
$ cp boot-logo.bmp.gz logo/bootup.bmp $ cp boot-logo.bmp.gz logo/bootup_secondary.bmp
$ ./logo_img_packer -r logo logo.img
$ adb root $ adb remount $ adb reboot fastboot
$ fastboot device 1234567890 fastboot $ fastboot flashing unlock_critical $ fastboot flashing unlock $ fastboot flash logo logo.img $ fastboot reboot
$ apt-get install pv $ curl -sL https://raw.githubusercontent.com/BPI-SINOVOIP/bpi-tools/master/bpi-tools | sudo -E bash
$ sudo apt-get install pv unzip $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/sdX bs=10M status=noxfer
$ sudo apt-get install pv unzip $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/sdX
$ sudo apt-get install pv unzip $ sudo unzip -p xxx-bpi-cm4-xxx.img.zip | pv | dd of=/dev/mmcblk0 bs=10M status=noxfer
$ sudo apt-get install pv unzip $ sudo bpi-copy xxx-bpi-cm4-xxx.img.zip /dev/mmcblk0
$ git clone https://github.com/BPI-SINOVOIP/BPI-M2S-bsp
root@bananapi:~# ls /boot/overlays/ hifi_pcm5122.dtbo pdmmic.dtbo sdio.dtbo waveshare_tft24_lcd.dtbo i2c1.dtbo pwm_c-beeper.dtbo spi0.dtbo waveshare_tft35c_lcd.dtbo i2c2.dtbo pwm_cd-c.dtbo spi0_flash.dtbo wifi_bt_rtl8822cs.dtbo i2s.dtbo pwm_cd.dtbo uart1_cts_rts.dtbo i2smic.dtbo pwm_ef.dtbo uart1.dtbo os08a10.dtbo pwm_ef-f.dtbo uart2.dtbo
# Device Tree Overlays # uart1 -- Enable UART1 (uart_A, GPIO Header PIN8 & PIN10) # pwm_c -- Enable PWM_C (GPIO Header PIN7) # i2c2 -- Enable i2c2 (GPIO Header PIN3 & PIN5) # spi0 -- Enable SPI0 (GPIO Header PIN19 & PIN21 & PIN23 & PIN24) overlays="i2c2 spi0 uart1"
overlays="os08a10"
iv009_isp_iq iv009_isp_lens iv009_isp_sensor iv009_isp
#choose camera calibration parameters options iv009_isp_iq cali_name=0 #choose isp register sequence options iv009_isp_sensor isp_seq_num=0
$ sudo systemctl enable camera_isp_3a_server.service
# Mipi panel type # Symbol | Resolution # ----------------------+------------- # "lcd_0" | 10" 800x1280 panel # "lcd_1" | 10" 1200x1920 panel panel_type=lcd_0
Section "Device" Identifier "Configured Video Device" # Rotate off # Option "Rotate" "off" # Rotate Right / clockwise, 90 degrees Option "Rotate" "CW" # Rotate upside down, 180 degrees # Option "Rotate" "UD" # Rotate counter clockwise, 270 degrees # Option "Rotate" "CCW" EndSection Section "InputClass" Identifier "Coordinate Transformation Matrix" MatchIsTouchscreen "on" MatchProduct "goodix-ts" MatchDevicePath "/dev/input/event0" MatchDriver "libinput" # Rotate Right / clockwise, 90 degrees Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1" # Rotate upside down, 180 degrees # Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1" # otate counter clockwise, 270 degrees # Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1" EndSection
echo 0 > /sys/class/graphics/fbcon/rotate //origin 0 degree echo 1 > /sys/class/graphics/fbcon/rotate //90 degree echo 2 > /sys/class/graphics/fbcon/rotate //180 degree echo 3 > /sys/class/graphics/fbcon/rotate //270 degree
# Framebuffer Rotate # 0 - origin 0 degree # 1 - 90 degree # 2 - 180 degree # 3 - 270 degree fb_rotate=0
$ sudo apt-get update $ sudo apt-get install build-essential git $ git clone https://github.com/Dangku/amlogic-wiringPi $ cd amlogic-wiringPi $ chmod a+x build $ sudo ./build
$ sudo apt-get update $ sudo apt-get install build-essential python python-dev python-setuptools git $ git clone https://github.com/Dangku/RPi.GPIO-Amlogic.git $ cd RPi.GPIO-Amlogic $ sudo python setup.py clean --all $ sudo python setup.py build install
$ sudo apt-get update $ sudo apt-get install build-essential python python-dev python-setuptools swig git $ git clone --recursive https://github.com/Dangku/WiringPi2-Python-Amlogic.git $ cd WiringPi2-Python-Amlogic $ sudo python setup.py install
$ sudo apt install ipppd
# pppd call quectel-ppp &
# quectel-pppd.sh /dev/ttyUSB2 <apn> <username> <password>
# quectel-ppp-kill
# quectel-CM &
# killall quectel-CM
diff a/boot/boot.ini b/boot/boot.ini index 2222e79..c485067 100755 --- a/boot/boot.ini +++ b/boot/boot.ini @@ -20,6 +20,8 @@ fi; if test "${devtype}" = "usb"; then setenv rootfsdev "/dev/sda2"; fi +# force set root=/dev/nvme0n1p2 +setenv rootfsdev "/dev/nvme0n1p2" + # Load env.txt fatload ${devtype} ${devno}:1 ${env_loadaddr} env.txt env import -t ${env_loadaddr} ${filesize};
sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash
Category | Test | Sdcard Test Result | Emmc Test Result | Nvme SSD Test Result |
HDParm | Disk Read | 60.67 MB/s | 148.80 MB/s | 351.29 MB/s |
HDParm | Cached Disk Read | 56.71 MB/s | 141.02 MB/s | 347.03 MB/s |
DD | Disk Write | 14 MB/s | 51.0 MB/s | 244 MB/s |
FIO | 4k random read | 2176 IOPS (8704 KB/s) | 8438 IOPS (33753 KB/s) | 101386 IOPS (405544 KB/s) |
FIO | 4k random write | 932 IOPS (3729 KB/s) | 10876 IOPS (43505 KB/s) | 43206 IOPS (172827 KB/s) |
IOZone | 4k read | 8586 KB/s | 20311 KB/s | 119475 KB/s |
IOZone | 4k write | 2385 KB/s | 19016 KB/s | 90619 KB/s |
IOZone | 4k random read | 6734 KB/s | 20807 KB/s | 51517 KB/s |
IOZone | 4k random write | 3737 KB/s | 22731 KB/s | 95139 KB/s |
Score: 1076 | Score: 5446 | Score: 24550 |
# User kernel args # Add customer kernel args here user_kernel_args=pci=pcie_bus_safe disableuhs
# This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. 88x2cs
$ sudo apt update $ sudo apt install bluez rfkill
network: version: 2 renderer: networkd wifis: wlan0: dhcp4: true access-points: "bananapi": password: "123456789"
$ iw list
$ sudo apt install network-manager
network: version: 2 renderer: NetworkManager wifis: wlan0: dhcp4: no access-points: "bananapi": mode: ap band: 2.4GHz channel: 6 auth: key-management: psk password: "123456789"
network: version: 2 renderer: NetworkManager wifis: wlan0: dhcp4: no access-points: "bananapi": mode: ap band: 5GHz channel: 36 auth: key-management: psk password: "123456789"
network: version: 2 renderer: networkd ethernets: wlan0: dhcp4: no addresses: - 192.168.11.1/24
$ sudo apt install hostapd
interface=wlan0 ssid=bananapi driver=nl80211 auth_algs=1 wpa=2 wpa_passphrase=123456789 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP #bridge=br0 beacon_int=500 #SSID not hidden ignore_broadcast_ssid=0 hw_mode=a channel=36 max_num_sta=8 ### IEEE 802.11n ieee80211n=1 #require_vht=0 ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40] ### IEEE 802.11ac ieee80211ac=1 #require_vht=0 #vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE] #vht_oper_chwidth=1 #vht_oper_centr_freq_seg0_idx=42 ### WMM wmm_enabled=1
options 88x2cs rtw_vht_enable=2
$ sudo apt install isc-dhcp-server
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACESv4="wlan0"
... option domain-name "example.org"; option domain-name-servers 8.8.8.8, 114.114.114.114; ... # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. subnet 192.168.11.0 netmask 255.255.255.0 { range dynamic-bootp 192.168.11.1 192.168.11.100; option broadcast-address 192.168.11.255; option routers 192.168.11.1; }
$ sudo hostapd /etc/hostapd/hostapd.conf -B $ sudo systemctl restart isc-dhcp-server
sysctl net.ipv4.ip_forward=1 iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE
... BL2 Built : 15:21:42, Mar 26 2020. g12a g486bc38 - gongwei.chen@droid11-sz Board ID = 1 Set cpu clk to 24M Set clk81 to 24M Use GP1_pll as DSU clk. DSU clk: 1200 Mhz CPU clk: 1200 MHz Set clk81 to 166.6M board id: 1 Load FIP HDR DDR from SD, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0 fw parse done PIEI prepare done fastboot data verify result: 255 Cfg max: 12, cur: 1. Board id: 255. Force loop cfg DDR4 probe ...
... Board ID = 1 Set cpu clk to 24M Set clk81 to 24M Use GP1_pll as DSU clk. DSU clk: 1200 Mhz CPU clk: 1200 MHz Set clk81 to 166.6M eMMC boot @ 0 sw8 s board id: 1 Load FIP HDR DDR from eMMC, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0 fw parse done PIEI prepare done 00000000 emmc switch 1 ok ddr saved addr:00016000 Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0 00000000 ...
root@dangku-desktop:/tmp# adb root adbd is already running as root root@dangku-desktop:/tmp# adb remount remount succeeded root@dangku-desktop:/tmp# adb shell bananapi_m2s:/ # reboot fastboot
root@dangku-desktop:/tmp# fastboot devices 1234567890 fastboot root@dangku-desktop:/tmp# fastboot flashing unlock_critical ... OKAY [ 0.044s] finished. total time: 0.044s root@dangku-desktop:/tmp# fastboot flashing unlock ... OKAY [ 0.047s] finished. total time: 0.047s root@dangku-desktop:/tmp# fastboot erase bootloader erasing 'bootloader'... OKAY [ 0.059s] finished. total time: 0.059s root@dangku-desktop:/tmp# fastboot erase bootloader-boot0 erasing 'bootloader-boot0'... OKAY [ 0.036s] finished. total time: 0.036s root@dangku-desktop:/tmp# fastboot erase bootloader-boot1 erasing 'bootloader-boot1'... OKAY [ 0.035s] finished. total time: 0.035s
bananapi_m2s_v1#amlmmc erase 1 emmckey_is_protected(): protect start = 0,end = 57343 start = 221184,end = 30535679 Erasing blocks 0 to 8192 @ boot0 start = 0,end = 8191 Erasing blocks 0 to 8192 @ boot1 start = 0,end = 8191 bananapi_m2s_v1#reset resetting ... SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:F;RCY:0;EMMC:0;READ:0;CHK:1F;READ:0;CHK:1F;READ:0;CHK;
... BPI: try boot from sdcard reading boot.ini 2453 bytes read in 3 ms (797.9 KiB/s) ## Executing script at 03080000 Starting boot.ini... reading env.txt 3483 bytes read in 7 ms (485.4 KiB/s) HDMI: Autodetect: 1080p60hz reading Image.gz 10924573 bytes read in 611 ms (17.1 MiB/s) reading bananapi_m2s.dtb 88054 bytes read in 12 ms (7 MiB/s) reading uInitrd 11704481 bytes read in 655 ms (17 MiB/s) reading overlays/wifi_bt_rtl8822cs.dtbo 729 bytes read in 6 ms (118.2 KiB/s)
bananapi_m2s# mmc erase 0 1000
$ sudo dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M status=noxfer $ sudo dd if=/dev/zero of=/dev/mmcblk0boot1 bs=1M status=noxfer $ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M status=noxfer $ sync
$ sudo touch /etc/cloud/cloud-init.disabled
$ sudo apt purge cloud-init
$ sudo apt purge snapd
$ sudo nano /lib/systemd/system/rc-local.service
[Unit] Description=/etc/rc.local Compatibility Documentation=man:systemd-rc-local-generator(8) ConditionFileIsExecutable=/etc/rc.local After=network.target [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 RemainAfterExit=yes GuessMainPID=no [Install] WantedBy=multi-user.target Alias=rc-local.service
sudo nano /etc/rc.local
#!/bin/sh # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. exit 0
$ sudo chmod +x /etc/rc.local
$ sudo systemctl enable rc-local.service $ sudo reboot
$ su root Password:(enter bananapi)
# apt-get update # apt-get install sudo # adduser pi sudo
$ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
$ echo \ "deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu/ \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ sudo docker run hello-world
Install docker with a simple command
$ curl -sSL get.docker.com | sudo sh
docs.docker.com on other Linux distributions