
Achieving Fast Startup in the Industrial Automation Field with the Falcon Mode of Forlinx Embedded FET-MX9352-C Platform
Fast startup is a key device performance indicator in today's rapidly evolving embedded systems. With the popularization of IoT, industrial control and in-vehicle electronics, higher requirements are placed on device response speed and startup time. Fast startup can not only enhance the user experience but also respond quickly in emergency situations, ensuring the stability and safety of the system. This article will introduce how to achieve fast startup to the interface after the system is powered on based on Forlinx Embedded's FET-MX9352-C platform.
Two Boot Modes of Bootloader
Bootloader is the first piece of software code to run after the system is powered on. It is responsible for loading the kernel image and detecting hardware and allocating resources. The Bootloader provides two boot modes: the default mode and the Falcon mode.
Default Boot Mode:
Boot Sequence: After the development board is powered on or reset, the BootROM (main program loader) stored in the CPU ROM is first executed.
Peripheral Initialization: The BootROM is responsible for basic peripheral initialization, such as phase-locked loop (PLL), clock configuration, memory initialization (SRAM), etc., to configure the system-on-chip (SoC).
Component Loading: After loading, the BootROM will find a boot device and load the bootloader image from this device. This image usually includes components such as U-Boot SPL, ATF, and U-Boot.
U-Boot SPL: As the first stage of the bootloader, SPL is the minimum code set suitable for SRAM. It is responsible for initializing hardware, such as the clock and memory controller, and configuring and initializing DRAM.
ATF and U-Boot: Subsequently, SPL loads ATF and U-Boot correctly into DRAM. ATF provides a reference trusted code library for the Armv8 architecture and implements a variety of ARM interface standards. U-Boot is the second-stage bootloader, which is responsible for loading and starting the kernel image and providing a command-line interface for interacting with the hardware.
Falcon Boot Mode
Feature: The Falcon mode is a feature in U-Boot that allows SPL to directly start the Linux kernel, thus skipping the loading and initialization process of U-Boot and achieving fast startup.
Advantage: By reducing the time spent in the bootloader, the Falcon mode significantly shortens the system startup time and improves the device's response speed.
Execution Process of Falcon Mode
The execution process of the Falcon mode is relatively simple and efficient, mainly including the following steps:
SPL Initialization: After the system is powered on or reset, the BootROM stored in the CPU ROM is first executed, and then SPL is loaded and run.
Hardware Initialization: SPL is responsible for initializing necessary hardware devices, such as the clock and memory controller, and configuring and initializing DRAM.
Kernel Loading and Startup: In the Falcon mode, SPL directly loads the Linux kernel into DRAM and jumps to the kernel entry address for execution. This process completely skips the loading and initialization steps of U-Boot.
System Startup: After the Linux kernel runs successfully, it takes over system control and completes the subsequent startup process.
Implementation of Falcon Mode
1.Reduce Bootloader Startup Time
The solution provided by NXP is implemented based on the Yocto BSP version 6.6.36, and the modified patches can be downloaded separately.
git clone https://github.com/nxp-imx-support/meta-imx-fastboot.git
u-boot patch
recipes-bsp/u-boot/files/0001-Enable-Fast-Boot-on-i.MX-8M-Family-and-i.MX-93.patch.
The main purpose of this patch is to add the logic of choosing to start UBOOT or the kernel during the SPL execution process. If any key is pressed during the boot process, it can prevent the automatic startup of the kernel, giving users the opportunity to enter the U-Boot command-line interface. If there is no key input, the system will continue the startup process.
ATF patch
recipes-bsp/imx-atf/files/0001-Add-support-to-jump-to-Kernel-directly-from-ATF.patch
The main purpose of this patch is to add the ability to jump directly to the kernel, and the FDT address must be passed as a parameter.
mkimage patch
recipes-bsp/imx-mkimage/files/0001-Add-scripts-for-Fast-Boot-implementation-for-i.MX8M-.patch
This patch is mainly for imx8M, so no more redundant explanations here.
2.Reduce kernel boot time
Add the “quiet” attribute
The kernel startup time can be reduced by about half by using the quiet parameter in the kernel startup parameters. This parameter reduces the output of debugging information during the Linux startup sequence. It has been added to the Yocto image enabled with the Falcon mode, using the nncargs_fastboot variable.
Remove unnecessary drivers and file systems
This can be trimmed according to the specific needs of the user.
3.Reduce user-space boot time
OK-MX9352-C uses systemd for management. Users can start their own programs before systemd.
Programs started before systemd.
Create a boot script/home/root/helloworld.sh
!/bin/sh echo “hello world” > /dev/kmsg exec /lib/systemd/systemd
Script plus permissions
$ chmod +x helloworld.sh
Link the script to/sbin/init
$ ln -sf /home/root/helloworld.sh /sbin/init
Cancel self-starting procedure
$ ln -sf /lib/systemd/systemd /sbin/init
After the above comprehensive optimization of the Bootloader and the kernel, the startup time of Forlinx Embedded's FET-MX9352-C has been significantly reduced.
The actual test results show that the desktop UI can be displayed on the screen in as little as about 3 seconds after power-on. Fast startup not only enhances the user experience but also ensures the device's rapid response in emergency situations, further enhancing the stability and reliability of the system. With the continuous advancement of technology, Forlinx Embedded's FET-MX9352-C will leverage its unique advantages in more fields, propelling the rapid development of embedded systems.