Weston use cases
Cases of this doc:
• Use of systemctl command
• Enabling and disabling the Weston desktop
• Print the startup log on the screen
• Customized replacement of Kernel startup logo
1. Please book one i.MX8MP board before practicing these hands-on, How to book an board on Cloud Lab
2. Use of systemctl command
systemctl is the main command of the Linux system management toolset Systemd.
For example, for system management, if you run the following commands on the cloud laboratory board, you will see the corresponding phenomenon.
systemctl reboot //Reboot system
systemctl poweroff //Shutdown system(If you want to boot system again, please click “Reset-EVK” icon and wait several seconds)
system suspend //Suspend system
After shutting down or entering system suspend, you need to click the Reset-EVK button below to restart the development board.
There are also other commands in systemd used to manage starting, stopping, restarting, checking status of various services:
systemctl enable
systemctl start
systemctl status
systemctl stop
systemctl kill
systemctl restart
systemctl analyze
Among them, systemctl-analyze can be used to analyze startup time. For details, see "System Startup Time Analysis Case".
3. Enabling and disabling the Weston desktop
systemctl stop weston //Close weston desktop,and you can see black screen
systemctl start weston //Enable weston desktop. See below picture:
4. Print the startup log on the screen
Use the fgconsole command to view the tty serial number corresponding to the board screen
root@imx8mpevk:~# fgconsole
7
When starting the board in the first time, find kernel cmdline in dmesg:
console=ttymxc1,115200 root=/dev/nfs ip=dhcp nfsroot=192.168.100.250:/opt/REAL/NFS/IMX8MPEVK-4-root,v3,tcp
Modify the defconfig file to enable the screen as console:
diff --git a/arch/arm64/configs/imx_v8_defconfig b/arch/arm64/configs/imx_v8_defconfig
index 85762b37006f..16d8a67b5bd3 100644
--- a/arch/arm64/configs/imx_v8_defconfig
+++ b/arch/arm64/configs/imx_v8_defconfig
@@ -1105,3 +1105,5 @@ CONFIG_CORESIGHT_STM=m
CONFIG_CORESIGHT_CPU_DEBUG=m
CONFIG_CORESIGHT_CTI=m
CONFIG_MEMTEST=y
+CONFIG_CMDLINE_FORCE=y
+CONFIG_CMDLINE="console=tty7 console=tty0,115200 earlycon dtb=imx8mp-evk.dtb root=/dev/mmcblk1p2 rootwait rw"
After modifying the code above, reconfigure and compile the code:
make imx_v8_defconfig
make -j$(nproc)
Upload the compiled kernel image to the tftp directory of the cloud board (refer to "Compile the kernel image and run it on the cloud laboratory development board.pdf").
Click the Reset-EVK button, and you can see the log printed on the board screen during the startup process. However, you cannot login system by typing “root” after startup. Then you need to make the following modifications and restart the development board:
root@imx8mpevk:~# vi /etc/systemd/system/weston.service
[Unit]
Description=Weston Wayland Compositor
After=graphical.target
[Service]
Type=simple ExecStart=/usr/bin/weston --tty=7
Restart=always
In this way, “root” commands can be entered at both the serial debugging terminal and the terminal on the board screen, as shown in Figures 1 and 2 above.
5. Customized replacement of Kernel startup logo
During the Kernel startup process, the logo of four little penguins will appear (for 4-core 8MP). In practical applications, some users hope to replace booting logo with their own logo.
Since the kernel's logo format is ppm, to convert general bmp images into ppm format, you must first have an ubuntu PC and install the format conversion tool:
sudo apt update
sudo apt install netpbm
For example, we take the image freescale.bmp in u-boot and use it to replace the penguin logo:
git clone https://github.com/nxp-imx/uboot-imx.git
cp uboot-imx/tools/logos/freescale.bmp ~/
Perform image conversion:
bmptopnm freescale.bmp > logo_linux.pnm
pnmquant 224 logo_linux.pnm > logo_linux_clut224.pnm
pnmtoplainpnm logo_linux_clut224.pnm > logo_linux_clut224.ppm
rm logo_linux.pnm logo_linux_clut224.pnm
By default, the logo of four little penguins during the kernel startup process are related to the number of CPU cores, so the code needs to be modified so that only one copy of our new logo is displayed. The kernel source code is modified as follows and recompiled (refer to "Compiling the Kernel Image and running on the cloud laboratory development board.pdf”):
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index e24b29c4fa0f..74122612f863 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -693,7 +693,7 @@ int fb_show_logo(struct fb_info *info, int rotate)
return 0;
count = fb_logo_count < 0 ? num_online_cpus() : fb_logo_count;
- y = fb_show_logo_line(info, rotate, fb_logo.logo, 0, count);
+ y = fb_show_logo_line(info, rotate, fb_logo.logo, 0, 1);
y = fb_show_extra_logos(info, y, rotate);
return y;
After compiling, upload the new image and run it again. The effect is as follows. You can see that the little penguin logo has been replaced with the logo we made.