Archlinux for BPI-M2 Zero

Hallo community,

I want install arch on my Banana PI Zero, is there any img that i can use? I have just found link for a img that not more exsit :frowning:

If anyone have infomation about arch for Banana Pi Zero please share it with me.

I hope you can help me.

I got it running by following this step https://wiki.archlinux.org/index.php/Banana_Pi. But I don’t think it is useful, Ethernet not working, HDMI not working. Need some hacks. I can only see it through TTL / Serial console. Feel free to post an update on this topic, guys.

Today i managed to build one Image with latest Archlinux and willing to share. HDMI and eth0 works!

I am new to ArchLinux, so i tried to setup wlan0 but hit the wall. Maybe one Archlinux user knows how to deal with this:

[root@bpi-m2z alarm]# pacman -S wireless_tools
warning: wireless_tools-30.pre9-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) wireless_tools-30.pre9-2

Total Installed Size:  0.37 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Processing package changes...
(1/1) reinstalling wireless_tools                  [######################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
[root@bpi-m2z alarm]# pacman -S wpa_supplicant
resolving dependencies...
looking for conflicting packages...

Packages (1) wpa_supplicant-2:2.8-1

Total Download Size:   0.74 MiB
Total Installed Size:  3.58 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
error: failed retrieving file 'wpa_supplicant-2:2.8-1-armv7h.pkg.tar.xz' from mirror.archlinuxarm.org : The requested URL returned error: 404
warning: failed to retrieve some files
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
[root@bpi-m2z alarm]# 

As soon i am able to figure out how to solve this i can push this Image.

Update: I did a system upgrade and now i am able to install wpa_supplicant and wlan0 is up, but how do i connect to wlan0:

[root@bpi-m2z alarm]# iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: 58:F9:87:E4:B7:E8
                    Channel:7
                    Frequency:2.442 GHz (Channel 7)
                    Quality=25/70  Signal level=-85 dBm  
                    Encryption key:on
                    ESSID:"Cop 71"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=0000000000000000
                    Extra: Last beacon: 76ms ago
                    IE: Unknown: 0008436F70656C203731
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 030107
                    IE: Unknown: 0706474220010D14
                    IE: Unknown: 2A0100
                    IE: Unknown: 32043048606C
                    IE: Unknown: 2D1AEF111BFFFFFF0000000000000000000100000000000000000000
                    IE: Unknown: 3D16070D0600000000000000000000000000000000000000
                    IE: Unknown: 4A0E14000A002C01C800140005001900
                    IE: Unknown: 7F080100000200000040
                    IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00
                    IE: Unknown: DD0900037F01010000FF7F
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
          Cell 02 - Address: 18:D6:C7:35:EB:8F
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=57/70  Signal level=-53 dBm  
                    Encryption key:on
                    ESSID:"foxy"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=0000000000000000
                    Extra: Last beacon: 76ms ago
                    IE: Unknown: 0004666F7879
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 03010B
                    IE: Unknown: 0706425220010D14
                    IE: Unknown: 2A0100
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: Unknown: 32043048606C
                    IE: Unknown: 2D1AEE1103FFFF000000000000000000000000000000000000000000
                    IE: Unknown: 331AEE1103FFFF000000000000000000000000000000000000000000
                    IE: Unknown: 3D160B0F0600000000000000000000000000000000000000
                    IE: Unknown: 34160B0F0600000000000000000000000000000000000000
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: Unknown: DD180050F2020101030003A4000027A4000042435E0062322F00
                    IE: Unknown: DD0900037F01010000FF7F

I tried this without success, what should be the correct command?:

[root@bpi-m2z alarm]# iw dev wlan0 connect "foxy" key 0:12345678901234567890
key must be [d:]index:data where
  'd:'     means default (transmit) key
  'index:' is a single digit (0-3)
  'data'   must be 5 or 13 ascii chars
           or 10 or 26 hex digits
for example: d:2:6162636465 is the same as d:2:abcde
or psk:data <AKM Suite> <pairwise CIPHER> <groupwise CIPHER> where
  'data' is the PSK (output of wpa_passphrase and the CIPHER can be CCMP or GCMP
for example: psk:0123456789abcdef PSK CCMP CCMP
The allowed AKM suites are PSK, FT/PSK, PSK/SHA-256
The allowed Cipher suites are TKIP, CCMP, GCMP, GCMP-256, CCMP-256

Whoa. Great work here. What kernel did you use? Did you compiled the newest kernel by using bpi-tool? And what did you do to make ethernet working? To connect the WiFi you can install ‘wifi-menu’ and just run it. You’ll know what to do.

Can’t wait to try it!

Thanks xqdzn,

wifi-menu did the trick, wlan0 is up and connected. What a nice tool… :slight_smile:

Currently, it is running stock kernel by accident. See: https://gist.github.com/avafinger/4d1b654a6cdb5d6e05218d013fe94d0a

Here is the explanation for the accident and the experiments:

  • Built one Archlinux Image with my kernel and Archlinux rootfs
  • removed the Archlinux kernel
  • booted fine and worked fine until i had to do a system upgrade (was forced to get some new packages, so i thought)
  • During the system upgrade the Archlinux detected a new kernel and upgraded and got in control of the board

I can now suppose it is the stock kernel running with my DTB.

Everything works except:

  • thermal throttling
  • DVFS

That makes one be very careful when putting a lot of load on the board. The best thing would be to prevent Archlinux to upgrade the kernel or create a kernel package (or point it to somewhere else) but that is for the experienced Archlinux builder/kernel dev and this was my first ride with Archlnux (newbie here).

BTW, the kernel running is the Cibieboard2 kernel.

What kernel and what OS?

Did you just remove by deleting it or replacing with something else?

Where did you get the DTB files?

I used Arch Linux for my daily driver (Laptop and Servers) But I i’m really new to this U-Boot, zImage/uImage, and DTB files. I want to try to mod some DTB file from DTS but it’s so hard to find the documentation. Did you use this step to build it?

This is actually pretty great achievement.

Yes. You can refer to those instructions you pointed to for the U-boot but use armhf instead. Kernel running is this one: https://archlinuxarm.org/platforms/armv7/allwinner/cubieboard-2 For the DTB/DTS: https://elinux.org/Device_Tree_Reference and https://elinux.org/Device_Tree_Linux and https://elinux.org/Device_Tree_Usage

I see,

So basically we only need one additional DTB files (for BPI M2Z / P2Z) and based on your experience, the one included in your image (bananapi-zero-ubuntu-base-minimal) is able to make ethernet working. The rest of it just the matter of installing and configuring the **bootloader** CMIIW I can't thank you enough, Dude. Gonna try it soon and post the update here!

to be precise, DTB and u-boot and /boot partitions are from my ubuntu image. Rootfs and kernel are from Archlinux. But if you use Archlinux u-boot just follow their rules and point to my DTB!

lrwxrwxrwx  1 root root      20 Jan 15  2018 boot.scr -> bpi-m2-zero_boot.scr
-rw-r--r--  1 root root    1255 Nov 24  2018 bpi-m2-zero_boot.scr
lrwxrwxrwx  1 root root      26 Jun 19 12:12 bpi-m2-zero.dtb -> bpi-m2-zero-v4.dtb_4.20.17
-rw-r--r--  1 root root   25727 Jun 22 16:35 bpi-m2-zero-v4.dtb_4.20.17
drwxr-xr-x  2 root root   36864 Ago  4 19:06 dtbs
-rw-r--r--  1 root root 6554663 Ago  4 19:07 initramfs-linux.img
-rw-rw-r--  1 alex alex  982455 Jan 17  2018 initrd.img
drwx------  2 root root   16384 Nov  5  2017 lost+found
-rwxr-xr-x  1 root root 6795824 Ago  2 15:46 zImage

Good luck.

Hey, here’s some update from my experiment:

I followed this tutorial for every step. Extracted DTB file from here then rename it to sun8i-h2-plus-bananapi-m2-zero.dtb to /boot/dtbs/
I got ethernet working but wifi is not detected.

But wifi is not working, still figuring out, currently cosidering to manually compile DTB files.
Soon after I do #pacman -Syu which is full upgrade, I lost ethernet and HDMI display after reboot. I have to use TTL to get to the screen.

You need to update Wifi firmware with the latest version compatible with mainline. /lib/firmware/brcm dmesg|grep brc

and compare to my boot log.

You need to figure out why Archlinux overwrites you DTB, just restore it.

Restored previous DTB file and it booted!
HDMI Works
Ethernet works

Next, will do some research on upgrading WiFi firmware and keeping DTB file (or recompile it correctly while upgrading OS)

[alarm@alarm ~]$ dmesg | grep brc
[   10.459254] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   10.468403] usbcore: registered new interface driver brcmfmac
[   10.531633] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.sinovoip,bananapi zero.txt failed with error -2
[   10.531739] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.txt failed with error -2
[   11.583193] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[alarm@alarm ~]$ uname -a
Linux alarm 5.2.6-1-ARCH #1 SMP PREEMPT Tue Aug 6 00:09:47 UTC 2019 armv7l GNU/Linux
[alarm@alarm ~]$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether ba:52:27:8b:f6:0f brd ff:ff:ff:ff:ff:ff
[alarm@alarm ~]$ 

Update:

I tried to replace few 43430 related files and it doesn’t work. So I replace whole /lib/firmware/brcm directory with files I extracted from here then WiFi is working. Not as I expected but It’s fine since other image can’t make it better (Signal start loosing if the board is too far from AP)

[alarm@alarm ~]$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether ba:52:27:8b:f6:0f brd ff:ff:ff:ff:ff:ff
    inet 192.168.99.1/24 brd 192.168.99.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::b852:27ff:fe8b:f60f/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 18:93:7f:35:4d:f2 brd ff:ff:ff:ff:ff:ff
[alarm@alarm ~]$ dmesg | grep brc
[   10.300791] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   10.340332] usbcore: registered new interface driver brcmfmac
[   10.395701] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.sinovoip,bananapi zero.txt failed with error -2
[   10.549858] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   10.550060] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[   10.551164] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Mar 30 2016 11:30:56 version 7.45.77.h8.4 FWID 01-ee8a6268

So every Wifi device… :smile:

I am not Archlinux user but in Ubuntu, i use this:

wireless-power off

This should improve a bit, hopefully. I am now at 5.2.7 and trying 5.3-rc3 with Ubuntu 19.04 to see if can get better results.

Too far I mean more than 15cm.
I worked with 802.11b/g/n device for years and I think this is not normal.
But that is not my concern right now. I’ll be fine even if I have to put my phone closer to the board so my P2Z could get enough hotspot signal.

Yes, not normal. Try that ubuntu image and see if you get better results, if you can then you have an issue,

I tried, and seems like still low on signal. So I guess mine is defected one (?). I’ll try another P2Z that I have.

Are you using the Phone as a modem? (tethering or something like that) ? Just a little info i can remember while testing the board with Wifi against another board with Wifi and had some low speed and sometimes a temporary loss of signal. I did not pay attention after i tested the boards from a wired PC and that was fine. Try to ping from a wired board and see if you get a good signal or just ssh to it.

Check if wifi has chosen the right country or you get a low signal.