01-Common_Linux_System_Customization

Boot Autostart Programs

Boot Autostart Script

$ /etc/init.d/kickpi.sh

Example:

$ vim /etc/init.d/kickpi.sh
+ source /usr/bin/test_boot.sh

Give the script execution permissions:

$ chmod +x /etc/init.d/kickpi.sh

Add the boot autostart program commands to the kickpi.sh script to achieve boot autostart.

Modify Serial Port Auto-Login User

By default, the serial port auto-logs in as the root user. The following example shows how to change it to kickpi:

$ vim /lib/systemd/system/serial-getty@.service
-ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM
+ExecStart=-/sbin/agetty --autologin kickpi --keep-baud 115200,38400,9600 %I $TERM

Language Configuration

After executing the commands, restart the system for the changes to take effect.

Ubuntu 20.04

  • Set the language to English

  • Set the language to Chinese

Time Zone Configuration

After executing the commands, restart the system for the changes to take effect.

  • Set the time zone to Asia/Shanghai

  • Set the time zone to America/New York

Configure Screen Display Orientation

  • View current screen information

Based on the printed information, the current system has a single-screen display, and the display device name is HDMI-1.

  • Rotate the screen display orientation

Set the rotation direction of the specified display device:

normal: Display the device normally.

left: Rotate the display device counterclockwise by 90 degrees.

inverted: Rotate the display device clockwise by 90 degrees.

right: Rotate the display device by 180 degrees.

Example:

Configure the HDMI-1 display to rotate counterclockwise by 90 degrees:

  • Touch calibration after screen rotation

Install tools:

View devices and IDs:

Based on the printed information, the current touch device is "goodix-ts" with an ID of 10.

Configure the calibration matrix for the input device:

Example:

Set the calibration matrix for the goodix-ts device:

$ xinput set-prop 10 --type=float "libinput Calibration Matrix" 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0

Configure the coordinate transformation matrix for the input device:

Use the corresponding command according to the rotation situation.

Example:

Set the coordinate transformation matrix for the goodix-ts device to left:

xinput set-prop 10 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1

Calibrate the touch:

Example:

Calibrate the goodix-ts device:

$ xinput_calibrator -v --device 10

Permanently modify the touch direction

You can refer to the LCD configuration document: [Single Touch Screen Driver Configuration](40-RK3568 LCD configuration.md#TouchDriver)

Network Configuration

Static IP Address Configuration

Example: Configure the static IP address of the eth0 network card to 192.168.1.50:

Restart the service:

Common Configurations

Display information for all network interfaces

The network interface names may vary depending on the actual situation.

Display information for a specific network interface

To display information for a specific network interface (e.g., eth0), you can enter ifconfig eth0.

Set the IP address

To set the IP address of the eth0 interface to 192.168.1.101 and the subnet mask to 255.255.255.0, you can use the command ifconfig eth0 192.168.1.101 netmask 255.255.255.0.

Enable a network interface

To enable the eth0 interface, you can use the ifconfig eth0 up command.

Disable a network interface

To disable the eth0 interface, use the ifconfig eth0 down command.

Set the MAC address

Different operating systems may have some differences. Some systems may not allow you to directly set the MAC address through ifconfig, or additional steps may be required.

Command-Line Configuration of WIFI Hotspot (AP) Mode

Check if AP mode is supported

AP/VLAN indicates that the hardware supports AP mode.

Create a Virtual Interface to Create a Hotspot Mode

Install dependent packages:

Create a virtual network card:

<wirelessname> is the name of the real wireless network card, which can be viewed through ifconfig. <virtualwlanname> is the name of the virtual wireless network card.

For example:

Add a physical address to the virtual network card:

You can fill in any address. If there is a conflict, try another one. <virtualwlanname> is the name of the virtual wireless network card.

For example:

View the creation status:

Note: The virtual network card created here will become invalid after restarting the computer.

Download and install the create_ap tool:

Use create_ap to create a hotspot:

<wirelessname> is the name of your wireless network card, <virtualwlanname> is the name of the virtual network card, and <SSID> and <password> are the name and password of the created hotspot Wi-Fi, respectively.

For example:

If the created hotspot gets stuck and the following error is reported when starting the hotspot:

You can stop the previously created hotspot as follows and then restart it:

<virtualwlanname> is the name of the virtual network card.

Use a Physical Interface to Create a Hotspot Mode

Install dependencies and create_ap:

Modify the firewall:

Create a hotspot named MyAccessPoint with a password of 12345678 and share the eth0 network:

NFS Configuration

Environment configuration:

Server Side

  1. Configure the shared files:

  1. Start the service:

  1. View the currently shared files on the server to verify the sharing:

Client Side

  1. View the shared files on the server:

  1. Mount the folder:

  1. Verify the successful mount:

Mirror Source Settings

Check the software version and find the mirror source to replace according to the version:

Replace the new mirror source and update:

Note: Use the ARM mirror source.

Chrome Hardware Acceleration Test

Test Platform: RK3568 Debian 11 Chrome

Test Method:

  1. Copy 1080P and 4K videos to the board and decode them locally through the Chrome browser.

  2. Check the GPU usage:

  1. Enable and print the frame decoding log:

Test Results:

1080P_30fps: The GPU usage is around 42% - 48%.

Log snippet of the test results for each frame decoding time:

4K_30fps: The GPU usage is around 60% - 68%.

Log snippet of the test results for each frame decoding time:

SSH Configuration

By default, root connection is not supported. To enable root connection, you need to configure it as follows:

Precautions:

  • Ensure that the board's IP address is valid.

  • Ensure that you can connect to the board's IP address normally.

USB Camera

Check the camera device nodes

Open the camera with ffmpeg

Example:

The File Manager in the Touch Screen GUI Cannot Open Files

  1. Open the desktop Home and enter the file manager.

  2. Click the second option in the upper right corner: Edit >> Preferences...

  3. On the Preferences interface, go to the third page Navigation and select Single click to activate items.

Install Software Packages from the Official Ubuntu Website

Take installing gcc as an example:

The website is https://ubuntu.pkgs.org/20.04/ubuntu-main-arm64/gcc-9_9.3.0-10ubuntu2_arm64.deb.html. You can directly search for the name of the required dependency package.

f78e90f7748d198d11dbbd163bb33a9

Backup the rootfs System

Note: After replacing the rootfs in this way, there may be issues with the mount UUID. You can use blkid to view the correct UUID and then modify /etc/fstab.

Connect a USB drive to the board. The USB drive should be at least 16GB in size because the packaged image will be relatively large.

The script is located in the network disk:

Copy the script to the Linux system on the board and run it:

The generated package name will be in the format like rootfs.img.

/mnt/usb is the mount directory of the USB drive.

For the board that needs to replace this system, you can burn the rootfs separately. If you need to repackage it into a complete image, refer to [Firmware Unpacking and Packing](../08-Advanced/03-Firmware Unpacking and Packing.md).

Enter the root User in the Ubuntu Desktop Edition

The default login user for the latest desktop edition system is kickpi.

When using some commands in the Terminal of the desktop edition system, you may encounter permission issues, such as ifconfig.

In this case, you need root permissions. You can add sudo before the command or switch to the root user.

The steps to switch to the root user are as follows:

  1. Set the root password:

Enter the current user password, e.g., kickpi. Then enter the new root password (the input will not be displayed). Confirm the password again. If you see the message passwd: password updated successfully, it means the password has been set successfully.

  1. Switch to the root user:

Enter the password you just set, and the current Terminal will enter the root user mode.

Enter the Linux Command-Line Interface

Ubuntu System

Turning off the Ubuntu graphical desktop will make the system enter the Linux command-line interface. The following describes how to turn the Ubuntu graphical desktop on and off.

Temporarily turn off the desktop:

Temporarily turn on the desktop:

Permanently disable the desktop:

Permanently enable the desktop:

If the GUI desktop freezes, you can use the keyboard to enter the command-line interface:

  • To enter the command-line interface, press the shortcut keys CTRL + ALT + F3.

  • To return to the GUI desktop, press the shortcut key ALT + F2.

Debian System

Disable the desktop environment and start in pure command-line mode

Modify the default runlevel:

Check the current system runlevel:

Restart the system:

Enable the desktop environment

Modify the default runlevel:

Restart the system:

Last updated