CN116700807A - Optimized starting method, device, equipment and medium for embedded system - Google Patents

Optimized starting method, device, equipment and medium for embedded system Download PDF

Info

Publication number
CN116700807A
CN116700807A CN202310667901.5A CN202310667901A CN116700807A CN 116700807 A CN116700807 A CN 116700807A CN 202310667901 A CN202310667901 A CN 202310667901A CN 116700807 A CN116700807 A CN 116700807A
Authority
CN
China
Prior art keywords
memory
reserved memory
determining
embedded system
capacity value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310667901.5A
Other languages
Chinese (zh)
Inventor
康克勤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ecarx Hubei Tech Co Ltd
Original Assignee
Ecarx Hubei Tech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ecarx Hubei Tech Co Ltd filed Critical Ecarx Hubei Tech Co Ltd
Priority to CN202310667901.5A priority Critical patent/CN116700807A/en
Publication of CN116700807A publication Critical patent/CN116700807A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses an optimized starting method, device, equipment and medium of an embedded system. The method comprises the following steps: the embedded system is powered on, the embedded system is initialized through the first bootstrap program, and the second bootstrap program is loaded into the static random access memory; determining a target capacity value of a root file system in the general flash memory through a second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree; determining a memory size value of the reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address; when the kernel of the embedded system is loaded, the memory size value is read through the kernel, and the embedded system is started. The method and the device realize the self-adaptive dynamic adjustment of the reserved memory size required by the root file system, realize the rationality of the memory layout of the embedded system, dynamically expand the size of the root file system and increase the flexibility and the stability of the embedded system.

Description

Optimized starting method, device, equipment and medium for embedded system
Technical Field
The present invention relates to the field of embedded systems, and in particular, to an optimized startup method, apparatus, device, and medium for an embedded system.
Background
The embedded system is composed of hardware and software, and is a device capable of operating independently.
Embedded systems typically consist of a boot, a kernel, a file system, an application, where the boot is a small piece of programming that runs before the operating system is loaded. Through the small program, the basic hardware equipment can be initialized, and a most suitable software and hardware environment is provided for the operation of an operating system. The kernel is the kernel realized by the Linux operating system and mainly comprises memory management, process scheduling and the like. File systems are used to store files, data, etc., such as file systems implemented based on memory: initrd file system and initrimfs file system. An application is an implementation of a specific business function. When the embedded system is powered on, the boot program starts to run, the kernel is guided to load, after the kernel is loaded, the file system is mounted, and finally the reference program is loaded, so that the starting of the embedded system is completed.
However, the file system based on the memory is fixed in size during the startup of the embedded system, and the file system cannot be dynamically expanded. When a user expands the service of the file system and exceeds a preset size, the file system mounted on the linux kernel is abnormal, so that the system cannot be started.
Disclosure of Invention
The invention provides an optimized starting method, device, equipment and medium for an embedded system, which are used for realizing the optimized starting of the embedded system.
According to a first aspect of the present invention, there is provided an optimized startup method of an embedded system, including:
the embedded system is powered on, the first bootstrap program is used for initializing the embedded system, and the second bootstrap program is loaded into the static random access memory;
determining a target capacity value of a root file system in the general flash memory through the second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree;
determining a memory size value of a reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address;
and when the kernel of the embedded system is loaded, reading the memory size value through the kernel, and starting the embedded system.
According to a second aspect of the present invention, there is provided an optimized starting apparatus for an embedded system, including:
the initialization module is used for powering on the embedded system, initializing the embedded system through the first bootstrap program and loading the second bootstrap program into the static random access memory;
the first determining module is used for determining a target capacity value of a root file system in the general flash memory through the second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree;
the second determining module is used for determining a memory size value of the reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address;
and the system starting module is used for reading the memory size value through the kernel when the kernel of the embedded system is loaded, and starting the embedded system.
According to a third aspect of the present invention, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of optimizing startup of the embedded system according to any one of the embodiments of the present invention.
According to a fourth aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute an optimized start-up method of an embedded system according to any one of the embodiments of the present invention.
According to the technical scheme, the embedded system is electrified, the first bootstrap program is used for initializing the embedded system, and the second bootstrap program is loaded into the static random access memory; determining a target capacity value of a root file system in the general flash memory through a second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree; determining a memory size value of the reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address; when the kernel of the embedded system is loaded, the memory size value is read through the kernel, and the embedded system is started. The method and the device realize the self-adaptive dynamic adjustment of the reserved memory size required by the root file system, realize the rationality of the memory layout of the embedded system, dynamically expand the size of the root file system and increase the flexibility and the stability of the embedded system.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of an optimized startup method for an embedded system according to a first embodiment of the present invention;
fig. 2 is a flowchart of an optimized startup method of an embedded system according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an optimized starting device of an embedded system according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device implementing an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of an optimized starting method of an embedded system according to an embodiment of the present invention, where the method may be performed by an optimized starting device of the embedded system, the optimized starting device of the embedded system may be implemented in hardware and/or software, and the optimized starting device of the embedded system may be configured in an electronic device. As shown in fig. 1, the method includes:
s110, powering on the embedded system, initializing the embedded system through the first bootstrap program, and loading the second bootstrap program into the static random access memory.
In this embodiment, the first boot program may be understood as a program for booting the loading system to initialize, for example, bootloader1 in ATF (Arm Trusted Firmware), where ATF is a secure firmware of ARM, ARM is a processor with a reduced instruction set, and ATF is a set of firmware pushed by ARM and used by an ARM 8 architecture processor, where initialization of the SOC platform may be completed by using the firmware, BL1 is a boot program solidified inside the SOC, and ATF may include main startup phases such as BL1/BL21/BL 22. The second boot program may be understood as another boot loader for booting the boot loader system, and may include Bootloader21 and Bootloader22. A Static Random Access Memory is understood to be a Random Access Memory, such as SRAM (Static Random-Access Memory).
Specifically, the embedded system is powered on, the first bootstrap program (such as BL 1) starts to run, which is a program solidified in the SOC, and starts to perform basic initialization operation on the embedded system, and after BL1 loading is completed, the second bootstrap program is booted to start to run and run in the static random access memory in the SOC.
S120, determining a target capacity value of a root file system in the general flash memory through a second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree.
In this embodiment, a general-purpose flash memory can be understood as a flash memory storage device, such as UFS (Universal Flash Storage). The root file system may be understood as the first file system required at kernel start-up, where the kernel code image file is stored, such as ROOTFS. The device tree may be used to hold files of device information, such as DTBs and DTSs, that are present in the system. The target capacity value may be understood as the optimal size value of the root file system. The reserved memory start address may be understood as a start address for designating the reserved memory. The reserved memory end address may be understood as an end address for specifying reserved memory.
Specifically, the related memory can be initialized through the second bootstrap program, global unique identification partition table format partition is carried out on the general flash memory, the partition where the root file system in the general flash memory is located is read into a memory designated address through a corresponding read function, the size value of the root file system in the general flash memory is determined through a corresponding function, and the size value is compared with the maximum system size value preset by the embedded system through a corresponding calculation function, so that the target capacity value is obtained. And reading the equipment tree partition from the universal flash memory to the equipment tree base address designated by the double-rate synchronous dynamic random access memory through a second bootstrap program, waiting for processing the equipment tree data, and determining a reserved memory starting address and a reserved memory ending address according to the equipment tree base address and a corresponding function by the second bootstrap program.
S130, determining the memory size value of the reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address.
In this embodiment, the memory size value may be understood as a value for allocating a reserved memory size, and typically, the linux kernel presets two values to fix the memory size value of the root file system.
Specifically, the second bootstrap program may set the target capacity value to the attribute of the reserved memory starting address and the reserved memory ending address through corresponding functions according to the target capacity value, so that the subsequent kernel may determine the memory size value according to the difference between the two attributes.
And S140, when the kernel of the embedded system is loaded, reading the memory size value through the kernel, and starting the embedded system.
In this embodiment, the kernel may be understood as an operating system implemented in the embedded system using a specific language, which may be a C language. The kernel is used for realizing the process management, the memory management, the file system management and the like of an operating system.
Specifically, the kernel loading start of the embedded system can be guided through UBOOT (Universal Boot Loader), wherein the main function of UBOOT is to initialize a device driver, guide Linux kernel loading, and the kernel can read the memory size value, and reallocate a new reserved memory to load the root file system, so that normal start of the file system is ensured, and further the start of the embedded system is performed, namely, the subsequent start of an application program and the like is continuously completed.
According to the technical scheme, the embedded system is electrified, the first bootstrap program is used for initializing the embedded system, and the second bootstrap program is loaded into the static random access memory; determining a target capacity value of a root file system in the general flash memory through a second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree; determining a memory size value of the reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address; when the kernel of the embedded system is loaded, the memory size value is read through the kernel, and the embedded system is started. The method and the device realize the self-adaptive dynamic adjustment of the reserved memory size required by the root file system, realize the rationality of the memory layout of the embedded system, dynamically expand the size of the root file system and increase the flexibility and the stability of the embedded system.
Example two
Fig. 2 is a flowchart of an optimized startup method of an embedded system according to a second embodiment of the present invention, where the present embodiment is further refined based on the foregoing embodiment. As shown in fig. 2, the method includes:
s201, powering on the embedded system, initializing the embedded system through the first bootstrap program, and loading the second bootstrap program into the static random access memory.
S202, initializing the dynamic random access memory and the general flash memory through a first subprogram in the second bootstrap program.
In the present embodiment, the first subroutine may be understood as a subroutine for initialization, such as BL21 (Bootloader 21), included in the second boot program.
Specifically, the dynamic random access memory (e.g., double Data Rate Dynamic Random Access Memory, DDR) and the general purpose flash memory may be initialized by a first subroutine (BL 21) in the second boot program. Thus, the data in the UFS partition can be read to the DDR for processing in the BL22 stage.
S203, determining a system capacity value of the root file system in the general flash memory through a second subprogram in the second boot program.
In this embodiment, the second sub-program may be understood as another boot loader sub-program included in the second boot program, such as BL22 (Bootloader 22).
Specifically, the system capacity value of the root file system in the general-purpose flash memory may be determined by a second subroutine in the second boot program.
Further, the step of determining the system capacity value of the root file system in the generic flash memory by the second subroutine in the second boot program may be further optimized to include:
a1, carrying out global unique identification partition table format partition on the general flash memory through a second subprogram.
In this embodiment, the globally unique identification partition table may be understood as a standard for extensible firmware interfaces, i.e., GPT (GUID Partition Table).
Specifically, a universal flash memory (UFS) may be formatted for partitioning by a second subroutine according to a globally unique identification partition table (GPT).
b1, reading the partition where the root file system in the general flash memory is located into the memory designated address through a second subprogram.
In this embodiment, the memory specified address may be understood as a preset address.
Specifically, a corresponding read function (such as UFS _read function) may be called by the second subroutine to read the partition where the root file system (ROOTFS) in the universal flash memory (UFS) is located into the memory specified address.
And c1, reading a system capacity value of a root file system in the general flash memory through a second subprogram.
Specifically, the system capacity value of the root file system can be read by calling ufs _size function through the second subroutine (BL 22), and the read system capacity value is saved.
S204, determining a target capacity value of the root file system according to the system capacity value and a preset maximum system capacity value through a second subprogram.
In this embodiment, the maximum system capacity value may be understood as a preset maximum capacity of the file system, and may be adjusted according to the size of the internal memory of the embedded system, and when the internal memory is large enough, the maximum system capacity value may be set larger, which is more beneficial to expansion.
Specifically, the second subprogram is combined with the set function to compare the system capacity value with the preset maximum system capacity value, so as to determine the target capacity value of the root file system.
Further, the step of determining, by the second subroutine, the target capacity value of the root file system according to the system capacity value and the preset maximum system capacity value may further be optimized, including:
a2, calling a preset target value determining function.
In the present embodiment, the target value determination function may be understood as a function for determining an optimal value, such as a round_up function.
Specifically, the preset target value determination function may be called by the second subroutine.
b2, comparing the preset maximum system capacity value with the system capacity value through a target value determining function, and determining a target capacity value of the root file system.
Specifically, the preset maximum system capacity value is compared with the system capacity value through the target value determining function, and the target capacity value of the root file system is calculated through a calculation mode defined by the target value determining function.
S205, the device tree partition is read from the general flash memory to the device tree base address in the dynamic random access memory through a second subprogram in the second bootstrap program.
Specifically, the Device Tree (DTB) partition may be read from the universal flash memory (UFS) into the device tree base address in the dynamic random access memory by a second sub-program (BL 22) in the second boot program, awaiting processing of the DTB data.
S206, calling a path function in the equipment tree operation library according to the equipment tree base address.
In this embodiment, the device tree operation library may be understood as a library for flat device tree data operations. Fdt can be translated into a flat device tree, such as libfdt's library.
Specifically, the second subroutine may call a path function (e.g., fdt path function) in the device tree operation library according to the device tree base address.
S207, finding a selection node from the equipment tree through a path function.
In this embodiment, a selection node may be understood as a node, such as a chosen node, for UBOOT to pass data to the kernel.
Specifically, the selection node may be found from the device tree by a path function.
S208, calling an offset function to analyze the selected node to obtain a reserved memory starting address and a reserved memory ending address.
It should be noted that, in a memory-based file system, such as an initrd type ROOTFS, a Linux system sets two attributes of Linux, initrd-start and Linux, initrd-end in dts, where the Linux, initrd-start attribute indicates that the ROOTFS reserves a memory start address, the Linux, initrd-end attribute indicates that the ROOTFS reserves a memory end address, a difference between start and end is the size of the entire ROOTFS, and the Linux kernel presets two values to fix the size of the ROOTFS file.
Specifically, the second subroutine may call an offset function (such as the fdt offset function) to parse the selected node, where the offset obtains the attribute of the reserved memory start address and the reserved memory end address, and prepare to set the two attribute values.
S209, calling an attribute value setting function through a second subprogram in the second bootstrap program.
Specifically, an attribute value setting function (e.g., the fdt setprop function) may be called by a second subroutine in the second bootstrap.
S210, setting the target capacity value into a first attribute of a reserved memory starting address and a second attribute of a reserved memory ending address by an attribute value setting function.
Specifically, the stored target capacity value may be set by the attribute value setting function to the first attribute of the reserved memory start address and the second attribute of the reserved memory end address, so that the update of the attribute of the DTB is completed.
S211, determining a memory size value of the reserved memory according to the difference value between the first attribute and the second attribute.
Specifically, the second subroutine may determine the memory size value of the reserved memory according to the difference between the first attribute and the second attribute.
S212, the reserved memory is redistributed through the kernel according to the memory size value.
Specifically, after the UBOOT boot KERNEL is started, the KERNEL will reallocate a new reserved memory for loading the ROOTFS, so as to ensure the normal start of the file system.
S213, loading the root file system by reserving the memory, and completing the starting of the embedded system.
Specifically, the root file system is loaded through the newly reserved memory after the reassignment, and the starting of the embedded system is completed through the steps of loading an application program and the like.
According to the technical scheme, the second subprogram in the UFS is used for reading the partition where the ROOTFS is located in the UFS to obtain the actual system capacity value of the root file system. And further reading the DTB file of the KERNEL KERNEL, and determining the reserved memory starting address and the reserved memory ending address. And determining a target capacity value according to the system capacity value and a preset maximum system capacity value by calling a corresponding function in the equipment tree operation library, and dynamically setting a memory size value of a reserved memory of the root file system according to the target capacity value. And when the kernel of the embedded system is started, the memory value of the reserved memory is redistributed for the root file system, and the root file system is correctly mounted. The normal starting of the embedded system is ensured, the reserved memory size required by the root file system is adaptively and dynamically adjusted, the rationality of the memory layout of the embedded system is realized, the size of the root file system can be dynamically expanded, and the flexibility and the stability of the embedded system are improved.
Example III
Fig. 3 is a schematic structural diagram of an optimized starting device of an embedded system according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: an initialization module 31, a first determination module 32, a second determination module 33, and a system start module 34. Wherein, the liquid crystal display device comprises a liquid crystal display device,
the initialization module 31 is configured to power up the embedded system, initialize the embedded system through a first bootstrap program, and load a second bootstrap program into the sram;
a first determining module 32, configured to determine, by the second boot program, a target capacity value of a root file system in the universal flash memory, and determine a reserved memory start address and a reserved memory end address from a device tree;
a second determining module 33, configured to determine a memory size value of the reserved memory according to the target capacity value, the reserved memory start address, and the reserved memory end address;
and the system starting module 34 is configured to read the memory size value through the kernel when the kernel of the embedded system is loaded, and perform starting of the embedded system.
According to the technical scheme, the embedded system is electrified, the first bootstrap program is used for initializing the embedded system, and the second bootstrap program is loaded into the static random access memory; determining a target capacity value of a root file system in the general flash memory through a second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree; determining a memory size value of the reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address; when the kernel of the embedded system is loaded, the memory size value is read through the kernel, and the embedded system is started. The method and the device realize the self-adaptive dynamic adjustment of the reserved memory size required by the root file system, realize the rationality of the memory layout of the embedded system, dynamically expand the size of the root file system and increase the flexibility and the stability of the embedded system.
Further, the first determining module 32 includes:
an initializing unit, configured to initialize a dynamic random access memory and a general flash memory through a first subroutine in the second boot program;
a first determining unit, configured to determine a system capacity value of a root file system in the general-purpose flash memory through a second subroutine in a second boot program;
and the second determining unit is used for determining the target capacity value of the root file system according to the system capacity value and a preset maximum system capacity value through the second subprogram.
The first determining unit is specifically configured to:
performing global unique identification partition table type partition on the general flash memory through the second subprogram;
reading a partition where a root file system in the general flash memory is located into a memory designated address through the second subprogram;
and reading the system capacity value of the root file system in the general flash memory through the second subprogram.
The second determining unit is specifically configured to:
calling a preset target value determining function;
and comparing a preset maximum system capacity value with the system capacity value through the target value determining function to determine a target capacity value of the root file system.
Further, the first determining module 32 may be further specifically configured to:
reading the device tree partition from the general flash memory to the device tree base address in the dynamic random access memory through a second subprogram in the second boot program;
calling a path function in an equipment tree operation library according to the equipment tree base address;
finding a selection node from the equipment tree through the path function;
and calling an offset function to analyze the selected node to obtain the reserved memory starting address and reserved memory ending address.
Further, the second determining module 33 is specifically configured to:
calling an attribute value setting function through a second subprogram in the second bootstrap;
setting the target capacity value into a first attribute of the reserved memory starting address and a second attribute of the reserved memory ending address by the attribute value setting function;
and determining the memory size value of the reserved memory according to the difference value between the first attribute and the second attribute.
Further, the system start module 34 is specifically configured to:
reallocating the reserved memory according to the memory size value through the kernel;
and loading the root file system through the reserved memory to finish the starting of the embedded system.
The optimized starting device of the embedded system provided by the embodiment of the invention can execute the optimized starting method of the embedded system provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executing method.
Example IV
Fig. 4 shows a schematic diagram of an electronic device 40 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 40 includes at least one processor 41, and a memory communicatively connected to the at least one processor 41, such as a Read Only Memory (ROM) 42, a Random Access Memory (RAM) 43, etc., in which the memory stores a computer program executable by the at least one processor, and the processor 41 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 42 or the computer program loaded from the storage unit 48 into the Random Access Memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 may also be stored. The processor 41, the ROM 42 and the RAM 43 are connected to each other via a bus 44. An input/output (I/O) interface 45 is also connected to bus 44.
Various components in electronic device 40 are connected to I/O interface 45, including: an input unit 46 such as a keyboard, a mouse, etc.; an output unit 47 such as various types of displays, speakers, and the like; a storage unit 48 such as a magnetic disk, an optical disk, or the like; and a communication unit 49 such as a network card, modem, wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 41 may be various general and/or special purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 41 performs the various methods and processes described above, such as an optimized boot method for an embedded system.
In some embodiments, the method of optimizing startup of an embedded system may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 48. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 40 via the ROM 42 and/or the communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the above-described method of optimizing boot-up of an embedded system may be performed. Alternatively, in other embodiments, the processor 41 may be configured to perform the optimized startup method of the embedded system in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. An optimized starting method of an embedded system is characterized by comprising the following steps:
the embedded system is powered on, the first bootstrap program is used for initializing the embedded system, and the second bootstrap program is loaded into the static random access memory;
determining a target capacity value of a root file system in the general flash memory through the second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree;
determining a memory size value of a reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address;
and when the kernel of the embedded system is loaded, reading the memory size value through the kernel, and starting the embedded system.
2. The method of claim 1, wherein determining, by the second boot program, a target capacity value for a root file system in a universal flash memory comprises:
initializing a dynamic random access memory and a general flash memory through a first subprogram in the second bootstrap program;
determining a system capacity value of a root file system in the universal flash memory through a second subprogram in a second boot program;
and determining the target capacity value of the root file system according to the system capacity value and a preset maximum system capacity value through the second subprogram.
3. The method of claim 2, wherein the determining, by a second subroutine in the second boot program, a system capacity value of a root file system in the universal flash memory comprises:
performing global unique identification partition table type partition on the general flash memory through the second subprogram;
reading a partition where a root file system in the general flash memory is located into a memory designated address through the second subprogram;
and reading the system capacity value of the root file system in the general flash memory through the second subprogram.
4. The method according to claim 2, wherein the determining, by the second subroutine, the target capacity value of the root file system according to the system capacity value and a preset maximum system capacity value includes:
calling a preset target value determining function;
and comparing a preset maximum system capacity value with the system capacity value through the target value determining function to determine a target capacity value of the root file system.
5. The method of claim 1, wherein determining a reserved memory start address and a reserved memory end address from the device tree comprises:
reading the device tree partition from the general flash memory to the device tree base address in the dynamic random access memory through a second subprogram in the second boot program;
calling a path function in an equipment tree operation library according to the equipment tree base address;
finding a selection node from the equipment tree through the path function;
and calling an offset function to analyze the selected node to obtain the reserved memory starting address and reserved memory ending address.
6. The method of claim 1, wherein determining a memory size value of reserved memory based on the target capacity value, the reserved memory start address, and the reserved memory end address comprises:
calling an attribute value setting function through a second subprogram in the second bootstrap;
setting the target capacity value into a first attribute of the reserved memory starting address and a second attribute of the reserved memory ending address by the attribute value setting function;
and determining the memory size value of the reserved memory according to the difference value between the first attribute and the second attribute.
7. The method of claim 1, wherein the reading, by the kernel, the memory size value, and performing the startup of the embedded system, comprises:
reallocating the reserved memory according to the memory size value through the kernel;
and loading the root file system through the reserved memory to finish the starting of the embedded system.
8. An optimized starting device for an embedded system, comprising:
the initialization module is used for powering on the embedded system, initializing the embedded system through the first bootstrap program and loading the second bootstrap program into the static random access memory;
the first determining module is used for determining a target capacity value of a root file system in the general flash memory through the second bootstrap program, and determining a reserved memory starting address and a reserved memory ending address from a device tree;
the second determining module is used for determining a memory size value of the reserved memory according to the target capacity value, the reserved memory starting address and the reserved memory ending address;
and the system starting module is used for reading the memory size value through the kernel when the kernel of the embedded system is loaded, and starting the embedded system.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the optimized launch method of the embedded system of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the method of optimizing boot-up of an embedded system according to any one of claims 1-7.
CN202310667901.5A 2023-06-07 2023-06-07 Optimized starting method, device, equipment and medium for embedded system Pending CN116700807A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310667901.5A CN116700807A (en) 2023-06-07 2023-06-07 Optimized starting method, device, equipment and medium for embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310667901.5A CN116700807A (en) 2023-06-07 2023-06-07 Optimized starting method, device, equipment and medium for embedded system

Publications (1)

Publication Number Publication Date
CN116700807A true CN116700807A (en) 2023-09-05

Family

ID=87836767

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310667901.5A Pending CN116700807A (en) 2023-06-07 2023-06-07 Optimized starting method, device, equipment and medium for embedded system

Country Status (1)

Country Link
CN (1) CN116700807A (en)

Similar Documents

Publication Publication Date Title
CN112667266A (en) Firmware upgrading method, device, equipment and storage medium
CN115794257B (en) System starting method, device, electronic equipment and storage medium
CN112486522A (en) Deployment method and device of OpenStack bare machine with intelligent network card
CN110781067A (en) Method, device, equipment and storage medium for calculating starting time consumption
CN115269025A (en) Kernel quick starting method and device, electronic equipment and storage medium
CN114936173B (en) Read-write method, device, equipment and storage medium of eMMC device
CN115291946A (en) Hongmong system transplanting method, device, electronic equipment and readable medium
CN112817660B (en) Method, device, equipment and storage medium for expanding applet capability
CN117234582A (en) Project code processing method and device, electronic equipment and storage medium
CN117289956A (en) Mirror image manufacturing method, apparatus, electronic device and storage medium
CN116248689A (en) Capacity expansion method, device, equipment and medium for cloud native application
CN116700807A (en) Optimized starting method, device, equipment and medium for embedded system
WO2019100704A1 (en) Starting method for multi-mode iot device, multi-mode iot device, and storage medium
CN115454515A (en) System processing method and device and electronic equipment
CN106557354B (en) Method for setting attribute parameters of private image and computer equipment
CN112241141B (en) Hardware configuration method, system, device and medium of PLC control system
CN115952004B (en) Resource allocation method, device, electronic equipment and storage medium
US8631221B2 (en) Method and apparatus for allocating host memory for a memory-less add-on devices
CN114640652B (en) Information processing method and device
CN116126403A (en) Operating system deployment method and device, electronic equipment and storage medium
CN113220576B (en) Management method, device, equipment and storage medium of test environment
CN117008837A (en) Partition mounting method, device and equipment of magnetic disk and storage medium
CN117130732A (en) Method, device, equipment and storage medium for setting interface starting item
CN117555570A (en) Service management method and device, electronic equipment and storage medium
CN117873775A (en) Data updating method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination