Lichee Pi Nano 5.2 + SPI0, SPI1, I2C0, USB Mass Storage, and USB Audio

So I took [xiaohui]'s very useful lichee-nano-one-key-package build script and updated it to use the nano-5.2-tf branch from the Lichee-Pi linux github and added in support for:

  • SPI0
  • SPI1 (Not tested but it does show up)
  • I2C0
  • USB Mass Storage (with automounting)
  • USB Audio

In the fullness of time I plan to add support for I2S (if anyone has gotten this to work on linux let me know), USB WiFi, and moving to a more modern Buildroot (currently 2017.08)

It is currently building a SD/TF card image. Eventually I will work on a SPI flash image as well

As you can see there is still lots to do, but I thought it was useful enough to share

You can find the script at

Just a quick note to say that wifi is now working! It currently only supports Realtek 8188eu, 8188CUS, and 8192 usb wifi adaptors; but they are widely available. For example the Edimax EW-7811Un

Note I haven’t added scripts to automatically connect to the network. Currently you would have to do the following steps:

	# Load kmods
	modprobe lib80211_crypt_ccmp.ko
	modprobe lib80211_crypt_wep.ko
	modprobe lib80211.ko
	modprobe r8188eu.ko

	# Add nameserver entries to /etc/resolv.conf 
	echo nameserver >  /etc/resolv.conf
	echo nameserver >> /etc/resolv.conf
	# plug in wifi
	# start the wifi driver
	ifconfig wlan0 up
	# connect to wifi
	wpa_passphrase MySSID MyPassphrase > wpa.conf
	wpa_supplicant -B -i wlan0 -c wpa.conf
	# start dhcp
	dhcpcd wlan0

	# test the connection

At some point I will automate that, but I have some actual work to do with the board first :smiley:

PS: USB Bluetooth is on the list at some point

1 Like

I have some issues running ./ pull_all it gives me this error at the end:

pull toolchain ok
--2020-05-15 11:08:52--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-05-15 11:08:53 ERROR 404: Not Found.

./ line 113: [: missing `]'
pull buildroot ok
cp: not writing through dangling symlink '/home/ubuntu/lichee-nano-one-key-package/buildroot/current'
cp: missing destination file operand after '/home/ubuntu/lichee-nano-one-key-package/linux-suniv-f1c100s.dtsi/suniv-f1c100s.dtsi'
Try 'cp --help' for more information.
build ok

after that the ./ nano_tf also fails:

ubuntu@ubuntu:~/lichee-nano-one-key-package$ ./ nano_tf
Welcome to use lichee pi one key package
clean log ...
clean output dir ...
Building uboot ...
--->Configuring ...
--->Get cpu info ...
--->Compiling ...
Image Name:   Beagleboard boot script
Created:      Fri May 15 11:12:14 2020
Image Type:   ARM Linux Script (uncompressed)
Data Size:    225 Bytes = 0.22 KiB = 0.00 MiB
Load Address: 00000000
Entry Point:  00000000
   Image 0: 217 Bytes = 0.21 KiB = 0.00 MiB
Build uboot ok
copy uboot ...
Building linux ...
--->Configuring ...
  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/
  HOSTCC  scripts/kconfig/lexer.lex.o
  YACC    scripts/kconfig/
  HOSTCC  scripts/kconfig/
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTLD  scripts/kconfig/conf
# configuration written to .config
--->Get cpu info ...
--->Compiling ...
Build linux ok
copy linux ...
./ line 301: cd: /home/ubuntu/lichee-nano-one-key-package/buildroot/current: No such file or directory
Building buildroot ...
--->Configuring ...
rm: cannot remove '/home/ubuntu/lichee-nano-one-key-package/buildroot/current/.config': No such file or directory
*** Default configuration is based on 'multi_v7_defconfig'
# configuration written to .config
cp: cannot create regular file '/home/ubuntu/lichee-nano-one-key-package/buildroot/current/.config': No such file or directory
scripts/kconfig/Makefile:93: *** No configuration exists for this target on this architecture.  Stop.
make: *** [Makefile:557: /home/ubuntu/lichee-nano-one-key-package/buildroot/current/.config] Error 2
Error: .config file not exist

Do you have any ideas? I am newbie to this.

Ugh, I am very sorry to hear this. I am very sick at the moment so it might take me a bit to address this.

However if you email me at: I can arrange to give you either a precompiled linux image or a clean build environment.

I tracked down the bug and have pushed a new update to github.

For those interested in just downloading my precompiled image:

Cool it is already working!

Wonderful! I am so glad this is of use.

I still need to get I2S working and do any testing at all of the SPI image (I know it will need work).

If you need to cross compile anything that isn’t included in buildroot, then after you have successfully run buildroot, do the following:

export PATH="{path to lichee-nano-one-key-package}/buildroot/current/output/host/bin:{path to lichee-nano-one-key-package}/output/host/sbin:$PATH

and call your makefile with the following additional command line arguments:

make ARCH=arm CROSS_COMPILE=arm-linux- {any other makefile arguments} {makefile target}

This should work for just about any makefile that supports cross-compiling

jockm, seems that USB was broken somehow.
I’ve used clean ubuntu to build your lichee-nano-one-key-package, and USB is not working. After some investigation I see no needed suniv patches in /drivers/phy/allwinner/phy-sun4i-usb.c and /drivers/usb/musb/sunxi.c and probable in other files too.
Please fix the USB - reapplying patches from did not helped me

Fixed. Reapplied patches manually from your usb.patch file

I had good luck cross-compile on linux/ubuntu just using the stock arm linux packages (CROSS_COMPILE=“arm-linux-gnueabi-” ARCH=arm) [v9.3]. Also have used as an easy starting point. Have a 5.10.3 kernel working. I’ll post link after I test lan, wlan.

Is WiringPi port been done?

Know is old replies, but you rock. You use the SDIO wifi to work, yet?