Fast starting method for CPU-FPGA platform linux system

By using a DMA controller to load and decompress files in parallel on the CPU-FPGA platform, and by optimizing uboot and kernel, the problem of excessively long boot time on the CPU-FPGA heterogeneous chip platform was solved, and fast boot was achieved.

CN116302133BActive Publication Date: 2026-04-07CSIC WUHAN LINCOM ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

When booting a Linux system, the CPU-FPGA heterogeneous chip platform suffers from issues such as the long loading time of the FPGA bitstream file and excessively long boot times due to multi-level booting, making it unsuitable for certain application scenarios with high requirements for program startup time.

Method used

The DMA controller replaces the CPU to take over the QSPI bus. The DMA controller is used to load and decompress zImage, root file system and bit stream files in parallel. uboot and kernel are optimized to reduce loading time, unnecessary initialization steps and modules are eliminated, and a two-level BootLoader structure is adopted.

Benefits of technology

It significantly shortens the Linux boot time of the CPU-FPGA heterogeneous platform, achieving system boot within 2.45 seconds, meeting the needs of demanding application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302133B_ABST
    Figure CN116302133B_ABST
Patent Text Reader

Abstract

The application discloses a kind of CPU-FPGA platform linux system's quick start method, including CPU-FPGA platform and linux system;Quick start method includes: reading kernel zImage compressed image, device tree and root file system in FSBL;zImage compressed image and root file system are decompressed in FSBL;Optimize uboot, and in the stage of uboot start, according to the address of zImage decompressed in FSBL, device tree and root file system address carry out kernel loading;Optimize kernel, directly read the zImage kernel of decompression completion and load in the stage of kernel loading.The application utilizes the characteristics of not occupying CPU of DMA, designs to use DMA to load file simultaneously, and zImage and root file system are decompressed, by parallel processing of loading and decompression, realize linux system acceleration, can greatly shorten the time of CPU-FPGA heterogeneous platform linux start.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a quick starting method of a system, in particular to a quick starting method of a CPU-FPGA platform linux system, and belongs to the technical field of software platform systems. BACKGROUND

[0002] With the continuous development of the Internet of Things, many heterogeneous chip platforms integrating FPGA and CPU are widely applied to data communication, industrial control and other fields due to their powerful and flexible performance. After the power-on of the heterogeneous chip, both FPGA and ARM need to be loaded, and multi-level booting occurs in the process of starting the linux system. The system loading time is usually 7 to 10 seconds, which cannot be applied to many scenes with high requirements for program starting time, such as missile launching and intermittent work for energy saving, thereby greatly limiting the application scenarios of the chip.

[0003] Due to the limited resources in the embedded system, large-volume files such as Linux kernel images and root file systems are usually compressed before being stored in the FLASH storage medium. In the boot program, the compressed files are loaded into the RAM and then decompressed. The decompression and loading are time-consuming actions, which will affect the starting time of the Linux system. In addition, compared with the single-CPU platform, the heterogeneous chip platform of CPU-FPGA loads the bit stream file of FPGA when starting the Linux system. The bit stream file is usually large in size, and the loading process is time-consuming. SUMMARY

[0004] The application aims to solve at least one of the above technical problems and provides a quick starting method of a CPU-FPGA platform linux system.

[0005] The application achieves the above-mentioned purpose through the following technical scheme: a quick starting method of a CPU-FPGA platform linux system, comprising a CPU-FPGA platform and a linux system.

[0006] The CPU-FPGA platform comprises a CPU end and an FPGA end. The CPU end is provided with a DMA controller, a QSPI controller and a DDR controller. The CPU end is mounted with a 16MB FLASH chip through the QSPI controller. The FLASH is used to store FSBL, logic bit stream, uboot, linux kernel and root file system program. The DDR controller is externally connected with a DDR chip for running programs.

[0007] The Linux system runs at least one BootLoader, kernel image, device tree and root file system.

[0008] The fast starting method comprises the following steps:

[0009] Step one, reading the kernel zImage compressed image, device tree and root file system in the FSBL;

[0010] Step two, decompressing the zImage compressed image and root file system in the FSBL;

[0011] Step three, optimizing the uboot, and loading the kernel according to the zImage address, device tree and root file system address decompressed in the FSBL in the uboot starting stage;

[0012] Step four, optimizing the kernel, and directly reading the decompressed zImage kernel for loading in the kernel loading stage.

[0013] As a further scheme of the present application, in step one, specifically comprising:

[0014] 1) starting the DMA controller in the FSBL, and using the DMA controller to replace the CPU to take over the QSPI bus;

[0015] 2) using the DMA to move the zImage image, device tree, root file system, bit stream and uboot to the DDR specific address;

[0016] 3) using the DMA to move the root file system, and the CPU synchronously decompresses the kernel compressed image to the specific address;

[0017] 4) using the DMA to move the bit stream file, and the CPU synchronously decompresses the root file system to the specific address.

[0018] As a further scheme of the present application, in step two, specifically comprising:

[0019] 1) canceling the initialization of the QSPI in the uboot, and compiling the environmental variable content into the uboot;

[0020] 2) skipping the inspection of the kernel image compression header in the uboot;

[0021] 3) skipping the 64-bit information inspection of the root file system header in the uboot;

[0022] 4) using the decompressed kernel image and root file system as the boot address in the uboot.

[0023] As a further scheme of the present application, in step three, specifically comprising:

[0024] 1) closing the kernel CONFIG_DEBUG_FS, nfs and xfs modules, and reducing the kernel image size;

[0025] 2) cancel the kernel to the peripheral network switch and phy initialization work, accelerate the time of network work;

[0026] 3) the kernel skips the decompression of the root file system, and directly mounts the root file system.

[0027] As a further scheme of the application: the CPU-FPGA platform has two levels of BootLoader, which are FSBL and uboot.

[0028] As a further scheme of the application: the CPU-FPGA platform loads the bit stream of FPGA first in the FSBL stage, then loads uboot into DDR, and then jumps to the uboot entrance; the uboot stage loads zImage image, device tree and root file system into DDR; in the kernel stage, the image is self-decompressed and re-run, the device tree is parsed to initialize the driver, and then the root file system is decompressed, and finally the root file system is mounted into the kernel.

[0029] The beneficial effects of the application are:

[0030] 1) using the characteristic of not occupying CPU of DMA, using DMA to load files in FSBL, and decompressing zImage and root file system at the same time, and parallel processing of loading and decompression, compared with the traditional serial processing of loading zImage and root file system first and then decompressing, the time of CPU-FPGA heterogeneous platform linux startup can be greatly shortened;

[0031] 2) optimize uboot: cancel the initialization of QSPI, compile the environment variable content into uboot, and save the access time of uboot to FLASH;

[0032] 3) optimize the kernel: close the kernel CONFIG_DEBUG_FS, nfs, xfs module, reduce the kernel image size, which can shorten the time of DMA loading kernel file in FSBL, and also reduce the loading time of these drive modules when the system is loaded; skip the decompression processing of the root file system, which can also reduce the system loading time. BRIEF DESCRIPTION OF DRAWINGS

[0033] Figure 1 It is a flowchart of starting Linux system of the application;

[0034] Figure 2 It is a composition schematic diagram of the embodiment of the application;

[0035] Figure 3 It is a flowchart of starting Linux system in the embodiment of the application under the traditional method;

[0036] Figure 4 Figure 1 is a schematic diagram of a Linux system startup process in an embodiment of the present application. DETAILED DESCRIPTION

[0037] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0038] Embodiment one

[0039] As shown in Figure 1, a fast startup method for a CPU-FPGA platform linux system includes a CPU-FPGA platform and a linux system. Figures 1 to 2

[0040] The CPU-FPGA platform includes a CPU end and an FPGA end. The CPU end has a DMA controller, a QSPI controller and a DDR controller. The CPU end mounts a 16 MB FLASH chip through the QSPI controller. The FSBL, logical bit stream, uboot, linux kernel and root file system program are stored in the FLASH. The DDR controller is externally connected to a DDR chip for running programs.

[0041] The linux system runs at least a BootLoader (the BootLoader runs before an embedded operating system, initializing the software and hardware environment), a kernel image, a device tree and a root file system.

[0042] The fast startup method includes the following steps:

[0043] Step one, reading the kernel zImage compressed image, the device tree and the root file system in the FSBL.

[0044] Step two, decompressing the zImage compressed image and the root file system in the FSBL.

[0045] Step three, optimizing the uboot, and loading the kernel according to the zImage address, the device tree and the root file system address decompressed in the FSBL in the uboot startup stage.

[0046] Step four, optimizing the kernel, and directly reading the decompressed zImage kernel for loading in the kernel loading stage.

[0047] Embodiment two

[0048] ​The embodiment includes all the technical features in embodiment one, and further includes:

[0049] Step one specifically includes:

[0050] 1) Start the DMA controller in FSBL, and use the DMA controller to replace the CPU to take over the QSPI bus;

[0051] 2) Use the DMA to move the zImage image, device tree, root file system, bit stream and uboot to the DDR specific address;

[0052] 3) Use the DMA to move the root file system, and the CPU synchronously decompresses the kernel compressed image to the specific address;

[0053] 4) Use the DMA to move the bit stream file, and the CPU synchronously decompresses the root file system to the specific address.

[0054] Step two specifically includes:

[0055] 1) Cancel the initialization of QSPI in uboot, and compile the environment variable content into uboot;

[0056] 2) Skip the inspection of the kernel image compression header in uboot;

[0057] 3) Skip the 64-bit information inspection of the root file system header in uboot;

[0058] 4) Use the decompressed kernel image and root file system as the boot address in uboot.

[0059] Step three specifically includes:

[0060] 1) Close the kernel CONFIG_DEBUG_FS, nfs and xfs modules to reduce the kernel image size;

[0061] 2) Cancel the kernel initialization of the peripheral network switch and phy to speed up the network work time;

[0062] 3) The kernel skips the decompression of the root file system, and directly mounts the root file system.

[0063] The CPU-FPGA platform has two levels of BootLoader, which are FSBL and uboot.

[0064] The CPU-FPGA platform loads the bit stream of the FPGA first in the FSBL stage, then loads uboot into the DDR, and then jumps to the uboot entrance. The zImage image, the device tree and the root file system are loaded into the DDR in the uboot stage. The image is self-decompressed and re-run in the kernel stage. The root file system is decompressed after the device tree is initialized to drive. Finally, the root file system is mounted to enter the kernel.

[0065] Embodiment three

[0066] As shown in Figures 3 to 4 , taking the FMQL45T900 heterogeneous platform as an example, a fast start method for a CPU-FPGA platform Linux system, the Linux system start process includes:

[0067] 1) BootRom parses BOOT.bin from the 0 address of FLASH, obtains fsbl.out through the FSBL header information, reads fsbl.out into OCM (On-Chip Memory), and runs FSBL.

[0068] 2) The first execution of ps_init in FSBL initializes the PLL (Phase Locked Loop), DDR, MIO, and clock of the chip.

[0069] 3) Preferably, the maximum frequency CPU clock supported by the chip is configured.

[0070] 4) Read the BOOT mode to obtain the current QSPI start mode.

[0071] 5) Preferably, the maximum frequency QSPI clock supported by the FLASH chip is configured.

[0072] 6) Initialize the QSPI controller.

[0073] 7) Initialize the DMA controller.

[0074] 8) Initiate a DMA request to move the zImage from the selected address in the FLASH to the DDR address r_addr1, and wait for the DMA transmission to end.

[0075] 9) Initiate a DMA request to move the root file system from the selected address in the FLASH to the DDR address r_addr2.

[0076] 10) Call do_compress to read zImage at r_addrl, decompress to full image at specific address s_addrl. Note that do_compress is ported from Linux kernel source code, and s_addrl is the ZRELADDR address in kernel project.

[0077] 11) Preferentially, trim the kernel, remove redundant kernel configurations.

[0078] 12) After decompression, check whether DMA transmission is completed, if not, wait for transmission to complete.

[0079] 13) If DMA transmission is completed, continue to parse BOOT.bin from the FLASH address after fsbl.out, obtain bit stream header information, initiate DMA request, and move the bit stream from the FLASH to DDR address r_addr3.

[0080] 14) Call gunzip to read the root file system at r_addr2, decompress to specific address s_addr2.

[0081] 15) After decompression, check whether DMA transmission is completed, if not, wait for transmission to complete.

[0082] 16) If DMA transmission is completed, initiate DMA request again, move the device tree from the selected address in the FLASH to DDR address s_addr3, and wait for DMA transmission to complete.

[0083] 17) Continue to parse BOOT.bin from the FLASH address after the bit stream, obtain ELF executable file header information, initiate DMA request, copy u-boot to r_addr4, and wait for DMA transmission to complete.

[0084] 18) Preferentially, compress the bit stream of the FPGA.

[0085] 19) Re-locate the CPU program loading address to r_addr4, and perform jump, exit FSBL and enter u-boot.

[0086] 20) U-boot stage:

[0087] 21) Initialize peripheral controllers, including serial port, network, and peripheral switch configuration.

[0088] 22) Configure bootdelay to 0;

[0089] 23) Configure bootargs to configure kernel print level loglevel = 0;

[0090] 24) Since zImage has been decompressed at this time, the detection of zImage compression header information in do_bootz is removed.

[0091] 25) In uboot, s_addr1 is used as the kernel entry address, s_addr3 is used as the device tree loading address, s_addr2 is used as the root file system loading address, uboot is ended, and the kernel is jumped to.

[0092] 26) Preferably, the root file system is trimmed to remove redundant service options.

[0093] 27) Kernel running stage:

[0094] 28) Kernel running stage, skipping the part of decompressing the kernel, directly loading the complete Linux kernel image at s_addr1.

[0095] 29) The kernel parses the device tree at s_addr3, initializes peripheral driver and network protocol stack.

[0096] 30) Preferably, the kernel removes the peripheral switch configuration completed by uboot.

[0097] 31) The kernel directly mounts the root file system at s_addr2.

[0098] 32) Enter Linux system.

[0099] 33) Preferably, the system services can be arranged for specific needs in the / etc / rcS initialization script of the root file system.

[0100] 34) The total time for the example from power-on to the completion of Linux system running and the realization of normal udp communication of the network is 2.45s.

[0101] Working principle: The CPU end has a built-in DMA controller, which is designed in the CPU boot program to read the program file of the storage medium in DMA mode. The DMA reads the kernel compressed image, the DMA reads the root file system, and the CPU synchronously decompresses the kernel compressed image to a specific address s_addr1. The DMA reads the bit stream file, and the CPU synchronously decompresses the root file system to address s_addr2, DMA reads the device tree to address s_addr3, directly runs the kernel at s_addr1 by skipping decompression, and mounts the root file system at s_addr2, which can greatly shorten the time of Linux startup of CPU-FPGA heterogeneous platform.

[0102] It will be obvious to a person skilled in the art that the application is not limited to the details of the foregoing exemplary embodiments and can be implemented in other concrete forms without departing from the spirit or essential characteristics of the application. The embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. No reference signs in the claims should be considered as limiting the scope of the claims to the identity of the reference signs therein.

[0103] Furthermore, it should be understood that although the description is made on the basis of the embodiments, not every embodiment contains only one independent technical solution, and the description of the specification is only for the sake of clarity, and those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that those skilled in the art can understand.

Claims

1. A fast boot method for a Linux system on a CPU-FPGA platform, characterized in that: This includes CPU-FPGA platforms and Linux systems; The CPU-FPGA platform includes a CPU and an FPGA: the CPU has a DMA controller, a QSPI controller and a DDR controller; the CPU has a 16MB FLASH chip connected to it via the QSPI controller, which stores the FSBL, logical bit stream, uboot, Linux kernel and root file system program; the DDR controller has an external DDR chip connected to it for running programs. The Linux system operation includes at least a BootLoader, a kernel image, a device tree, and a root file system; The fast startup method includes the following steps: Step 1: Read the kernel zImage compressed image, device tree, and root file system from the FSBL; Step one specifically includes: 1) Enable the DMA controller in FSBL and use the DMA controller to take over the QSPI bus instead of the CPU; 2) Use DMA to move the zImage image, device tree, root file system, bit stream, and uboot to a specific address in DDR; 3) DMA is used to synchronously decompress the kernel compressed image to a specific address when moving the root file system; 4) When moving bit stream files using DMA, the CPU simultaneously decompresses the root file system to a specific address; Step 2: Decompress the zImage compressed image and root file system in FSBL; Step two specifically includes: 1) In uboot, QSPI initialization is disabled, and the environment variable contents are compiled into uboot; 2) The check on the kernel image compression header is skipped in uboot; 3) U-Boot skips the 64-bit header information verification of the root file system; 4) In uboot, the decompressed kernel image and root file system are used as the boot address; Step 3: Optimize uboot, and load the kernel during the uboot startup phase based on the zImage address, device tree, and root file system address decompressed in FSBL; Step three specifically includes: 1) Disable the kernel CONFIG_DEBUG_FS, nfs, and xfs modules to reduce the kernel image size; 2) Eliminate kernel initialization of peripheral network switches and PHYs to speed up network setup time; 3) The kernel skips the decompression of the root file system and mounts the root file system directly; 4) In uboot, s_addr1 is used as the kernel entry address, s_addr3 as the device tree loading address, and s_addr2 as the root file system loading address. Then uboot ends and jumps to the kernel. Step 4: Optimize the kernel by directly reading and loading the decompressed zImage kernel during the kernel loading phase; 1) During the kernel runtime phase, the kernel decompression process is skipped, and the complete Linux kernel image is loaded directly at s_addr1; 2) The kernel parses the device tree at s_addr3 and initializes peripheral drivers and the network protocol stack; 3) Remove the peripheral switch configurations already completed by uboot from the kernel; 4) The kernel directly mounts the root file system at s_addr2.

2. The fast startup method according to claim 1, characterized in that: The CPU-FPGA platform has two levels of BootLoader: FSBL and uboot.

3. The fast startup method according to claim 2, characterized in that: The CPU-FPGA platform first loads the FPGA bit stream during the FSBL stage, then loads uboot into DDR, and then jumps to the uboot entry point. During the uboot stage, the zImage image, device tree, and root file system are loaded into DDR. In the kernel stage, the image is self-decompressed and then re-run. After parsing the device tree and initializing the driver, the root file system is decompressed and finally mounted to enter the kernel.

Citation Information

Patent Citations

  • Linux system booting method and system

    CN106126241A

  • System for rapidly starting Linux core in field programmable gate array (FPGA) environment and starting method

    CN106598652A