the specs

CPU Allwinner A20,32 Bit Cortex™-A7 2-Core 1G
GPU ARM® Mali400MP2 -> get the GPU going
SDRAM 1GB DDR3 (shared with GPU) 432Mhz
Storage “SD Card up to 64GB (SDXC) 1 SATA up to 2TB “
Network 4x Gigabit LAN 1x Gigabit WAN <- which is nice marketing aka short of “lies”, it is a layer 2 broadcom switch with 5 LAN ports
WIFI 802.11b/g/n (RTL8192CU)
Video In CSI input for video cameras
Video Out HDMI/LVDS/RGB
Audio Output 3.5 mm Jack and HDMI out <- yes that is right, this ARM switch can do audio out over hdmi
Audio In Microphone
USB 2.0 2 USB 2.0 ports, 1 OTG microUSB port
GPIO 40-PIN GPIO, UART, I²C bus,I²S bus,SPI bus with two chip selects, CAN bus, PWM,+3.3 V, +5 V, ground
Power Source 5 volt via MicroUSB and/or MicroUSB (OTG)
Buttons Reset button Power button, Uboot button
LED Power key and RJ45
Remote IR reciever
Board Size 120mm ×100mm
Weight 60g
OS Android, Bananian (Debian / Armbian based) GNU Linux OS, OpenWRT

the positive

it is an interesting – but far from perfect SoC to play around with

it all could have been so well

  • an ARM based router, with HDMI (!) with SATA (!) with enough power, but adding a second interface (every router needs at least 2x LAN-NICs (one NIC can be layer 2 switch, but there needs to be at least one separate NIC to do the routing))
  • adding a USB-ETHERNET adapter is (usually) no good: probably (unreliable and slow) option

the naming is confusing: Lamobo R1, Bananian, Bananapi (it is all the same)

Bananian R1 as router: only one ethernet nic, not optimal hardware for router-firewall etc.

Network
  • WiFi 802.11 b/g/n (Realtek RTL8192CU connected internally via USB2.0, two Hirose U.FL connectors for WiFi antennas)

“On the Lamobo R1 the BCM53125 (a simple switch IC that features two RGMII GbE host ports and 5 GbE PHYs and can be configured through MDIO to separate traffic through VLANs) interconnects by default all 5 Ethernet ports and the A20 SoC.

This means we can not speak about a true WAN port and LAN ports since all the ports are connected at network layer 2 by default.

Since the A20 SoC features only one single RGMII interface no other mode of operation is possible (illustration available).

This might raise serious security risks since while the device boots or when it is in bricked state or booted without SD card or when VLAN configuration hasn’t been setup correctly or a simple bug exists in the b53 driver then the BCM53125 always acts as a primitive layer 2 switch forwarding Ethernet frames between all external Ethernet ports (not differentiating between the so called WAN port and the 4 LAN ports).

Since this device in fail state always bridges the networks it should separate instead of building a barrier it simply can not be considered a router between the so called WAN port and the other Ethernet ports. It’s just a switch!

“If one tries to use the R1 as a (NAT) router without a separate firewall between WAN and the R1 then it depends largely on the ISP’s infrastructure whether this is not that good or an absolute no-go from a security point of view since all sorts of attacks against devices behind the so called LAN ports can be triggered from behind the WAN port.

In case you’re not sure what that means you should simply treat the WAN port as another LAN port and use a separate USB to Ethernet adapter to be connected to WAN.

Only in this mode the R1 might reliably work as a router.”

SATA works out of the box

did not have to solder around to get the SATA port working 🙂 (harddisk is recognized and works, a SSD probably better than magnetic SATA HD because it will (probably) use less power and thus ensure more stable operations), but still, there it is the:

SATA power fix

“With the Lamobo R1 electrical design, the SATA drive is powered from the system supply of the AXP209: IPSOUT.”

“A maximum of 2.5A can be sourced from this supply, which is barely enough to power a SATA drive and the rest of the system when the drive is busy.”

“More specifically, spikes in the current consumption caused by the drive’s activity can cause the system voltage and remaining available current to lower below the required minimum for proper operation of the DRAM, that will get corrupted.”

“When DRAM corruption happens, the kernel soon fails to handle kernel paging requests, as the page table got corrupted.”

“In order to fix this issue, the input of the SATA voltage regulator has to be diverted from IPSOUT to ACIN or VBAT directly.”

“Resistor R6 connects the SATA voltage regulator’s input to IPSOUT. It can be moved to the unpopulated pads of R51 to connect the input to VBAT or it can be removed to connect ACIN, sourced from CT5/C16 to the input, as shown in the picture.”

creditz & src: https://linux-sunxi.org/Lamobo_R1

possible alternatives:

BANANA PI BPI-W2 Router RAM: 2GB Flash: 8000000kB A53 ARM Quad-Core 148×100,5mm

way more expensive, but seems to have two proper ethernet NICs (untested!)

https://wiki.banana-pi.org/Banana_Pi_BPI-W2

getting started anyway

download the improved version from dwaves.org:

wget https://dwaves.de/upload/firmware/bananapi-r1-image_v1.dwaves.img.gz
# and corresponding
wget https://dwaves.de/upload/firmware/bananapi-r1-image_v1.dwaves.img.gz.sha512sum
# run integrity check
sha512sum -c bananapi-r1-image_v1.dwaves.img.gz.sha512sum
# no need to unpack, can directly unpack and write to microsd
# (target the whole device, not a single partition!)
su - root
apt install pv pigz; # show dd status and unpack multithreaded
pigz -dc /path/to/image.img.gz | pv | dd bs=1M of=/dev/mmc...0
sync

  • + latest updates (Debian 8)
  • + eth0 dhcp + fixed ip (virtual nic) eth0:0 192.168.0.225
  • + mali drivers loaded
  • + xfce 4 desktop
  • + increased /root partition to 58GB (so 64GB MicroSDCard is required!)
  • + added 2GB swap partition (original uses swap to file)
  • + firefox is installed and works (but very slow, especially youtube)
    • + installed :
      • + very minimalist keyboard controlled web browsers uzbl/oldoldstable 0.0.0~git.20120514-1.1 armhf (works uses very little resources)
    • compiled retroarch
      • but won’t start with error:
      • xwdump

  • or the original bananian version image (at least 2GB MicroSDCard required) and apply the changes: that can be found here: unzip the latest Bananian image.
    • insert your SD card into the card reader.
      • identify your SD card device using ‘dmesg’ and ‘umount’ it
  • write the image to the SD card using the following dd command:
    dd if=bananian-1604.img of=/dev/<your-sd-card> bs=1M && sync

to login:

  • usr: root
  • pwd: pi
    • and should (of course) be immediately changed
  • or dwaves.org image:
  • usr: user
  • pwd: user

to change default login shell from zsh to bash

usermod -s /bin/bash root

# change hostname
# temporarily
hostname bananapi
# permanent
echo "bananapi" > /etc/hostname
reboot

to change keyboard layout:

GNU Linux Debian Ubuntu Mint and Fedora RedHat CentOS – change keyboard layout no gui

temporary fixed ip (additional to dhcp ip)

SUBNET=0;while true; do ifconfig eth0:0 192.168.$SUBNET.225 up; ip -c a s; ping -c 3 192.168.$SUBNET.100; sleep 3; clear; done

install basics

apt install htop vim curl wget tmux net-tools lshw hdparm secure-delete lm-sensors hddtemp rsync apt-transport-https less apt-rdepends

about:

uname -a
Linux c 3.4.111-bananian #5 SMP PREEMPT Fri Mar 25 17:24:42 UTC 2016 armv7l GNU/Linux

lscpu
Architecture:          armv7l
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
CPU max MHz:           1008.0000
CPU min MHz:           60.0000

# watch cpu temps
sensors-detect; # YES YES YES...
watch sensors
axp20_mfd-i2c-0-34
Adapter: sunxi-i2c.0
temp1: +47.4°C (low = -144.7°C, high = +264.8°C) <- ARM CPU can become pretty hot (too hot to touch)

# watch power usage (Amps)
# either this works
awk '{printf ("%0.2f",$1/1000000); }' </sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now
# or that
awk '{printf ("%0.2f",$1/1000000); }' </sys/power/axp_pmu/ac/amperage
cat /etc/debian_version 8.11

# what nics are there
ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    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 pfifo_fast state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether 02:8a:02:c2:12:1e brd ff:ff:ff:ff:ff:ff
3: tunl0:  mtu 1480 qdisc noop state DOWN mode DEFAULT group default 
    link/ipip 0.0.0.0 brd 0.0.0.0
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 3c:33:00:bd:51:09 brd ff:ff:ff:ff:ff:ff

# more info
lshw 
bananapi                  
    description: Computer
    width: 32 bits
  *-core
       description: Motherboard
       physical id: 0
     *-memory
          description: System memory
          physical id: 0
          size: 970MiB
     *-cpu
          physical id: 1
          bus info: cpu@0
          size: 1008MHz
          capacity: 1008MHz
          capabilities: cpufreq
     *-scsi
          physical id: 2
          logical name: scsi0
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: WDC WD2500BEVT-7
             vendor: Western Digital
             physical id: 0.0.0
             bus info: scsi@0:0.0.0
             logical name: /dev/sda
             version: 01.0
             serial: WD-XXXXXXXXXXXX
             size: 232GiB (250GB)
             configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512
  *-network:0 DISABLED
       description: Wireless interface
       physical id: 1
       bus info: usb@3:1
       logical name: wlan0
       serial: 3c:33:00:bd:51:09
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=rtl8192cu multicast=yes wireless=unassociated
  *-network:1
       description: Ethernet interface
       physical id: 2
       logical name: eth0
       serial: 02:8a:02:c2:12:1e
       size: 1Gbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical 1000bt-fd
       configuration: autonegotiation=on broadcast=yes driver=sunxi_gmac
driverversion=SUNXI GMAC driver V0.1 duplex=full
ip=100.XXX.XXX.XXX link=yes multicast=yes
port=MII speed=1Gbit/s

monitoring script

cat /scripts//scripts/monitor_system.sh

#!/bin/bash

while true;
do
	echo -e "=== date & time ==="
	date '+DATE: %Y-%m-%d TIME: %H:%M:%S'
	echo -e "=== about ==="
	uname -a;
	lscpu;
	echo -e "\n=== cpu temp ==="
	sensors;
	echo -e "\n=== power usage ==="
	awk '{printf ("%0.2f",$1/1000000); }' </sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now
	echo " Ampere";
	echo -e "\n=== hdtemp ==="
	hddtemp /dev/sda
	echo -e "\n=== dmesg ==="
	dmesg|tail -n10;
	echo -e '\n===== storage info';
	lsblk -o 'NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT,UUID'
	echo -e '\n===== storage usage';
	df -Th;
	sleep 1;
	clear;
done;

sample output:

=== date & time ===
DATE: 2021-11-01 TIME: 12:30:09
=== about ===
Linux bananapi 3.4.113-bananian #9 SMP PREEMPT Sat May 6 12:20:11 UTC 2017 armv7l GNU/Linux
Architecture:          armv7l
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
CPU max MHz:           1008.0000
CPU min MHz:           60.0000

=== cpu temp ===
axp20_mfd-i2c-0-34
Adapter: sunxi-i2c.0
temp1:        +49.0°C  (low  = -144.7°C, high = +264.8°C)


=== power usage ===
1.34 Ampere

=== hdtemp ===
/dev/sda: WDC WD2500BEVT-XXXXXXX: 40°C

=== dmesg ===
[  911.634569] incomplete xfer (0x20)
[  911.636962] incomplete xfer (0x20)
[  911.639342] incomplete xfer (0x48)
[  911.641718] incomplete xfer (0x48)
[  911.644304] incomplete xfer (0x48)
[  911.646698] incomplete xfer (0x48)
[  911.649072] incomplete xfer (0x48)
[  911.651441] incomplete xfer (0x48)
[  911.654019] incomplete xfer (0x20)
[  911.656416] incomplete xfer (0x20)

===== storage info
NAME        MAJ:MIN RM   SIZE RO FSTYPE MOUNTPOINT UUID
sda           8:0    0 232.9G  0                   
mmcblk0     179:0    0  59.5G  0                   
├─mmcblk0p1 179:1    0    20M  0 vfat              BCCA-xxxx
└─mmcblk0p2 179:2    0   1.8G  0 ext4   /          a1ab4975-dd32-4d7c-b905-xxxxxxxxxxx

===== storage usage
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4      1.8G  1.2G  465M  73% /
devtmpfs       devtmpfs  486M     0  486M   0% /dev
tmpfs          tmpfs      98M  260K   97M   1% /run
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs     195M     0  195M   0% /run/shm

problems with updates

su - root
apt update
apt upgrade

==> /var/log/apt/history.log <== Start-Date: 2021-11-01 10:11:44 Commandline: apt -f install Install: firmware-misc-nonfree:armhf (20161130-5~deb8u1, automatic)
Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2021-11-01 10:11:45 ==>
/var/log/apt/term.log <== Log started: 2021-11-01 10:11:44 (Reading database ... 17773 files and directories currently installed.)
Preparing to unpack .../firmware-misc-nonfree_20161130-5~deb8u1_all.deb ...
Unpacking firmware-misc-nonfree (20161130-5~deb8u1) ...
dpkg: error processing archive /var/cache/apt/archives/firmware-misc-nonfree_20161130-5~deb8u1_all.deb (--unpack):
trying to overwrite '/lib/firmware/kaweth/trigger_code.bin', 
which is also in package linux-firmware-image 16.04.05
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing: /var/cache/apt/archives/firmware-misc-nonfree_20161130-5~deb8u1_all.deb
Log ended: 2021-11-01 10:11:45 ==> /var/log/dpkg.log <==
2021-11-01 10:11:44 startup archives unpack
2021-11-01 10:11:44 install firmware-misc-nonfree:all  20161130-5~deb8u1
2021-11-01 10:11:44 status half-installed firmware-misc-nonfree:all 20161130-5~deb8u1
2021-11-01 10:11:44 status not-installed firmware-misc-nonfree:all 

# won't fix the error-problem
apt -f install

# won't fix the error-problem
apt install firmware-misc-nonfree

# reproduces the error-problem
dpkg --unpack /var/cache/apt/archives/firmware-misc-nonfree_20161130-5~deb8u1_all.deb

# this fixes the error-problem (creditz)
dpkg -i --force-overwrite /var/cache/apt/archives/firmware-misc-nonfree_20161130-5~deb8u1_all.deb
apt -f install

will it desktop?

arm firefox works 🙂 (great job Mozilla!)

of course: neither mali GPU nor CPU can handle smooth playback

yes it desktops!

mate desktop not working (some dependency problem with libpam-systemd), but the minimalistic desktop: xfce4 which is even more light-weight seems to work 🙂

to turn this missfit router at least into into a arm-typewriter 🙂

  • insert the micro sd card into a computer that can run gparted
  • increase the root partition (2GB is not enough space)
apt install lightdm xfce4 xinit imagemagick
# make mali gpu drivers auto load on boot
modprobe mali
echo '# closed source drivers for Mali400MP2' >> /etc/modules
echo 'mali' >> /etc/modules
reboot

if that did not work: try this script

https://github.com/ann0see/bananianX/blob/master/bananianX.sh

Links:

https://xfce.org/

https://en.wikipedia.org/wiki/1-Wire

https://linux-sunxi.org/Lamobo_R1

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin