I tried to build the SD boot image of LicheePi Nano

LicheePi Nano Sipeed's small, cheap SBC. Purchased at Akizuki Denshi and Switch Science in Japan it can. Soc has Allwinner F1C100s, 32MB DDR and 16MB SPI Flash The official documentation is here. Since it is Chinese, it is easy to read if you use Google Translate of Chrome extension

Build environment

Since Windows 10 is the main machine, I ran Ubuntu 18.04 LTS with WSL2 and built it. I will omit the installation method etc. because it will come out if I google (Ubuntu 20.04 LTS uses 18.04 LTS because an error occurred in the build root build)

I used Ubuntu 20.04.1 LTS installed on Surface Pro 3 to create the SD card.

Toolchain Download the latest binary of ** arm-linux-gnueabi ** from Linaro Toolchain

$ wget http://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz

Place it in a suitable place (place it in / opt as an example)

$ tar -vxJf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz
$ sudo cp -r ./gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi /opt/

Pass the path to .bashrc

/etc/bash.bashrc


#Add to the end of the file
PATH="$PATH:/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin"

U-boot Clone a branch for LicheePi Nano from Lichee-Pi's github repository

$ git clone --depth=1 -b nano-v2018.01 https://github.com/Lichee-Pi/u-boot.git

Generate and build .config for LicheePi Nano

$ cd u-boot/
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- licheepi_nano_defconfig
$ make ARCH=arm menuconfig //Check settings
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- //Build

Install the missing package with ʻapt install` if needed

#I needed the following items
$ sudo apt install build-essential
$ sudo apt install gcc python swig python-dev bc
$ sudo apt-get install libncurses5-dev

Linux Kernel Clone a branch for LicheePi Nano from Lichee-Pi's github repository

$ git clone --depth=1 -b nano-5.2-tf https://github.com/Lichee-Pi/linux.git

Download .conf from official

$ cd linux
$ wget http://dl.sipeed.com/LICHEE/Nano/SDK/config
$ mv config .config
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4

Install the missing package with ʻapt install` if needed

#I needed the following items
$ sudo apt install flex
$ sudo apt install bison
$ sudo apt install libssl-dev

buildroot

$ wget https://buildroot.org/downloads/buildroot-2017.08.tar.gz
$ tar xvf buildroot-2017.08.tar.gz
$ cd buildroot-2017.08/
# .Download config
$ wget https://fdvad021asfd8q.oss-cn-hangzhou.aliyuncs.com/migrate/buildroot.config
$ mv buildroot.config .config
$ make ARCH=arm menuconfig
$ make

Install the missing package with ʻapt install` if needed

#I needed the following items
$ sudo apt install unzip
$ sudo apt install libc6-i386 lib32stdc++6 lib32z1

Boot configuration file

boot.cmd


setenv bootargs console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
load mmc 0:1 0x80C00000 suniv-f1c100s-licheepi-nano.dtb
load mmc 0:1 0x80008000 zImage
bootz 0x80008000 - 0x80C00000

Generate boot.scr from boot.cmd

$ ./u-boot/tools/mkimage -C none -A arm -T script -d boot.cmd boot.scr

SD card creation for boot

WSL2 cannot access the USB memory, so a separate Linux environment is required (I used Ubuntu 20.04.1 LTS installed on Surface Pro 3) Copy the following required files to your Linux environment

Below, it is assumed that the SD card is recognized as / dev / sdb

SD card editing

#Unmount if already mounted
$ sudo umount /dev/sdbx

#Partition editing
$ sudo fdisk /dev/sdb
d //Delete an existing partition
n //Create 1st partition
p
1
+32M
n  //Create second partition
p
2
p
w

##Partition type change
$ sudo mkfs.vfat /dev/sdb1
$ sudo mkfs.ext4 /dev/sdb2

U-boot writing

$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8

Copy boot file

$ sudo mount /dev/sdb1 /mnt/boot
$ sudo cp zImage /mnt/boot/
$ sudo cp boot.scr /mnt/boot/
$ sudo cp suniv-f1c100s-licheepi-nano.dtb /mnt/boot
$ sync
$ sudo umount /dev/sdb1

Copy of File System

$ sudo mount /dev/sdb2 /mnt/rootfs
$ sudo tar xvf rootfs.tar -C /mnt/rootfs/

Linux boot confirmation

U-Boot SPL 2018.01-g013ca45 (Sep 06 2020 - 06:07:34)
DRAM: 32 MiB
Trying to boot from MMC1


U-Boot 2018.01-g013ca45 (Sep 06 2020 - 06:07:34 +0900) Allwinner Technology

CPU:   Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM:  32 MiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

In:    serial@1c25000
Out:   serial@1c25000
Err:   serial@1c25000
Net:   No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
279 bytes read in 14 ms (18.6 KiB/s)
## Executing script at 80c50000
reading suniv-f1c100s-licheepi-nano.dtb
5908 bytes read in 31 ms (185.5 KiB/s)
reading zImage
4173736 bytes read in 215 ms (18.5 MiB/s)
## Flattened Device Tree blob at 80c00000
   Booting using the fdt blob at 0x80c00000
   Loading Device Tree to 816fb000, end 816ff713 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.2.0-licheepi-nano+ (pi@Windows10) (gcc version 7.5.0 (Linaro GCC 7.5-2019.12)) #2 Sun Sep 6 08:58:05 JST 2020
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22688K/32768K available (6144K kernel code, 240K rwdata, 1556K rodata, 1024K init, 241K bss, 10080K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x254/0x42c with crng_init=0
[    0.000048] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000123] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000639] Console: colour dummy device 80x30
[    0.001241] printk: console [tty0] enabled
[    0.001339] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070270] pid_max: default: 32768 minimum: 301
[    0.070712] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070782] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072428] CPU: Testing write buffer coherency: ok
[    0.074451] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076748] devtmpfs: initialized
[    0.082497] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082670] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083015] pinctrl core: initialized pinctrl subsystem
[    0.085402] NET: Registered protocol family 16
[    0.086931] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.089016] cpuidle: using governor menu
[    0.139913] SCSI subsystem initialized
[    0.140524] usbcore: registered new interface driver usbfs
[    0.140768] usbcore: registered new interface driver hub
[    0.141005] usbcore: registered new device driver usb
[    0.141499] pps_core: LinuxPPS API ver. 1 registered
[    0.141578] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.141710] PTP clock support registered
[    0.142288] Advanced Linux Sound Architecture Driver Initialized.
[    0.143998] clocksource: Switched to clocksource timer
[    0.173383] NET: Registered protocol family 2
[    0.175173] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.175363] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.175476] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.175561] TCP: Hash tables configured (established 1024 bind 1024)
[    0.175881] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.176002] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.176586] NET: Registered protocol family 1
[    0.178144] RPC: Registered named UNIX socket transport module.
[    0.178256] RPC: Registered udp transport module.
[    0.178310] RPC: Registered tcp transport module.
[    0.178357] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.180773] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.182840] Initialise system trusted keyrings
[    0.183498] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.206814] NFS: Registering the id_resolver key type
[    0.206969] Key type id_resolver registered
[    0.207029] Key type id_legacy registered
[    0.213155] Key type asymmetric registered
[    0.213265] Asymmetric key parser 'x509' registered
[    0.213480] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.213569] io scheduler mq-deadline registered
[    0.213619] io scheduler kyber registered
[    0.225263] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.407365] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.413124] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regulator
[    0.415127] printk: console [ttyS0] disabled
[    0.435455] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 22, base_baud = 6250000) is a 16550A
[    0.852596] printk: console [ttyS0] enabled
[    0.860564] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[    0.878394] SCSI Media Changer driver v0.25
[    0.884217] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.890823] ehci-platform: EHCI generic platform driver
[    0.896438] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.902723] ohci-platform: OHCI generic platform driver
[    0.908481] usbcore: registered new interface driver usb-storage
[    0.915303] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[    0.924480] i2c /dev entries driver
[    0.929697] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regulator
[    0.967825] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[    0.977224] usbcore: registered new interface driver usbhid
[    0.982872] usbhid: USB HID core driver
[    1.002940] NET: Registered protocol family 17
[    1.007844] Key type dns_resolver registered
[    1.014854] Loading compiled-in X.509 certificates
[    1.029255] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regulator
[    1.040780] sun4i-backend 1e60000.display-backend: Couldn't find matching frontend, frontend features disabled
[    1.051747] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc073b2d4)
[    1.060887] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0739f2c)
[    1.068775] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.075496] [drm] No driver support for vblank timestamp query.
[    1.082817] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.305099] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.308612] mmc0: new high speed SDHC card at address aaaa
[    1.312951] mmcblk0: mmc0:aaaa SL08G 7.40 GiB
[    1.335178] Console: switching to colour frame buffer device 100x30
[    1.338312]  mmcblk0: p1 p2
[    1.464230] sun4i-drm display-engine: fb0: sun4i-drmdrmfb frame buffer device
[    1.486568] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.519601] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.540946] ALSA device list:
[    1.558265]   #0: Loopback 1
[    1.576107] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.599249] cfg80211: failed to load regulatory.db
[    1.653586] random: fast init done
[    1.977284] EXT4-fs (mmcblk0p2): recovery complete
[    2.145650] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    2.168407] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    2.194191] devtmpfs: mounted
[    2.217951] Freeing unused kernel memory: 1024K
[    2.237009] Run /sbin/init as init process
[    2.411834] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
Starting logging: OK
Initializing random number generator... [    2.774459] random: dd: uninitialized urandom read (512 bytes read)
done.

Welcome to Lichee Pi
Lichee login: root
Password:
# 

If USB memory can be used with WLS2, it will not be necessary to prepare a Linux PC separately from Windows 10, so I hope that WLS2 will be able to support USB devices.

Recommended Posts

I tried to build the SD boot image of LicheePi Nano
I tried to correct the keystone of the image
I tried to find the entropy of the image with python
I tried to touch the API of ebay
I tried using the image filter of OpenCV
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
I tried to transform the face image using sparse_image_warp of TensorFlow Addons
I tried to detect the iris from the camera image
I tried to summarize the basic form of GPLVM
I tried to visualize the spacha information of VTuber
I tried to erase the negative part of Meros
I tried to automate the face hiding work of the coordination image for wear
I tried to classify the voices of voice actors
I tried to compress the image using machine learning
I tried to summarize the string operations of Python
I tried to sort out the objects from the image of the steak set meal-④ Clustering
I tried to extract the text in the image file using Tesseract of the OCR engine
I tried "gamma correction" of the image with Python + OpenCV
I tried to get the location information of Odakyu Bus
I tried to find the average of the sequence with TensorFlow
[Python] I tried to visualize the follow relationship of Twitter
[Machine learning] I tried to summarize the theory of Adaboost
I tried to fight the Local Minimum of Goldstein-Price Function
I tried to move the ball
I tried to estimate the interval.
I tried to sort out the objects from the image of the steak set meal-① Object detection
[Linux] I tried to summarize the command of resource confirmation system
I tried to get the index of the list using the enumerate function
I tried to automate the watering of the planter with Raspberry Pi
I tried to process the image in "sketch style" with OpenCV
I summarized how to change the boot parameters of GRUB and GRUB2
I tried to process the image in "pencil style" with OpenCV
I tried to expand the size of the logical volume with LVM
I tried to cut out a still image from the video
I tried to summarize the frequently used implementation method of pytest-mock
I tried to improve the efficiency of daily work with Python
I tried to visualize the common condition of VTuber channel viewers
I tried the asynchronous server of Django 3.0
I tried to summarize the umask command
I tried to recognize the wake word
I tried to summarize the graphical modeling.
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried playing with the image with Pillow
I tried to sort out the objects from the image of the steak set meal-② Overlap number sorting
I tried moving the image to the specified folder by right-clicking and left-clicking
I tried to visualize the age group and rate distribution of Atcoder
I tried transcribing the news of the example business integration to Amazon Transcribe
zoom I tried to quantify the degree of excitement of the story at the meeting
I tried to estimate the similarity of the question intent using gensim's Doc2Vec
I tried how to improve the accuracy of my own Neural Network
I tried to solve the 2020 version of 100 language processing [Chapter 3: Regular expressions 25-29]
I tried to get the authentication code of Qiita API with Python.
I tried to automatically extract the movements of PES players with software
(Python) I tried to analyze 1 million hands ~ I tried to estimate the number of AA ~
I tried to summarize the logical way of thinking about object orientation.
I tried to find the optimal path of the dreamland by (quantum) annealing
I tried to extract and illustrate the stage of the story using COTOHA
I tried to verify and analyze the acceleration of Python by Cython
I tried to analyze the negativeness of Nono Morikubo. [Compare with Posipa]