Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# Minimal SD card image for the sipeed Lichee RV
image sdcard.img {
hdimage {
}
partition u-boot {
in-partition-table = false
image = "u-boot-sunxi-with-spl.bin"
offset = 8K
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
bootable = "true"
offset = 1M
}
}

View File

@@ -0,0 +1,4 @@
label linux
kernel /boot/Image
# use devicetree from u-boot
append console=ttyS0,115200 root=/dev/mmcblk0p1 ro rootwait

View File

@@ -0,0 +1,26 @@
Lichee RV
===============
Lichee RV - Nezha CM is a compute module with modular design, equipped
with Allwinner D1 chip (based on T-Head XuanTie C906 core), 512MB DDR3 RAM.
It can boot from TF card or SD-NAND, uses two sets of M.2 b key 67 pin
connectors to route all IO, making it convient for wide use and easy to replace.
How to build
============
$ make sipeed_lichee_rv_defconfig
$ make
How to write the SD card
========================
Once the build process is finished you will have an image called "sdcard.img"
in the output/images/ directory.
Copy the bootable "sdcard.img" onto an SD card with "dd":
$ sudo dd if=output/images/sdcard.img of=/dev/sdX
Connect a TTL UART to the debug connector, insert the microSD card and
plug in a USB-C cable to the PWR connector to boot the system.

View File

@@ -0,0 +1,19 @@
# Minimal SD card image for the sipeed Lichee RV dock
image sdcard.img {
hdimage {
}
partition u-boot {
in-partition-table = false
image = "u-boot-sunxi-with-spl.bin"
offset = 8K
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
bootable = "true"
offset = 1M
}
}

View File

@@ -0,0 +1,7 @@
CONFIG_BT=y
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_SERDEV=y
CONFIG_BT_HCIUART_3WIRE=y
CONFIG_BT_HCIUART_RTL=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y

View File

@@ -0,0 +1,6 @@
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant.conf

View File

@@ -0,0 +1,8 @@
ap_scan=1
network={
ssid="YOURSSID"
scan_ssid=1
key_mgmt=WPA-PSK
psk="YOURPASSWD"
}

View File

@@ -0,0 +1,45 @@
Lichee RV dock
===============
Lichee RV Dock is a RISC-V Linux development kits with high integration, small
size and affordable price designed for opensource developer. It's equipped with
HDMI interface and it supports many screen by its screen convert board. It's
also equipped with many peripherals, including a UAB-A port, 2.4G Wifi-BT module,
an analog microphone and a speaker jack interface.
How to build
============
$ make sipeed_lichee_rv_dock_defconfig
$ make
Wifi
==========
Edit board/sipeed/lichee_rv_dock/overlay/etc/wpa_supplicant.conf or
/etc/wpa_supplicant.conf once connected to the board:
* Replace YOURSSID with your AP ssid
* Replace YOURPASSWD with your AP password
Bluetooth
==========
To make the device discoverable and pairable, once connected to the board:
* bluetoothctl power on
* bluetoothctl discoverable yes
* bluetoothctl pairable yes
How to write the SD card
========================
Once the build process is finished you will have an image called "sdcard.img"
in the output/images/ directory.
Copy the bootable "sdcard.img" onto an SD card with "dd":
$ sudo dd if=output/images/sdcard.img of=/dev/sdX
Connect a TTL UART to the debug connector, insert the microSD card and
plug in a USB-C cable to the PWR connector to boot the system.

View File

@@ -0,0 +1,4 @@
label linux
kernel /Image
devicetree /th1520-lichee-pi-4a.dtb
append console=ttyS0,115200 root=/dev/mmcblk0p4 rootfstype=ext4 rootwait rw earlycon clk_ignore_unused init=/sbin/init

View File

@@ -0,0 +1,7 @@
image boot.ext4 {
ext4 {
label = "boot"
}
size = 64M
}

View File

@@ -0,0 +1 @@
../linux/linux.hash

View File

@@ -0,0 +1,2 @@
# From https://www.kernel.org/pub/linux/kernel/v6.x/sha256sums.asc
sha256 beb902a5f69d9e57710112203db38111dad6d30556ea8ce389284c8077fe944d linux-6.12.18.tar.xz

View File

@@ -0,0 +1,2 @@
# Locally computed
sha256 2510c0e867b4f8c28579def9a21e97fa2e8de95b8c7d66bb8b6642202bcee3b4 opensbi-61d7484c752a5e4c464d5dc18e21d9ac67fbbefa-git4.tar.gz

View File

@@ -0,0 +1,2 @@
# Locally computed
sha256 6158b9c6faee41a1e790ad4ba2e1b3e18a122ecdb5749fa77c7495a2d1c56262 uboot-b5ee6e549a7b5ff382a14021a5d6a3c94017bddd-git4.tar.gz

View File

@@ -0,0 +1,24 @@
#!/bin/sh
set -e
BOARD_DIR="$(dirname "$0")"
GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
trap 'rm -rf "${ROOTPATH_TMP}"' EXIT
ROOTPATH_TMP="$(mktemp -d)"
rm -rf "${GENIMAGE_TMP}"
cp "${BINARIES_DIR}"/Image "${BINARIES_DIR}"/*.dtb "${BINARIES_DIR}"/fw_dynamic.bin "${ROOTPATH_TMP}"
cp -a "${BINARIES_DIR}"/bootbins/* "${ROOTPATH_TMP}"
cp -a "${BOARD_DIR}"/extlinux "${ROOTPATH_TMP}"
genimage \
--rootpath "${ROOTPATH_TMP}" \
--tmppath "${GENIMAGE_TMP}" \
--inputpath "${BINARIES_DIR}" \
--outputpath "${BINARIES_DIR}" \
--config "${GENIMAGE_CFG}"
exit $?

View File

@@ -0,0 +1,97 @@
Intro
=====
This directory contains a Buildroot configuration for building a
LicheePi 4A image. For more information, see the board wiki page [1].
How to build it
===============
Configure Buildroot
-------------------
make sipeed_licheepi_4a_defconfig
Build the boot and rootfs
-------------------------
Note: you will need to have access to the network, since Buildroot
will download the packages' sources.
You may now build your rootfs with:
make
(This may take a while, consider getting yourself a coffee ;-) )
Result of the build
-------------------
After building, you should obtain this tree:
output/images/
+-- boot.ext4
+-- rootfs.ext2
+-- rootfs.ext4 -> rootfs.ext2
+-- rootfs.tar
+-- u-boot.bin
+-- u-boot-with-spl.bin
+-- fw_dynamic.bin
`-- Image
How to flash the board
======================
Once the build process is finished you will have to flash the
correspoding images to the respective partitions in the eMMC.
LicheePi 4A uses fastboot to flash the images.
The board needs to be booted in "Burning Mode". For that, check first
the boot switches (SW1, SW2) on the base board are set up on the
"eMMC" mode (this is the factory default). Then, boot the board while
pressing the "BOOT" button. See [2].
Note that the board can be booted by either:
- attaching the USB-C power cable, or
- pressing the "RESET" button (near the USB-C power connector) if the
power cable is already connected to the host computer.
The board should be enumerated from the host computer. This can be
confirmed with "lsusb". The board should be listed as:
ID 2345:7654 T-HEAD USB download gadget
The device should also be listed by the "fastboot devices" command:
???????????? Android Fastboot
The board can be flashed with the commands:
fastboot flash ram output/images/u-boot-with-spl.bin
fastboot reboot
fastboot flash uboot output/images/u-boot-with-spl.bin
fastboot flash boot output/images/boot.ext4
fastboot flash root output/images/rootfs.ext2
Boot the board
==============
Connect the console on the System Serial Port on pins
U0-RX, U0-TX and GND. For more details, see [3].
When resetting or powering up the board on the USB-C port, the U-Boot
prompt and Linux console will appear on this System Serial Port.
References
==========
[1] https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/1_intro.html
[2] https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/4_burn_image.html#How-to-enter-burning-mode
[3] https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/6_peripheral.html#System-Serial-Port

View File

@@ -0,0 +1,33 @@
flash w25q128 {
pebsize = 65536
numpebs = 256
minimum-io-unit-size = 1
sub-page-size = 1
vid-header-offset = 64
}
image flash.bin {
flash {}
flashtype = w25q128
partition uboot {
image = "u-boot-sunxi-with-spl.bin"
size = 512K
}
partition dtb {
image = "suniv-f1c100s-licheepi-nano.dtb"
size = 64K
}
partition zimage {
image = "zImage"
size = 5M
}
partition rootfs {
image = "rootfs.jffs2"
size = 0
}
}

View File

@@ -0,0 +1,11 @@
# CONFIG_NET is not set
# CONFIG_DRM is not set
# CONFIG_CMA is not set
# CONFIG_ARCH_MULTI_V7 is not set
CONFIG_UEVENT_HELPER=y
CONFIG_MTD=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_SPI_NOR=y
# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_JFFS2_FS=y

View File

@@ -0,0 +1,84 @@
Intro
=====
This directory contains a buildroot configuration for building a
LicheePi Nano image which can be flashed into the board.
This frees the MMC port which can be used for an additional SD
card of for a WiFi adapter.
How to build it
===============
Configure Buildroot
-------------------
$ make sipeed_licheepi_nano_defconfig
Build the rootfs
----------------
Note: you will need to have access to the network, since Buildroot
will download the packages' sources.
You may now build your rootfs with:
$ make
(This may take a while, consider getting yourself a coffee ;-) )
Result of the build
-------------------
After building, you should obtain this tree:
output/images/
+-- flash.bin
+-- rootfs.jffs2
+-- rootfs.tar
+-- suniv-f1c100s-licheepi-nano.dtb
+-- u-boot.bin
+-- u-boot-sunxi-with-spl.bin
`-- zImage
How to flash
============
Once the build process is finished you will have an image called
"flash.bin" in the output/images/ directory. It contains the
bootloader, the device tree, the kernel and the root file system.
The device can be flashed when it is in special mode called "FEL
mode". There are multiple ways to enter this mode described here:
https://linux-sunxi.org/FEL#Entering_FEL_mode
One way is to write one file from sunxi-tools to a SD card with:
$ sudo dd if=./output/build/host-sunxi-tools-*/bin/fel-sdboot.sunxi of=/dev/sdX bs=1024 seek=8
Once the SD card is burned, insert it into your LicheePi Nano board,
and plug the USB cable. A new USB device should be visible with
lsusb:
1f3a:efe8 Allwinner Technology sunxi SoC OTG connector in FEL/flashing mode
The image can be flashed with:
$ sudo ./output/host/bin/sunxi-fel -p spiflash-write 0 output/images/flash.bin
Once this completes, remove the SD card and power the board. Your
new system should come up now and start a console on the UART0
serial port.
Note
====
Some standard kernel features are disabled using the fragment in
order to reduce the size. They can be enabled again if other
features are disabled instead.
For U-Boot, the upstream repository is preferred and the system
boots, but loading the image from the flash takes a long time. It
is much faster when using the branch "licheepi-nano-v2020.01" of
this fork:
https://github.com/florpor/u-boot

View File

@@ -0,0 +1,3 @@
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2 mtdparts=spi0.0:512k(uboot)ro,64k(dtb),5M(kernel)ro,-(rootfs)"
CONFIG_BOOTCOMMAND="sf probe 0 50000000; sf read 0x80C00000 0x80000 0x4000; sf read 0x80008000 0x90000 0x500000; bootz 0x80008000 - 0x80C00000"

View File

@@ -0,0 +1,4 @@
setenv bootargs console=ttyS0,115200 panic=5 console=tty0 rootwait root=/dev/mmcblk0p2 earlyprintk rw
load mmc 0:1 0x41000000 zImage
load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb
bootz 0x41000000 - 0x41800000

View File

@@ -0,0 +1,36 @@
image boot.vfat {
vfat {
files = {
"zImage",
"sun8i-v3s-licheepi-zero-dock.dtb",
"sun8i-v3s-licheepi-zero.dtb",
"boot.scr"
}
}
size = 8M
}
image sdcard.img {
hdimage {
}
partition u-boot {
in-partition-table = "no"
image = "u-boot-sunxi-with-spl.bin"
offset = 8K
size = 504K # 512KB - 8KB
}
partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
size = 0
}
}

View File

@@ -0,0 +1,2 @@
# From https://www.kernel.org/pub/linux/kernel/v6.x/sha256sums.asc
sha256 0fcbbbbcd456e87bbbfc8bf37af541fda62ccfcce76903503424fd101ef7bdee linux-6.12.43.tar.xz

View File

@@ -0,0 +1,2 @@
# Locally calculated
sha256 0f933f6c5a426895bf306e93e6ac53c60870e4b54cda56d95211bec99e63bec7 u-boot-2025.07.tar.bz2

View File

@@ -0,0 +1,62 @@
Intro
=====
This directory contains a buildroot configuration for building a
LicheePi Zero.
How to build it
===============
Configure Buildroot
-------------------
$ make sipeed_licheepi_zero_defconfig
Build the rootfs
----------------
Note: you will need to have access to the network, since Buildroot
will download the packages' sources.
You may now build your rootfs with:
$ make
(This may take a while, consider getting yourself a coffee ;-) )
Result of the build
-------------------
After building, you should obtain this tree:
output/images/
+-- boot.scr
+-- boot.vfat
+-- rootfs.ext2
+-- rootfs.ext4 -> rootfs.ext2
+-- rootfs.tar
+-- sdcard.img
+-- sun8i-v3s-licheepi-zero-dock.dtb
+-- sun8i-v3s-licheepi-zero.dtb
+-- u-boot.bin
+-- u-boot-sunxi-with-spl.bin
`-- zImage
How to write the SD card
========================
Once the build process is finished you will have an image called
"sdcard.img" in the output/images/ directory.
Copy the bootable "sdcard.img" onto an SD card with "dd":
$ sudo dd if=output/images/sdcard.img of=/dev/sdX
Alternatively, you can use the Etcher graphical tool to burn the image
to the SD card safely and on any platform:
https://etcher.io/
Once the SD card is burned, insert it into your LicheePi Zero board,
and power it up. Your new system should come up now and start a
console on the UART0 serial port.

View File

@@ -0,0 +1,2 @@
CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y
CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maix_bit"

View File

@@ -0,0 +1,316 @@
Sipeed MAIX-Bit Board
=====================
The Sipeed MAXI-Bit board is a dual-core RISC-V 64-bits board based on the
Canaan Kendryte K210 SoC.
Prerequisite
------------
In order to use the kflash utility to program this board, the user must have
access to the board USB serial device file. The simplest way to do this is to
add your user to the same group as this device file. Assume the device file is
/dev/ttyUSB0, first identify the device group name. In most cases, it is
either "dialout" or "uucp". Also verify that read-write access is enabled for
the group:
```
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0
```
Then add yourself to that group (dialout in this example):
```
$ sudo usermod -a -G dialout $(whoami)
```
To enable the above, it is sometimes necessary to logout and login again.
Buildroot Configuration
-----------------------
Two buildroot configuration files are provided:
(1) Direct Linux Kernel Boot
This is defined by the sipeed_maix_bit_defconfig configuration. This
configuration allows building a bootable kernel image with a built-in initramfs
root file system (the board SD card is not used). The built kernel image can be
flashed directly to the board ROM for direct booting. No boot loader is
required.
(2) U-Boot SD-Card Boot
The sipeed_maix_bit_sdcard_defconfig configuration allows building a kernel
image with the root file system on the board SD card. U-Boot is used as the
boot loader.
Both configuration files will also compile and install the kflash and
pyserial-miniterm host utilities to program bootable image files to the board
and open a serial terminal console.
Direct Linux Kernel Boot
-------------------------
Using the sipeed_maix_bit_defconfig configuration, the bootable kernel binary
image is built as follows.
```
$ make sipeed_maix_bit_defconfig
$ make
```
The bootable binary image is the output/images/loader.bin file. This image file
can be written to the board boot ROM using the kflash utility.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin
```
Once the kernel image file is fully programmed, a terminal console is open and
the board can be rebooted by pressing the reset button on the board (if it does
not reboot automatically).
The output will be similar to the following.
```
[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 14:30:02 JST 2022
[ 0.000000] Machine model: SiPeed MAIX BiT
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 5996K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 530K init, 66K bss, 2196K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008188] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018250] pid_max: default: 4096 minimum: 301
[ 0.022860] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029972] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040244] rcu: Hierarchical SRCU implementation.
[ 0.045121] smp: Bringing up secondary CPUs ...
[ 0.050225] smp: Brought up 1 node, 2 CPUs
[ 0.054355] devtmpfs: initialized
[ 0.071168] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.080240] pinctrl core: initialized pinctrl subsystem
[ 0.119221] clocksource: Switched to clocksource clint_clocksource
[ 0.131498] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.176943] k210-sysctl 50440000.syscon: K210 system controller
[ 0.193558] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.201526] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.211611] i2c_dev: i2c /dev entries driver
[ 0.221375] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.233591] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.242529] printk: console [ttySIF0] enabled
[ 0.242529] printk: console [ttySIF0] enabled
[ 0.251165] printk: bootconsole [sifive0] disabled
[ 0.251165] printk: bootconsole [sifive0] disabled
[ 0.274348] Freeing unused kernel image (initmem) memory: 524K
[ 0.279504] This architecture does not have kernel memory protection.
[ 0.285908] Run /init as init process
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
To open a terminal console without re-flashing the board, the pyserial-miniterm
host tool can be used.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```
The options "--raw" and "--eol=LF" are added here to avoid a double carriage
return each time a command is entered.
U-Boot SD-Card Boot
-------------------
The build procedure is similar to the direct Linux kernel boot case.
```
$ make sipeed_maix_bit_sdcard_defconfig
$ make
```
The build process will generate two files under the output/images directory.
* sdcard.img: The image file for the SD card filesystem. This image has 2
partitions. The first partition is a vfat partition containing the kernel
uImage and the board device tree binary. The second partition is the root
filesystem with busybox installed. The second partition is formatted using
ext2 (rev1).
* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD
card.
The SD card can be prepared by writing the sdcard.img file, as follows.
```
$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M
$ sync
$ eject /dev/sdX
```
Where /dev/sdX is the device file name of the SD card. Once completed, the SD
card can be inserted into the board and the U-Boot binary image written to the
board boot flash using the kflash utility.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin
```
The above command will program U-Boot image to the board boot ROM and open a
terminal console once the u-boot.bin file is fully programmed. Reboot into the
newly programmed environment by pressing the board reset button.
The output will be similar to the following.
```
U-Boot 2022.04 (May 24 2022 - 17:08:34 +0900)
DRAM: 8 MiB
Core: 34 devices, 17 uclasses, devicetree: separate
WDT: Not starting watchdog@50400000
MMC: spi@53000000:slot@0: 0
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
In: serial@38000000
Out: serial@38000000
Err: serial@38000000
Hit any key to stop autoboot: 0
1668562 bytes read in 933 ms (1.7 MiB/s)
10468 bytes read in 11 ms (928.7 KiB/s)
## Booting kernel from Legacy Image at 80060000 ...
Image Name: Linux
Image Type: RISC-V Linux Kernel Image (uncompressed)
Data Size: 1668498 Bytes = 1.6 MiB
Load Address: 80000000
Entry Point: 80000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 80400000
Booting using the fdt blob at 0x80400000
Loading Kernel Image
Loading Device Tree to 00000000803fa000, end 00000000803ff8e3 ... OK
Starting kernel ...
[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-1056-gc356b62332) 10.3.0, GNU ld (GNU Binutils) 2.37) #1 SMP Tue May 24 06:45:04 JST 2022
[ 0.000000] Machine model: SiPeed MAIX BiT
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: base ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15648 r0 d29408 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 6204K/8192K available (1134K kernel code, 150K rwdata, 239K rodata, 100K init, 68K bss, 1988K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008194] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018257] pid_max: default: 4096 minimum: 301
[ 0.022869] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029982] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040424] rcu: Hierarchical SRCU implementation.
[ 0.045397] smp: Bringing up secondary CPUs ...
[ 0.050518] smp: Brought up 1 node, 2 CPUs
[ 0.054676] devtmpfs: initialized
[ 0.072365] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.081396] pinctrl core: initialized pinctrl subsystem
[ 0.123762] clocksource: Switched to clocksource clint_clocksource
[ 0.136796] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.181768] k210-sysctl 50440000.syscon: K210 system controller
[ 0.198397] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.207373] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.218270] spi spi1.0: setup: ignoring unsupported mode bits a00
[ 0.224786] i2c_dev: i2c /dev entries driver
[ 0.235984] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.249172] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.258078] printk: console [ttySIF0] enabled
[ 0.258078] printk: console [ttySIF0] enabled
[ 0.266707] printk: bootconsole [sifive0] disabled
[ 0.266707] printk: bootconsole [sifive0] disabled
[ 0.307910] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling
[ 0.319869] Waiting for root device /dev/mmcblk0p2...
[ 0.345016] mmc0: host does not support reading read-only switch, assuming write-enable
[ 0.352330] mmc0: new SDHC card on SPI
[ 0.359338] mmcblk0: mmc0:0000 SA16G 14.5 GiB
[ 0.367589] random: fast init done
[ 0.371533] mmcblk0: p1 p2
[ 0.391794] random: get_random_bytes called from 0x0000000080095ae8 with crng_init=1
[ 0.393388] VFS: Mounted root (ext2 filesystem) readonly on device 179:2.
[ 0.411377] devtmpfs: mounted
[ 0.413922] Freeing unused kernel image (initmem) memory: 96K
[ 0.419344] This architecture does not have kernel memory protection.
[ 0.425777] Run /sbin/init as init process
[ 0.718314] random: crng init done
[ 0.799903] init (1): drop_caches: 3
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
Of note is that the kernel mounts the SD card as read-only by default to avoid
corruptions of the ext2 root file system when the board is powered down. This
is recommended as this board does not support clean shutdown or halt.
Similarly to the initramfs build case, a console can be open without
re-flashing the board using the host tool pyserial-miniterm.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```

View File

@@ -0,0 +1,2 @@
CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y
CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maix_dock"

View File

@@ -0,0 +1,321 @@
Sipeed MAIX-Dock Board
======================
The Sipeed MAXI-Dock board is a dual-core RISC-V 64-bits board based on the
Canaan Kendryte K210 SoC.
Prerequisite
------------
In order to use the kflash utility to program this board, the user must have
access to the board USB serial device file. The simplest way to do this is to
add your user to the same group as this device file. Assume the device file is
/dev/ttyUSB0, first identify the device group name. In most cases, it is
either "dialout" or "uucp". Also verify that read-write access is enabled for
the group:
```
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0
```
Then add yourself to that group (dialout in this example):
```
$ sudo usermod -a -G dialout $(whoami)
```
To enable the above, it is sometimes necessary to logout and login again.
Buildroot Configuration
-----------------------
Two buildroot configuration files are provided:
(1) Direct Linux Kernel Boot
This is defined by the sipeed_maix_dock_defconfig configuration. This
configuration allows building a bootable kernel image with a built-in initramfs
root file system (the board SD card is not used). The built kernel image can be
flashed directly to the board ROM for direct booting. No boot loader is
required.
(2) U-Boot SD-Card Boot
The sipeed_maix_dock_sdcard_defconfig configuration allows building a kernel
image with the root file system on the board SD card. U-Boot is used as the
boot loader.
Note: U-Boot does not natively support the Sipeed MAIX-Dock board. However, the
board and device tree differences with the Sipeed MAIX-Bit board are small
enough for U-Boot to work.
Both configuration files will also compile the pyserial-miniterm host tool open
a serial terminal console for the board.
Direct Linux Kernel Boot
-------------------------
Using the sipeed_maix_dock_defconfig configuration, the bootable kernel binary
image is built as follows.
```
$ make sipeed_maix_dock_defconfig
$ make
```
Both configuration files will also compile and install the kflash and
pyserial-miniterm host utilities to program bootable image files to the board
and open a serial terminal console.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin
```
Once the kernel image file is fully programmed, a terminal console is open and
the board can be rebooted by pressing the reset button on the board (if it does
not reboot automatically).
The output will be similar to the following.
```
[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 15:47:42 JST 2022
[ 0.000000] Machine model: SiPeed MAIX Dock
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 5980K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 546K init, 66K bss, 2212K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008187] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018250] pid_max: default: 4096 minimum: 301
[ 0.022859] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029971] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040238] rcu: Hierarchical SRCU implementation.
[ 0.045110] smp: Bringing up secondary CPUs ...
[ 0.050215] smp: Brought up 1 node, 2 CPUs
[ 0.054345] devtmpfs: initialized
[ 0.071112] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.080182] pinctrl core: initialized pinctrl subsystem
[ 0.120689] clocksource: Switched to clocksource clint_clocksource
[ 0.133165] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.181750] k210-sysctl 50440000.syscon: K210 system controller
[ 0.198612] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.206644] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.216569] i2c_dev: i2c /dev entries driver
[ 0.225905] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.238866] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.247778] printk: console [ttySIF0] enabled
[ 0.247778] printk: console [ttySIF0] enabled
[ 0.256459] printk: bootconsole [sifive0] disabled
[ 0.256459] printk: bootconsole [sifive0] disabled
[ 0.268225] panel@0 enforce active low on chipselect handle
[ 0.285238] Freeing unused kernel image (initmem) memory: 540K
[ 0.290372] This architecture does not have kernel memory protection.
[ 0.296807] Run /init as init process
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
To open a terminal console without re-flashing the board, the pyserial-miniterm
host tool can be used.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```
The options "--raw" and "--eol=LF" are added here to avoid a double carriage
return each time a command is entered.
U-Boot SD-Card Boot
-------------------
The build procedure is similar to the built-in initramfs case.
```
$ make sipeed_maix_dock_sdcard_defconfig
$ make
```
The build process will generate two files under the output/images directory.
* sdcard.img: The image file for the SD card filesystem. This image has 2
partitions. The first partition is a vfat partition containing the kernel
uImage and the board device tree binary. The second partition is the root
filesystem with busybox installed. The second partition is formatted using
ext2 (rev1).
* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD
card.
The SD card can be prepared by writing the sdcard.img file, as follows.
```
$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M
$ sync
$ eject /dev/sdX
```
Where /dev/sdX is the device file name of the SD card. Once completed, the SD
card can be inserted into the board and the U-Boot binary image written to the
board boot flash using the kflash utility.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin
```
The above command will program U-Boot image to the board boot ROM and open a
terminal console once the u-boot.bin file is fully programmed. Reboot into the
newly programmed environment by pressing the board reset button if it does not
reboot automatically.
The output will be similar to the following.
```
U-Boot 2022.04 (Apr 21 2022 - 15:59:50 +0900)
DRAM: 8 MiB
Core: 34 devices, 17 uclasses, devicetree: separate
WDT: Not starting watchdog@50400000
MMC: spi@53000000:slot@0: 0
Loading Environment from SPIFlash... SF: Detected w25q128fw with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
In: serial@38000000
Out: serial@38000000
Err: serial@38000000
Hit any key to stop autoboot: 0
1717730 bytes read in 957 ms (1.7 MiB/s)
10382 bytes read in 11 ms (920.9 KiB/s)
## Booting kernel from Legacy Image at 80060000 ...
Image Name: Linux
Image Type: RISC-V Linux Kernel Image (uncompressed)
Data Size: 1717666 Bytes = 1.6 MiB
Load Address: 80000000
Entry Point: 80000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 80400000
Booting using the fdt blob at 0x80400000
Loading Kernel Image
Loading Device Tree to 00000000803fa000, end 00000000803ff88d ... OK
Starting kernel ...
[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #1 SMP Thu Apr 21 16:00:03 JST 2022
[ 0.000000] Machine model: SiPeed MAIX Dock
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15392 r0 d29664 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 6156K/8192K available (1180K kernel code, 151K rwdata, 239K rodata, 102K init, 69K bss, 2036K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008196] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018256] pid_max: default: 4096 minimum: 301
[ 0.022876] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029980] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040401] rcu: Hierarchical SRCU implementation.
[ 0.045379] smp: Bringing up secondary CPUs ...
[ 0.050494] smp: Brought up 1 node, 2 CPUs
[ 0.054656] devtmpfs: initialized
[ 0.072338] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.081415] pinctrl core: initialized pinctrl subsystem
[ 0.123902] clocksource: Switched to clocksource clint_clocksource
[ 0.136898] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.182570] k210-sysctl 50440000.syscon: K210 system controller
[ 0.198158] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.207473] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.219724] i2c_dev: i2c /dev entries driver
[ 0.230080] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.243091] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.252034] printk: console [ttySIF0] enabled
[ 0.252034] printk: console [ttySIF0] enabled
[ 0.260656] printk: bootconsole [sifive0] disabled
[ 0.260656] printk: bootconsole [sifive0] disabled
[ 0.272546] panel@0 enforce active low on chipselect handle
[ 0.308098] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling
[ 0.320197] Waiting for root device /dev/mmcblk0p2...
[ 0.344667] mmc0: host does not support reading read-only switch, assuming write-enable
[ 0.352020] mmc0: new SDHC card on SPI
[ 0.358566] mmcblk0: mmc0:0000 SA16G 14.5 GiB
[ 0.366866] random: fast init done
[ 0.371439] mmcblk0: p1 p2
[ 0.391314] random: get_random_bytes called from 0x000000008009b7d2 with crng_init=1
[ 0.400977] VFS: Mounted root (ext2 filesystem) readonly on device 179:2.
[ 0.410966] devtmpfs: mounted
[ 0.413521] Freeing unused kernel image (initmem) memory: 96K
[ 0.418944] This architecture does not have kernel memory protection.
[ 0.425370] Run /sbin/init as init process
[ 0.633502] random: crng init done
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
Of note is that the kernel mounts the SD card as read-only by default to avoid
corruptions of the ext2 root file system when the board is powered down. This
is recommended as this board does not support clean shutdown or halt.
Similarly to the initramfs build case, a console can be open without
re-flashing the board using the host tool pyserial-miniterm.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```

View File

@@ -0,0 +1,2 @@
CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y
CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maix_go"

View File

@@ -0,0 +1,320 @@
Sipeed MAIX-Go Board
====================
The Sipeed MAXI-Go board is a dual-core RISC-V 64-bits board based on the
Canaan Kendryte K210 SoC.
Prerequisite
------------
In order to use the kflash utility to program this board, the user must have
access to the board USB serial device file. The simplest way to do this is to
add your user to the same group as this device file. Assume the device file is
/dev/ttyUSB0, first identify the device group name. In most cases, it is
either "dialout" or "uucp". Also verify that read-write access is enabled for
the group:
```
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0
```
Then add yourself to that group (dialout in this example):
```
$ sudo usermod -a -G dialout $(whoami)
```
To enable the above, it is sometimes necessary to logout and login again.
Buildroot Configuration
-----------------------
Two buildroot configuration files are provided:
(1) Direct Linux Kernel Boot
This is defined by the sipeed_maix_go_defconfig configuration. This
configuration allows building a bootable kernel image with a built-in initramfs
root file system (the board SD card is not used). The built kernel image can be
flashed directly to the board ROM for direct booting. No boot loader is
required.
(2) U-Boot SD-Card Boot
The sipeed_maix_go_sdcard_defconfig configuration allows building a kernel
image with the root file system on the board SD card. U-Boot is used as the
boot loader.
Note: U-Boot does not natively support the Sipeed MAIX-Go board. However, the
board and device tree differences with the Sipeed MAIX-bit board are small
enough for U-Boot to work.
Both configuration files will also compile and install the kflash and
pyserial-miniterm host utilities to program bootable image files to the board
and open a serial terminal console.
Direct Linux Kernel Boot
-------------------------
Using the sipeed_maix_go_defconfig configuration, the bootable kernel binary
image is built as follows.
```
$ make sipeed_maix_go_defconfig
$ make
```
The bootable binary image is the output/images/loader.bin file. This image file
can be written to the board boot flash using the kflash utility.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin
```
Once the kernel image file is fully programmed, a terminal console is open and
the board can be rebooted by pressing the reset button on the board (if it does
not reboot automatically).
The output will be similar to the following.
```
[ 0.000000] Linux version 5.17.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 16:09:24 JST 2022
[ 0.000000] Machine model: SiPeed MAIX GO
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 5980K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 546K init, 66K bss, 2212K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008193] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018250] pid_max: default: 4096 minimum: 301
[ 0.022862] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029971] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040239] rcu: Hierarchical SRCU implementation.
[ 0.045118] smp: Bringing up secondary CPUs ...
[ 0.050204] smp: Brought up 1 node, 2 CPUs
[ 0.054336] devtmpfs: initialized
[ 0.071519] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.080591] pinctrl core: initialized pinctrl subsystem
[ 0.121163] clocksource: Switched to clocksource clint_clocksource
[ 0.133221] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.180960] k210-sysctl 50440000.syscon: K210 system controller
[ 0.196811] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.204879] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.214087] i2c_dev: i2c /dev entries driver
[ 0.222736] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.236173] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.245104] printk: console [ttySIF0] enabled
[ 0.245104] printk: console [ttySIF0] enabled
[ 0.253726] printk: bootconsole [sifive0] disabled
[ 0.253726] printk: bootconsole [sifive0] disabled
[ 0.265588] panel@0 enforce active low on chipselect handle
[ 0.282358] Freeing unused kernel image (initmem) memory: 540K
[ 0.287492] This architecture does not have kernel memory protection.
[ 0.293926] Run /init as init process
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
To open a terminal console without re-flashing the board, the pyserial-miniterm
host tool can be used.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```
The options "--raw" and "--eol=LF" are added here to avoid a double carriage
return each time a command is entered.
U-Boot SD-Card Boot
-------------------
The build procedure is similar to the built-in initramfs case.
```
$ make sipeed_maix_go_sdcard_defconfig
$ make
```
The build process will generate two files under the output/images directory.
* sdcard.img: The image file for the SD card filesystem. This image has 2
partitions. The first partition is a vfat partition containing the kernel
uImage and the board device tree binary. The second partition is the root
filesystem with busybox installed. The second partition is formatted using
ext2 (rev1).
* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD
card.
The SD card can be prepared by writing the sdcard.img file, as follows.
```
$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M
$ sync
$ eject /dev/sdX
```
Where /dev/sdX is the device file name of the SD card. Once completed, the SD
card can be inserted into the board and the U-Boot binary image written to the
board boot flash using the kflash utility.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin
```
The above command will program U-Boot image to the board boot ROM and open a
terminal console once the u-boot.bin file is fully programmed. Reboot into the
newly programmed environment by pressing the board reset button.
The output will be similar to the following.
```
U-Boot 2022.04 (Apr 21 2022 - 16:28:58 +0900)
DRAM: 8 MiB
Core: 34 devices, 17 uclasses, devicetree: separate
WDT: Not starting watchdog@50400000
MMC: spi@53000000:slot@0: 0
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
In: serial@38000000
Out: serial@38000000
Err: serial@38000000
Hit any key to stop autoboot: 0
1717730 bytes read in 956 ms (1.7 MiB/s)
10502 bytes read in 11 ms (931.6 KiB/s)
## Booting kernel from Legacy Image at 80060000 ...
Image Name: Linux
Image Type: RISC-V Linux Kernel Image (uncompressed)
Data Size: 1717666 Bytes = 1.6 MiB
Load Address: 80000000
Entry Point: 80000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 80400000
Booting using the fdt blob at 0x80400000
Loading Kernel Image
Loading Device Tree to 00000000803fa000, end 00000000803ff905 ... OK
Starting kernel ...
[ 0.000000] Linux version 5.17.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #1 SMP Thu Apr 21 16:29:10 JST 2022
[ 0.000000] Machine model: SiPeed MAIX GO
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15392 r0 d29664 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 6156K/8192K available (1180K kernel code, 151K rwdata, 239K rodata, 102K init, 69K bss, 2036K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008201] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018256] pid_max: default: 4096 minimum: 301
[ 0.022875] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029983] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040405] rcu: Hierarchical SRCU implementation.
[ 0.045387] smp: Bringing up secondary CPUs ...
[ 0.050501] smp: Brought up 1 node, 2 CPUs
[ 0.054662] devtmpfs: initialized
[ 0.072840] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.081918] pinctrl core: initialized pinctrl subsystem
[ 0.124601] clocksource: Switched to clocksource clint_clocksource
[ 0.137869] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.183507] k210-sysctl 50440000.syscon: K210 system controller
[ 0.199987] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.209219] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.221062] i2c_dev: i2c /dev entries driver
[ 0.232254] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.245342] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.254281] printk: console [ttySIF0] enabled
[ 0.254281] printk: console [ttySIF0] enabled
[ 0.262908] printk: bootconsole [sifive0] disabled
[ 0.262908] printk: bootconsole [sifive0] disabled
[ 0.274939] panel@0 enforce active low on chipselect handle
[ 0.308760] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling
[ 0.321220] Waiting for root device /dev/mmcblk0p2...
[ 0.344805] mmc0: host does not support reading read-only switch, assuming write-enable
[ 0.352142] mmc0: new SDHC card on SPI
[ 0.358622] mmcblk0: mmc0:0000 SA16G 14.5 GiB
[ 0.366636] random: fast init done
[ 0.371323] mmcblk0: p1 p2
[ 0.392887] random: get_random_bytes called from 0x000000008009b7d2 with crng_init=1
[ 0.394338] VFS: Mounted root (ext2 filesystem) readonly on device 179:2.
[ 0.411277] devtmpfs: mounted
[ 0.413836] Freeing unused kernel image (initmem) memory: 96K
[ 0.419267] This architecture does not have kernel memory protection.
[ 0.425683] Run /sbin/init as init process
[ 0.594251] random: crng init done
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
Of note is that the kernel mounts the SD card as read-only by default to avoid
corruptions of the ext2 root file system when the board is powered down. This
is recommended as this board does not support clean shutdown or halt.
Similarly to the initramfs build case, a console can be open without
re-flashing the board using the host tool pyserial-miniterm.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```

View File

@@ -0,0 +1,2 @@
CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y
CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maixduino"

View File

@@ -0,0 +1,292 @@
Sipeed MAIXDUINO Board
======================
The Sipeed MAIXDUINO board is a dual-core RISC-V 64-bits board based on the
Canaan Kendryte K210 SoC. This board has the same form factor as the Arduino
UNO board.
Prerequisite
------------
In order to use the kflash utility to program this board, the user must have
access to the board USB serial device file. The simplest way to do this is to
add your user to the same group as this device file. Assume the device file is
/dev/ttyUSB0, first identify the device group name. In most cases, it is
either "dialout" or "uucp". Also verify that read-write access is enabled for
the group:
```
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0
```
Then add yourself to that group (dialout in this example):
```
$ sudo usermod -a -G dialout $(whoami)
```
To enable the above, it is sometimes necessary to logout and login again.
Buildroot Configuration
-----------------------
Two buildroot configurations are provided:
(1) Direct Linux Kernel Boot
This is defined by the sipeed_maixduino_defconfig configuration. This
configuration allows building a bootable kernel image with a built-in initramfs
root file system (the board SD card is not used). The built kernel image can be
flashed directly to the board ROM for direct booting. No boot loader is
required.
(2) U-Boot SD-Card Boot
The sipeed_maixduino_sdcard_defconfig configuration allows building a kernel
image with the root file system on the board SD card. U-Boot is used as the
boot loader.
Note: U-Boot does not natively support the Sipeed MAIXDUINO board. However, the
board and device tree differences with the Sipeed MAIX-bit board are small
enough for U-Boot to work.
Both configuration files will also compile and install the kflash and
pyserial-miniterm host utilities to program bootable image files to the board
and open a serial terminal console.
Direct Linux Kernel Boot
------------------------
Using the sipeed_maixduino_defconfig configuration, the bootable kernel binary
image is built as follows.
```
$ make sipeed_maixduino_defconfig
$ make
```
The bootable binary image is the output/images/loader.bin file. This image file
can be written to the board boot flash using the kflash utility.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin
```
Once the kernel image file is fully programmed, a terminal console is open and
the board can be rebooted by pressing the reset button on the board (if it does
not reboot automatically).
The output will be similar to the following.
```
[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 15:16:00 JST 2022
[ 0.000000] Machine model: SiPeed MAIXDUINO
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 6000K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 530K init, 66K bss, 2192K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008183] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018249] pid_max: default: 4096 minimum: 301
[ 0.022860] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029971] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040242] rcu: Hierarchical SRCU implementation.
[ 0.045124] smp: Bringing up secondary CPUs ...
[ 0.050217] smp: Brought up 1 node, 2 CPUs
[ 0.054346] devtmpfs: initialized
[ 0.070924] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.079996] pinctrl core: initialized pinctrl subsystem
[ 0.119893] clocksource: Switched to clocksource clint_clocksource
[ 0.131992] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.179099] k210-sysctl 50440000.syscon: K210 system controller
[ 0.194904] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.203108] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.213867] i2c_dev: i2c /dev entries driver
[ 0.223397] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.235632] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.244585] printk: console [ttySIF0] enabled
[ 0.244585] printk: console [ttySIF0] enabled
[ 0.253190] printk: bootconsole [sifive0] disabled
[ 0.253190] printk: bootconsole [sifive0] disabled
[ 0.264820] panel@0 enforce active low on chipselect handle
[ 0.281482] Freeing unused kernel image (initmem) memory: 524K
[ 0.286621] This architecture does not have kernel memory protection.
[ 0.293047] Run /init as init process
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
To open a terminal console without re-flashing the board, the pyserial-miniterm
host tool can be used.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```
The options "--raw" and "--eol=LF" are added here to avoid a double carriage
return each time a command is entered.
U-Boot SD-Card Boot
-------------------
The build procedure is similar to the built-in initramfs case.
```
$ make sipeed_maixduino_sdcard_defconfig
$ make
```
The build process will generate two files under the output/images directory.
* sdcard.img: The image file for the SD card filesystem. This image has 2
partitions. The first partition is a vfat partition containing the kernel
uImage and the board device tree binary. The second partition is the root
filesystem with busybox installed. The second partition is formatted using
ext2 (rev1).
* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD
card.
The SD card can be prepared by writing the sdcard.img file, as follows.
```
$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M
$ sync
$ eject /dev/sdX
```
Where /dev/sdX is the device file name of the SD card. Once completed, the SD
card can be inserted into the board and the U-Boot binary image written to the
board boot flash using the kflash utility.
```
$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin
```
The above command will program U-Boot image to the board boot ROM and open a
terminal console once the u-boot.bin file is fully programmed. Reboot into the
newly programmed environment by pressing the board reset button.
The output will be similar to the following.
```
[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #1 SMP Thu Apr 21 15:30:18 JST 2022
[ 0.000000] Machine model: SiPeed MAIXDUINO
[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8')
[ 0.000000] printk: bootconsole [sifive0] enabled
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[ 0.000000] riscv: ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0
[ 0.000000] percpu: Embedded 11 pages/cpu s15392 r0 d29664 u45056
[ 0.000000] percpu: wasting 10 pages per chunk
[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020
[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro
[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 6156K/8192K available (1180K kernel code, 151K rwdata, 239K rodata, 102K init, 69K bss, 2036K reserved, 0K cma-reserved)
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped
[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz
[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz
[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[ 0.008191] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[ 0.018255] pid_max: default: 4096 minimum: 301
[ 0.022876] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.029982] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.040417] rcu: Hierarchical SRCU implementation.
[ 0.045397] smp: Bringing up secondary CPUs ...
[ 0.050513] smp: Brought up 1 node, 2 CPUs
[ 0.054680] devtmpfs: initialized
[ 0.072127] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.081205] pinctrl core: initialized pinctrl subsystem
[ 0.125074] clocksource: Switched to clocksource clint_clocksource
[ 0.138311] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[ 0.183471] k210-sysctl 50440000.syscon: K210 system controller
[ 0.199873] k210-rst 50440000.syscon:reset-controller: K210 reset controller
[ 0.208858] cacheinfo: Unable to detect cache hierarchy for CPU 0
[ 0.221586] i2c_dev: i2c /dev entries driver
[ 0.232786] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller
[ 0.246572] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0
[ 0.255508] printk: console [ttySIF0] enabled
[ 0.255508] printk: console [ttySIF0] enabled
[ 0.264137] printk: bootconsole [sifive0] disabled
[ 0.264137] printk: bootconsole [sifive0] disabled
[ 0.275560] panel@0 enforce active low on chipselect handle
[ 0.313245] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling
[ 0.322845] Waiting for root device /dev/mmcblk0p2...
[ 0.345869] mmc0: host does not support reading read-only switch, assuming write-enable
[ 0.353221] mmc0: new SDHC card on SPI
[ 0.360233] mmcblk0: mmc0:0000 SA16G 14.5 GiB
[ 0.368350] random: fast init done
[ 0.372926] mmcblk0: p1 p2
[ 0.391887] random: get_random_bytes called from 0x000000008009b7d2 with crng_init=1
[ 0.400427] VFS: Mounted root (ext2 filesystem) readonly on device 179:2.
[ 0.410128] devtmpfs: mounted
[ 0.412628] Freeing unused kernel image (initmem) memory: 96K
[ 0.418137] This architecture does not have kernel memory protection.
[ 0.424530] Run /sbin/init as init process
[ 0.563384] random: crng init done
__ _
/ / (_) ____ _ _ __ __
/ / | || _ \ | | | |\ \/ /
/ /___| || | | || |_| | > <
/_____/|_||_| |_| \____|/_/\_\
64-bits RISC-V Kendryte K210 NOMMU
/ #
```
Of note is that the kernel mounts the SD card as read-only by default to avoid
corruptions of the ext2 root file system when the board is powered down. This
is recommended as this board does not support clean shutdown or halt.
Similarly to the initramfs build case, a console can be open without
re-flashing the board using the host tool pyserial-miniterm.
```
$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200
```