Again, amazing China. This time, Nanjing. What a city!!!!!

Ancient Qinhuai @ Qinhuai River, Nanjing Ancient Qinhuai @ Qinhuai River, Nanjing
GuQinHuai 01 GuQinHuai 02
WanQingLou LiXiangJun
Lights 01 Lights 02
Lights BaiLuZhou QinHuaiRenJia 01
QinHuaiRenJia 02 QinHuaiRenJia 03
NanjingSouth High Speed Train Railway Station Exterior NanjingSouth High Speed Train Railway Station Inside
Nanjing Old Station Renovated ChangYu Noodle

Raspberry Pi has already well-established a comprehensive community support world wide. Among ALL the operating systems supporting Raspberry Pi, Home Assistant stands out, shining brightly as an open-source home automation operating system in the field of IoT.

1. Overview

1.1 What is Home Assistant?

Home Assistant is the ``open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server.'' (cited from first page of the official website of Home Assistant.)

Home Assistant OS is a minimal operating system optimized for running Home Assistant, and it does not use traditional package management systems like apt. Instead, it relies on Docker containers to manage and run services, including Home Assistant and its add-ons.

1.2 Web UI

After simply flashed Home Assistant OS 12.3 onto a 16GB TF card and insert it into my old Raspberry Pi 3B V1.2, we can now take a brief look at Home Assistant web UI at http://homeassistant.local:8123/.

Home Assistant Overview Home Assistant Dashboard
Home Assistant Overview Home Assistant Dashboard
Home Assistant Terminal SSH Home Assistant Run Terminal SSH

2. ssh Into Home Assistant OS

2.1 Configuration

2.1.1 Installation of Home Assistant Add-on Terminal & SSH

Please have the add-on Home Assistant Add-on Terminal & SSH installed from Home Assistant -> Settings -> Add-ons.

2.1.2 Edit in YAML

Please do remember to add these 2 lines:

1
2
3
ssh:
enable: true
port: 22

at the end of the YAML configuration:

1
2
3
4
5
6
7
8
authorized_keys: []
password: []
apks: []
server:
tcp_forwarding: false
ssh:
enable: true
port: 22

2.2 ssh Into Home Assistant OS From Remote Desktop

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
➜  ~ ssh root@192.168.1.83
The authenticity of host '192.168.1.83 (192.168.1.83)' can't be established.
ED25519 key fingerprint is SHA256:MZDkXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXJmxE.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.83' (ED25519) to the list of known hosts.

▄██▄ _ _
▄██████▄ | | | | ___ _ __ ___ ___
▄████▀▀████▄ | |_| |/ _ \| '_ ` _ \ / _ \
▄█████ █████▄ | _ | (_) | | | | | | __/
▄██████▄ ▄██████▄ |_| |_|\___/|_| |_| |_|\___| _
████████ ██▀ ▀██ / \ ___ ___(_)___| |_ __ _ _ __ | |_
███▀▀███ ██ ▄██ / _ \ / __/ __| / __| __/ _` | '_ \| __|
██ ██ ▀ ▄█████ / ___ \\__ \__ \ \__ \ || (_| | | | | |_
███▄▄ ▀█ ▄███████ /_/ \_\___/___/_|___/\__\__,_|_| |_|\__|
▀█████▄ ███████▀

Welcome to the Home Assistant command line.

System information
IPv4 addresses for enu1u1: 192.168.1.83/24
IPv6 addresses for enu1u1: 2001:569:5993:5900:1b4a:e1e6:140c:aac0/64, fe80::ab1f:8f98:b81:a479/64
IPv4 addresses for wlan0:
IPv4 addresses for wlu1u4:

OS Version: Home Assistant OS 12.3
Home Assistant Core: 2024.5.5

Home Assistant URL: http://homeassistant.local:8123
Observer URL: http://homeassistant.local:4357
[core-ssh ~]$

3. ESPHome with Home Assistant

One of my very old blogs LVT ESP32-Cam has talked about ESP32 Camera. Today, I found that blog posted 4 years ago before COVID-19, and I’m trying to integrate some of my [ESP32 Cameras] into Home Assistant. Namely, use Home Assistant running on the Raspberry Pi to manage a couple of my ESP32 Cameras.

3.1 ESP32 Boards Management

Please ensure the following 2 boards support have been installed successfully.

Arduino IDE Esp32

3.2 CameraWebServer

Current ESP32 Examples provide an webcam server example: ESP32 Example CameraWebServer. Or, we can simply open up the example from within Arduino IDE: File->Examples->ESP32->Camera->CameraWebServer.

3.2.1 Four ESP32 Cameras

Both are compatible with the configuration CAMERA_MODEL_AI_THINKER in ESP32 Example CameraWebServer. Therefore, three places are to be correctly setup:

  • #define CAMERA_MODEL_AI_THINKER // Has PSRAM
  • const char *ssid = "XXXXXXXXX";
  • const char *password = "YYYYYYYYY";

3.2.2 Verify and Upload

Verify

Upload

3.2.3 Demonstration

CameraWebServer

However, as you can see, the captured image is not quite stable. And, I did find the WiFi connection is easy to get disconnected. What to do???

[!NOTE:] What to do??? Please continue reading.

3.3 RTSP with MJPEG

As of today, June 4, 2024, there is NO H.264 or H.265 streaming server support. Therefore, I’m going to follow the following 2 blogs and build up RTSP server with MJPEG video streams.

3.4 Integrate ESPHome Into Home Assistant

Getting Started with ESPHome and Home Assistant

3.5 Demonstration

ESPHome ESPHome
ESPHome Build Failed ESPHome Compile
ESPHome Device Discovered ESPHome Device Info
ESPHome Devices ESPHome Flash
ESPHome Installation ESPHome Install Connecting Hang
ESPHome Installed 3232 Connection Refused ESPHome Visit
Home Assistant Overview Home Assistant Media Live
ESPHome ESP32Cam Configured ESPHome ESP32Cam Integrated

I got a LicheeRV Nano before I left China for Canada a couple of weeks ago. Nowadays China is amazing. Let’s take a look at my hometown Wuhan of year 2024.

Sunset @ Yangtze River 2nd Bridge Sunset @ Yangtze River TianXingZhou Bridge
Yangtze River 2nd Bridge Sunset Yangtze River TianXingZhou Bridge Sunset
Yangtze River Grove Sunset Yangtze River Embankment Grassland Constructions
YuChiYuZui 01 YuChiYuZui 02

Now, let’s start our today’s topic: LicheeRV Nano.

1. Introduction

1.1 First Look

LicheeRV Nano LicheeRV Nano with N2425D
LicheeRV Nano 01 LicheeRV Nano 01

1.2 Official Documentation

Actually, ALL you need can be found at:

1.3 LicheeRV-Nano-WE

According to the LicheeRV Nano Version Comparison, there are 4 versions totally.

  • LicheeRV-Nano-B
  • LicheeRV-Nano-E
  • LicheeRV-Nano-W
  • LicheeRV-Nano-WE

Clearly, the one I purchased is a LicheeRV-Nano-WE.

2. lsusb

1
2
3
4
➜  ~ lsusb
......
Bus 009 Device 010: ID 3346:1009 sipeed licheervnano
......

3. WiFi Setup

After LicheeRV Nano is connected to your host computer via USB Type-C, enter the mounted rootfs and add the following new file:

1
2
3
4
5
➜  rootfs sudo vim ./etc/network/wpa_supplicant.conf
network={
ssid="XXXXX"
psk="YYYYY"
}

Then, reboot. Now, you should be able to find out your LicheeRV Nano by sudo nmap -sN 192.168.1.254/24.

4. LicheeRV Nano Overview

4.1 ssh Into LicheeRV Nano

Both the default username and password of LicheeRV Nano are root.

1
2
3
4
5
6
7
8
➜  ~ ssh root@192.168.1.78
root@192.168.1.78's password:

# uname -a
Linux licheervnano-8c93 5.10.4-tag- #1 PREEMPT Mon Apr 22 11:13:44 HKT 2024 riscv64 GNU/Linux

# hostname
licheervnano-8c93

4.2 CPU and Memory

Clearly, LicheeRV Nano is armed with only 1 single Risc-V 64bit CPU, and about 160M flash memory.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# cat /proc/cpuinfo
processor : 0
hart : 0
isa : rv64imafdvcsu
mmu : sv39

# cat /proc/meminfo
MemTotal: 162672 kB
MemFree: 98276 kB
MemAvailable: 128976 kB
Buffers: 3416 kB
Cached: 28776 kB
SwapCached: 0 kB
Active: 11792 kB
Inactive: 26892 kB
Active(anon): 144 kB
Inactive(anon): 6592 kB
Active(file): 11648 kB
Inactive(file): 20300 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 4 kB
Writeback: 0 kB
AnonPages: 6508 kB
Mapped: 10092 kB
Shmem: 248 kB
KReclaimable: 5164 kB
Slab: 13988 kB
SReclaimable: 5164 kB
SUnreclaim: 8824 kB
KernelStack: 1248 kB
PageTables: 524 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 81336 kB
Committed_AS: 9868 kB
VmallocTotal: 67108863 kB
VmallocUsed: 5468 kB
VmallocChunk: 0 kB
Percpu: 64 kB
CmaTotal: 0 kB
CmaFree: 0 kB

4.3 Python

By default, Python 3.11.6 has been installed on LicheeRV Nano.

1
2
# python --version
Python 3.11.6

5. LicheeRV-Nano-Build

The default LicheeRV-Nano-Build README.md seems to be problematic. I did it in my way:

5.1 Clone LicheeRV-Nano-Build

1
2
3
➜  git clone https://github.com/sipeed/LicheeRV-Nano-Build --depth=1
➜ cd LicheeRV-Nano-Build
➜ LicheeRV-Nano-Build git:(main)

5.2 Setup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
➜  LicheeRV-Nano-Build git:(main) ✗ source build/cvisetup.sh
/proc/self/fd/19:7: cv1800b_board_sel: assignment to invalid subscript range
-------------------------------------------------------------------------------------------------------
Usage:
(1) menuconfig - Use menu to configure your board.
ex: $ menuconfig

(2) defconfig $CHIP_ARCH - List EVB boards($BOARD) by CHIP_ARCH.
** sg200x ** -> ['sg2000', 'sg2002']
** cv181x ** -> ['cv1812cp', 'cv1812h', 'cv1813h']
** cv180x ** -> ['cv1800b']
ex: $ defconfig cv181x

(3) defconfig $BOARD - Choose EVB board settings.
ex: $ defconfig cv1813h_wevb_0007a_spinor
ex: $ defconfig cv1812cp_wevb_0006a_spinor
-------------------------------------------------------------------------------------------------------

5.3 GUI-based menuconfig

I personally prefer the GUI-based configuration.

5.3.1 Copy menuconfig.py

1
2
3
➜  LicheeRV-Nano-Build git:(main) ✗ cd build/scripts 
➜ scripts git:(main) ✗ cp menuconfig.py .py
➜ scripts git:(main) ✗

5.3.2 Modify ./build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig b/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig
index 4138f665b..58a5ea02d 100644
--- a/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig
+++ b/build/boards/sg200x/sg2002_licheervnano_sd/sg2002_licheervnano_sd_defconfig
@@ -2,12 +2,12 @@ CONFIG_CHIP_sg2002=y
CONFIG_BOARD_licheervnano_sd=y
CONFIG_DDR_CFG_ddr3_1866_x16=y
CONFIG_ARCH="riscv"
-CONFIG_CROSS_COMPILE="riscv64-unknown-linux-musl-"
+CONFIG_CROSS_COMPILE="riscv64-linux-gnu-"
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_KERNEL_ENTRY_HACK=y
CONFIG_KERNEL_ENTRY_HACK_ADDR="0x80200000"
CONFIG_TOOLCHAIN_MUSL_RISCV64=y
-CONFIG_FLASH_SIZE_SHRINK=y
+# CONFIG_FLASH_SIZE_SHRINK=y
CONFIG_BOOT_IMAGE_SINGLE_DTB=y
# CONFIG_FLASH_SIZE_SHRINK is not set
CONFIG_CP_EXT_WIRELESS=y
@@ -16,7 +16,7 @@ CONFIG_MIPI_PANEL_ZCT2133V1=y
CONFIG_SENSOR_GCORE_GC4653=y
CONFIG_SENSOR_OV_OS04A10=y
CONFIG_UBOOT_2021_10=y
-CONFIG_KERNEL_SRC_5.10=y
+CONFIG_KERNEL_SRC="linux_5.10"
CONFIG_KERNEL_UNCOMPRESSED=y
# CONFIG_SKIP_RAMDISK is not set
CONFIG_SENSOR_TUNING_PARAM_cv181x_src_gcore_gc4653=y

By the way, even until now, I’ve got NO idea what the MIPI_PANEL should be?

5.3.3 Run menuconfig

1
➜  LicheeRV-Nano-Build git:(main) ✗ menuconfig

LicheeRV Nano Build menuconfig

5.4 Build

5.4.1 Exports

1
2
3
➜  LicheeRV-Nano-Build git:(main) ✗ export IMGTOOL_PATH=tools/common/image_tool                      
➜ LicheeRV-Nano-Build git:(main) ✗ export COMMON_TOOLS_PATH=tools/common
➜ LicheeRV-Nano-Build git:(main) ✗ export FLASH_PARTITION_XML=boards/default/partition/partition_none.xml

Happy Chinese Dragon Year !!! Today, let's continue this SBC: Milk-V Duo 256M.

1. Some Suggestions

  • Auto resizing in order to use the full TF card). So far, I'll have to do it manually. Anyway, now I can use my full TF card as:
    1
    2
    3
    4
    5
    6
    7
    [root@milkv-duo]~# df -h
    Filesystem Size Used Available Use% Mounted on
    /dev/root 28.5G 146.0M 27.2G 1% /
    devtmpfs 83.1M 0 83.1M 0% /dev
    tmpfs 83.1M 0 83.1M 0% /dev/shm
    tmpfs 83.1M 48.0K 83.1M 0% /tmp
    tmpfs 83.1M 32.0K 83.1M 0% /run
    Without resizing, as in my previous blog Milk-V Duo 256M - 01
    1
    2
    3
    4
    5
    6
    7
    [root@milkv-duo]~# df -h
    Filesystem Size Used Available Use% Mounted on
    /dev/root 752.0M 152.6M 557.0M 22% /
    devtmpfs 83.1M 0 83.1M 0% /dev
    tmpfs 83.1M 0 83.1M 0% /dev/shm
    tmpfs 83.1M 48.0K 83.1M 0% /tmp
    tmpfs 83.1M 32.0K 83.1M 0% /run
  • Fix eth0's MAC address. For the wired connection on this particular small SBC Milk-V Duo 256M, I'd strongly recommend to use the physical MAC address for eth0, rather than a dynamic one. Whenever rebooting, Milk-V Duo 256M will change its MAC address, as well as the IP address, which is seriously NOT what I expected. Therefore, what we need to do is to modify file /etc/network/interfaces as suggested by StackExchange issue Change Mac Address permanently inside /etc/network/interfaces:
    1
    2
    3
    4
    5
    6
    auto eth0
    iface eth0 inet static
    address 192.168.1.51
    netmask 255.255.255.0
    gateway 192.168.1.1
    hwaddress ether 00:11:22:33:44:55

2. Yolo5 Example Based on TPU

Finally, I got duo-buildroot-sdk built today. So, yes, happy Chinese new year of Dragon, 2024. Let's have some fun of Milk-V Duo 256M.

1. Introduction

From Milk-V Duo 256M's official website, the following picture clearly shows it has

MilkV Duo 256M Core chips

The detailed specifications are also highlighted in the table on the official website of Milk-V Duo 256M.

2. Build duo-buildroot-sdk

2.1 Failed to build duo-buildroot-sdk using Ubuntu 22.04

Even if I strictly followed the manual on duo-buildroot-sdk's official documentation Compiled using Ubuntu 22.04, I still failed to build an image out for flashing, with the following error messages inside the log file build/br.log:

1
2
3
4
5
6
7
8
......
2024-02-08T13:34:11 tic: symbol lookup error: tic: undefined symbol: _nc_disable_period
2024-02-08T13:34:11 ? tic could not build ....../duo-buildroot-sdk-Duo-V1.0.8/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/per-package/ncurses/host/riscv64-buildroot-linux-musl/sysroot/usr/share/terminfo
2024-02-08T13:34:11 make[4]: *** [Makefile:92: install.data] Error 1
2024-02-08T13:34:12 make[3]: *** [Makefile:122: install] Error 2
2024-02-08T13:34:12 make[2]: *** [package/pkg-generic.mk:289: ....../duo-buildroot-sdk-Duo-V1.0.8/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/build/ncurses-6.1/.stamp_staging_installed] Error 2
2024-02-08T13:34:12 make[2]: *** Waiting for unfinished jobs....
......

A possible solution is found at: https://lore.kernel.org/buildroot/bug-15685-163-ecW1EgIyRW@https.bugs.busybox.net%2F/T/.

2.2 Successfully build duo-buildroot-sdk using Docker

By strictly following the manual on duo-buildroot-sdk's official documentation Compiled using Docker, I now am able to build an image out as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
......
mkfs.fat: Warning: lowercase labels might not work properly on some systems
INFO: vfat(boot.vfat): adding file 'fip.bin' as 'fip.bin' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '~/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat' '~/install/soc_cv1812cp_milkv_duo256m_sd/fip.bin' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'rawimages/boot.sd' as 'rawimages/boot.sd' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '~/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat' '~/install/soc_cv1812cp_milkv_duo256m_sd/rawimages/boot.sd' '::'" (stderr):
INFO: ext4(rootfs.ext4): cmd: "genext2fs -d '~/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root' --size-in-blocks=786432 -i 16384 '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4' " (stderr):
copying from directory ~/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root
INFO: ext4(rootfs.ext4): cmd: "tune2fs -O 'extents,uninit_bg,dir_index,has_journal' '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4'" (stderr):
INFO: ext4(rootfs.ext4): cmd: "tune2fs -L 'rootfs' '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4'" (stderr):
INFO: ext4(rootfs.ext4): cmd: "e2fsck -pvfD '~/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4'" (stderr):
INFO: hdimage(milkv-duo256m.img): adding partition 'boot' (in MBR) from 'boot.vfat' ...
INFO: hdimage(milkv-duo256m.img): adding partition 'rootfs' (in MBR) from 'rootfs.ext4' ...
INFO: hdimage(milkv-duo256m.img): writing MBR
gnimage for milkv-duo256m success!
~/build
~
Create SD image successful: out/milkv-duo256m-20240208-1949.img

And, the last couple of lines in the log file build/br.log are:

1
2
3
4
5
6
7
8
9
10
11
......
2024-02-08T19:48:15
2024-02-08T19:48:15 Allocating group tables: 0/25 done
2024-02-08T19:48:15 Writing inode tables: 0/25 done
2024-02-08T19:48:15 Creating journal (4096 blocks): done
2024-02-08T19:48:15 Copying files into the device: PATH="~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/host/bin:~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/host/sbin:~/host-tools/gcc/riscv64-linux-musl-x86_64/bin:~/host-tools/gcc/riscv64-linux-x86_64/bin:~/host-tools/gcc/riscv64-elf-x86_64/bin:~/host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-elf/bin:~/host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin:~/host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/host-tools/gcc/arm-cvitek-linux-uclibcgnueabihf/bin" xz -9 -C crc32 -c -T 9 ~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/images/rootfs.tar > ~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/images/rootfs.tar.xz
2024-02-08T19:48:16 done
2024-02-08T19:48:16 Writing superblocks and filesystem accounting information: 0/25 done
2024-02-08T19:48:16
2024-02-08T19:48:16 ln -sf rootfs.ext2 ~/buildroot-2021.05/output/milkv-duo256m_musl_riscv64/images/rootfs.ext4
2024-02-08T19:49:28 make[1]: Leaving directory '~/buildroot-2021.05'

3. Boot after Flashing

After flashing the generated out/milkv-duo256m-20240208-1949.img into the SD card, we can now boot up Milk-V Duo 256M by connecting it with my laptop via a USB cable.

3.1 lsusb

1
2
3
......
Bus 001 Device 009: ID 3346:1009 Cvitek RNDIS
......

3.2 SSH into Milk-V Duo 256M via USB Connection

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
➜  ~ ssh root@192.168.42.1
The authenticity of host '192.168.42.1 (192.168.42.1)' can't be established.
ED25519 key fingerprint is SHA256:NyuhOwhRh9sfzW+C2D5OIaTIbGCuVI1v1jrJv4DaM+U.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.42.1' (ED25519) to the list of known hosts.
root@192.168.42.1's password:
[root@milkv-duo]~# ls
[root@milkv-duo]~# pwd
/root
[root@milkv-duo]~# uname -a
Linux milkv-duo 5.10.4-tag- #1 PREEMPT Thu Feb 8 19:28:21 CST 2024 riscv64 GNU/Linux
[root@milkv-duo]~# lsb_release -a
-sh: lsb_release: not found
[root@milkv-duo]~# neofetch
-sh: neofetch: not found
[root@milkv-duo]~# ll /
total 33
drwxr-xr-x 18 root root 1024 Feb 8 2024 ./
drwxr-xr-x 18 root root 1024 Feb 8 2024 ../
drwxr-xr-x 2 root root 3072 Feb 8 2024 bin/
drwxr-xr-x 7 root root 1540 Jan 1 00:00 dev/
drwxr-xr-x 8 root root 1024 Jan 1 00:00 etc/
drwxr-xr-x 3 root root 1024 Jan 30 2024 lib/
lrwxrwxrwx 1 root root 3 Feb 8 2024 lib64 -> lib/
lrwxrwxrwx 1 root root 11 Feb 8 2024 linuxrc -> bin/busybox*
drwx------ 2 root root 16384 Feb 8 2024 lost+found/
drwxr-xr-x 2 root root 1024 Jan 30 2024 media/
drwxr-xr-x 6 root root 1024 Jan 30 2024 mnt/
drwxr-xr-x 2 root root 1024 Jan 30 2024 opt/
dr-xr-xr-x 122 root root 0 Jan 1 00:00 proc/
drwx------ 2 root root 1024 Jan 1 00:03 root/
drwxr-xr-x 4 root root 200 Jan 1 00:00 run/
drwxr-xr-x 2 root root 3072 Feb 8 2024 sbin/
dr-xr-xr-x 11 root root 0 Jan 1 00:00 sys/
drwxrwxrwt 3 root root 160 Jan 1 00:00 tmp/
drwxr-xr-x 8 root root 1024 Feb 8 2024 usr/
drwxr-xr-x 5 root root 1024 Feb 8 2024 var/
[root@milkv-duo]~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 752.0M 152.6M 557.0M 22% /
devtmpfs 83.1M 0 83.1M 0% /dev
tmpfs 83.1M 0 83.1M 0% /dev/shm
tmpfs 83.1M 48.0K 83.1M 0% /tmp
tmpfs 83.1M 32.0K 83.1M 0% /run
[root@milkv-duo]~# cat /proc/cpuinfo
processor : 0
hart : 0
isa : rv64imafdvcsu
mmu : sv39

[root@milkv-duo]~# cat /proc/meminfo
MemTotal: 170288 kB
MemFree: 147812 kB
MemAvailable: 148580 kB
Buffers: 872 kB
Cached: 3024 kB
SwapCached: 0 kB
Active: 2520 kB
Inactive: 2808 kB
Active(anon): 72 kB
Inactive(anon): 1440 kB
Active(file): 2448 kB
Inactive(file): 1368 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 44 kB
Writeback: 0 kB
AnonPages: 1444 kB
Mapped: 2532 kB
Shmem: 80 kB
KReclaimable: 2664 kB
Slab: 7220 kB
SReclaimable: 2664 kB
SUnreclaim: 4556 kB
KernelStack: 1024 kB
PageTables: 404 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 85144 kB
Committed_AS: 5004 kB
VmallocTotal: 67108863 kB
VmallocUsed: 4408 kB
VmallocChunk: 0 kB
Percpu: 32 kB
CmaTotal: 0 kB
CmaFree: 0 kB
[root@milkv-duo]~#

3.3 SSH into Milk-V Duo 256M via Wired Connection

After my clumsy soldering, Milk-V Duo 256M is now able to be connected via my home Intranet. Now, let's ssh into Milk-V Duo 256M via its IP address.

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@milkv-duo]~# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 0a:95:ef:1e:ec:c2 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.51/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
valid_lft 259082sec preferred_lft 226682sec
3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 5e:59:d4:f7:99:f7 brd ff:ff:ff:ff:ff:ff
inet 192.168.42.1/24 brd 192.168.42.255 scope global usb0
valid_lft forever preferred_lft forever

4. Camera Test - Face Detection

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
[root@milkv-duo]~# cd /bin
[root@milkv-duo]/bin# ls
arch chattr cpio dumpkmap getopt link lsattr mount nuke pwd setarch su uname
ash chgrp date echo grep linux32 mk_cmds mountpoint pidof resume setpriv sync usleep
base32 chmod dd egrep gunzip linux64 mkdir mt ping rm setserial tar vi
base64 chown df false gzip ln mknod mv pipe_progress rmdir sh touch watch
busybox compile_et dmesg fdflush hostname login mktemp netstat printenv run-parts sleep true zcat
cat cp dnsdomainname fgrep kill ls more nice ps sed stty umount
[root@milkv-duo]/bin# camera-test.sh
[SAMPLE_COMM_SNS_ParseIni]-1950: Parse /mnt/data/sensor_cfg.ini
[parse_source_devnum]-1605: devNum = 1
[parse_sensor_name]-1686: sensor = GCORE_GC2083_MIPI_2M_30FPS_10BIT
[parse_sensor_busid]-1714: bus_id = 2
[parse_sensor_i2caddr]-1725: sns_i2c_addr = 37
[parse_sensor_mipidev]-1736: mipi_dev = 0
[parse_sensor_laneid]-1747: Lane_id = 1, 0, 2, -1, -1
[parse_sensor_pnswap]-1758: pn_swap = 0, 0, 0, 0, 0
MMF Version:7e0cc6a08-musl_riscv64
Create VBPool[0], size: (3110400 * 3) = 9331200 bytes
Create VBPool[1], size: (3110400 * 3) = 9331200 bytes
Create VBPool[2], size: (2764800 * 1) = 2764800 bytes
Total memory of VB pool: 21427200 bytes
Initialize SYS and VB
Initialize VI
ISP Vipipe(0) Allocate pa(0x8c771000) va(0x0x3fbed36000) size(291120)
stSnsrMode.u16Width 1920 stSnsrMode.u16Height 1080 25.000000 wdrMode 0 pstSnsObj 0x3fbf86b400
[SAMPLE_COMM_VI_StartMIPI]-483: sensor 0 stDevAttr.devno 0
awbInit ver 6.8@2021500
0 R:1400 B:3100 CT:2850
1 R:1500 B:2500 CT:3900
2 R:2300 B:1600 CT:6500
Golden 1024 1024 1024
WB Quadratic:0
isWdr:0
ViPipe:0,===GC2083 1080P 30fps 10bit LINE Init OK!===
********************************************************************************
cvi_bin_isp message
gerritId: 36403 commitId: c69c5863e
md5: cab880835a2ad5184de5ed7762404b84
sensorNum 1
sensorName0 2083

PQBIN message
gerritId: 80171 commitId: 5c9d8fc5d
md5: ba5a510e093ad42db6788e6c2d13169e
sensorNum 3
sensorName0 2053

author: wanqiang.he desc: 思博慧CV1812H_GC2083_RGB_mode_V1.0.0
createTime: 2023-08-04 16:48:08version: V1.1
tool Version: v3.0.5.24 mode:
********************************************************************************
sensorName(0) mismatch, mwSns:2083 != pqBinSns:2053
[SAMPLE_COMM_ISP_Thread]-95: ISP Dev 0 running!
Initialize VPSS
---------VPSS[0]---------
Input size: (1920x1080)
Input format: (19)
VPSS physical device number: 1
Src Frame Rate: -1
Dst Frame Rate: -1
--------CHN[0]-------
Output size: (1920x1080)
Depth: 1
Do normalization: 0
Src Frame Rate: -1
Dst Frame Rate: -1
----------------------
--------CHN[1]-------
Output size: (1920x1080)
Depth: 1
Do normalization: 0
Src Frame Rate: -1
Dst Frame Rate: -1
----------------------
------------------------
Bind VI with VPSS Grp(0), Chn(0)
Attach VBPool(0) to VPSS Grp(0) Chn(0)
Attach VBPool(1) to VPSS Grp(0) Chn(1)
Initialize VENC
venc codec: h264
venc frame size: 1920x1080
Initialize RTSP
rtsp://192.168.1.51/h264
prio:0
version: 1.4.0
scrfd768432 Build at 2023-12-25 01:21:44 For platform cv181x
Max SharedMem size:1658880
anchor:-8,-8,8,8
anchor:-16,-16,16,16
bbox:bbox_8_Conv_dequant
landmark:kps_8_Conv_dequant
score:score_8_Sigmoid_dequant
anchor:-32,-32,32,32
anchor:-64,-64,64,64
bbox:bbox_16_Conv_dequant
landmark:kps_16_Conv_dequant
score:score_16_Sigmoid_dequant
anchor:-128,-128,128,128
anchor:-256,-256,256,256
bbox:bbox_32_Conv_dequant
landmark:kps_32_Conv_dequant
score:score_32_Sigmoid_dequant
Enter TDL thread
Enter encoder thread
0 R:1165 B:3087 CT:2688
1 R:1464 B:2327 CT:3937
2 R:1974 B:1613 CT:7225
Golden 1464 1024 2327
wdrLEOnly:1
face count: 0
face count: 0
face count: 0
face count: 0
face count: 0
face count: 0
face count: 0
......

One captured image over rtsp://ipaddress/h264 is shown as follows:

MilkV Duo Streaming

Now, it's the time to go to bed. Happy Chinese new year's Eve. The new year's day of 2024 is February 10, 2024.

Finally, in China, I setup my old laptop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
➜  ~ neofetch
.-/+oossssoo+/-. lvision@lvision-GT72-6QE
`:+ssssssssssssssssss+:` ------------------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 22.04.3 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: GT72 6QE REV:1.0
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 6.5.0-15-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 26 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 3057 (dpkg), 13 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.8.1
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 1920x1080
ossyNMMMNyMMhsssssssssssssshmmmhssssssso DE: GNOME 42.9
ossyNMMMNyMMhsssssssssssssshmmmhssssssso WM: Mutter
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ WM Theme: Adwaita
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Theme: Yaru [GTK2/3]
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ Icons: Yaru [GTK2/3]
+sssssssssdmydMMMMMMMMddddyssssssss+ Terminal: gnome-terminal
/ssssssssssshdmNNNNmyNMMMMhssssss/ CPU: Intel i7-6700HQ (8) @ 3.500GHz
.ossssssssssssssssssdMMMNysssso. GPU: NVIDIA GeForce GTX 980M
-+sssssssssssssssssyyyssss+- Memory: 3075MiB / 64254MiB
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.



➜ ~

1. Overview

1.1 What Is ESP32-S3

ESP32-S3 is a dual-core XTensa LX7 MCU, capable of running at 240 MHz. Apart from its 512 KB of internal SRAM, it also comes with integrated 2.4 GHz, 802.11 b/g/n Wi-Fi and Bluetooth 5 (LE) connectivity that provides long-range support. (Cite from Espressif's official online doc ESP32-S3).

In this blog, I'm going to heavily follow ESP32-S3-EYE Getting Started Guide.

1.2 Directly Plug-In USB Type C

1
2
3
➜  ~ lsusb | grep Espressif  
Bus 009 Device 034: ID 303a:700f Espressif ESP32-S3-EYE
➜ ~

1.3 Entering Flash Mode

Steps to enter flash mode:

  • Plug out USB Type C
  • Press BOOT button
  • Plug in USB Type C
  • Release BOOT button
1
2
3
➜  ~ lsusb| grep Espressif
Bus 009 Device 035: ID 303a:1001 Espressif USB JTAG/serial debug unit
➜ ~

1.4 Flash Default Firmware esp32-s3-eye-v2.2-firmware-v0.2.0-en.bin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
➜  v2.2 git:(master) esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 460800 write_flash -z 0x0 esp32-s3-eye-v2.2-firmware-v0.2.0-en.bin
esptool.py v4.8.1
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S3 (QFN56) (revision v0.2)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: ec:da:3b:9d:58:18
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00762fff...
Compressed 7745536 bytes to 4981103...
Wrote 7745536 bytes (4981103 compressed) at 0x00000000 in 48.0 seconds (effective 1292.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
➜ v2.2 git:(master)

1.5 Demonstration

ESP-S3-EYE Booting ESP-S3-EYE Camera ESP-S3-EYE Face Detection
Luckfox Pico Ultra W Enable CSI Luckfox Pico Ultra W CSI Enabled Luckfox Pico Ultra W CSI Enabled

2. WiFi

For simplicity, you can just use the Google app ESP BLE Provisioning.

1. Symptom

When I tried to build qt 5.15, I always obtain the following ERROR message:

1
2
3
4
5
6
7
8
9
10
Project ERROR: Library 'assimp' is not defined.
make[4]: *** [Makefile:85: sub-assimp-install_subtargets] Error 3
make[4]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src/plugins/assetimporters'
make[3]: *** [Makefile:59: sub-assetimporters-install_subtargets] Error 2
make[3]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src/plugins'
make[2]: *** [Makefile:206: sub-plugins-install_subtargets-ordered] Error 2
make[2]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src'
make[1]: *** [Makefile:62: sub-src-install_subtargets] Error 2
make[1]: Leaving directory '/opt/qt/qt-everywhere-src-5.15.12/qtquick3d'
make: *** [Makefile:378: module-qtquick3d-install_subtargets] Error 2

2. Reason

Why? Please refer to QT5.15在Ubuntu22.04上编译流程.

3. Solution

  • Modify line 13 of /opt/qt/qt-everywhere-src-5.15.12/qtquick3d/src/plugins/assetimporters/assimp/assimp.pro from QMAKE_USE_PRIVATE += assimp to QMAKE_USE_PRIVATE += quick3d-assimp.
  • Don't use assimp-5.2.2 from Ubuntu default repo, but build and install assimp (5.2.3 or above) from source.

China indeed is becoming better and better. Let me show you some pictures in SuZhou before my flight back to Vancouver.

Temple @ Lingyanshan, MUdu, Suzhou Stone Turtle @ Lingyanshan, Mudu, Suzhou
Linyanshan Temple Linyanshan Turtle
ShanTang Road XiangXi Bridge
XiangXi XiangXi Unknown Bridge
XuanGuan Temple PingJiangRoad Starbucks
PingJiang Road PingJiangRoad Side Road

1. My Working Environment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
➜  ~ neofetch                                                              
.-/+oossssoo+/-. lvision@lvision-MS-7C60
`:+ssssssssssssssssss+:` -----------------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 24.04 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: MS-7C60 1.0
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 6.8.0-39-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 18 hours, 3 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 5669 (dpkg), 25 (brew), 18 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.9
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 2560x1440
ossyNMMMNyMMhsssssssssssssshmmmhssssssso DE: GNOME 46.0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso WM: Mutter
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ WM Theme: Adwaita
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Theme: Adwaita [GTK2/3]
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ Icons: Adwaita [GTK2/3]
+sssssssssdmydMMMMMMMMddddyssssssss+ Terminal: gnome-terminal
/ssssssssssshdmNNNNmyNMMMMhssssss/ CPU: AMD Ryzen Threadripper 3960X (48) @ 3.800GHz
.ossssssssssssssssssdMMMNysssso. GPU: NVIDIA GeForce RTX 3090
-+sssssssssssssssssyyyssss+- Memory: 9520MiB / 257591MiB
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.

2. Introduction

2.1 First Look

Luckfox Pico Max Top View Luckfox Pico Max Bottom View Luckfox Pico Max Top View with Camera
Luckfox Pico Max Top View Luckfox Pico Max Bottom View Luckfox Pico Max Top View with Camera

2.2 Official Documentation

Actually, ALL you need can be found at:

2.3 Luckfox Pico Max

According to the Luckfox Pico Product Parameters, two streams of the products can be categorized into 2 classes by their chips:

  • RV1103:
    • Luckfox Pico
    • Luckfox Pico Mini A
    • Luckfox Pico Mini B
    • Luckfox Pico Plus
  • RV1106:
    • Luckfox Pico Pro
    • Luckfox Pico Max

[!NOTE]
From Taobao, the one I purchased is a Luckfox Pico Max.

3. Have Some Fun

3.1 lsusb For Direct USB Plug-In

1
2
➜  ~ lsusb | grep -i Fuzhou
Bus 009 Device 013: ID 2207:0019 Fuzhou Rockchip Electronics Company rk3xxx

A little weird: Why rk3xxx but not rv1106 ???

3.2 ssh Into Luckfox Pico

I personally prefer ssh into LuckFox Pico over Intranet and talk a look.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
➜  ~ ssh root@192.168.1.66
# pwd
/root
# cd /
# ls -la
total 0
drwxr-xr-x 20 1002 1002 1584 Nov 14 2023 .
drwxr-xr-x 20 1002 1002 1584 Nov 14 2023 ..
drwxrwxr-x 2 1002 1002 5704 Nov 16 2023 bin
lrwxrwxrwx 1 1002 1002 8 Sep 1 09:04 data -> userdata
drwxr-xr-x 12 root root 2020 Jan 1 12:00 dev
drwxrwxr-x 11 1002 1002 2184 Jan 1 12:00 etc
drwxrwxr-x 3 1002 1002 2168 Nov 16 2023 lib
lrwxrwxrwx 1 1002 1002 3 Nov 14 2023 lib32 -> lib
lrwxrwxrwx 1 1002 1002 3 Nov 30 2021 lib64 -> lib
lrwxrwxrwx 1 1002 1002 11 Nov 14 2023 linuxrc -> bin/busybox
drwxr-xr-x 2 1002 1002 160 Oct 16 2023 media
drwxr-xr-x 3 1002 1002 224 Oct 16 2023 mnt
drwxrwxr-x 3 1002 1002 296 Jan 1 13:10 oem
drwxr-xr-x 2 1002 1002 160 Oct 16 2023 opt
dr-xr-xr-x 126 root root 0 Jan 1 12:00 proc
drwxrwxr-x 6 1002 1002 664 Nov 16 2023 rockchip_test
drwx------ 2 1002 1002 160 Oct 16 2023 root
drwxr-xr-x 6 root root 220 Jan 1 12:00 run
drwxrwxr-x 2 1002 1002 5120 Nov 16 2023 sbin
dr-xr-xr-x 13 root root 0 Jan 1 12:00 sys
drwxrwxrwt 3 root root 100 Jan 1 13:06 tmp
drwxrwxr-x 2 1002 1002 312 Jan 1 12:00 userdata
drwxrwxr-x 7 1002 1002 608 Nov 14 2023 usr
drwxr-xr-x 5 1002 1002 736 Nov 16 2023 var
1
2
3
4
# uname -a
Linux luckfox 5.10.110 #1 Tue Nov 14 18:06:04 CST 2023 armv7l GNU/Linux
# python --version
Python 3.11.6
1
2
3
4
5
6
7
8
9
# df -h
Filesystem Size Used Available Use% Mounted on
ubi0:rootfs 181.3M 60.0M 121.3M 33% /
devtmpfs 90.9M 0 90.9M 0% /dev
tmpfs 91.0M 0 91.0M 0% /dev/shm
tmpfs 91.0M 64.0K 90.9M 0% /tmp
tmpfs 91.0M 488.0K 90.5M 1% /run
/dev/ubi4_0 20.2M 17.1M 3.0M 85% /oem
/dev/ubi5_0 2.2M 28.0K 2.2M 1% /userdata
1
2
3
4
5
6
7
8
9
10
11
12
13
# cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 61.13
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
Hardware : Generic DT based system
Revision : 0000
Serial : eb8d68468b29abe9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# cat /proc/meminfo
MemTotal: 186388 kB
MemFree: 156648 kB
MemAvailable: 164500 kB
Buffers: 0 kB
Cached: 11224 kB
SwapCached: 0 kB
Active: 6112 kB
Inactive: 10000 kB
Active(anon): 200 kB
Inactive(anon): 5248 kB
Active(file): 5912 kB
Inactive(file): 4752 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 4 kB
Writeback: 0 kB
AnonPages: 4908 kB
Mapped: 7520 kB
Shmem: 560 kB
KReclaimable: 3840 kB
Slab: 8156 kB
SReclaimable: 3840 kB
SUnreclaim: 4316 kB
KernelStack: 576 kB
PageTables: 428 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 93192 kB
Committed_AS: 19308 kB
VmallocTotal: 1032192 kB
VmallocUsed: 3580 kB
VmallocChunk: 0 kB
Percpu: 32 kB
CmaTotal: 67584 kB
CmaAllocated: 12 kB
CmaReleased: 67572 kB
CmaFree: 0 kB

From what I can see after SSH into my Luckfox Pico, the one I purchased is a Luckfox Pico Pro.

4. Reflash

4.1 Entering Flash Mode

  • Press BOOT button
  • Press RESET button
  • Release RESET button
  • Release BOOT button

To demonstrate it is flash mode now:

1
2
➜  ~ lsusb | grep -i Fuzhou
Bus 009 Device 015: ID 2207:110c Fuzhou Rockchip Electronics Company

4.2 Flash firmware

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
➜  Luckfox_Pico_Pro_Max_Flash sudo upgrade_tool uf update.img 
[sudo] password for lvision:
Loading firmware...
Support Type:1106 FW Ver:0.0.00 FW Time:2024-07-10 14:43:58
Loader ver:1.01 Loader Time:2024-07-10 14:42:28
Start to upgrade firmware...
Download Boot Start
Download Boot Success
Wait For Maskrom Start
Wait For Maskrom Success
Test Device Start
Test Device Success
Check Chip Start
Check Chip Success
Get FlashInfo Start
Get FlashInfo Success
Prepare IDB Start
Prepare IDB Success
Download IDB Start
Download IDB Success
Download Firmware Start
Download Image... (100%)
Download Firmware Success
Upgrade firmware ok.

4.3 ssh Into LuckFox Pico Max

Luckfox Pico Max CPUInfo Luckfox Pico Max MemInfo
Luckfox Pico Max CPUInfo Luckfox Pico Max MemInfo

5. Luckfox Pico Max CSI Camera

5.1 Connection Of CSI Camera

For my LuckFox Pico Max, I need to follow the following citation: When connecting the camera to LuckFox Pico Pro/Max development boards, ensure that the metal side of the camera ribbon cable faces the chip on the development board. (Refer to CSI Camera)

v4l2-ctl --list-devices and rkipc.ini

5.2 Content of rkipc.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
[root@luckfox data]# cat rkipc.ini 
[audio.0]
enable = 1
card_name = hw:0,0
encode_type = G711A
format = S16
sample_rate = 8000
channels = 2
frame_size = 1152
bit_rate = 16000
input = mic_in
volume = 50
enable_aed = 0
enable_bcd = 0
enable_vqe = 1
vqe_cfg = /oem/usr/share/vqefiles/config_aivqe.json
rt_audio_period_size = 1024

[video.source]
enable_aiq = 1
enable_vo = 0
vo_dev_id = 3 ; 0 is hdmi, 3 is mipi
enable_ivs = 1
enable_jpeg = 1
enable_venc_0 = 1
enable_venc_1 = 1
enable_venc_2 = 0
enable_npu = 1
npu_fps = 10
buffer_line = 1296
enable_rtsp = 1
enable_rtmp = 0
rotation = 0 ; available value:0 90 180 270

[video.0]
buffer_size = 1492992 ; w * h / 2
buffer_count = 4
enable_refer_buffer_share = 1
stream_type = mainStream
video_type = compositeStream
max_width = 2304
max_height = 1296
width = 2304
height = 1296
rc_mode = CBR
rc_quality = high
src_frame_rate_den = 1
src_frame_rate_num = 25
dst_frame_rate_den = 1
dst_frame_rate_num = 25
target_rate = 0
mid_rate = 1024
max_rate = 2048
min_rate = 0
output_data_type = H.265
smart = close
h264_profile = high
gop = 50
smartp_viridrlen = 25
gop_mode = normalP
stream_smooth = 50
enable_motion_deblur = 1
enable_motion_static_switch = 0
frame_min_i_qp = 26
frame_min_qp = 28
frame_max_i_qp = 51
frame_max_qp = 51
scalinglist = 0
enable_debreath_effect = 0
debreath_effect_strength = 16

......
......
......
[roi.4]
stream_type = thirdStream
id = 1
enabled = 0
name = test
position_x = 0
position_y = 0
width = 0
height = 0
quality_level = 3

[roi.5]
stream_type = thirdStream
id = 2
enabled = 0
name = test
position_x = 0
position_y = 0
width = 0
height = 0
quality_level = 3

[region_clip.1]
enabled = 0
position_x = 0
position_y = 0
width = 640
height = 480

[network.ntp]
enable = 1
refresh_time_s = 60
ntp_server = 119.28.183.184
[root@luckfox data]#

5.3 Snapshot of Streamed Video Over RTSP

Snapshot

BeagleV®-Fire is a revolutionary single-board computer (SBC) powered by the Microchip’s PolarFire® MPFS025T 5x core RISC-V System on Chip (SoC) with FPGA fabric. (Cited from BeagleV-Fire Board).

1. Introduction

This MPFS025T is actually a PolarFire Family FPGA SoC, fabriced with both FPGA and RISC-V CPU. I'm saving my word in this part. Let's just do it.

2. Official Ubuntu

Approximately 25 days ago, the official page for the BeagleV-Fire Board announced its first-ever distribution, the BeagleV-Fire Distro Ubuntu 2023-11-21.

3. Flash BeagleV-Fire Board

In this section, we're going to strictly follow BeagleV-Fire Ubuntu readme.md, with trivial modifiations.

3.1 Update ALL Packages to 2023.09 in 01_git_sync.sh

After you checkout BeagleV-Fire Ubuntu, modify 01_git_sync.sh as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
➜  BeagleV-Fire-ubuntu git:(main) ✗ git diff 01_git_sync.sh 

diff --git a/01_git_sync.sh b/01_git_sync.sh
index cf3e230..6ab34c1 100755
--- a/01_git_sync.sh
+++ b/01_git_sync.sh
@@ -3,11 +3,11 @@
GIT_DEPTH="20"
GCC_VERSION="11.4.0"

-HSS_BRANCH="v2023.02"
+HSS_BRANCH="v2023.09"
HSS_REPO="https://github.com/polarfire-soc/hart-software-services.git"

#UBOOT_BRANCH="mpfs-uboot-2022.01"
-UBOOT_BRANCH="linux4microchip+fpga-2023.02"
+UBOOT_BRANCH="linux4microchip+fpga-2023.09"
UBOOT_REPO="https://github.com/polarfire-soc/u-boot.git"
#UBOOT_REPO="https://git.beagleboard.org/beaglev-fire/beaglev-fire-u-boot.git"
#UBOOT_REPO="git@git.beagleboard.org:beaglev-fire/beaglev-fire-u-boot.git"
@@ -16,7 +16,7 @@ DT_BRANCH="v6.1.x-Beagle"
DT_REPO="https://git.beagleboard.org/beagleboard/BeagleBoard-DeviceTrees.git"
#DT_REPO="git@git.beagleboard.org:beagleboard/BeagleBoard-DeviceTrees.git"

-LINUX_BRANCH="linux4microchip+fpga-2023.06"
+LINUX_BRANCH="linux4microchip+fpga-2023.09"
LINUX_REPO="https://github.com/linux4microchip/linux.git"
#LINUX_REPO="https://git.beagleboard.org/beaglev-fire/beaglev-fire-linux.git"
#LINUX_REPO="git@git.beagleboard.org:beaglev-fire/beaglev-fire-linux.git"

Namely, use ALL possible NEWEST or MOST UP-TO-DATE packages. As you can see, ALL branches that I'm using are of 2023.09.

3.2 Start Building

3.2.1 01_git_sync.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
➜  BeagleV-Fire-ubuntu git:(main) ✗ ./01_git_sync.sh 
git clone -b v2023.09 https://github.com/polarfire-soc/hart-software-services.git ./hart-software-services/ --depth=20
Cloning into './hart-software-services'...
remote: Enumerating objects: 1609, done.
remote: Counting objects: 100% (1609/1609), done.
remote: Compressing objects: 100% (1194/1194), done.
remote: Total 1609 (delta 513), reused 1014 (delta 361), pack-reused 0
Receiving objects: 100% (1609/1609), 3.58 MiB | 8.44 MiB/s, done.
Resolving deltas: 100% (513/513), done.
Note: switching to '919a27fa692d356a8fa0d9a6c4b950d04bee41bf'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

git switch -c <new-branch-name>

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

git clone -b linux4microchip+fpga-2023.09 https://github.com/polarfire-soc/u-boot.git ./u-boot/ --depth=20
Cloning into './u-boot'...
remote: Enumerating objects: 21670, done.
remote: Counting objects: 100% (21670/21670), done.
remote: Compressing objects: 100% (18160/18160), done.
remote: Total 21670 (delta 4173), reused 11080 (delta 3124), pack-reused 0
Receiving objects: 100% (21670/21670), 27.91 MiB | 13.00 MiB/s, done.
Resolving deltas: 100% (4173/4173), done.
Note: switching to '8f5e331e3f09cdf469d528905f5d6a7139016634'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

git switch -c <new-branch-name>

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Updating files: 100% (19905/19905), done.
git clone -b v6.1.x-Beagle https://git.beagleboard.org/beagleboard/BeagleBoard-DeviceTrees.git ./device-tree/ --depth=20
Cloning into './device-tree'...
remote: Enumerating objects: 390, done.
remote: Counting objects: 100% (390/390), done.
remote: Compressing objects: 100% (251/251), done.
remote: Total 390 (delta 191), reused 225 (delta 120), pack-reused 0
Receiving objects: 100% (390/390), 368.83 KiB | 6.96 MiB/s, done.
Resolving deltas: 100% (191/191), done.
git clone -b linux4microchip+fpga-2023.09 https://github.com/linux4microchip/linux.git ./linux/ --depth=20
Cloning into './linux'...
info: Could not add alternate for '/home/lvision/linux-src/': path '/home/lvision/linux-src/' does not exist
remote: Enumerating objects: 94584, done.
remote: Counting objects: 100% (94584/94584), done.
remote: Compressing objects: 100% (84459/84459), done.
remote: Total 94584 (delta 12732), reused 88132 (delta 9251), pack-reused 0
Receiving objects: 100% (94584/94584), 263.65 MiB | 19.75 MiB/s, done.
Resolving deltas: 100% (12732/12732), done.
Note: switching to '25e35c7c54ad853d03c14a02b189b408cb5b5eb3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

git switch -c <new-branch-name>

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Updating files: 100% (78845/78845), done.

3.2.2 02_build_hss.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
➜  BeagleV-Fire-ubuntu git:(main) ✗ ./02_build_hss.sh 
make: Entering directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator'
RM /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/hss-payload-generator /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/main.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/yaml_parser.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/blob_handler.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/elf_parser.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/elf_strings.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/crc32.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/generate_payload.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/dump_payload.o /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/debug_printf.o
make: Leaving directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator'
make -C hart-software-services/tools/hss-payload-generator/
make: Entering directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator'
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/main.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/yaml_parser.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/blob_handler.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/elf_parser.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/elf_strings.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/crc32.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/generate_payload.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/dump_payload.o
CC /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/debug_printf.o
LD /home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator/hss-payload-generator
make: Leaving directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/hart-software-services/tools/hss-payload-generator'
'./hart-software-services/tools/hss-payload-generator/hss-payload-generator' -> './deploy/hss-payload-generator'

3.2.3 03_build_u-boot.sh

An issue: Error: illegal operands `li t1,(CFG_SYS_INIT_RAM_ADDR+CFG_SYS_INIT_RAM_SIZE-400)'

Solution: Modifly line 98 of file u-boot/arch/riscv/cpu/start.s from li t1, SYS_INIT_SP_ADDR to

1
2
lui t1, %hi(0x80000000)
addi t1, t1, %lo(0x80000000)

Then, start building:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
➜  BeagleV-Fire-ubuntu git:(main) ✗ ./03_build_u-boot.sh 
make: Entering directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
CLEAN dts/../arch/riscv/dts
CLEAN dts
CLEAN lib/efi_loader
CLEAN tools
CLEAN tools/lib tools/common
CLEAN include/generated/env.in include/generated/env.txt u-boot u-boot.bin u-boot.cfg u-boot.dtb u-boot-dtb.bin u-boot.lds u-boot.map u-boot-nodtb.bin u-boot.srec u-boot.sym System.map defconfig
CLEAN scripts/basic
CLEAN scripts/dtc
CLEAN scripts/kconfig
CLEAN include/config include/generated
CLEAN .config .config.old include/autoconf.mk include/autoconf.mk.dep include/config.h
make: Leaving directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
'../patches/u-boot/beaglev-fire/microchip_mpfs_icicle.h' -> 'include/configs/microchip_mpfs_icicle.h'
'../patches/u-boot/beaglev-fire/microchip-mpfs-icicle-kit.dts' -> 'arch/riscv/dts/microchip-mpfs-icicle-kit.dts'
'../patches/u-boot/beaglev-fire/microchip_mpfs_icicle_defconfig' -> 'configs/microchip_mpfs_icicle_defconfig'
make: Entering directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
YACC scripts/kconfig/zconf.tab.c
LEX scripts/kconfig/zconf.lex.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
make: Leaving directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
make: Entering directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
scripts/kconfig/conf --olddefconfig Kconfig
#
# configuration written to .config
#
make: Leaving directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
make: Entering directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
scripts/kconfig/conf --savedefconfig=defconfig Kconfig
make: Leaving directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
'./u-boot/defconfig' -> './u-boot/configs/microchip_mpfs_icicle_defconfig'
'./u-boot/defconfig' -> './patches/u-boot/beaglev-fire/microchip_mpfs_icicle_defconfig'
make -C u-boot -j48 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- all
make: Entering directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
scripts/kconfig/conf --syncconfig Kconfig
UPD include/config.h
CFG u-boot.cfg
GEN include/autoconf.mk.dep
......
In file included from ././include/linux/kconfig.h:4,
from <command-line>:
include/generated/autoconf.h:142: note: this is the location of the previous definition
142 | #define CONFIG_SYS_BOOTM_LEN 0x800000
|
AR drivers/core/built-in.o
AR drivers/mtd/ubi/built-in.o
AR lib/zlib/built-in.o
AR drivers/mtd/built-in.o
AR drivers/built-in.o
AR fs/fat/built-in.o
AR fs/ubifs/built-in.o
AR fs/built-in.o
AR lib/built-in.o
LD u-boot
OBJCOPY u-boot.srec
OBJCOPY u-boot-nodtb.bin
SYM u-boot.sym
DTC arch/riscv/dts/microchip-mpfs-icicle-kit.dtb
DTC arch/riscv/dts/microchip-mpfs-icicle-kit-amp.dtb
DTC arch/riscv/dts/microchip-mpfs-icicle-kit-qspi-nor.dtb
SHIPPED dts/dt.dtb
CAT u-boot-dtb.bin
COPY u-boot.dtb
COPY u-boot.bin
OFCHK .config
make: Leaving directory '/home/lvision/Desktop/BeagleV-Fire-ubuntu/u-boot'
'./u-boot/u-boot.bin' -> './deploy/u-boot.bin'
'./u-boot/u-boot.bin' -> './deploy/src.bin'

3.2.4 04_build_linux.sh

Two issues:

Then, start building:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
➜  BeagleV-Fire-ubuntu git:(main) ✗ ./04_build_linux.sh 
Applying: PCIe: Change controller and bridge base address.
Applying: GPIO: Add Microchip CoreGPIO driver.
Applying: ADC: Add Microchip MCP356X driver.
error: patch failed: drivers/iio/adc/Makefile:68
error: drivers/iio/adc/Makefile: patch does not apply
Patch failed at 0001 ADC: Add Microchip MCP356X driver.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
'../device-tree/src/microchip/mpfs-beaglev-fire.dts' -> 'arch/riscv/boot/dts/microchip/mpfs-beaglev-fire.dts'
'../device-tree/src/microchip/mpfs-beaglev-fire-fabric.dtsi' -> 'arch/riscv/boot/dts/microchip/mpfs-beaglev-fire-fabric.dtsi'
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- clean
'../patches/linux/mpfs_defconfig' -> './arch/riscv/configs/mpfs_defconfig'
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- mpfs_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
make -j48 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- olddefconfig
#
# No change to .config
#
make -j48 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- Image modules dtbs
SYNC include/config/auto.conf.cmd
WRAP arch/riscv/include/generated/uapi/asm/errno.h
WRAP arch/riscv/include/generated/uapi/asm/fcntl.h
WRAP arch/riscv/include/generated/uapi/asm/ioctls.h
WRAP arch/riscv/include/generated/uapi/asm/ioctl.h
WRAP arch/riscv/include/generated/uapi/asm/ipcbuf.h
WRAP arch/riscv/include/generated/uapi/asm/msgbuf.h
WRAP arch/riscv/include/generated/uapi/asm/mman.h
......
LD [M] net/unix/unix_diag.ko
LD [M] net/vmw_vsock/vmw_vsock_virtio_transport.ko
LD [M] net/vmw_vsock/vsock.ko
LD [M] net/vmw_vsock/vmw_vsock_virtio_transport_common.ko
LD [M] net/vmw_vsock/vsock_diag.ko
LD [M] net/vmw_vsock/vsock_loopback.ko
LD [M] net/wireless/cfg80211.ko
LD [M] net/wireless/lib80211.ko
LD [M] net/wireless/lib80211_crypt_ccmp.ko
LD [M] net/wireless/lib80211_crypt_tkip.ko
LD [M] net/wireless/lib80211_crypt_wep.ko
LD [M] net/xdp/xsk_diag.ko
LD [M] net/xfrm/xfrm_algo.ko
LD [M] net/xfrm/xfrm_interface.ko
LD [M] net/xfrm/xfrm_ipcomp.ko
LD [M] net/xfrm/xfrm_user.ko
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.S
LD vmlinux
NM System.map
SORTTAB vmlinux
OBJCOPY arch/riscv/boot/Image
Kernel: arch/riscv/boot/Image is ready
Compressing 6.1.43-linux4microchip+fpga-2023.09-20231219+-modules.tar.gz...
'./.config' -> '../patches/linux/mpfs_defconfig'
'./arch/riscv/boot/dts/microchip/mpfs-beaglev-fire.dts' -> '../patches/linux/dts/mpfs-beaglev-fire.dts'
'./arch/riscv/boot/dts/microchip/mpfs-beaglev-fire-fabric.dtsi' -> '../patches/linux/dts/mpfs-beaglev-fire-fabric.dtsi'
'./arch/riscv/boot/Image' -> '../deploy/input/Image'
'./arch/riscv/boot/dts/microchip/mpfs-beaglev-fire.dtb' -> '../deploy/input/mpfs-beaglev-fire.dtb'
'./patches/linux/beaglev_fire.its' -> './deploy/input/beaglev_fire.its'
FIT description: U-Boot fitImage for the BeagleV-Fire
Created: Tue Dec 19 12:58:17 2023
Image 0 (kernel)
Description: Linux kernel
Created: Tue Dec 19 12:58:17 2023
Type: Kernel Image
Compression: gzip compressed
Data Size: 8622322 Bytes = 8420.24 KiB = 8.22 MiB
Architecture: RISC-V
OS: Linux
Load Address: 0x80200000
Entry Point: 0x80200000
Hash algo: sha256
Hash value: 82f0ce932fe469cd5ea7aa4d3230f49560ed490d92ad2e9e555a488b10ae3dae
Image 1 (base_fdt)
Description: Flattened Device Tree blob
Created: Tue Dec 19 12:58:17 2023
Type: Flat Device Tree
Compression: uncompressed
Data Size: 20670 Bytes = 20.19 KiB = 0.02 MiB
Architecture: RISC-V
Load Address: 0x8a000000
Hash algo: sha256
Hash value: b8fcfe485d229df53d3f68d5db0372237c8754bc1e96822c4527362ce076d537
Default Configuration: 'kernel_dtb'
Configuration 0 (kernel_dtb)
Description: 1 Linux kernel, FDT blob
Kernel: kernel
FDT: base_fdt
Configuration 1 (base_dtb)
Description: Base FDT blob for BeagleV-Fire board
Kernel: unavailable
FDT: base_fdt

3.2.5 05_generate_payload.bin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
➜  BeagleV-Fire-ubuntu git:(main) ✗ ./05_generate_payload.bin.sh 
Hart Software Service formatted boot image generator v0.99.37
Copyright (c) 2021-2022 Microchip FPGA Embedded Systems Solutions.

Parsing set-name
Parsing hart entry points
Entry Point U54_1 is 0x80200000
Entry Point U54_2 is 0x80200000
Entry Point U54_3 is 0x80200000
Entry Point U54_4 is 0x80200000
Parsing payload >>src.bin<<
exec_addr is 0x80200000
owner is 1
secondary is 2
secondary is 3
secondary is 4
priv_mode is 1

Processing ELF >>src.bin<<
>>src.bin<< is not an ELF object

Processing blob >>src.bin<< - placing at 0x80200000
lastChunk is 0, numChunks is 1
Set-name is >>PolarFire-SoC-HSS::U-Boot<<
Output filename is >>./input/payload.bin<<
Outputting Payload Header
Outputting Code/Data Chunks
Outputting ZI Chunks
Outputting Binary Data
Outputting Payload Header
Tue 19 Dec 2023 12:58:45 PM PST
[u-boot.bin: U-Boot 2023.07.02-linux4microchip+fpga-2023.09-dirty (Dec 19 2023 - 12:53:03 -0800)]
[src.bin: U-Boot 2023.07.02-linux4microchip+fpga-2023.09-dirty (Dec 19 2023 - 12:53:03 -0800)]
[payload.bin:U-Boot 2023.07.02-linux4microchip+fpga-2023.09-dirty (Dec 19 2023 - 12:53:03 -0800)]

3.2.6 06_generate_debian_console_root.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
➜  BeagleV-Fire-ubuntu git:(main) ✗ sudo ./06_generate_debian_console_root.sh
--2023-12-19 12:59:30-- https://rcn-ee.net/rootfs/debian-riscv64-sid-minimal/2023-12-19/debian-sid-console-riscv64-2023-12-19.tar.xz
Resolving rcn-ee.net (rcn-ee.net)... 2606:4700:3037::ac43:8616, 2606:4700:3037::6815:5fb, 172.67.134.22, ...
Connecting to rcn-ee.net (rcn-ee.net)|2606:4700:3037::ac43:8616|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 397978580 (380M) [application/x-xz]
Saving to: ‘./deploy/debian-sid-console-riscv64-2023-12-19.tar.xz’

debian-sid-console-riscv64-2023-12-19.tar.xz 100%[======================================================================================================================================================================>] 379.54M 86.4MB/s in 4.7s

2023-12-19 12:59:35 (80.9 MB/s) - ‘./deploy/debian-sid-console-riscv64-2023-12-19.tar.xz’ saved [397978580/397978580]

Extracting: debian-sid-console-riscv64-2023-12-19/riscv64-rootfs-*.tar
'./deploy/boot.scr' -> 'deploy/input/boot.scr'
'./ignore/.root/etc/bbb.io/templates/eth0-DHCP.network' -> './ignore/.root/etc/systemd/network/eth0.network'
'./ignore/.root/etc/bbb.io/templates/eth1-DHCP.network' -> './ignore/.root/etc/systemd/network/eth1.network'
'./ignore/.root/etc/bbb.io/templates/nginx/nginx-autoindex' -> './ignore/.root/etc/nginx/sites-enabled/default'
'./ignore/.root/etc/bbb.io/templates/nginx/Cockpit.html' -> './ignore/.root/var/www/html/Cockpit.html'
'./ignore/.root/etc/bbb.io/templates/nginx/Docs-BeagleBoard.html' -> './ignore/.root/var/www/html/Docs-BeagleBoard.html'
---------------------
File Size
1.4G ignore/.root/
---------------------
0+0 records in
0+0 records out
0 bytes copied, 0.000160765 s, 0.0 kB/s
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done
Creating filesystem with 563200 4k blocks and 140832 inodes
Filesystem UUID: 99243c2d-5c98-489f-a06f-719f691c31f1
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Copying files into the device: done
Writing superblocks and filesystem accounting information: done

3.2.7 07_create_sdcard_img.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
➜  BeagleV-Fire-ubuntu git:(main) ✗ sudo ./07_create_sdcard_img.sh 
INFO: cmd: "mkdir -p "/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/tmp"" (stderr):
INFO: cmd: "rm -rf "/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/tmp"/*" (stderr):
INFO: cmd: "mkdir -p "/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/tmp"" (stderr):
INFO: cmd: "cp -a "/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/root" "/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/tmp/root"" (stderr):
INFO: hdimage(sdcard.img): The option 'gpt' is deprecated. Use 'partition-table-type' instead
INFO: cmd: "mkdir -p "/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/images"" (stderr):
INFO: vfat(boot.vfat): cmd: "mkdosfs '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/images/boot.vfat'" (stderr):
INFO: vfat(boot.vfat): adding file 'beaglev_fire.itb' as 'beaglev_fire.itb' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/images/boot.vfat' '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/input/beaglev_fire.itb' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'boot.scr' as 'boot.scr' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/images/boot.vfat' '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/input/boot.scr' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'mpfs-beaglev-fire.dtb' as 'mpfs-beaglev-fire.dtb' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/images/boot.vfat' '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/input/mpfs-beaglev-fire.dtb' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'Image' as 'Image' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/images/boot.vfat' '/home/lvision/Desktop/BeagleV-Fire-ubuntu/deploy/input/Image' '::'" (stderr):
INFO: hdimage(sdcard.img): adding partition 'uboot' (in MBR) from 'payload.bin' ...
INFO: hdimage(sdcard.img): adding partition 'kernel' (in MBR) from 'boot.vfat' ...
INFO: hdimage(sdcard.img): adding partition 'root' (in MBR) from 'root.ext4' ...
INFO: hdimage(sdcard.img): adding partition '[MBR]' ...
INFO: hdimage(sdcard.img): adding partition '[GPT header]' ...
INFO: hdimage(sdcard.img): adding partition '[GPT array]' ...
INFO: hdimage(sdcard.img): adding partition '[GPT backup]' ...
INFO: hdimage(sdcard.img): writing GPT
INFO: hdimage(sdcard.img): writing protective MBR
INFO: hdimage(sdcard.img): writing MBR
bmaptool: debug: opened image "./images/sdcard.img"
bmaptool: debug: block size 4096, blocks count 578750, image size 2370560000
bmaptool: debug: FilemapFiemap: initializing
bmaptool: debug: FilemapFiemap: block_is_mapped(0) returns True
bmaptool: debug: FilemapFiemap: get_mapped_ranges(0, 578750(578749))
bmaptool: debug: FilemapFiemap: yielding range (0, 8521)
bmaptool: debug: FilemapFiemap: yielding range (15545, 15833)
bmaptool: debug: FilemapFiemap: yielding range (15837, 15843)
bmaptool: debug: FilemapFiemap: yielding range (15853, 18412)
bmaptool: debug: FilemapFiemap: yielding range (23677, 48315)
bmaptool: debug: FilemapFiemap: yielding range (48589, 113851)
bmaptool: debug: FilemapFiemap: yielding range (114125, 179387)
bmaptool: debug: FilemapFiemap: yielding range (179661, 244923)
bmaptool: debug: FilemapFiemap: yielding range (245197, 310459)
bmaptool: debug: FilemapFiemap: yielding range (310733, 390634)
bmaptool: debug: FilemapFiemap: yielding range (539833, 539835)
bmaptool: debug: FilemapFiemap: yielding range (578729, 578749)

3.2.8 Flash SD Card

1
2
3
4
5
➜  BeagleV-Fire-ubuntu git:(main) ✗ ll deploy/images 
total 1.5G
-rw-r--r-- 1 root root 60M Dec 15 05:14 boot.vfat
-rw-r--r-- 1 root root 3.5K Dec 15 05:14 sdcard.bmap
-rw-r--r-- 1 root root 2.3G Dec 15 05:14 sdcard.img

4. Demonstration

4.1 Initial Look

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
➜  ~ ssh beagle@192.168.1.17
Ubuntu 23.04

BeagleBoard.org Ubuntu 23.04 Console Image 2023-10-19
Support: https://bbb.io/debian
default username:password is [beagle:temppwd]

beagle@192.168.1.17's password:
Last login: Fri Dec 15 12:12:31 2023 from 192.168.1.1
beagle@BeagleV:~$ uname -a
Linux BeagleV 6.1.33-linux4microchip+fpga-2023.06-20231019+ #1 SMP Thu Oct 19 16:01:29 UTC 2023 riscv64 riscv64 riscv64 GNU/Linux
beagle@BeagleV:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 23.04
Release: 23.04
Codename: lunar
➜ ~ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 4.0G 9.7G 30% /
tmpfs 771M 0 771M 0% /dev/shm
tmpfs 309M 1.6M 307M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/mmcblk0p2 60M 33M 28M 55% /boot/firmware
tmpfs 155M 0 155M 0% /run/user/1000

4.2 After Update-Upgrade and Installed Neofetch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
➜  ~ neofetch
.-/+oossssoo+/-. beagle@BeagleV
`:+ssssssssssssssssss+:` --------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 23.04 riscv64
.ossssssssssssssssssdMMMNysssso. Host: BeagleBoard BeagleV-Fire
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 6.1.33-linux4microchip+fpga-2023.06-20231019+
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 4 hours, 58 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 898 (dpkg)
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.9
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Terminal: /dev/pts/0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso CPU: (4)
ossyNMMMNyMMhsssssssssssssshmmmhssssssso Memory: 137MiB / 1541MiB
+sssshhhyNMMNyssssssssssssyNMMMysssssss+
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
+sssssssssdmydMMMMMMMMddddyssssssss+
/ssssssssssshdmNNNNmyNMMMMhssssss/
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
`:+ssssssssssssssssss+:`
.-/+oossssoo+/-.

➜ ~

4.3 Weird

Did you find what's weird? - In the above subsection 3.2.6, I clearly used debian rootfs. However, my BeagleV-Fire Board is now running Ubuntu 23.04????? - I am using a SD card of size 32G, why this one is detected as 16G ONLY?????

Some more investigation clearly shows that I do have 2 block devices:

1
2
3
4
5
6
7
8
9
10
11
12
➜  ~ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk1 179:0 0 28.9G 0 disk
├─mmcblk1p1 179:1 0 722.5K 0 part
├─mmcblk1p2 179:2 0 60M 0 part
└─mmcblk1p3 179:3 0 28.9G 0 part
mmcblk0 179:8 0 14.6G 0 disk
├─mmcblk0p1 179:9 0 684K 0 part
├─mmcblk0p2 179:10 0 60M 0 part /boot/firmware
└─mmcblk0p3 179:11 0 14.5G 0 part /
mmcblk0boot0 179:16 0 4M 1 disk
mmcblk0boot1 179:24 0 4M 1 disk
  • mmcblk1 is the SD card of size 32G
  • mmcblk0 is the on-board eMMC of size 16G

Solution: refer to Beagleboard Official Documentation Flashing Board

4.4 Finally

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
beagle@BeagleV:~$ cat /proc/cpuinfo
processor : 0
hart : 1
isa : rv64imafdc
mmu : sv39
uarch : sifive,u54-mc
mvendorid : 0x1cf
marchid : 0x1
mimpid : 0x0

processor : 1
hart : 2
isa : rv64imafdc
mmu : sv39
uarch : sifive,u54-mc
mvendorid : 0x1cf
marchid : 0x1
mimpid : 0x0

processor : 2
hart : 3
isa : rv64imafdc
mmu : sv39
uarch : sifive,u54-mc
mvendorid : 0x1cf
marchid : 0x1
mimpid : 0x0

processor : 3
hart : 4
isa : rv64imafdc
mmu : sv39
uarch : sifive,u54-mc
mvendorid : 0x1cf
marchid : 0x1
mimpid : 0x0

beagle@BeagleV:~$ cat /proc/meminfo
MemTotal: 1578744 kB
MemFree: 1246916 kB
MemAvailable: 1433180 kB
Buffers: 12136 kB
Cached: 181060 kB
SwapCached: 0 kB
Active: 46052 kB
Inactive: 210292 kB
Active(anon): 1460 kB
Inactive(anon): 63260 kB
Active(file): 44592 kB
Inactive(file): 147032 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Zswap: 0 kB
Zswapped: 0 kB
Dirty: 20 kB
Writeback: 0 kB
AnonPages: 63172 kB
Mapped: 99268 kB
Shmem: 1572 kB
KReclaimable: 21992 kB
Slab: 50108 kB
SReclaimable: 21992 kB
SUnreclaim: 28116 kB
KernelStack: 2160 kB
PageTables: 1892 kB
SecPageTables: 0 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 789372 kB
Committed_AS: 424384 kB
VmallocTotal: 67108864 kB
VmallocUsed: 7684 kB
VmallocChunk: 0 kB
Percpu: 1152 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB

Clearly, this Single-board computer is using SiFive Cores. That is ALL for today. Temoparily. See you next time.

4.5 Further Demonstration

This is truly a provisional milestone:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[  OK  ] Finished systemd-user-sessions.service - Permit User Sessions.
[ 24.197143] imx219 1-0010: failed to read chip id 219
[ 24.202314] imx219: probe of 1-0010 failed with error -5
[ 24.667023] usb0: HOST MAC 00:04:a3:d5:1a:45
[ 24.671376] usb0: MAC 00:04:a3:d5:1a:46
[ 24.680189] configfs-gadget.g_multi gadget.0: unable to autoconfigure all endpoints
[ 24.693802] udc musb-hdrc.1.auto: failed to start g_multi: -524
[ 24.699874] configfs-gadget.g_multi: probe of gadget.0 failed with error -524
[ 24.707368] UDC core: g_multi: couldn't find an available UDC or it's busy
[FAILED] Failed to start bb-usb-gadgets.service - BeagleBoard.org USB gadgets.
See 'systemctl status bb-usb-gadgets.service' for details.
[ OK ] Finished cockpit-motd.service - Cockpit motd updater service.
[ OK ] Started nginx.service - A high per… server and a reverse proxy server.
[ OK ] Started getty@tty1.service - Getty on tty1.
[ OK ] Started serial-getty@ttyGS0.service - Serial Getty on ttyGS0.
[ OK ] Started serial-getty@ttyS0.service - Serial Getty on ttyS0.
[ OK ] Reached target getty.target - Login Prompts.
[ OK ] Finished grow_partition.service - Grow Root Partition.

Debian GNU/Linux trixie/sid BeagleV ttyS0

BeagleBoard.org Debian Sid Console Image 2023-12-19
Support: https://bbb.io/debian
default username:password is [debian:temppwd]

Web console: https://BeagleV.localdomain:9090/

BeagleV login: debian
Password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@BeagleV:~$ neofetch
Command 'neofetch' not found, but can be installed with:
sudo apt install neofetch
debian@BeagleV:~$ sudo apt install neofetch
[sudo] password for debian:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package neofetch
debian@BeagleV:~$ uname -a
Linux BeagleV 6.1.43-linux4microchip+fpga-2023.09-20231219+ #1 SMP Tue Dec 19 12:57:20 PST 2023 riscv64 GNU/Linux
debian@BeagleV:~$

Now, plug in Wired connection,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
➜  ~ ssh debian@192.168.1.17                                         
The authenticity of host '192.168.1.17 (192.168.1.17)' can't be established.
......

BeagleBoard.org Debian Sid Console Image 2023-12-19
Support: https://bbb.io/debian
default username:password is [debian:temppwd]

debian@192.168.1.17's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Dec 19 08:27:24 2023
debian@BeagleV:~$ sudo apt update
[sudo] password for debian:
Get:1 http://deb.debian.org/debian sid InRelease [198 kB]
Get:3 http://repos.rcn-ee.com/debian-riscv64 sid InRelease [3083 B]
Get:2 https://debian.beagle.cc/riscv64 sid InRelease [3083 B]
Get:4 http://deb.debian.org/debian sid/main riscv64 Packages [9076 kB]
Get:5 http://repos.rcn-ee.com/debian-riscv64 sid/main riscv64 Packages [13.0 kB]
Get:6 https://debian.beagle.cc/riscv64 sid/main riscv64 Packages [13.0 kB]
Get:7 http://deb.debian.org/debian sid/main riscv64 Components [4198 kB]
Get:8 http://deb.debian.org/debian sid/main riscv64 Contents (deb) [10.3 MB]
Get:9 http://deb.debian.org/debian sid/main all Contents (deb) [37.8 MB]
Fetched 61.6 MB in 3min 0s (341 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
debian@BeagleV:~$ apt list --upgradable
Listing... Done
appstream/unstable 1.0.1-2 riscv64 [upgradable from: 1.0.1-1]
libappstream5/unstable 1.0.1-2 riscv64 [upgradable from: 1.0.1-1]
libjs-sphinxdoc/unstable 7.2.6-3 all [upgradable from: 7.2.6-2]
openssh-client/unstable 1:9.6p1-1 riscv64 [upgradable from: 1:9.5p1-2]
openssh-server/unstable 1:9.6p1-1 riscv64 [upgradable from: 1:9.5p1-2]
openssh-sftp-server/unstable 1:9.6p1-1 riscv64 [upgradable from: 1:9.5p1-2]
debian@BeagleV:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
......
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
debian@BeagleV:~$ neofetch
_,met$$$$$gg. debian@BeagleV
,g$$$$$$$$$$$$$$$P. --------------
,g$$P" """Y$$.". OS: Debian GNU/Linux trixie/sid riscv64
,$$P' `$$$. Host: BeagleBoard BeagleV-Fire
',$$P ,ggs. `$$b: Kernel: 6.1.43-linux4microchip+fpga-2023.09-20231219+
`d$$' ,$P"' . $$$ Uptime: 12 mins
$$P d$' , $$P Packages: 587 (dpkg)
$$: $$. - ,d$$' Shell: bash 5.2.21
$$; Y$b._ _,d$P' Terminal: /dev/pts/0
Y$$. `.`"Y$$$$P"' CPU: (4)
`$$b "-.__ Memory: 88MiB / 1541MiB
`Y$$
`Y$$.
`$$b.
`Y$$b.
`"Y$b._
`"""

Bingo!!! Debian!!!

Today, I would disclose RISC-V. Let's save my word and dive into it directly. As of today, December 18, 2023, MOST of RISC-V chips are designed and manufactured by Chinese companies.

1. Related Companies

2. U-Boot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
➜  u-boot git:(master) ✗ ls arch
arc arm Kconfig Kconfig.nxp m68k microblaze mips nios2 powerpc riscv sandbox sh u-boot-elf.lds x86 xtensa
➜ u-boot git:(master) ✗ cd arch/riscv
➜ riscv git:(master) ✗ ls cpu
andesv5 cpu.c cpu.su fu740 jh7110 mtrap.o start.o u-boot.lds
built-in.o cpu.o fu540 generic Makefile mtrap.S start.S u-boot-spl.lds
➜ riscv git:(master) ✗ ls dts
ae350_32.dts hifive-unmatched-a00.dts mpfs-icicle-kit.dts
ae350_64.dts hifive-unmatched-a00-u-boot.dtsi mpfs-icicle-kit-fabric.dtsi
ae350-u-boot.dtsi jh7110.dtsi mpfs-icicle-kit-u-boot.dtsi
binman.dtsi jh7110-starfive-visionfive-2.dtb openpiton-riscv64.dts
fu540-c000.dtsi jh7110-starfive-visionfive-2.dts qemu-virt32.dts
fu540-c000-u-boot.dtsi jh7110-starfive-visionfive-2.dtsi qemu-virt64.dts
fu540-hifive-unleashed-a00-ddr.dtsi jh7110-starfive-visionfive-2-u-boot.dtsi sunxi-d1s-t113.dtsi
fu740-c000.dtsi jh7110-u-boot.dtsi sunxi-d1-t113.dtsi
fu740-c000-u-boot.dtsi k210.dtsi th1520.dtsi
fu740-hifive-unmatched-a00-ddr.dtsi k210-maix-bit.dts th1520-lichee-module-4a.dtsi
hifive-unleashed-a00.dts Makefile th1520-lichee-pi-4a.dts
hifive-unleashed-a00-u-boot.dtsi mpfs.dtsi
➜ riscv git:(master) ✗

2.1 CPU

Let's simple analyze all 5 folders under subfolder cpu.

2.2 DTS

Let's further analyze all device trees under subfolder dts.

3. Linux Kernel

1
2
3
4
5
6
7
8
9
➜  linux ls arch
alpha arm csky ia64 loongarch microblaze nios2 parisc riscv sh um xtensa
arc arm64 hexagon Kconfig m68k mips openrisc powerpc s390 sparc x86
➜ linux cd arch/riscv
➜ riscv ls configs
32-bit.config defconfig nommu_k210_sdcard_defconfig rv32_defconfig
64-bit.config nommu_k210_defconfig nommu_virt_defconfig
➜ riscv ls boot/dts
allwinner canaan Makefile microchip renesas sifive starfive thead

3.1 DTS

Again, let's analyze all 5 folders under subfolder dts.

By the way: recent Arduino UNO R4 uses a Renesas RA4M1, a 32-bit Arm® Cortex®-M4 MCU.

Conclusion: MOST of recent RISC-V chips are supported, designed, and manufactured by China.

VisionFive2 has been talked twice recently: - VisionFive2 - 01 - VisionFive2 - 02

Today, we're going to follow U-Boot VisionFive2 and demonstrate the MOST up-to-date U-Boot, Linux kernel, and OpenSBI.

1. Building

1.1 OpenSBI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
➜  opensbi git:(master) make PLATFORM=generic FW_TEXT_START=0x40000000 FW_OPTIONS=0
CC lib/sbi/riscv_asm.o
CC lib/sbi/riscv_atomic.o
AS lib/sbi/riscv_hardfp.o
CC lib/sbi/riscv_locks.o
CC lib/sbi/sbi_ecall.o
CC lib/sbi/sbi_ecall_exts.o
CC lib/sbi/sbi_ecall_time.o
CC lib/sbi/sbi_ecall_rfence.o
CC lib/sbi/sbi_ecall_ipi.o
CC lib/sbi/sbi_ecall_base.o
CC lib/sbi/sbi_ecall_hsm.o
CC lib/sbi/sbi_ecall_srst.o
CC lib/sbi/sbi_ecall_susp.o
CC lib/sbi/sbi_ecall_pmu.o
CC lib/sbi/sbi_ecall_dbcn.o
CC lib/sbi/sbi_ecall_cppc.o
CC lib/sbi/sbi_ecall_legacy.o
CC lib/sbi/sbi_ecall_vendor.o
CC lib/sbi/sbi_bitmap.o
CC lib/sbi/sbi_bitops.o
CC lib/sbi/sbi_console.o
CC lib/sbi/sbi_domain.o
CC lib/sbi/sbi_emulate_csr.o
CC lib/sbi/sbi_fifo.o
CC lib/sbi/sbi_hart.o
CC lib/sbi/sbi_heap.o
CC lib/sbi/sbi_math.o
AS lib/sbi/sbi_hfence.o
CC lib/sbi/sbi_hsm.o
CC lib/sbi/sbi_illegal_insn.o
CC lib/sbi/sbi_init.o
CC lib/sbi/sbi_ipi.o
CC lib/sbi/sbi_irqchip.o
CC lib/sbi/sbi_misaligned_ldst.o
CC lib/sbi/sbi_platform.o
CC lib/sbi/sbi_pmu.o
CC lib/sbi/sbi_scratch.o
CC lib/sbi/sbi_string.o
CC lib/sbi/sbi_system.o
CC lib/sbi/sbi_timer.o
CC lib/sbi/sbi_tlb.o
CC lib/sbi/sbi_trap.o
CC lib/sbi/sbi_unpriv.o
AS lib/sbi/sbi_expected_trap.o
CC lib/sbi/sbi_cppc.o
AR lib/libsbi.a
CC platform/generic/lib/utils/timer/aclint_mtimer.o
CC platform/generic/lib/utils/timer/andes_plmt.o
CC platform/generic/lib/utils/timer/fdt_timer.o
CC platform/generic/lib/utils/timer/fdt_timer_drivers.o
CC platform/generic/lib/utils/timer/fdt_timer_mtimer.o
CC platform/generic/lib/utils/timer/fdt_timer_plmt.o
CC platform/generic/lib/utils/sys/htif.o
CC platform/generic/lib/utils/sys/atcsmu.o
CC platform/generic/lib/utils/serial/fdt_serial.o
CC platform/generic/lib/utils/serial/fdt_serial_drivers.o
CC platform/generic/lib/utils/serial/fdt_serial_cadence.o
CC platform/generic/lib/utils/serial/fdt_serial_gaisler.o
CC platform/generic/lib/utils/serial/fdt_serial_htif.o
CC platform/generic/lib/utils/serial/fdt_serial_renesas_scif.o
CC platform/generic/lib/utils/serial/fdt_serial_shakti.o
CC platform/generic/lib/utils/serial/fdt_serial_sifive.o
CC platform/generic/lib/utils/serial/fdt_serial_litex.o
CC platform/generic/lib/utils/serial/fdt_serial_uart8250.o
CC platform/generic/lib/utils/serial/fdt_serial_xlnx_uartlite.o
CC platform/generic/lib/utils/serial/cadence-uart.o
CC platform/generic/lib/utils/serial/gaisler-uart.o
CC platform/generic/lib/utils/serial/renesas_scif.o
CC platform/generic/lib/utils/serial/shakti-uart.o
CC platform/generic/lib/utils/serial/sifive-uart.o
CC platform/generic/lib/utils/serial/litex-uart.o
CC platform/generic/lib/utils/serial/uart8250.o
CC platform/generic/lib/utils/serial/xlnx-uartlite.o
CC platform/generic/lib/utils/serial/semihosting.o
CC platform/generic/lib/utils/reset/fdt_reset.o
CC platform/generic/lib/utils/reset/fdt_reset_drivers.o
CC platform/generic/lib/utils/reset/fdt_reset_atcwdt200.o
CC platform/generic/lib/utils/reset/fdt_reset_gpio.o
CC platform/generic/lib/utils/reset/fdt_reset_htif.o
CC platform/generic/lib/utils/reset/fdt_reset_sunxi_wdt.o
CC platform/generic/lib/utils/reset/fdt_reset_syscon.o
CC platform/generic/lib/utils/regmap/fdt_regmap.o
CC platform/generic/lib/utils/regmap/fdt_regmap_drivers.o
CC platform/generic/lib/utils/regmap/fdt_regmap_syscon.o
CC platform/generic/lib/utils/regmap/regmap.o
CC platform/generic/lib/utils/libfdt/fdt.o
CC platform/generic/lib/utils/libfdt/fdt_addresses.o
CC platform/generic/lib/utils/libfdt/fdt_check.o
CC platform/generic/lib/utils/libfdt/fdt_empty_tree.o
CC platform/generic/lib/utils/libfdt/fdt_ro.o
CC platform/generic/lib/utils/libfdt/fdt_rw.o
CC platform/generic/lib/utils/libfdt/fdt_strerror.o
CC platform/generic/lib/utils/libfdt/fdt_sw.o
CC platform/generic/lib/utils/libfdt/fdt_wip.o
CC platform/generic/lib/utils/irqchip/fdt_irqchip.o
CC platform/generic/lib/utils/irqchip/fdt_irqchip_drivers.o
CC platform/generic/lib/utils/irqchip/fdt_irqchip_aplic.o
CC platform/generic/lib/utils/irqchip/fdt_irqchip_imsic.o
CC platform/generic/lib/utils/irqchip/fdt_irqchip_plic.o
CC platform/generic/lib/utils/irqchip/aplic.o
CC platform/generic/lib/utils/irqchip/imsic.o
CC platform/generic/lib/utils/irqchip/plic.o
CC platform/generic/lib/utils/ipi/aclint_mswi.o
CC platform/generic/lib/utils/ipi/andes_plicsw.o
CC platform/generic/lib/utils/ipi/fdt_ipi.o
CC platform/generic/lib/utils/ipi/fdt_ipi_drivers.o
CC platform/generic/lib/utils/ipi/fdt_ipi_mswi.o
CC platform/generic/lib/utils/ipi/fdt_ipi_plicsw.o
CC platform/generic/lib/utils/i2c/i2c.o
CC platform/generic/lib/utils/i2c/fdt_i2c.o
CC platform/generic/lib/utils/i2c/fdt_i2c_adapter_drivers.o
CC platform/generic/lib/utils/i2c/fdt_i2c_sifive.o
CC platform/generic/lib/utils/i2c/fdt_i2c_dw.o
CC platform/generic/lib/utils/i2c/dw_i2c.o
CC platform/generic/lib/utils/gpio/fdt_gpio.o
CC platform/generic/lib/utils/gpio/fdt_gpio_drivers.o
CC platform/generic/lib/utils/gpio/fdt_gpio_designware.o
CC platform/generic/lib/utils/gpio/fdt_gpio_sifive.o
CC platform/generic/lib/utils/gpio/fdt_gpio_starfive.o
CC platform/generic/lib/utils/gpio/gpio.o
CC platform/generic/lib/utils/fdt/fdt_domain.o
CC platform/generic/lib/utils/fdt/fdt_pmu.o
CC platform/generic/lib/utils/fdt/fdt_helper.o
CC platform/generic/lib/utils/fdt/fdt_fixup.o
CC platform/generic/thead/thead_c9xx_pmu.o
AS platform/generic/thead/thead_c9xx_tlb_trap_handler.o
CC platform/generic/thead/thead_c9xx_errata_tlb_flush.o
CC platform/generic/thead/thead-generic.o
CC platform/generic/starfive/jh7110.o
CC platform/generic/sophgo/sg2042.o
CC platform/generic/sifive/fu540.o
CC platform/generic/sifive/fu740.o
CC platform/generic/renesas/rzfive/rzfive.o
CC platform/generic/platform.o
CC platform/generic/platform_override_modules.o
CC platform/generic/andes/ae350.o
AS platform/generic/andes/sleep.o
CC platform/generic/andes/andes45-pma.o
CC platform/generic/andes/andes_sbi.o
CC platform/generic/andes/andes_pmu.o
CC platform/generic/allwinner/sun20i-d1.o
AR platform/generic/lib/libplatsbi.a
AS platform/generic/firmware/payloads/test_head.o
CC platform/generic/firmware/payloads/test_main.o
MERGE platform/generic/firmware/payloads/test.o
ELF platform/generic/firmware/payloads/test.elf
OBJCOPY platform/generic/firmware/payloads/test.bin
AS platform/generic/firmware/fw_dynamic.o
ELF platform/generic/firmware/fw_dynamic.elf
OBJCOPY platform/generic/firmware/fw_dynamic.bin
AS platform/generic/firmware/fw_jump.o
ELF platform/generic/firmware/fw_jump.elf
OBJCOPY platform/generic/firmware/fw_jump.bin
AS platform/generic/firmware/fw_payload.o
ELF platform/generic/firmware/fw_payload.elf
OBJCOPY platform/generic/firmware/fw_payload.bin

1.2 U-Boot

1
2
3
4
5
6
7
8
9
10
➜  u-boot git:(master) ✗ make starfive_visionfive2_defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
YACC scripts/kconfig/zconf.tab.c
LEX scripts/kconfig/zconf.lex.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
➜  u-boot git:(master) ✗ make OPENSBI=$OPENSBI
scripts/kconfig/conf --syncconfig Kconfig
UPD include/config.h
CFG spl/u-boot.cfg
GEN spl/include/autoconf.mk
CFG u-boot.cfg
GEN include/autoconf.mk
GEN include/autoconf.mk.dep
UPD include/generated/timestamp_autogenerated.h
ENVC include/generated/env.txt
ENVP include/generated/env.in
ENVT include/generated/environment.h
CC lib/asm-offsets.s
CC arch/riscv/lib/asm-offsets.s
PYMOD rebuild
/home/lvision/Desktop/VisionFive/u-boot/scripts/dtc/pylibfdt/setup.py:40: SyntaxWarning: invalid escape sequence '\w'
RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$')
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
......
AR spl/drivers/spi/built-in.o
CC spl/drivers/timer/timer-uclass.o
CC spl/drivers/timer/riscv_timer.o
CC spl/drivers/timer/riscv_aclint_timer.o
AR spl/drivers/timer/built-in.o
AR spl/drivers/built-in.o
AR spl/dts/built-in.o
CC spl/fs/fs_internal.o
AR spl/fs/built-in.o
LDS spl/u-boot-spl.lds
LD spl/u-boot-spl
OBJCOPY spl/u-boot-spl-nodtb.bin
mkdir -p spl/dts/
FDTGREP spl/dts/dt-spl.dtb
COPY spl/u-boot-spl.dtb
CAT spl/u-boot-spl-dtb.bin
COPY spl/u-boot-spl.bin
SYM spl/u-boot-spl.sym
MKIMAGE u-boot.img
COPY u-boot.dtb
MKIMAGE u-boot-dtb.img
BINMAN .binman_stamp
OFCHK .config
➜ u-boot git:(master) ✗

1.3 Linux Kernel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
➜  linux make defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
*** Default configuration is based on 'defconfig'
#
# No change to .config
#
1
2
3
4
5
6
7
8
9
10
11
12
13
➜  linux make menuconfig
HOSTCC scripts/kconfig/mconf.o
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTLD scripts/kconfig/mconf


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

By configuring menuconfig, we ignore building ALL other SoCs but tick VisionFive ONLY.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
➜  linux make -j16
HOSTCC scripts/basic/fixdep
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/util.o
HOSTCC scripts/dtc/checks.o
YACC scripts/dtc/dtc-parser.tab.[ch]
LEX scripts/dtc/dtc-lexer.lex.c
HOSTCC scripts/dtc/libfdt/fdt.o
HOSTCC scripts/dtc/libfdt/fdt_ro.o
HOSTCC scripts/dtc/libfdt/fdt_wip.o
HOSTCC scripts/dtc/libfdt/fdt_sw.o
HOSTCC scripts/dtc/libfdt/fdt_rw.o
HOSTCC scripts/dtc/libfdt/fdt_strerror.o
HOSTCC scripts/dtc/libfdt/fdt_empty_tree.o
HOSTCC scripts/dtc/libfdt/fdt_addresses.o
HOSTCC scripts/dtc/libfdt/fdt_overlay.o
HOSTCC scripts/dtc/fdtoverlay.o
HOSTCC scripts/dtc/dtc-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/fdtoverlay
HOSTLD scripts/dtc/dtc
......
LD [M] net/8021q/8021q.ko
LD [M] net/bridge/br_netfilter.ko
LD [M] net/llc/llc.ko
LD [M] net/bridge/bridge.ko
NM .tmp_vmlinux.kallsyms1.syms
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.S
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.S
LD vmlinux
NM System.map
SORTTAB vmlinux
OBJCOPY arch/riscv/boot/Image
GZIP arch/riscv/boot/Image.gz
Kernel: arch/riscv/boot/Image.gz is ready

1.4 Busybox

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
➜  busybox make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv defconfig
scripts/kconfig/conf -d Config.in
*
* Busybox Configuration
*
*
* Settings
*
Enable compatibility for full-blown desktop systems (8kb) (DESKTOP) [Y/n/?] (NEW) y
Provide compatible behavior for rare corner cases (bigger code) (EXTRA_COMPAT) [N/y/?] (NEW) n
Building for Fedora distribution (FEDORA_COMPAT) [N/y/?] (NEW) n
Enable obsolete features removed before SUSv3 (INCLUDE_SUSv2) [Y/n/?] (NEW) y
Support --long-options (LONG_OPTS) [Y/?] (NEW) y
Show applet usage messages (SHOW_USAGE) [Y/n/?] (NEW) y
Show verbose applet usage messages (FEATURE_VERBOSE_USAGE) [Y/n/?] (NEW) y
Store applet usage messages in compressed form (FEATURE_COMPRESS_USAGE) [Y/n/?] (NEW) y
Support files > 2 GB (LFS) [Y/n/?] (NEW) y
Support 64bit wide time types (TIME64) [Y/n/?] (NEW) y
Support PAM (Pluggable Authentication Modules) (PAM) [N/y/?] (NEW) n
Use the devpts filesystem for Unix98 PTYs (FEATURE_DEVPTS) [Y/n/?] (NEW) y
Support utmp file (FEATURE_UTMP) [Y/n/?] (NEW) y
Support wtmp file (FEATURE_WTMP) [Y/n/?] (NEW) y
Support writing pidfiles (FEATURE_PIDFILE) [Y/n/?] (NEW) y
Directory for pidfiles (PID_FILE_PATH) [/var/run] (NEW) /var/run
Include busybox applet (BUSYBOX) [Y/n/?] (NEW) y
Support --show SCRIPT (FEATURE_SHOW_SCRIPT) [Y/n] (NEW) y
Support --install [-s] to install applet links at runtime (FEATURE_INSTALLER) [Y/n/?] (NEW) y
Don't use /usr (INSTALL_NO_USR) [N/y/?] (NEW) n
Drop SUID state for most applets (FEATURE_SUID) [Y/n/?] (NEW) y
Enable SUID configuration via /etc/busybox.conf (FEATURE_SUID_CONFIG) [Y/n/?] (NEW) y
Suppress warning message if /etc/busybox.conf is not readable (FEATURE_SUID_CONFIG_QUIET) [Y/n/?] (NEW) y
exec prefers applets (FEATURE_PREFER_APPLETS) [N/y/?] (NEW) n
Path to busybox executable (BUSYBOX_EXEC_PATH) [/proc/self/exe] (NEW) /proc/self/exe
Support NSA Security Enhanced Linux (SELINUX) [N/y/?] (NEW) n
Clean up all memory before exiting (usually not needed) (FEATURE_CLEAN_UP) [N/y/?] (NEW) n
Support LOG_INFO level syslog messages (FEATURE_SYSLOG_INFO) [Y/n/?] (NEW) y
*
*
* Build Options
*
......
......
......
*
* Options common to all shells
*
POSIX math support (FEATURE_SH_MATH) [Y/n/?] (NEW) y
Extend POSIX math support to 64 bit (FEATURE_SH_MATH_64) [Y/n/?] (NEW) y
Support BASE#nnnn literals (FEATURE_SH_MATH_BASE) [Y/n] (NEW) y
Hide message on interactive shell startup (FEATURE_SH_EXTRA_QUIET) [Y/n/?] (NEW) y
Standalone shell (FEATURE_SH_STANDALONE) [N/y/?] (NEW) n
Run 'nofork' applets directly (FEATURE_SH_NOFORK) [N/y/?] (NEW) n
read -t N.NNN support (+110 bytes) (FEATURE_SH_READ_FRAC) [Y/n/?] (NEW) y
Use $HISTFILESIZE (FEATURE_SH_HISTFILESIZE) [Y/n/?] (NEW) y
Embed scripts in the binary (FEATURE_SH_EMBEDDED_SCRIPTS) [Y/n/?] (NEW) y
*
* System Logging Utilities
*
klogd (6.2 kb) (KLOGD) [Y/n/?] (NEW) y
*
* klogd should not be used together with syslog to kernel printk buffer
*
Use the klogctl() interface (FEATURE_KLOGD_KLOGCTL) [Y/n/?] (NEW) y
logger (6.5 kb) (LOGGER) [Y/n/?] (NEW) y
logread (5 kb) (LOGREAD) [Y/n/?] (NEW) y
Double buffering (FEATURE_LOGREAD_REDUCED_LOCKING) [Y/n/?] (NEW) y
syslogd (14 kb) (SYSLOGD) [Y/n/?] (NEW) y
Rotate message files (FEATURE_ROTATE_LOGFILE) [Y/n/?] (NEW) y
Remote Log support (FEATURE_REMOTE_LOG) [Y/n/?] (NEW) y
Support -D (drop dups) option (FEATURE_SYSLOGD_DUP) [Y/n/?] (NEW) y
Support syslog.conf (FEATURE_SYSLOGD_CFG) [Y/n/?] (NEW) y
Include milliseconds in timestamps (FEATURE_SYSLOGD_PRECISE_TIMESTAMPS) [N/y/?] (NEW) n
Read buffer size in bytes (FEATURE_SYSLOGD_READ_BUFFER_SIZE) [256] (NEW) 256
Circular Buffer support (FEATURE_IPC_SYSLOG) [Y/n/?] (NEW) y
Circular buffer size in Kbytes (minimum 4KB) (FEATURE_IPC_SYSLOG_BUFFER_SIZE) [16] (NEW) 16
Linux kernel printk buffer support (FEATURE_KMSG_SYSLOG) [Y/n/?] (NEW) y
➜ busybox
1
2
3
4
5
6
7
8
9
➜  busybox make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv menuconfig
scripts/kconfig/mconf Config.in
#
# using defaults found in .config
#


*** End of configuration.
*** Execute 'make' to build the project or try 'make help'.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
➜  busybox make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv -j8       
LD archival/built-in.o
CC archival/bzip2.o
CC archival/bbunzip.o
CC archival/chksum_and_xwrite_tar_header.o
CC archival/dpkg.o
CC archival/cpio.o
CC archival/dpkg_deb.o
LD archival/libarchive/built-in.o
CC archival/gzip.o
CC archival/libarchive/common.o
CC archival/lzop.o
CC archival/libarchive/data_align.o
LD console-tools/built-in.o
CC console-tools/chvt.o
CC console-tools/clear.o
CC console-tools/deallocvt.o
CC archival/libarchive/data_extract_all.o
LD coreutils/built-in.o
CC coreutils/basename.o
CC coreutils/cat.o
CC console-tools/dumpkmap.o
archival/libarchive/data_extract_all.c: In function ‘data_extract_all’:
archival/libarchive/data_extract_all.c:235:25: warning: ignoring return value of ‘chown’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
235 | chown(dst_name, uid, gid);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
LD coreutils/libcoreutils/built-in.o
CC archival/libarchive/data_extract_to_command.o
CC archival/libarchive/data_extract_to_stdout.o
CC coreutils/libcoreutils/cp_mv_stat.o
LD debianutils/built-in.o
CC debianutils/pipe_progress.o
console-tools/dumpkmap.c: In function ‘dumpkmap_main’:
......
......
......
CC libbb/verror_msg.o
util-linux/mkfs_minix.c: In function ‘get_list_blocks’:
util-linux/mkfs_minix.c:532:17: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
532 | fscanf(listfile, "%lu\n", &blockno);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC libbb/vfork_daemon_rexec.o
CC libbb/warn_ignoring_args.o
CC util-linux/mkswap.o
CC util-linux/more.o
CC libbb/wfopen.o
CC util-linux/mount.o
CC libbb/wfopen_input.o
CC libbb/write.o
CC util-linux/mountpoint.o
CC libbb/xatonum.o
CC util-linux/nsenter.o
CC util-linux/pivot_root.o
CC util-linux/rdate.o
CC libbb/xconnect.o
CC util-linux/rdev.o
CC libbb/xfunc_die.o
CC util-linux/readprofile.o
CC libbb/xfuncs.o
CC util-linux/renice.o
CC libbb/xfuncs_printf.o
CC util-linux/rev.o
CC libbb/xgetcwd.o
CC util-linux/rtcwake.o
CC util-linux/script.o
CC libbb/xgethostbyname.o
CC libbb/xreadlink.o
CC libbb/xrealloc_vector.o
CC util-linux/scriptreplay.o
CC util-linux/setarch.o
CC libbb/xregcomp.o
CC util-linux/setpriv.o
CC util-linux/setsid.o
CC util-linux/swaponoff.o
CC util-linux/switch_root.o
CC util-linux/taskset.o
CC util-linux/uevent.o
CC util-linux/umount.o
AR libbb/lib.a
CC util-linux/unshare.o
CC util-linux/wall.o
util-linux/unshare.c: In function ‘unshare_main’:
util-linux/unshare.c:295:25: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
295 | read(fdp.rd, ns_ctx_list, 1); /* ...using bogus buffer */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
AR util-linux/lib.a
LINK busybox_unstripped
Trying libraries: m resolv rt
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Library rt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
➜  busybox make CONFIG_PREFIX=./../busybox_rootfs install
./../busybox_rootfs//bin/arch -> busybox
./../busybox_rootfs//bin/ash -> busybox
./../busybox_rootfs//bin/base32 -> busybox
./../busybox_rootfs//bin/base64 -> busybox
./../busybox_rootfs//bin/cat -> busybox
./../busybox_rootfs//bin/chattr -> busybox
./../busybox_rootfs//bin/chgrp -> busybox
./../busybox_rootfs//bin/chmod -> busybox
./../busybox_rootfs//bin/chown -> busybox
./../busybox_rootfs//bin/conspy -> busybox
./../busybox_rootfs//bin/cp -> busybox
./../busybox_rootfs//bin/cpio -> busybox
./../busybox_rootfs//bin/cttyhack -> busybox
./../busybox_rootfs//bin/date -> busybox
......
......
......
./../busybox_rootfs//usr/sbin/ubirmvol -> ../../bin/busybox
./../busybox_rootfs//usr/sbin/ubirsvol -> ../../bin/busybox
./../busybox_rootfs//usr/sbin/ubiupdatevol -> ../../bin/busybox
./../busybox_rootfs//usr/sbin/udhcpd -> ../../bin/busybox


--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.
--------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
➜  busybox mkdir -p initramfs/{bin,dev,etc,home,mnt,proc,sys,usr}
➜ busybox cd initramfs/dev
➜ dev sudo mknod sda b 8 0
[sudo] password for lvision:
mknod: sda: File exists
➜ dev sudo mknod console c 5 1
mknod: console: File exists
➜ dev cd ..
➜ initramfs cp -r ../../busybox_rootfs/* ./
➜ initramfs ll
total 2.3M
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:59 bin
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:57 dev
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 etc
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 home
-rwxrwxr-x 1 lvision lvision 73 Dec 16 03:00 init
lrwxrwxrwx 1 lvision lvision 11 Dec 16 02:59 linuxrc -> bin/busybox
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 mnt
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 proc
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:59 sbin
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 sys
drwxrwxr-x 4 lvision lvision 4.0K Dec 16 02:59 usr
➜ initramfs
1
➜  initramfs vim init

and put

1
2
3
4
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
exec /bin/sh

in file init.

1
2
3
4
5
6
➜  initramfs cat init 
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
exec /bin/sh
➜ initramfs chmod +x init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
➜  initramfs find . -print0 | cpio --null -ov --format=newc > initramfs.cpio 
.
./etc
./init
./busybox_rootfs
./busybox_rootfs/bin
./busybox_rootfs/bin/cpio
./busybox_rootfs/bin/ln
./busybox_rootfs/bin/su
./busybox_rootfs/bin/pwd
./busybox_rootfs/bin/gzip
./busybox_rootfs/bin/link
./busybox_rootfs/bin/lzop
./busybox_rootfs/bin/nice
./busybox_rootfs/bin/makemime
./busybox_rootfs/bin/fatattr
./busybox_rootfs/bin/busybox
......
......
......
./usr/sbin/sendmail
./usr/sbin/rtcwake
./usr/sbin/ftpd
./usr/sbin/adduser
./usr/sbin/nbd-client
./usr/sbin/dhcprelay
./usr/sbin/brctl
./usr/sbin/mim
./usr/sbin/udhcpd
./usr/sbin/nologin
./usr/sbin/ubidetach
./usr/sbin/addgroup
./usr/sbin/fdformat
./usr/sbin/crond
./sys
11511 blocks
➜ initramfs gzip ./initramfs.cpio
➜ initramfs ll
total 1.4M
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 03:58 bin
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:57 dev
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 etc
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 home
-rwxrwxr-x 1 lvision lvision 73 Dec 16 03:55 init
-rw-rw-r-- 1 lvision lvision 1.4M Dec 16 04:01 initramfs.cpio.gz
lrwxrwxrwx 1 lvision lvision 11 Dec 16 03:58 linuxrc -> bin/busybox
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 mnt
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 proc
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 03:58 sbin
drwxrwxr-x 2 lvision lvision 4.0K Dec 16 02:56 sys
drwxrwxr-x 4 lvision lvision 4.0K Dec 16 02:59 usr

2. Flashing

2.1 Prepare SD Disk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
➜  VisionFive sudo sgdisk --clear \
--set-alignment=2 \
--new=1:4096:8191 --change-name=1:spl --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985\
--new=2:8192:16383 --change-name=2:uboot --typecode=2:BC13C2FF-59E6-4262-A352-B275FD6F7172 \
--new=3:16384:1654784 --change-name=3:system --typecode=3:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 \
/dev/sdb

Setting name!
partNum is 0
Setting name!
partNum is 1
Setting name!
partNum is 2
The operation has completed successfully.

2.2 Flash the SD Card

Including ALL the above, say: - U-Boot - Linux Kernel - Busybox

1
2
3
4
5
6
7
8
9
10
11
12
13
14
➜  VisionFive sudo dd if=./u-boot/spl/u-boot-spl.bin.normal.out of=/dev/sdb1
275+1 records in
275+1 records out
140919 bytes (141 kB, 138 KiB) copied, 0.111194 s, 1.3 MB/s
➜ VisionFive sudo dd if=./u-boot/u-boot.itb of=/dev/sdb2
1994+1 records in
1994+1 records out
1020947 bytes (1.0 MB, 997 KiB) copied, 0.0101341 s, 101 MB/s
➜ VisionFive sudo mount /dev/sdb3 /mnt/
➜ VisionFive sudo cp ./u-boot/spl/u-boot-spl.bin.normal.out /mnt
➜ VisionFive sudo cp ./u-boot/u-boot.itb /mnt
➜ VisionFive sudo cp ./linux/arch/riscv/boot/Image.gz /mnt
➜ VisionFive sudo cp ./busybox/initramfs/initramfs.cpio.gz /mnt
➜ VisionFive sudo cp ./linux/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb /mnt

Then, we take a look at our built system currently under folder /mnt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
➜  VisionFive ll /mnt
total 9.2M
lrwxrwxrwx 1 root root 7 Dec 15 00:10 bin -> usr/bin
drwxr-xr-x 3 root root 4.0K Dec 15 03:38 boot
drwxr-xr-x 4 root root 4.0K Dec 15 00:10 dev
drwxr-xr-x 84 root root 4.0K Dec 15 00:26 etc
drwxr-xr-x 3 root root 4.0K Dec 15 00:26 home
-rw-r--r-- 1 root root 6.6M Dec 16 04:12 Image.gz
-rw-r--r-- 1 root root 1.4M Dec 16 04:13 initramfs.cpio.gz
-rw-r--r-- 1 root root 30K Dec 16 04:14 jh7110-starfive-visionfive-2-v1.3b.dtb
lrwxrwxrwx 1 root root 7 Dec 15 00:10 lib -> usr/lib
drwx------ 2 root root 16K Dec 15 03:38 lost+found
drwxr-xr-x 2 root root 4.0K Dec 15 00:10 media
drwxr-xr-x 2 root root 4.0K Dec 15 00:10 mnt
drwxr-xr-x 3 root root 4.0K Dec 15 00:26 opt
drwxr-xr-x 2 root root 4.0K Jul 27 22:43 proc
drwx------ 3 root root 4.0K Dec 15 00:12 root
drwxr-xr-x 2 root root 4.0K Jul 27 22:43 run
lrwxrwxrwx 1 root root 8 Dec 15 00:10 sbin -> usr/sbin
drwxr-xr-x 2 root root 4.0K Dec 15 00:10 srv
drwxr-xr-x 2 root root 4.0K Jul 27 22:43 sys
drwxrwxrwt 2 root root 4.0K Dec 15 00:25 tmp
-rw-r--r-- 1 root root 998K Dec 16 04:11 u-boot.itb
-rw-r--r-- 1 root root 138K Dec 16 04:11 u-boot-spl.bin.normal.out
drwxr-xr-x 11 root root 4.0K Dec 15 00:10 usr
drwxr-xr-x 12 root root 4.0K Dec 15 00:21 var
0%