Firefly Ubuntu User Manual This user manual is applicable to Firefly Ubuntu Desktop & Minimal system. Some introductions related to UI display are only for Desktop system. It is strongly recommended to use Ubuntu 18.04. If you use other versions of the system, some sections of this document may not be fully applicable. Create Ubuntu root file system "Compile Ubuntu firmware(GPT)" ADB use ADB Firefly-RK3399 use Type-C data cable to connect the device and the PC host; adb devices adb shell Network ADB Check the IP address of the development board, the PC end is accessed through the network: adb connect + IP adb shell Install linux-headers and linux-image DEBIAN package download link: Downloads Install header files sudo dpkg -i linux-headers-4.4.194+_4.4.194+-5_arm64.deb sudo dpkg -i linux-image-4.4.194+_4.4.194+-5_arm64.deb cd /usr/src/linux-headers-4.4.194+ make headers_check make headers_install #make scripts It might go wrong but it doesn't matter make scripts Qt cross compilation environment support The Qt cross-compilation tool chain released by Firefly is suitable for the following environments: Host: x86-64 / Ubuntu 18.04 Target: Firefly RK3399 RK3328 PX30 / Ubuntu 18.04 Minimal&Desktop The tool chain fully supports wenEngine and backends such as EGLFS LinuxFB XCB. download link Link: https://drive.google.com/drive/folders/1sQdnuZe2onTxvguUUV0LeVsOGWXb-d_q?usp=sharing Deployment See Qt5.12.2_Release.md for details Note that the names of all paths in the document cannot be changed, otherwise it will cause compilation or running errors. Compile On the host side, enter the Qt project directory, qmake && make. Run Two test demos are provided in the tool chain, corresponding to EGLFS and LinuxFB Backend. After the deployment is completed, the user can build the demo on the host side and run the demo on the tartget side to test whether the deployment is successful. Change the device boot and desktop LOGO Boot up LOGO The boot logo is stored in the SDK/kernel. After modification, recompile the kernel. linux-sdk/kenel/logo.bmp LOGO on the desktop After the replacement, restart the system. /usr/share/lubuntu/ ├── images │   └── lubuntu-ff-logo.png #Small icon in the upper left corner of the desktop └── wallpapers └── firefly-default-wallpaper.png #desktop wallpaper Create WIFI hotspot Hardware requirements: Requires wireless network card and supports mobile hotspot function Click the "Ethernet Network" icon in the upper right corner of the desktop, select "Edit Connection..." Select the "+" icon, Add a new connection Select "Wi-Fi", then click "Create" Wi-Fi settings: Set SSID Mode: select Hotspot Device: select wireless network card (wlan) Choose the appropriate encryption method: Click "Save" to complete the hotspot creation immediately Set static IP (using netplan) Set static IP with netplan addresses gateway4 nameservers: DNS nameservers ethernets wifis root@firefly:~# vim /etc/netplan/netplan.yaml root@firefly:~# netplan apply The contents of netplan are as follows: network: ethernets: eth0: addresses: [168.168.4.3/24] gateway4: 168.168.0.1 dhcp4: yes optional: true wifis: wlan0: addresses: [168.168.4.23/24] gateway4: 168.168.0.1 dhcp4: yes dhcp6: no access-points: "ssid": password: "password" version: 2 or network: ethernets: eth0: addresses: [168.168.4.3/24] gateway4: 168.168.0.1 dhcp4: no optional: true nameservers: addresses: [202.96.128.166] wifis: wlan0: addresses: [168.168.4.23/24] gateway4: 168.168.0.1 dhcp4: no dhcp6: no access-points: "ssid": password: "password" version: 2 More configuration examples for netplan: https://netplan.io/examples USB Ethernet USB Ethernet, the main realization is to use the OTG interface of the device as a peripheral mode and simulate it as a network interface, and then the host connects to the device via USB and accesses the Internet through the device. The following is the specific operation based on Firefly-RK3399 device. Operating environment: PC with Ubuntu system Firefly-RK3399 device Kernel Settings In the kernel directory, open the kernel configuration options menu: make firefly_linux_defconfig make menuconfig After entering the kernel configuration menu, select in turn: "Device Drivers" -> "USB Support" -> "USB Gadget Support". Set the "USB Gadget Driver" to compile into a module, and then you can find the option of "Ethernet Gadget (with CDC Ethernet support)" below, and choose to compile into a module as well. At the same time, select "RNDIS support". USB Gadget Drivers USB functions configurable through configfs Ethernet Gadget (with CDC Ethernet support) [*] RNDIS support (NEW) Then compile the kernel in the "kernel" directory: make rk3399-firefly.img -j12 After the compilation is completed, burn the kernel to the device. For the burn process, please refer to the partition image burning part in the Wiki tutorial: Upgrade Firmware . Then copy the following modules generated in the kernel directory to the device: drivers/usb/gadget/function/u_ether.ko drivers/usb/gadget/function/usb_f_ecm_subset.ko drivers/usb/gadget/function/usb_f_ecm.ko drivers/usb/gadget/function/usb_f_rndis.ko drivers/usb/gadget/function/usb_f_eem.ko drivers/usb/gadget/legacy/g_ether.ko drivers/usb/gadget/libcomposite.ko Then on the device, load the above modules in sequence: insmod libcomposite.ko insmod u_ether.ko insmod usb_f_ecm_subset.ko insmod usb_f_rndis.ko insmod usb_f_ecm.ko insmod usb_f_eem.ko insmod g_ether.ko Note: You must load "libcomposite.ko" and "u_ether.ko" first, and then the following modules can be loaded. IP address settings Connect the PC and the OTG interface of the device with a data cable, and execute the "lsusb" command in the PC to view the USB Ethernet device, which means the connection is successful. firefly@Desktop:~$ lsusb Bus 002 Device 003: ID 09da:5814 A4Tech Co., Ltd. Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 005: ID 04f2:b2ea Chicony Electronics Co., Ltd Integrated Camera [ThinkPad] Bus 001 Device 004: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad] Bus 001 Device 003: ID 147e:1002 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 003: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget in the output information is the USB network card device. The device is plugged into the network cable so that the device can connect to the external network. IP settings in the device: Enter and execute the "ifconfig -a" command, you can see the following information: root@firefly:~# ifconfig -a # eth0 is the wired network card eth0: flags=4163 mtu 1500 inet 168.168.100.48 netmask 255.255.0.0 broadcast 168.168.255.255 inet6 fe80::1351:ae2f:442e:e436 prefixlen 64 scopeid 0x20 ether 8a:4f:c3:77:94:ac txqueuelen 1000 (Ethernet) RX packets 9759 bytes 897943 (897.9 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 236 bytes 35172 (35.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 42 base 0x8000 ... # usb0 is a virtual usb network card usb0: flags=4098 mtu 1500 ether 4a:81:b1:34:d2:ad txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Then customize an appropriate IP for the usb0 network card: Note that the IP of usb0 and the IP of wired network card eth0 are not in the same network segment! ! ifconfig usb0 192.168.1.101 IP setting in PC: # First check the USB virtual network card firefly@Desktop:~$ ifconfig enp0s20u2i1: flags=4163 mtu 1500 inet 192.168.2.90 netmask 255.255.255.0 broadcast 192.168.2.255 inet6 fe80::871c:b87e:1327:7fd4 prefixlen 64 scopeid 0x20 ether 46:fe:6e:97:ee:a6 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1 bytes 54 (54.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ... # Set the USB network card's IP address and the device's usb0 IP address in the same network segment firefly@Desktop:~$ sudo ifconfig enp0s20u2i1 192.168.1.100 #Set the default gateway: it should be set to the ip address of the device usb0, because the traffic will be forwarded through usb0 later firefly@Desktop:~$ sudo route add default gw 192.168.1.101 After setting the IP of the device and the PC, they can ping each other, and the PC can also use the "ssh" command to log in to the device. Network sharing to realize PC Internet access On the device: First turn on the IPv4 forwarding function: echo 1> /proc/sys/net/ipv4/ip_forward If you want to automatically turn on the forwarding function every time you restart the device, please directly modify the value of "net.ipv4.ip_forward" in the "/etc/sysctl.conf" file to 1. After modifying the file parameters, execute the "sysctl -p" command to reload the "/etc/sysctl.conf" file to make the IPv4 forwarding function effective. Add rules for traffic forwarding: iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j SNAT --to-source 168.168.100.48 Now the host PC can access the network. If the PC can ping the usb0 and eth0 of the device, but cannot access the Internet, you need to modify the DNS of the PC and add the following in "/etc/resolv.conf": nameserver 8.8.8.8 nameserver 8.8.4.4 Pay attention to the following points during the configuration process: Correspond to each IP address on your device in the above steps, and note that the USB virtual network card IP and wired network IP on the device are not in the same network segment; The gateway of the PC virtual USB network card should be set to the IP address of the device virtual USB network card; The virtual network card IP address, IP forwarding function, traffic forwarding rules and other settings on the device will be restored after the device is restarted. The user can find out the information on how to automatically set these configurations after booting. Export device system This chapter applies to: When the user has completed the deployment of the work environment on one device, the current environment needs to be completely exported for batch deployment to other devices on the same platform.Users can also backup the current development environment by exporting the device file system. "Export device system" Screen rotation Firefly Ubuntu Desktop uses the ff_rotate script to control screen rotation: ff_rotate root@firefly:~# ff_rotate rotate screen and touchscreen run as root ff_rotate orientation: left, right, normal, inverted #Image output flip root@firefly:~# ff_rotate inverted Display version information ffgo The ffgo command provided by Firefly can easily view the firmware information, which is convenient for developers to debug and locate problems. When users need to feedback information to Firefly, they need to attach the version information displayed by ffgo version. root@firefly:~# ffgo Usage: ffgo: show this usage ffgo update: update ffgo ffgo version: get version ffgo cmdlist: get support cmd list ffgo [cmd]: run cmd in cmd list root@firefly:~# ffgo update update success root@firefly:~# ffgo version OS: Ubuntu 18.04.4 LTS MODEL: Firefly-RK3399 Board (Linux Opensource) FIREFLY: v2.03-1-g2ed565c DATE: 20200617-1042 KERNEL: Linux version 4.4.194-59119-g968ba5005831 (jincheng@jincheng-System-Product-Name) (local/firefly-linux/rk3399/firefly: 968ba5005831c5f69d68d95984451fd2a7c457c0) (gcc version 6.3.1 20170404 (Lina0 reset Firefly Ubuntu supports restoring factory settings. Note that this factory setting means that the device is restored to its initial state after the last firmware upgrade root@firefly:~# recovery Usage: update