System starting method and device, electronic equipment and storage medium
By using a first flash memory that supports updating the initial boot code, the preloaded code is migrated to static memory, and the target code and components are migrated in stages. This solves the problems of poor hardware compatibility and extended time during the startup process of embedded systems, and improves the consistency and reliability of system startup.
Patent Information
- Application Number
- CN202511737479.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-03-27
AI Technical Summary
In the prior art, the boot process of embedded systems relies on read-only memory, which results in poor hardware compatibility and prolonged boot time, and makes it impossible to flexibly update the initial boot code.
By leveraging the feature of the first flash memory to support updating the initial boot code, the preloaded code is migrated to static storage. Furthermore, by parsing and migrating the target code and components to static and dynamic storage in stages, the consistency and reliability of system startup are improved.
It improves the maintainability of the system startup code, shortens startup time, and enhances the consistency and reliability of system startup.
Smart Images

Figure CN121744323A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method and apparatus for system startup, electronic equipment, and storage medium. Background Technology
[0002] Embedded systems are widely used in fields such as artificial intelligence computing boards and embedded development equipment. Their startup process requires hardware initialization and firmware loading to enable the system to run normally. This process usually relies on the cooperation of storage media and bus interface, and is a fundamental link for embedded systems to realize their functions.
[0003] In related technologies, an architecture combining read-only memory (ROM) and a high-speed serial bus standard is used for embedded system booting. During the boot phase, initialization is completed through ROM. After initialization, the host server sends the firmware required for subsequent booting to the embedded system through the high-speed serial bus standard interface. However, the contents of the ROM cannot be updated or modified after tape-out, thus making it unsuitable for new hardware. In addition, after initialization, sending the firmware required for subsequent booting to the embedded system through the high-speed serial bus standard interface requires waiting for the host server driver to load and transmit, resulting in an extension of the overall boot time. Summary of the Invention
[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for system startup to solve problems in related technologies. By leveraging the feature of a first flash memory that supports updating the initial boot code, the initial boot code can be updated, improving the maintainability of the system startup base code. By migrating preloaded code, target code, and components to static and / or dynamic memory in stages, the startup process is promoted in an orderly manner, improving the coherence and reliability of system startup.
[0005] According to a first aspect embodiment of this disclosure, a method for system startup is provided, comprising: In response to the execution of the initial boot code in the first flash memory, the preloaded code in the first flash memory is migrated to static memory; wherein the first flash memory supports updates to the initial boot code; Execute the initialization operation corresponding to the preloaded code in the static memory; In response to the completion of the initialization operation, the firmware package stored in the second flash memory is parsed to obtain the target code and target components in the firmware package; The target code and the target components are migrated to the static memory and / or dynamic memory to start the system.
[0006] In some embodiments, migrating preloaded code in the first flash memory to static memory in response to executing initial boot code in the first flash memory includes: The first flash memory is divided into a first storage area and a second storage area; wherein, the first storage area is used to store the initial boot code, and the second storage area is used to store the preload code; The initialization boot code in the first storage area is executed. After the initialization boot code is executed, the preload code in the second storage area is migrated to the static memory.
[0007] In some embodiments, performing the initialization operation corresponding to the preloaded code in the static memory includes: The preloaded code is executed in the static memory; Configure a peripheral controller for the static memory, and perform clock initialization, serial interface controller initialization and other peripheral initialization through the peripheral controller; wherein the initialization operation includes at least the clock initialization, the serial interface controller initialization and the other peripheral initialization.
[0008] In some embodiments, the step of parsing the firmware package stored in the second flash memory in response to the completion of the initialization operation to obtain the target code and target components in the firmware package includes: After the initialization operation is completed, the firmware package stored in the second flash memory is parsed to obtain the second-stage boot code, the third-stage security code, the boot loader, the operating system kernel, and the simplified file system; The target code includes at least the second-stage boot code and the third-stage security code, and the target components include at least the bootloader, the operating system kernel, and the simplified file system.
[0009] In some embodiments, migrating the target code and the target component to the static memory and / or dynamic memory to start system operation includes: The second-stage boot code is migrated to the static memory device; The third-stage security code, the bootloader, the operating system kernel, and the streamlined file system are migrated to the dynamic memory to start the system.
[0010] In some embodiments, after migrating the target code and the target component to the static memory and / or dynamic memory to start system operation, the method further includes: Obtain the complete file system from the host and switch the thin file system in the component to the complete file system; Execute the driver module in the full file system and unload the thin file system.
[0011] According to a second aspect of this disclosure, a system startup apparatus is provided, comprising: A first migration unit is configured to migrate preloaded code in the first flash memory to static memory in response to the execution of initial boot code in the first flash memory; wherein the first flash memory supports updates to the initial boot code; The first execution unit is used to execute the initialization operation corresponding to the preloaded code in the static memory; The parsing unit is configured to, in response to the end of the initialization operation, parse the firmware package stored in the second flash memory to obtain the target code and target components in the firmware package; The second migration unit is used to migrate the target code and the target components to the static memory and / or dynamic memory to start the system.
[0012] In some embodiments, the first migration unit includes: A partitioning module is used to divide the first flash memory into a first storage area and a second storage area; wherein, the first storage area is used to store the initial boot code, and the second storage area is used to store the preload code; An execution module is used to execute the initialization boot code in the first storage area, and after the initialization boot code is executed, to migrate the preload code in the second storage area to the static memory.
[0013] In some embodiments, the first execution unit includes: The runtime module is used to run the preloaded code in the static memory; A configuration module is used to configure a peripheral controller for the static memory, and to perform clock initialization, serial interface controller initialization and other peripheral initialization through the peripheral controller; wherein the initialization operation includes at least the clock initialization, the serial interface controller initialization and the other peripheral initialization.
[0014] In some embodiments, the parsing unit is further configured to parse the firmware package stored in the second flash memory after the initialization operation is completed, to obtain the second-stage boot code, the third-stage security code, the bootloader, the operating system kernel, and the simplified file system; The target code includes at least the second-stage boot code and the third-stage security code, and the target components include at least the bootloader, the operating system kernel, and the simplified file system.
[0015] In some embodiments, the second migration unit includes: The first migration module is used to migrate the second-stage boot code to the static memory. The second migration module is used to migrate the third-stage security code, the bootloader, the operating system kernel, and the streamlined file system to the dynamic memory to start the system.
[0016] In some embodiments, the apparatus further includes: The switching unit is used to migrate the target code and the target component to the static memory and / or dynamic memory in the second migration unit so that after the system starts running, it can obtain a complete file system from the host and switch the simplified file system in the component to a complete file system. The second execution unit is used to execute the driver module in the complete file system and unload the simplified file system.
[0017] According to a third aspect of this disclosure, an electronic device is provided, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect embodiment.
[0018] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect of the present disclosure.
[0019] According to a fifth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described in the first aspect of the preceding embodiments.
[0020] In summary, this disclosure provides a system boot method, apparatus, electronic device, and storage medium. The method includes: migrating preloaded code in a first flash memory to a static memory in response to executing initial boot code in a first flash memory; wherein the first flash memory supports updating the initial boot code; performing an initialization operation corresponding to the preloaded code in the static memory; parsing a firmware package stored in a second flash memory in response to the completion of the initialization operation to obtain target code and target components in the firmware package; migrating the target code and target components to the static memory and / or dynamic memory to start system operation; by leveraging the feature of the first flash memory supporting the updating of the initial boot code, the initial boot code can be updated, improving the maintainability of the system boot basic code; and by migrating the preloaded code, target code, and components to the static memory and / or dynamic memory in stages, the boot process is promoted in an orderly manner, improving the coherence and reliability of system boot.
[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0022] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 A flowchart illustrating a system startup method provided in an embodiment of this disclosure; Figure 2 A flowchart illustrating another system startup method provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram illustrating a code migration method provided in an embodiment of this disclosure; Figure 4 A flowchart illustrating another system startup method provided in an embodiment of this disclosure; Figure 5 A flowchart illustrating another system startup method provided in an embodiment of this disclosure; Figure 6 A flowchart illustrating another system startup method provided in an embodiment of this disclosure; Figure 7 This is a schematic diagram illustrating another code migration provided by an embodiment of this disclosure; Figure 8 A flowchart illustrating another system startup method provided in an embodiment of this disclosure; Figure 9 A flowchart illustrating another system startup method provided in an embodiment of this disclosure; Figure 10A flowchart illustrating another system startup method provided in an embodiment of this disclosure; Figure 11 A schematic diagram of a system startup device provided in an embodiment of this disclosure; Figure 12 A schematic diagram of a system startup device provided in an embodiment of this disclosure; Figure 13 A schematic block diagram of an example electronic device provided for embodiments of this disclosure. Detailed Implementation
[0023] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0024] The following description, with reference to the accompanying drawings, outlines a method and apparatus for system startup, an electronic device, and a storage medium according to embodiments of the present disclosure.
[0025] Figure 1 This is a schematic flowchart illustrating a system startup method provided in an embodiment of the present disclosure.
[0026] like Figure 1 As shown, the method includes the following steps: Step 101: In response to executing the initial boot code in the first flash memory, the preloaded code in the first flash memory is migrated to static memory; wherein the first flash memory supports updates to the initial boot code.
[0027] In this embodiment, the first flash memory (such as in-chip execution flash memory, XIP FLASH) has random read characteristics, making it suitable for direct code execution. The initial boot code is the first code executed after the system powers on, used to trigger the initial stage of the boot process, such as completing basic processor initialization and establishing a simplified operating environment. The preloaded code is boot code with richer functionality than the initial boot code, used to support complex initialization operations. Static memory does not require refresh operations, has fast read and write speeds, and is suitable for running code with high response speed requirements, such as static random-access memory (SRAM). When the system powers on, the initial boot code is read from and executed from the first flash memory. During execution, the initial boot code triggers a data migration instruction, transferring the preloaded code stored in the first flash memory to the static memory via the system bus. The first flash memory supports updating the initial boot code and can receive external update data through a preset communication interface (such as SPI interface, I2C interface, etc.) to write the new initial boot code into the original storage area, thereby updating the initial boot logic. It should be noted that the above examples are merely illustrative and do not limit the specific content.
[0028] Step 102: Perform the initialization operation corresponding to the preloaded code in the static memory.
[0029] When the preloaded code in static memory is executed, it triggers a series of initialization operations. These initialization operations aim to establish the hardware foundation for the subsequent parsing and loading of the firmware package. Initialization operations may include configuring the system clock, such as setting the frequency and timing relationship of the processor core clock and peripheral clocks to ensure that each hardware module works in coordination according to a preset rhythm. They may also include initializing the serial interface controller, such as the SPI controller, by configuring its data transmission mode, baud rate, chip select signal and other parameters to enable it to establish a communication connection with the second flash memory. In addition, they may include initializing other peripherals (such as UART controllers, interrupt controllers, etc.) to improve the system's basic input / output capabilities and exception response mechanisms. These initialization operations are all implemented by the preloaded code by reading and writing the control registers of the corresponding hardware, so that the hardware module switches from the power-on default state to the working state adapted to the boot process.
[0030] Step 103: In response to the end of the initialization operation, parse the firmware package stored in the second flash memory to obtain the target code and target components in the firmware package.
[0031] The second flash memory (such as SPI Flash) has a large capacity, making it suitable for storing firmware packages containing the content required for multiple boot stages. The firmware package is a collection of packaged files containing the code and functional components required for each stage of system boot. The firmware package can be packaged in common compressed formats (such as tar, zip, etc.). After the initialization operation is completed, the preloaded code or its triggered control logic will establish data interaction with the second flash memory through the initialized serial interface (such as SPI interface, etc.), read the corresponding data in the firmware package, and parse it. The parsing process includes, but is not limited to, verifying the integrity of the firmware package, unpacking it to obtain the target code and target components contained inside. The target code includes, but is not limited to, the boot code of different stages, and the target components include, but are not limited to, the boot loader, the operating system kernel, the root file system, etc.
[0032] Step 104: Migrate the target code and the target component to the static memory and / or dynamic memory to start the system.
[0033] Dynamic memory (such as Double Data Rate Synchronous Dynamic Random Access Memory, DDR) has a large capacity, making it suitable for storing and running large code and components. Depending on the characteristics and operational requirements of the target code and components, they are migrated to different storage locations. For example, target code with high speed requirements and small size (such as a certain stage of boot code) can be migrated to static memory (such as SRAM) to improve execution efficiency; while large target components (such as the operating system kernel and root file system) and some target code are migrated to dynamic memory (such as DDR). The migration process is implemented through the system bus (such as PCIe), with the loaded boot code controlling the data transfer from the secondary flash memory to the target memory. After the target code and components have been migrated, they are executed in a preset order, for example, executing the boot code at each stage sequentially, starting the operating system kernel, and finally completing the system startup and operation. It should be noted that the above examples are merely illustrative and do not limit the specific content.
[0034] By utilizing the first flash memory's ability to update the initial boot code, the initial startup logic can be flexibly updated. By migrating the target code and components to static and / or dynamic memory in stages, combined with hardware initialization operations, the system startup process can be advanced in an orderly manner, ensuring the stable operation of the system from power-on to running.
[0035] In summary, this disclosure provides a system startup method, which includes: migrating preloaded code in the first flash memory to static memory in response to executing initial boot code in the first flash memory; wherein the first flash memory supports updating the initial boot code; performing an initialization operation corresponding to the preloaded code in the static memory; parsing a firmware package stored in a second flash memory in response to the completion of the initialization operation to obtain target code and target components in the firmware package; migrating the target code and target components to static memory and / or dynamic memory to start system operation; by leveraging the feature of the first flash memory supporting the updating of the initial boot code, the initial boot code can be updated, improving the maintainability of the system startup basic code; and by migrating the preloaded code, target code, and components to static memory and / or dynamic memory in stages, the startup process is promoted in an orderly manner, improving the coherence and reliability of system startup.
[0036] Figure 2 A flowchart illustrating a system startup method provided in an embodiment of this disclosure is further shown. Based on Figure 1 The illustrated embodiment further explains step 101. Figure 2 This may include the following steps: Step 201: Divide the first flash memory into a first storage area and a second storage area; wherein the first storage area is used to store the initial boot code and the second storage area is used to store the preload code.
[0037] The first flash memory can be divided into two independent storage areas, a first storage area and a second storage area, through a preset partitioning mechanism. The partitioning method includes, but is not limited to, static partitioning based on address ranges. For example, if the total address space of the first flash memory is 0x00000000 to 0x00100000, 0x00000000 to 0x0001FFFF can be defined as the first storage area, and 0x00020000 to 0x0009FFFF as the second storage area. The remaining address space can be reserved for backup or used to store other auxiliary data. This partitioning is implemented through the firmware configuration of the first flash memory, ensuring that the first and second storage areas are physically isolated from each other, each independently storing its corresponding code. The capacity of the first storage area is determined based on the size of the initial boot code, typically only needing to satisfy the storage of a simplified initial boot logic. The capacity of the second storage area is adapted to the size of the preloaded code to ensure its complete storage. It should be noted that the above examples are merely illustrative and do not limit the specific content.
[0038] Step 202: Execute the initialization boot code in the first storage area. After the initialization boot code is executed, migrate the preload code in the second storage area to the static memory.
[0039] During the execution of the initial boot code, basic initialization is completed, such as configuring the processor's operating mode, disabling unnecessary interrupts, and initializing registers to establish the simplest possible operating environment. When the initial boot code reaches a preset end instruction (such as a jump instruction or flag setting), its execution is considered complete. At this point, the initial boot code triggers data migration logic, reading the binary data of the preloaded code according to the address range of the second storage area via the system's internal data bus, and continuously writing the preloaded code into a preset address space in static memory (such as SRAM) (e.g., from 0x20000000 to 0x2000FFFF). During the migration, the data length is verified to ensure the complete transmission of the preloaded code. After the migration is complete, the processor's execution pointer will point to the starting address of the preloaded code in static memory, preparing for subsequent execution. It should be noted that the above example is for illustrative purposes only and does not limit the specific content.
[0040] The first flash memory is divided into independent areas to store the initial boot code and the preload code respectively, which realizes the physical isolation and orderly management of the two types of code; the execution result of the initial boot code triggers the migration of the preload code, ensuring the phased and continuous nature of the startup process.
[0041] In some embodiments, Figure 3 The diagram illustrates the code migration provided in this embodiment. The first flash memory supports direct code execution and is divided into two regions: a first storage region containing the initial boot code and a second storage region containing the preloaded code. Static memory is the target storage medium for code migration. After the system is powered on, the initial boot code is executed from the first flash memory. During the execution of the initial boot code, the preloaded code stored in the first flash memory is migrated to the static memory via the system bus.
[0042] In some embodiments, Figure 4 The present invention illustrates a flowchart of a system startup method provided in an embodiment of the present disclosure, wherein the initial boot code in the first flash memory is executed, registers are configured during execution, a link for establishing a system bus is triggered, the preloaded code in the first flash memory is migrated to static memory, and the preloaded code is executed in static memory.
[0043] Figure 5 A flowchart illustrating a system startup method provided in an embodiment of this disclosure is further shown. Based on Figure 1 The illustrated embodiment further explains step 102. Figure 5 This may include the following steps: Step 301: Run the preloaded code in the static memory.
[0044] The static memory has a fixed address space. The preloaded code is migrated from the first flash memory to a preset region of the address space (such as from 0x20000000 to 0x2000FFFF). After the preloaded code has completed the migration, it starts from the starting address of the preset region and begins to read and execute the instructions of the preloaded code from the static memory.
[0045] Step 302: Configure a peripheral controller for the static memory, and perform clock initialization, serial interface controller initialization and other peripheral initialization through the peripheral controller; wherein the initialization operation includes at least the clock initialization, the serial interface controller initialization and the other peripheral initialization.
[0046] The peripheral controller is an intermediate control module connecting the processor and external devices. It is responsible for coordinating data transmission and control signal interaction between the processor and peripherals. The peripheral controller can be integrated into the processor or exist as a separate hardware module. For static memory (SRAM), the peripheral controller is configured by writing configuration parameters to its control registers through preloaded code, establishing a communication link between the SRAM and the peripheral controller, and ensuring that initialization instructions can be transmitted to the target peripheral through the peripheral controller. During clock initialization, the peripheral controller configures the system clock module registers according to the instructions in the preloaded code, setting the clock source, divider, and timing parameters to ensure that the processor core clock and peripheral operating clock reach the preset frequencies, guaranteeing timing matching of each hardware module. When the serial interface controller (such as the SPI controller) is initialized, the peripheral controller configures parameters to enable the serial interface to interact with the second flash memory according to a preset protocol. Other peripheral initializations (such as the UART controller initialization) establish serial communication links.
[0047] Running preloaded code in static memory and combining it with peripheral controllers to perform hardware initialization not only utilizes the high-speed characteristics of static memory to ensure code execution efficiency, but also coordinates the initialization process of each peripheral through peripheral controllers, ensuring that peripheral controllers complete the configuration according to preset logic.
[0048] Figure 6 A flowchart illustrating a system startup method provided in an embodiment of this disclosure is further shown. Based on Figure 1 The embodiment shown, Figure 6 This may include the following steps: Step 401: After the initialization operation is completed, the firmware package stored in the second flash memory is parsed to obtain the second-stage boot code (e.g., BL2), the third-stage security code (e.g., BL31), the bootloader (e.g., uboot), the operating system kernel (e.g., Kernel), and the simplified file system (e.g., a simplified rootfs); wherein, the target code includes at least the second-stage boot code and the third-stage security code, and the target components include at least the bootloader, the operating system kernel, and the simplified file system.
[0049] The firmware package stored in the second flash memory (such as SPI Flash) is a packaged binary file. The second flash memory contains multiple independent sub-files. After the initialization operation is completed, the preload code sends a read command to the second flash memory through the initialized serial interface (such as the SPI interface) to read the complete data into a temporary buffer (which can be located in the initialization area of static memory or dynamic memory) according to the storage address range of the firmware package. During the parsing process, the verification information of the firmware package is first verified to confirm that the data has not been tampered with or damaged. Then, each sub-file is parsed according to the file index table. Among them, the second-stage boot code is used to receive the preload code and execute more in-depth system initialization code, and the third-stage security code is the code involved in system security startup (such as permission verification, encryption and decryption). Both of these belong to the target code. The boot loader is a functional module used to boot the operating system kernel. The operating system kernel is a program that manages the system's hardware and software resources. The simplified file system is a small file system containing basic system functions. All three belong to the target components. The parsed target code and target components are temporarily stored in the buffer, waiting for subsequent migration.
[0050] Step 402: Migrate the second-stage boot code to the static memory.
[0051] Static memory (such as SRAM) is suitable for storing and running small but high-efficiency code due to its fast read and write speed and lack of refresh requirements. The second-stage boot code is usually compact (e.g., no more than a few hundred KB) and is therefore migrated to the free address region of static memory (e.g., from 0x20010000 to 0x2001FFFF). The migration process is dominated by the preloaded code or its triggered control logic. The second-stage boot code data is read from the buffer via the system bus and written to the target region of static memory in address order. At the same time, the integrity of the migration is ensured by comparing the data length.
[0052] Step 403: Migrate the third-stage security code, the bootloader, the operating system kernel, and the streamlined file system to the dynamic memory to start the system.
[0053] In some embodiments, the third-stage security code, bootloader, operating system kernel, and streamlined file system are typically large (e.g., from several MB to tens of MB). Therefore, they are migrated to a preset address space in dynamic memory (e.g., from 0x80000000 to 0x8FFFFFFF). During the migration, the executed second-stage boot code controls the data transfer. Through the initialized dynamic memory controller, the target code and target components in the buffer are written sequentially to the corresponding areas of dynamic memory. A verification mechanism can be used during the transfer to ensure data accuracy. After the migration is completed, the system executes the target code and target components in a preset order: first, the third-stage security code is executed to complete security verification; then, the bootloader is run to configure the operating system boot parameters; subsequently, the bootloader loads and decompresses the operating system kernel; and finally, the streamlined file system is mounted, enabling the operating system kernel to access basic files and drivers, thereby completing the system startup and operation.
[0054] The firmware package is parsed into target code and target components, and then migrated to static memory and dynamic memory respectively according to their characteristics. This not only utilizes the high-speed characteristics of static memory to ensure the execution efficiency of the boot code, but also leverages the large capacity of dynamic memory to accommodate large target components, thus achieving the orderly progress of the boot process and the stable startup of the system.
[0055] Figure 7 This is a schematic diagram of another code migration provided in an embodiment of this disclosure. Dynamic memory and static memory are the target storage media for the migration of target code and components, and the second flash memory is the storage medium for the firmware package. The second flash memory stores the firmware package (including second-stage boot code, third-stage security code, bootloader, operating system kernel, simplified file system, etc.). During migration, the second-stage boot code, preloaded code, etc. are migrated to static memory; the third-stage security code, bootloader, operating system kernel, simplified file system, etc. are migrated to dynamic memory, thereby allocating suitable storage resources for the operation of target code and target components after system startup, ensuring the efficiency and stability of system operation.
[0056] Figure 8 This is a flowchart illustrating another system startup method provided in this embodiment of the present disclosure, which involves migrating the second-stage boot code to static memory, migrating the third-stage security code to dynamic memory, migrating the bootloader to dynamic memory, migrating the operating system kernel to dynamic memory, migrating the simplified file system to dynamic memory, and then entering the complete file system.
[0057] Figure 9 A flowchart illustrating a system startup method provided in an embodiment of this disclosure is further shown. Based on Figure 1 The embodiment shown, Figure 9This may include the following steps: Step 501: Obtain the complete file system from the host and switch the simplified file system in the component to the complete file system.
[0058] Compared to a simplified file system, a complete file system contains more applications, driver modules, configuration files, and user data, enabling the system to implement more complex business functions. During the process of obtaining a complete file system from the host, the system establishes a data connection with the host through a preset communication module and receives the complete file system sent by the host using a preset transmission protocol.
[0059] Step 502: Execute the driver module in the complete file system and unload the simplified file system.
[0060] The driver modules for the full file system are stored in a preset driver directory, containing drivers that support more peripherals. After the system switches from the thin file system to the full file system, it scans and loads the driver modules according to preset rules. By executing the driver modules, a communication link is established between the kernel and the corresponding peripheral, enabling the peripheral to be recognized and controlled by the system. When unloading the thin file system, the system first terminates all processes that depend on the thin file system. After ensuring that there are no data read / write operations, it removes the mount point of the thin file system through the unload command, releasing the dynamic memory space and related system resources it occupies, thus avoiding resource waste.
[0061] Obtaining and switching from the host to the full file system expands the system's functional support scope; the driver module that executes the full file system can adapt to more peripherals, while unloading the thin file system releases storage resources, thereby improving the system's business capabilities and resource utilization efficiency while ensuring the system's basic startup.
[0062] Figure 10 This is a flowchart illustrating another system startup method provided in this embodiment of the present disclosure. The system checks whether a complete file system has been distributed. If no complete file system is found, the system continues to check. If a complete file system is found, the system switches from the simplified file system to the complete file system, unloads the simplified file system, and starts the complete business functions based on the complete file system.
[0063] The present disclosure of embodiments may also have the following beneficial effects: 1. Enhanced flexibility: The first flash memory is reprogrammable and supports dynamic adjustment of register configuration, solving the problem of read-only memory being fixed.
[0064] 2. Boot acceleration: Critical firmware (such as BL2 / BL31 / Kernel) is loaded from the second flash memory, avoiding transmission delays via the high-speed serial interface.
[0065] 3. Decoupling of storage and driver: The second flash memory only stores a simplified file system, which can greatly save the space of the second flash memory. The complete file system is dynamically distributed by the host. When the operating system kernel remains unchanged, there is no need to update the second flash memory, reducing the number of write cycles and extending the life of the second flash memory.
[0066] 4. Optimized development efficiency: Driver and application iterations only require updating the complete file system corresponding to the host, without re-burning the board firmware.
[0067] Corresponding to the system startup method described above, the present invention also proposes a system startup apparatus. Since the apparatus embodiments of the present invention correspond to the method embodiments described above, details not disclosed in the apparatus embodiments can be referred to the method embodiments described above, and will not be repeated here.
[0068] Figure 11 This is a schematic diagram of the structure of a system startup device provided in an embodiment of the present disclosure, as shown below. Figure 11 As shown, it includes: a first migration unit 51, a first execution unit 52, a parsing unit 53, and a second migration unit 54.
[0069] The first migration unit 51 is configured to migrate preloaded code in the first flash memory to static memory in response to the execution of initial boot code in the first flash memory; wherein the first flash memory supports updates to the initial boot code; The first execution unit 52 is used to execute the initialization operation corresponding to the preloaded code in the static memory; The parsing unit 53 is used to parse the firmware package stored in the second flash memory in response to the end of the initialization operation, and obtain the target code and target components in the firmware package; The second migration unit 54 is used to migrate the target code and the target components to the static memory and / or dynamic memory to start the system.
[0070] In summary, this disclosure provides a system booting apparatus, comprising: migrating preloaded code in a first flash memory to a static memory in response to executing initial boot code in a first flash memory; wherein the first flash memory supports updating the initial boot code; executing an initialization operation corresponding to the preloaded code in the static memory; parsing a firmware package stored in a second flash memory in response to the completion of the initialization operation to obtain target code and target components in the firmware package; migrating the target code and target components to the static memory and / or dynamic memory to start system operation; by leveraging the feature of the first flash memory supporting the updating of the initial boot code, the initial boot code can be updated, improving the maintainability of the system boot base code; and by migrating the preloaded code, target code, and components to the static memory and / or dynamic memory in stages, the boot process is promoted in an orderly manner, improving the coherence and reliability of system booting.
[0071] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 12 As shown, the first migration unit 51 includes: The partitioning module 511 is used to divide the first flash memory into a first storage area and a second storage area; wherein, the first storage area is used to store the initial boot code, and the second storage area is used to store the preload code; The execution module 512 is used to execute the initialization boot code in the first storage area, and after the initialization boot code is executed, to migrate the preload code in the second storage area to the static memory.
[0072] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 12 As shown, the first execution unit 52 includes: Run module 521 is used to run the preloaded code in the static memory; Configuration module 522 is used to configure a peripheral controller for the static memory, and to perform clock initialization, serial interface controller initialization and other peripheral initialization through the peripheral controller; wherein the initialization operation includes at least the clock initialization, the serial interface controller initialization and the other peripheral initialization.
[0073] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 12 As shown, the parsing unit 53 is further configured to parse the firmware package stored in the second flash memory after the initialization operation is completed, and obtain the second-stage boot code, the third-stage security code, the boot loader, the operating system kernel, and the simplified file system. The target code includes at least the second-stage boot code and the third-stage security code, and the target components include at least the bootloader, the operating system kernel, and the simplified file system.
[0074] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 12 As shown, the second migration unit 54 includes: The first migration module 541 is used to migrate the second-stage boot code to the static memory. The second migration module 542 is used to migrate the third-stage security code, the bootloader, the operating system kernel, and the streamlined file system to the dynamic memory to start the system.
[0075] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 12 As shown, the device further includes: The switching unit 55 is used to obtain a complete file system from the host after the second migration unit 54 migrates the target code and the target component to the static memory and / or dynamic memory to start the system, and then switches the simplified file system in the component to a complete file system. The second execution unit 56 is used to execute the driver module in the complete file system and unload the simplified file system.
[0076] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of the embodiments of this disclosure, and the principle is the same. Therefore, the embodiments of this disclosure are not limited thereto.
[0077] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0078] Figure 13 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0079] like Figure 13 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 602 or loaded from storage unit 608 into RAM (Random Access Memory) 603. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604.
[0080] Multiple components in electronic device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows electronic device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0081] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the system startup method. For example, in some embodiments, the system startup method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the aforementioned system startup method by any other suitable means (e.g., by means of firmware).
[0082] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0083] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0084] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0085] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0086] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0087] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0088] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0089] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0090] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for system startup, characterized in that, The method includes: In response to the execution of the initial boot code in the first flash memory, the preloaded code in the first flash memory is migrated to static memory; wherein the first flash memory supports updates to the initial boot code; Execute the initialization operation corresponding to the preloaded code in the static memory; In response to the completion of the initialization operation, the firmware package stored in the second flash memory is parsed to obtain the target code and target components in the firmware package; The target code and the target components are migrated to the static memory and / or dynamic memory to start the system.
2. The method according to claim 1, characterized in that, The step of migrating the preloaded code in the first flash memory to static memory in response to executing the initial boot code in the first flash memory includes: The first flash memory is divided into a first storage area and a second storage area; wherein, the first storage area is used to store the initial boot code, and the second storage area is used to store the preload code; The initialization boot code in the first storage area is executed. After the initialization boot code is executed, the preload code in the second storage area is migrated to the static memory.
3. The method according to claim 1, characterized in that, The initialization operation corresponding to the preloaded code in the static memory includes: The preloaded code is executed in the static memory; Configure a peripheral controller for the static memory, and perform clock initialization, serial interface controller initialization and other peripheral initialization through the peripheral controller; wherein the initialization operation includes at least the clock initialization, the serial interface controller initialization and the other peripheral initialization.
4. The method according to claim 1, characterized in that, In response to the completion of the initialization operation, the firmware package stored in the second flash memory is parsed to obtain the target code and target components in the firmware package, including: After the initialization operation is completed, the firmware package stored in the second flash memory is parsed to obtain the second-stage boot code, the third-stage security code, the boot loader, the operating system kernel, and the simplified file system; The target code includes at least the second-stage boot code and the third-stage security code, and the target components include at least the bootloader, the operating system kernel, and the simplified file system.
5. The method according to claim 4, characterized in that, The step of migrating the target code and the target components to the static memory and / or dynamic memory to start system operation includes: The second-stage boot code is migrated to the static memory device; The third-stage security code, the bootloader, the operating system kernel, and the streamlined file system are migrated to the dynamic memory to start the system.
6. The method according to claim 1, characterized in that, After migrating the target code and the target component to the static memory and / or dynamic memory to start the system, the method further includes: Obtain the complete file system from the host and switch the thin file system in the component to the complete file system; Execute the driver module in the full file system and unload the thin file system.
7. A device for system startup, characterized in that, The device includes: A first migration unit is configured to migrate preloaded code in the first flash memory to static memory in response to the execution of initial boot code in the first flash memory; wherein the first flash memory supports updates to the initial boot code; The first execution unit is used to execute the initialization operation corresponding to the preloaded code in the static memory; The parsing unit is configured to, in response to the end of the initialization operation, parse the firmware package stored in the second flash memory to obtain the target code and target components in the firmware package; The second migration unit is used to migrate the target code and the target components to the static memory and / or dynamic memory to start the system.
8. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.