- Muchas notas - Fran Acién

20230803 - Lichee RV

Low-level linux debug

Ubuntu

Download

It is necessary to log in via uart, and then start ubuntu.

nmcli dev wifi
nmcli dev wifi connect FaunaPhotonics password ******

The ip is 10.10.20.138

It takes like 3 minutes to start becuase there is a grub startup message and some other things.

Debian

Download

it is necessary to burn the SD with a software:

Guy showing how to compile Debian for SBC

I have been reading and seems to be a nice approach.

I tried the prebuilt files and it just work fine, and is more light than the ubuntu image.

I am having some issues becuase the system is a bit outdate and there are not basic packages for ping, or apt keyring etc.

I am continuing this work in 20240309 - Building my own U-Boot for Lichee RV

Tina linux using the SDK

I have compiled a Tina Linux for the Lichee using the next guide. It works just fine, but Tina linux is not very good honestly.

Connect through UART and power it

I fell in love with this feature. It is possible to connect to the Computer over UART. There are 4 pins near the USB type c, that they are UART and power. Also the Type C is completly usable, and is possible to connect ethernet there. However, this feature only work on startup of the configureation of the board, like the i2c and these, when is booting up it seems to be freezed. It seems that the devicetree is not configuring that pins as uart by default, because when I use the dock with those pins, the serial is perfect.

dd03e59de5d7294a254781687854bdb0.png

The pins close to the USB-C is that one. There is no silkscreen, but the pin that is most near to the sd slot is the 5V.

Minimum power usage

To get the minimum power usage, just disconnect from the dock. The values is listed in 20230628 - Linux computer for Fadi

Compile Linux

It is possible to compile Linux. They give you the tool. It is a docker file. There a description about the docker file,and how to use it.

It is the definition of the overlay in ~/sdk/tina-d1 open_new/device/config/chips/d1/configs/nezha

Trying to add overlays

I tried different OS, and I have different errors:

  • Ubuntu official with wifi driver. It is perfect, but I dont know how to add overlays. After a while I was able to modify it with 20230806 - How to add your overlay to any Linux
  • Armbian, the overlay is not added correctly and the tool to add overlays doesnt work
  • Debian, nothing in boot
  • Tina -> Is totally different

Example overlay led

I want to put working the overlay. In the first test I am going to make that the led2 is power on at startup.

There are 2 leds, one green on the main board, and one rgb on the dock. To turn on the led on the main board is:

echo 1 > /sys/class/leds/\:status/brightness

And for the RGB there is a nice official guide here, but doesnt work on ubuntu >.<

  • LED 2 Is connected to PC1

This part is explained in 20230806 - How to add your overlay to any Linux

The steps are:

  • Use official image of ubuntu
  • Add the next conf to /etc/grub.d/40_custom
menuentry 'UbuntuWithOverlays' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'ubuntu-custom-overlay' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_gpt
	insmod ext2
	search --no-floppy --fs-uuid --set=root 90836834-7e07-48ca-b0f9-29880429770d
	echo	'Loading Linux 5.17.0-1003-allwinner ...'
	linux	/boot/vmlinuz-5.17.0-1003-allwinner root=LABEL=cloudimg-rootfs ro  quiet splash
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-5.17.0-1003-allwinner
	echo	'Loading device tree blob...'
	devicetree	/boot/overlay/my_overlay.dtb
}
  • Modify grub so ‘ubuntu-custom-overlay’ is the default and update grub
  • Then get the official overlay of ubuntu by dtc -I fs /proc/device-tree
  • Modify the lines related to the led
leds {
		compatible = "gpio-leds";

		led-0 {
			function = "status";
			gpios = <0x25 0x02 0x01 0x00>;
            default-state = "on";
		};
	};
  • Compile it dtc -@ -I dts -O dtb -o test.dtb test.dts
  • Add it to the /boot/overlay/my_overlay.dtb
  • Boot, but select that option in the grub