Lichee Sipeed RV Dock RISC-V SBC: installing and configuring Debian

Lichee RV Dock RISC-V SBC: installing and configuring Debian

Things you need

  1. Lichee RV Dock

  2. USB-C power supply

  3. SD-card with minimum size 16GB

  4. Keyboard and mouse connected via one USB. I used a Logitech wireless-to-USB set. Maybe it works too via an USB hub

  5. Windows computer (or maybe Linux on x86, with wine & winetricks installed)

  6. Wifi network

  7. Monitor with HDMI, plus a HDMI cable

Optional:

  1. Linux system to increase your disk size from 4 (8?) GB to something bigger

  2. An U.FL wifi antenna to improve your wifi signal

On Windows (or Linux x86 with wine?)

  1. Download the debian image 20211230_LicheeRV_debian_d1_hdmi_8723ds.7z from https://mega.nz/folder/lx4CyZBA#PiFhY7oSVQ3gp2ZZ_AnwYA/folder/xtxkABIB

    1. At moment of writing: the 7z file is 1.07 GB, and dated 2021-12-30 (hence the file name)

  2. Unpack the 7z file, so that you get an .img file

  3. install the PhoenixCard tool from  https://dl.sipeed.com/shareURL/LICHEE/D1/Lichee_RV/tool

  4. Start phoenixcard.exe

  5. Insert an SD card, with minimum size 16GB into your Windows

  6. Select the .img file

  7. Select option “Start Up”

  8. Burn the Debian image to the SD Card. The PhoenixCard progress Status will quickly go to 40%, and then it will take 10 minutes to burn the image (depending on the size of the SD-card?). Alas the progress indicator will not show any progress until it’s completely finished

Someone reported it worked with wine on linux x86 like this:

  1. Install winetricks (on debian/ubuntu: sudo apt install winetricks)

  2. winetricks -q mfc42

  3. wine PhoenixCard.exe

After 10 minutes:

With your Lichee RV Dock

  1. Insert the SD-card into the Lichee RV Dock

  2. Connect HDMI and USB-C power

  3. The Lichee will boot. After a few minutes, you should see a mouse pointer, and then the full GUI

  4. You can log on with sipeed / licheepi

Hardware on the Dock

Setting up Wifi

If possible, connect an U.FL wifi antenna to the Lichee RV Dock. The U.FL connector (“IPEX”) is on the Dock, next to the small white 2-pin speaker connector and the USB-A connector

Note: I only got Wifi working when connecting to a password-less (so: open) Wifi access point within 1 meter from the Lichee RV. 

Set up wifi:

  1. From the start button, select Preferences -> Connman Settings

  2. Set Wifi from Disabled to Enabled. Strangely enough, each network will show twice. Possibly due to the two WLAN interface on the Lichee

  3. Select the Wifi network you want to connect to: click on the network, then Connect

  4. After that, check that you can “sudo ping 1.1.1.1” (yes, with sudo)

From the command line, the below can help

[email protected]:~$ connmanctl scan wifi

Scan completed for wifi

[email protected]:~$ connmanctl services

It seems Connman stores settings in

/var/lib/connman/wifi… 

Like for example:

/var/lib/connman/wifi_74ee2a6dc234_47726f6e696e67656e33_managed_none/settings

Disk layout

[email protected]:~$ df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/root       3.6G  2.8G  588M  83% /

devtmpfs        242M     0  242M   0% /dev

tmpfs           246M     0  246M   0% /dev/shm

tmpfs            99M  960K   98M   1% /run

tmpfs           5.0M  4.0K  5.0M   1% /run/lock

tmpfs            50M   24K   50M   1% /run/user/110

tmpfs            50M   20K   50M   1% /run/user/1000

[email protected]:~$ mount | grep /dev/

/dev/mmcblk0p7 on / type ext4 (rw,relatime,discard)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)

[email protected]:~$

If you put the SD-card in another system, fdisk will show these partitions:

Device            Start      End  Sectors  Size Type

/dev/mmcblk1p1    41464    49527     8064    4M Microsoft basic data

/dev/mmcblk1p2    49528    50031      504  252K Microsoft basic data

/dev/mmcblk1p3    50032    50535      504  252K Microsoft basic data

/dev/mmcblk1p4    50536    72671    22136 10,8M Microsoft basic data

/dev/mmcblk1p5    72672    73679     1008  504K Microsoft basic data

/dev/mmcblk1p6    73680   101903    28224 13,8M Microsoft basic data

/dev/mmcblk1p7   101904 16879119 16777216    8G Microsoft basic data

/dev/mmcblk1p8 16879120 31289343 14410224  6,9G Microsoft basic data

/dev/mmcblk1p1 contains Volumn

/dev/mmcblk1p7 contains rootfs

Enlarge the main partition without losing data

Warning: do the below carefully.

The default partition is 8GB, and only 4GB is available. To enlarge this partition without losing data, do this:

  1. Power off the Lichee

  2. Remove the SD-card and put into another Linux system

  3. Start gparted and in the upper right corner select the SD-card

  4. Remove the last, unused partition (partition #8)

  5. Select partition #7, and enlarge it, and execute that

  6. Put the SD-card into the Lichee again, and boot it

Before:

After:

SSH access

You can access the Lichee via ssh. Again, login is sipeed / licheepi

Updating Debian

sudo apt update

sudo apt upgrade -y

The first time, the upgrade command will take an hour or so to complete.

The bad stuff: kernel oops

There is a kernel oops each 25 seconds.

Brute force solution:

sudo apt remove rtkit

… and the oops-es are gone.

[Sun Jan 16 21:44:14 2022] Unable to handle kernel paging request at virtual address ffffffdf8099707e

[Sun Jan 16 21:44:14 2022] Oops [#16]

[Sun Jan 16 21:44:14 2022] Modules linked in: xt_time xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG uvcvideo videobuf2_vmalloc videobuf2_memops iptable_filter ipt_REJECT hdmi20 fuse

[Sun Jan 16 21:44:14 2022] CPU: 0 PID: 507 Comm: (t-daemon) Tainted: G      D           5.4.61 #217

[Sun Jan 16 21:44:14 2022] sepc: ffffffdf8099707e ra : ffffffe000531e80 sp : ffffffe01b037d10

[Sun Jan 16 21:44:14 2022]  gp : ffffffe0008f4500 tp : ffffffe01e858000 t0 : ffffffe00e09cc00

[Sun Jan 16 21:44:14 2022]  t1 : 0000000000000006 t2 : ffffffe01cf55908 s0 : ffffffe01b037d60

[Sun Jan 16 21:44:14 2022]  s1 : ffffffe012dfae00 a0 : ffffffe012dfae00 a1 : ffffffe012dfae00

[Sun Jan 16 21:44:14 2022]  a2 : ffffffe00deeed38 a3 : 0000000000000001 a4 : ffffffe00e099e00

[Sun Jan 16 21:44:14 2022]  a5 : ffffffdf8099707e a6 : 0000000000000000 a7 : ffffffffffffff7f

[Sun Jan 16 21:44:14 2022]  s2 : ffffffdf80995218 s3 : 0000000000000000 s4 : ffffffdf80995218

[Sun Jan 16 21:44:14 2022]  s5 : ffffffe012dfae00 s6 : 0000000000000000 s7 : fffffffffffff000

[Sun Jan 16 21:44:14 2022]  s8 : 0000000000000000 s9 : 0000002ae9138000 s10: 0000003fff965c90

[Sun Jan 16 21:44:14 2022]  s11: 0000000000000000 t3 : ffffffe01f218bc8 t4 : ffffffe0008f27d8

[Sun Jan 16 21:44:14 2022]  t5 : 0000000000000038 t6 : ffffffe00e09cbeb

[Sun Jan 16 21:44:14 2022] sstatus: 0000000200000120 sbadaddr: ffffffdf8099707e scause: 000000000000000c

[Sun Jan 16 21:44:14 2022] ---[ end trace e80aff6adb9cd09d ]---

Turn off annoying kernel oops messages on your ssh login

In the file /etc/rsyslog.conf, comment out the following line like this:

#*.emerg :omusrmsg:*

Reboot your system to take effect

Set timezone

/usr/bin/timedatectl list-timezones | grep -i amsterdam

sudo /usr/bin/timedatectl set-timezone Europe/Amsterdam

Disable graphical interface

If you don’t need the graphical interface (X, lightdm), and you want to save RAM, you can achieve that like below.

sudo systemctl isolate multi-user.target

More info on https://unix.stackexchange.com/a/546425/203116

If you can login to the system and have root access, you could use systemctl isolate multi-user.target to switch the system immediately to non-GUI mode, or systemctl set-default multi-user.target to set it as the default system state for any future boot-ups until told otherwise.

To switch back, use systemctl isolate graphical.target to start the GUI mode immediately, or systemctl set-default graphical.target to make it the default system state again.

The multi-user.target starts all network services, but omits the GUI subsystem. Many rack-mount servers run in that mode because they don't have any use for local GUI.

Add a swapfile

Note: I’m not sure this is a good idea on a SD-card

Follow instructions on https://tecadmin.net/how-to-add-swap-space-on-debian-11/

[email protected]:~$ sudo swapon -s

[email protected]:~$ free -m

               total        used        free      shared  buff/cache   available

Mem:             491         245           9          10         236         225

Swap:              0           0           0

[email protected]:~$ sudo fallocate -l 1G /swapfile

[email protected]:~$ chmod 600 /swapfile

chmod: changing permissions of '/swapfile': Operation not permitted

[email protected]:~$ sudo chmod 600 /swapfile

[email protected]:~$ sudo mkswap /swapfile

Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)

no label, UUID=e9de21f8-5bec-4a87-8966-e05ec4e62c22

[email protected]:~$ sudo swapon /swapfile

[email protected]:~$ free -m

               total        used        free      shared  buff/cache   available

Mem:             491         246           8          10         236         223

Swap:           1023           0        1023

[email protected]:~$ free -m

               total        used        free      shared  buff/cache   available

Mem:             491         246           7          10         237         223

Swap:           1023           0        1023

[email protected]:~$ sudo nano /etc/fstab # see instruction

[email protected]:~$ sudo nano /etc/sysctl.conf # see instruction

[email protected]:~$ free -m

               total        used        free      shared  buff/cache   available

Mem:             491         246           9          10         234         223

Swap:           1023           0        1023

[email protected]:~$ sudo ps -ef | grep -i swap

root          51       2  0 13:51 ?        00:00:01 [kswapd0]

sipeed       919     423  1 14:00 pts/0    00:00:00 grep -i swap

[email protected]:~$ free -m

               total        used        free      shared  buff/cache   available

Mem:             491         283           8          17         200         179

Swap:           1023           9        1014

Shutdown / reboot

I learned to use the power symbol in the right lower corner, wait a few minutes, and it was going down.

(So, not good: “sudo reboot now”)

Documenation and URLs

Buy the Dock with wifi here (price ? 26,57, incl VAT, ex shipping) from the Sipeed shop itself:

https://www.aliexpress.com/item/1005003741287162.html?spm=a2g0o.9042311.0.0.49d44c4dZpzw8L

(Sipeed shop https://www.aliexpress.com/item/1005003741287162.html )

https://wiki.sipeed.com/hardware/zh/lichee/RV/RV.html

https://wiki.sipeed.com/hardware/zh/lichee/RV/Dock.html

Ubuntu image (with readme inside, including fdisk and dd instruction): from https://mega.nz/folder/lx4CyZBA#PiFhY7oSVQ3gp2ZZ_AnwYA/folder/xtxkABIB get licheerv_d1_1.14lcd_ub2004.tgz … I didn’t get that working, but someone else did.

Useful info on https://linux-sunxi.org/Sipeed_Lichee_RV#Boot_and_system_support 

Very technical D1 documentation: https://ovsienko.info/D1/

https://mirrors.romanrm.net/risc-v/

Files on Mega.nz:

Background

“In Nov. 2020, Allwinner and Alibaba’s T-head subsidiary announced an Allwinner D1 SoC based on T-head’s RISC-V-based XuanTie C906 core.”

CNX article from november 2020: https://www.cnx-software.com/2020/11/09/xuantie-c906-based-allwinner-risc-v-processor-to-power-12-linux-sbcs/

TTY interface

Heard (but not tested): the TTY interface is on the daughterboard, like in the figure below. Level should be 3.3V

The Desktop

Leave a Comment

Your email address will not be published.