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 https://github.com/jockm/lichee-nano-one-key-package

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 1.1.1.1 >  /etc/resolv.conf
	echo nameserver 1.0.0.1 >> /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
	ping www.google.com

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

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

gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gdb
gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-gprof
gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-g++
pull toolchain ok
--2020-05-15 11:08:52--  https://buildroot.org/downloads/buildroot-2019.08.03.tar.gz
Resolving buildroot.org (buildroot.org)... 140.211.167.122
Connecting to buildroot.org (buildroot.org)|140.211.167.122|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-05-15 11:08:53 ERROR 404: Not Found.

./build.sh: 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 ./build.sh nano_tf also fails:

ubuntu@ubuntu:~/lichee-nano-one-key-package$ ./build.sh 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
Contents:
   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/parser.tab.h
  HOSTCC  scripts/kconfig/lexer.lex.o
  YACC    scripts/kconfig/parser.tab.c
  HOSTCC  scripts/kconfig/parser.tab.o
  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 ...
./build.sh: 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: jock@jockmurphy.com 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: http://jockmurphy.com/lichee-nano-normal-size.img

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