Tag Archives: boot

relatively full Debian desktop, server or both environnement on RISC-V based LicheeRV.

Table of Contents

* Introduction
* Installing the Image
* Booting
* Setting the WiFi
* What is working

Introduction


I managed to have a working Debian desktop environment on RISC-V after previous test and some exchanges on different Sipeed/D1 channels. Most informations are today available on Linux-SunXI.org Wiki dedicated page.

See also the previous article Booting Ubuntu Linux on a LicheeRV.

This image seems to manage more of the SoC features, or at least it announce lot of flags (IMAFDCVU):

$ cat /proc/cpuinfo 
processor	: 0
hart		: 0
isa		: rv64imafdcvu
mmu		: sv39

* IMAF = base ISA, Mul/div, Atomic isntruction, (single precision) Float
* D = Double precision float
* V = Vector processor extension
* C = Compressed instructions
* U = User mode hyperverisor

The main problem was to have a working image with Debian, AllWinner and Speed give only a Linux image that can be made on Windows using PhoenixCard tool………

Someone of a Sipeed chat that have access to a Windows installed computer, made the conversion and give it available here (my mirror copy) sha256sum of the image: cf73baf3ed67d480e7606c666ccb81fce21295ba8fbba10e0ad86939065be6ffw. You need an at least 16GB microSD card to use it with LicheeRV and it’s Dock..

Installing the Image

To install it, you can follow the following steps:

Install aria2 (Debian based (Debian, Ubuntu, …) sudo apt install aria2, Archlinux based (Arch, Manjaro, …): pacman -S aria2)

For an USB microSD card reader (I use /dev/sdd for /dev/sdX in my case you can verify which one is your by sudo fdisk -l:

DEVICE=/dev/sdX
aria2c https://popolon.org/depots/RISC-V/D1/images/LicheeRV/20211230_LicheeRV_debian_d1_hdmi_8723ds.ddimg.xz.metalink
sudo wipefs -a ${DEVICE}
xzcat 20211230_LicheeRV_debian_d1_hdmi_8723ds.ddimg.xz | sudo dd bs=1MB status=progress of=${DEVICE}

Then delete the partition 8:

sudo fdisk ${DEVICE}
d
8
w
q

Resize the partition 7 to use the remaining space:

sudo parted ${DEVICE}
p

You will see the exact size of your partition (here in bold) that will be used later:

Model: SD ACLCE (sd/mmc)
Disk /dev/mmcblk0: 63.9GB

Then reuse the same value here to use the whole end of the card:

(parted) resizepart 7
End?  [??.?GB]? 63.9GB
(parted) quit

Then now grow the fs itself.
* for an USB sdcard reader (/dev/sdX):

sudo resize2fs ${DEVICE}7

* for an internal sdcard reader (/dev/mmcblkX):

sudo resize2fs ${DEVICE}p7

Now sync (flush data in memory on disk) the card:

sync

You can now extract the card from your reader and put it in the LicheeRV board.

Booting

H2MI to DVI and HDMI to USB dongles I used
Then boot it plugged on a 1080p HDMI screen. It doesn’t work with my HDMI->DVI (tried on a 1680×1050 DVI-A and a 1080p DVI-D) or with my 1080p HDMI->USB dongle. Someone else reported it worked with an HDMI-DVI dongle (reference: 6140063500G).

Update: This was resolved partially by removing rfkit, a watchdog daemon that tried to kill something, probably on a wrong test. The message that come in loop on the console disappear then, the HDMI output on the HDMI to USB dongle worked, this will allow me to record/stream video output, and audio output on HDMI now work too. It could be suggestive, but I feel like system also work a bit faster (testing/killing/restarting things can take a lot of resources) :

sudo dpkg -P rtkit

You can see the whole boot sequence by connecting to UART. See this ASCIInema record of the boot sequence (local copy of the cast).

LigthDM connexion prompt

At the LightDM Login and pass prompt use:
* Login: sipeed
* Password: licheepi

Then you will have after about less than 1 minutes (yes, that’s a bit slow) the desktop.

Setting the WiFi

You can set your WiFi connexion (and even BlueTooth) with connexion manager. It is accessible from the main menu (the most left-bottom gray icon) by Preferences > Connman Settings, see this picture

access to Connman from menu

Then choose Wireless at left of the new box.Activate the Wifi connexion in Connman
* Click on the gray button to start the wifi (1 in red on the picture).
* Select the network you want to connect to (2 in red)
* Click on connect (3 in red).
* A prompt will open, where you will need to enter the passphrase of the WiFi.
Authentication required

The connexion should be established now, with “Connected” wrote at top of the window and “Online” beside the name of the Wifi router name (as on the picture at right.

You can by pressing on the gear at the right of the router name (2) in previous right picture, have access to some control to have the connexion set automatically at each boot.

click on the grayed autoconnect button, it should become blue meaning autoconnect is activated

Click on the IPv4 at left and then on the Method (set to None) button, choose automatic in the menu as shown in the following picture, then apply at bottom right.

I noticed it worked better if I uncommented the following lines in /etc/network/interfaces using

sudo vi /etc/network/interfaces<

, it seems to work far better when it's uncommented (there is a typo: wpa-deriver instead of wpa-driver, but works as is. to remove the # comments, just move the cursors to them and press x one time.

auto wlan0 #(wlp3s0 为网卡名)
iface wlan0 inet dhcp
	wpa-deriver wext
 	wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

When finished, quit and save with the sequence of keys: ":", "x!", ["enter"] key

You can sync your card and reboot safely now:

sync
sudo reboot

It should work fine the next time. you can verify the ip address on your router, or by connecting on the console or interface, and typing:

sipeed@sipeed:~$ ip address
1: lo:  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: sit0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: wlan0:  mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 74:ee:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.xx.xx/24 brd 192.168.xx.xx scope global dynamic wlan0
       valid_lft 41822sec preferred_lft 41822sec
4: wlan1:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 76:ee:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.xx.xx/24 brd 192.168.xx.xx scope global wlan1
       valid_lft forever preferred_lft forever

or, like the former way:

sipeed@sipeed:~$ sudo ifconfig
[sudo] password for sipeed: 
lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 13  bytes 1793 (1.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1793 (1.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=-28669  mtu 1500
        inet 192.168.xx.xx  netmask 255.255.255.0  broadcast 192.168.xx.xx
        ether 74:ee:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan1: flags=-28605  mtu 1500
        inet 192.168.xx.xx  netmask 255.255.255.0  broadcast 192.168.xx.xx
        ether 76:ee:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 582  bytes 80736 (78.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 504  bytes 82357 (80.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

To be more comfortable I suggest to make a swap file on the microSD if you want to use some desktop application, because, 512MB is really short:

Create a swap file of 1GB (1024M) and format it:

sudo dd bs=1M count=1024 status=progress if=/dev/zero of=/swap
sudo mkswap /swap

Add this to /etc/fstab for automatic mount after reboot:

echo "/swap none swap defaults 0 0" |sudo tee -a /etc/fstab/

Then mount it immediately

sudo swapon -a

For more comfortable serial (UART) console usage, you could also install xterm package. It will give you the resize command. When you type resize from your serial connexion, the serial view will adapt to you local Xterm, VTE term, or whatever terminal you use.

Among application working well, I found:
* graphic tool: GIMP, Krita work a bit slowly. The first time, need to wait long time, and then go to preferences to disable GL acceleration before creating an image, else it will be awfully slow. Everything will go far faster after that.
* Animation tool: Pencil2D
* IRC client hexchat, and Telegram-desktop client
* Blender work but is totally unusable
* Web browser are generally unusable, the exception is Netsurf (package netsurf-gtk, see screenshot below), that is still slow but a minimum usable, a framebuffer version (netsurf-fb) is pre-installed, but should be used in terminal console view, that is not setup by default. Text browsers like w3m, elinks, etc, can work. Firefox is unavailable (there is an unofficial method to patch it and compile it for RISC-V, need to test it, but I doubt it will be efficient, a 3 or 4 year old version, could be better. There is an official patch but seem to be no more available? As often, Firefox like to block progress on new technologies....
screenshot with Gimp, Pencil2D, Hexchat (irc client)
I put checkers on name to not display private informations:
Screenshot with Blender and Telegram

Netsurf-GTK has little display bugs, but is relatively usable. Still not reactive for typing URL in URL bars.
Screenshot of Netsurf-GTK

Booting Ubuntu Linux on a LicheeRV


Sipeed made a microSD card image to boot Ubuntu on RISC-V based Allwinner D1 SoC. with their LicheeRV SoM.

Boot sequence on ASCIInema (local copy)

I made a copy of the image in my own repository, that’s faster/easier to download.
* SHA256sum: 4a414a36ba5ae8000bd2f8ee088ea399b502527e1868662427bc00676d65ca79

Just download the archive, untar and follow the instruction in the README. There is an error, the primary partition should start at 80MB (163840), not 40MB (81920). The is limited to 4Go, so it should be grown with resize2fs to have more place to work.

The whole process so:

You must first set the SDCARD device name. For me it was /dev/sdd warning if you are wrong you can delete your system ^^. You can have it’s value by using dmesg just after plugging it:

sudo dmesg | tail

or by using fdisk -l. You need a microSD card with 16GB or more space.

export SDCARD=/dev/sdd

Then follow the following script:

wget https://popolon.org/depots/RISC-V/D1/LicheeRV/Sipeed_mirror/LicheeRV/image/licheerv_d1_1.14lcd_ub2004.tgz
tar xf licheerv_d1_1.14lcd_ub2004.tgz
cd licheerv_d1_ub2004_20220104a
sudo wipefs -a "${SDCARD}"
sudo fdisk "${SDCARD}"

In fdisk:

n
p
1
163840
[press_the_return_key]
w

then continue the process:

sudo dd if=boot0_sdcard_sun20iw1p1.bin of="${SDCARD}" bs=512 seek=16
sudo dd if=d1-kernel.toc1 of="${SDCARD}" bs=512 seek=32800 status=progress

Then depending on the name of the device on your system, if its of kind /dev/mmcblk0 then you should use /dev/mmcblk0p1 for partition 1, if it’s a /dev/sdd then, it’s /dev/sdd1.

if you use a /dev/mmcblkX type of device (typically internal SDcard reader) use this:

sudo dd if=ub2004_rootfs.img of="${SDCARD}p1" bs=1M status=progress
sudo resize2fs "${SDCARD}p1"
sync

if you use a /dev/sdX type of device (typically an USB SDcard reader) use this:

sudo dd if=ub2004_rootfs.img of="${SDCARD}1" bs=1M status=progress
sudo resize2fs "${SDCARD}1"
sync

After the sync, you can unplug the microSD card, plug it in your Lichee RV turn on the SoM, wait few seconds, after OpenSBI have booted it will open the kernel and you will see the Ubuntu boot sequence on screen.

Here is the boot with the LicheeRV dock, allowing to plug USB keyboard or other device, and HDMI, still need to manage it. There are some Debian image with HDMI working, but need proprietary Windows tools to make the microSD card :(.

Update: Another interesting image with more features Debian Bulleseye 11 from RVBoards, but with very strange FS (Android ?) and only 4GB partition (the /opt could be hacked). On their mirror (can be slow), local copy
* Sha256sum: e4a042d3a7c0658ffa009185488164eb18bd49fd92928cdec190a80f15b0c86b
* Just need to unzip and dd to the microSDcard.
* ASCIInema record of the boot sequence (local copy). This image is for Allwinner Nezha, so lot of things will not work and throw error message. But on the other side, most peripherals are detected, could be interesting for tuning. Linux condig.gz of the kernel