Method, device, equipment and medium for building an embedded operating system
Through the method of building block componentization, the differences in operating system and platform software are blocked, and one-stop construction of embedded operating systems is realized, solving the problems of construction difficulties and inefficiency, improving construction efficiency and simplifying the development process.
Patent Information
- Application Number
- CN202210409836.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-19
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-04-19
AI Technical Summary
The existing embedded operating system construction methods have problems such as difficulty in building and low development efficiency, mainly due to large differences in construction environments and complex configurations.
The method of building block componentization is adopted to build a target environment, obtain the identification information and target parameter information of building block components, download and compile building block components as needed, block differences between operating system and platform software, and achieve one-stop construction.
It improves the efficiency of the embedded operating system construction, saves download and configuration time, simplifies the development process, reduces manual intervention, and realizes fast and efficient construction of embedded operating system.
Smart Images

Figure CN114816418B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, apparatus, device, and medium for building an embedded operating system. Background Art
[0002] An embedded operating system (OS) is an operating system designed for resource-constrained devices such as smart lights, air conditioners, and refrigerators. Unlike operating systems used in mobile phones and PCs, embedded OSes operate in a complex environment and have varying resource requirements. For example, an embedded OS can run on a Bluetooth low energy device with tens of kilobytes of memory, or on a network device with tens of megabytes of memory and Wi-Fi connectivity. This complexity makes embedded OSes difficult to standardize, leading to various challenges in their development.
[0003] At present, there are usually three main steps in building an embedded operating system. The first step is to build a compilation environment. Currently, building a compilation environment requires installing various software. Due to the large differences in the construction environment, problems such as software version conflicts often occur, and a lot of time has to be spent on debugging and solving the problems, which is time-consuming and inefficient. The second step is to download the relevant code (i.e., software modules). Currently, all source code can only be downloaded from one software repository. The source code contains both the software required for the project and some unnecessary software. Developers usually need to spend several days to determine which modules are needed and which modules are not needed, which also takes a lot of time for developers. The third step is to tailor and configure the functions in a certain file through macros or other methods according to the system requirements. Each software module is usually configured in different header files, and even a single software module is configured multiple times in different places. The configurable files are not in the same configuration header file, which can easily omit related configurations, causing confusion and affecting development efficiency.
[0004] In summary, due to the large differences in construction environments and complex configurations, the existing methods for building embedded operating systems have the disadvantages of being difficult to build and having low development efficiency, which need to be urgently addressed. Summary of the Invention
[0005] In view of this, the present application provides a method, apparatus, device and medium for building an embedded operating system to solve the problems of difficult construction and low development efficiency in the prior art. The technical solution is as follows:
[0006] A method for building an embedded operating system, comprising:
[0007] Build the target environment;
[0008] Obtain identification information of a first building block component and target parameter information supporting an embedded operating system, wherein the first building block component is a root building block component in a target building block component, and a script file corresponding to each building block component included in the target building block component includes building block dependency information and building block configuration information, the building block dependency information is used to describe a dependency relationship between the corresponding building block component and other building block components, the building block configuration information is used to describe whether several functional modules constituting the corresponding building block component are set functional modules required to build the embedded operating system, and the target parameter information includes at least identification information of the set functional module;
[0009] Downloading the first building block component and a script file corresponding to the first building block component to a target environment at least according to the identification information of the first building block component;
[0010] Downloading a second building block component and a script file corresponding to the second building block component into a target environment based at least on the building block dependency information in the script file corresponding to the first building block component, wherein the second building block component is a building block component other than the first building block component in the target building block component;
[0011] According to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information, the downloaded target building block component is compiled to obtain the compiled executable file as the built embedded operating system.
[0012] Optionally, build the target environment on the embedded device, including:
[0013] Use virtual environment technology and target sandbox software to build the target environment, or create a Docker virtual image.
[0014] Optionally, obtain target parameter information supporting the embedded operating system, including:
[0015] The preset initial parameter information is rewritten to obtain target parameter information matching the embedded operating system, or the target parameter information matching the embedded operating system is written.
[0016] Optionally, the script information of any building block component also includes version information of the building block component;
[0017] Downloading the first building block component and a script file corresponding to the first building block component to a target environment based at least on the identification information of the first building block component includes:
[0018] Determining, based on the identification information of the first building block component and preset warehouse information, a software sub-warehouse where the first building block component is located as a first software sub-warehouse, wherein the warehouse information includes a correspondence between the identification information of the building block component and the identification information of the software sub-warehouse, and the first software sub-warehouse includes multiple versions of the first building block component and script files corresponding to the multiple versions of the first building block component;
[0019] If the target parameter information does not include the first version information, downloading the latest version of the first building block component and the script file corresponding to the latest version of the first building block component from the first software sub-warehouse to the target environment, wherein the first version information is the version information of the first building block component to be downloaded;
[0020] If the target warehouse information includes the first version information, the first building block component under the first version information and the script file corresponding to the first building block component under the first version information are downloaded from the first software sub-warehouse to the target environment.
[0021] Optionally, downloading the second building block component and the script file corresponding to the second building block component to the target environment based on at least the building block dependency information in the script file corresponding to the first building block component includes:
[0022] If the target parameter information does not include the second version information, then according to the building block dependency information and repository information in the script file corresponding to the first building block component, the latest version of the second building block component and the script file corresponding to the latest version of the second building block component are downloaded to the target environment, wherein the second version information is the version information of the second building block component to be downloaded;
[0023] If the target parameter information includes the second version information, the second building block component under the second version information and the script file corresponding to the second building block component under the second version information are downloaded to the target environment according to the building block dependency information and warehouse information in the script file corresponding to the first building block component.
[0024] Optionally, downloading the second building block component under the second version information and the script file corresponding to the second building block component under the second version information to the target environment according to the building block dependency information and the repository information in the script file corresponding to the first building block component includes:
[0025] Determine identification information of a second software sub-warehouse based on the building block dependency information and warehouse information in the script file corresponding to the first building block component, wherein the second software sub-warehouse refers to the software sub-warehouse where the second building block component is located;
[0026] Constructing a dependency tree for the embedded operating system based on the building block dependency information, the second version information, and the identification information of the second software sub-warehouse in the script file corresponding to the first building block component, wherein each node of the dependency tree corresponds to a building block component in the target building block component, the node corresponding to the first building block component includes the first version information and the identification information of the first software sub-warehouse, and the node corresponding to the second building block component includes the second version information and the identification information of the second software sub-warehouse;
[0027] According to the dependency tree, the second building block component under the second version information and the script file corresponding to the second building block component under the second version information are downloaded from the second software sub-warehouse indicated by the identification information of the second software sub-warehouse to the target environment.
[0028] Optionally, the downloaded target building block component is compiled according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain a compiled executable file, including:
[0029] Obtain a target configuration file based on the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information;
[0030] According to the target configuration file, the downloaded target building block component is cropped to obtain the cropped target building block component;
[0031] Generate a target compilation file according to the target configuration file, wherein the target compilation file is used to instruct how to compile the tailored target building block components;
[0032] According to the target compilation file, the cut target building block components are compiled to obtain the compiled executable file.
[0033] Optionally, a target configuration file is obtained based on the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information, including:
[0034] The building block configuration information in the script file corresponding to the target building block component is modified according to the identification information of the function module set in the target parameter information, and the target configuration file is obtained from the modified building block configuration information.
[0035] Optionally, the downloaded target building block component is cropped according to the target configuration file to obtain a cropped target building block component, including:
[0036] According to the target configuration file, the function modules other than the set function module in the downloaded target building block component are cut out to obtain a cut target building block component.
[0037] Optionally, the script file corresponding to the target building block component also includes building block post-processing information;
[0038] After compiling the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain the compiled executable file, the following steps are further included:
[0039] According to the building block post-processing information, the compiled executable file is post-processed, and the post-processed executable file is used as the built embedded operating system.
[0040] Optionally, perform post-processing on the compiled executable file based on the building block post-processing information, including:
[0041] If the block post-processing information includes encryption processing, the encryption command is obtained from an external specified location, and the compiled executable file is encrypted based on the encryption command;
[0042] and / or,
[0043] If the block post-processing information includes adding a header, then obtain the header adding command from the external specified location, and add the header information to the compiled executable file based on the header adding command;
[0044] and / or,
[0045] If the building block post-processing information includes function printing processing, a function printing command is obtained from an external specified location, and the function list information corresponding to the compiled executable file is printed out based on the function printing command.
[0046] A device for building an embedded operating system, comprising: a target environment building module, an information acquisition module, a first downloading module, a second downloading module and a compiling module;
[0047] Target environment building module, used to build the target environment;
[0048] An information acquisition module is configured to obtain identification information of a first building block component and target parameter information supporting an embedded operating system, wherein the first building block component is a root building block component in a target building block component, and a script file corresponding to each building block component included in the target building block component includes building block dependency information and building block configuration information. The building block dependency information is used to describe the dependency relationship between the corresponding building block component and other building block components, and the building block configuration information is used to describe whether several functional modules constituting the corresponding building block component are set functional modules required for building an embedded operating system. The target parameter information includes at least identification information of the set functional modules.
[0049] A first downloading module, configured to download the first building block component and a script file corresponding to the first building block component to a target environment based at least on the identification information of the first building block component;
[0050] a second downloading module, configured to download a second building block component and a script file corresponding to the second building block component to a target environment based at least on the building block dependency information in the script file corresponding to the first building block component, wherein the second building block component is a building block component other than the first building block component in the target building block component;
[0051] The compilation module is used to compile the downloaded target building block components according to the building block configuration information in the script file corresponding to the target building block components and the identification information of the function modules set in the target parameter information, and obtain the compiled executable file as the built embedded operating system.
[0052] A device for building an embedded operating system, comprising a memory and a processor;
[0053] Memory, used to store programs;
[0054] The processor is used to execute the program to implement each step of the method for building an embedded operating system as described above.
[0055] A readable storage medium stores a computer program thereon. When the computer program is executed by a processor, each step of the method for building an embedded operating system as described above is implemented.
[0056] Through the above technical solution, it can be seen that the method for building an embedded operating system provided by the present application first builds a target environment, then obtains the identification information of the first building block component and the target parameter information matching the embedded operating system, and then downloads the first building block component and the script file corresponding to the first building block component to the target environment at least based on the identification information of the first building block component, and then downloads the second building block component and the script file corresponding to the second building block component to the target environment at least based on the building block dependency information in the script file corresponding to the first building block component, and finally compiles the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the functional module set in the target parameter information to obtain the compiled executable file as the built embedded operating system. It can be seen that the present application adopts the method of building a target environment, which shields the differences between the operating system and platform software to be run by the compilation and construction of the embedded operating system, so that the present application can build a compilation environment in one stop, and the present application maintains the existing software modules in the form of building block components. When building an embedded operating system, only the target building block components related to the embedded operating system need to be downloaded on demand, and there is no need to download all building block components, which saves download time, and developers do not need to worry about which building block components are needed and which building block components are not needed among the downloaded building block components, which saves developers' time. In addition, the present application only needs to configure the target parameter information supporting the embedded operating system once, and can build the embedded operating system in one stop. The construction process is relatively simple and improves the efficiency of building the embedded operating system. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0058] Figure 1 A flowchart of a method for building an embedded operating system provided in an embodiment of the present application;
[0059] Figure 2a A schematic diagram of an embedded operating system architecture provided by the prior art;
[0060] Figure 2b A schematic diagram of the architecture of the embedded operating system built for this application;
[0061] Figure 3 A schematic diagram of the structure of an embedded operating system construction device provided in an embodiment of the present application;
[0062] Figure 4 This is a hardware structure block diagram of the embedded operating system building device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0064] In view of the problems existing in the prior art, the inventors of this case conducted in-depth research and finally proposed a method for building an embedded operating system. The following embodiments will now introduce in detail the method for building an embedded operating system provided by this application.
[0065] See also Figure 1 , shows a flow chart of a method for building an embedded operating system provided by an embodiment of the present application. The method for building an embedded operating system may include:
[0066] Step S101: Build a target environment.
[0067] Taking into account the differences in desktop operating systems, compilation software versions, functional software, etc. when building an embedded operating system, it will take a lot of time to build a compilation environment. Therefore, this step can build a target environment, so that the differences in operating systems (for example, Windows system, Linux system, etc.) can be shielded with the smallest space.
[0068] It is worth noting that, unlike the existing technology, this application builds an embedded operating system based on the target environment. Therefore, the tool software used in the process of building the embedded operating system (such as build tools and build software, where the build software can be, for example, CMake or Make software) also needs to be pre-installed in the target environment. In other words, the tool software used in the process of building the embedded operating system needs to run in the target environment.
[0069] It should also be noted that there can be multiple specific implementation methods for this step. This application provides but is not limited to the following two implementation methods.
[0070] The first method is to create a Docker virtual image and pre-install all tool software in the image.
[0071] The first method requires the creation of an operating system image, which occupies more disk space. Based on this, preferably, the following second implementation method can be used in this step.
[0072] The second method: Use virtual environment technology and target sandbox software to build the target environment.
[0073] Optionally, the virtual environment technology here can specifically be Python's virtual environment technology, and the target sandbox software can be miniconda software or other python sandbox software. That is, this step can use Python's virtual environment technology and use miniconda software or other python sandbox software to build the target environment.
[0074] Optionally, the target environment built in this embodiment can be run locally when the system is built, or can be downloaded and run from a software warehouse.
[0075] In summary, this step uses virtualization and specified software pre-installation technology to shield operating system differences and platform software differences, and install all required tool software in advance, saving developers the time of selecting and installing software, allowing developers to build a compilation environment in one stop.
[0076] Step S102: Obtain identification information of the first building block component and target parameter information matching the embedded operating system.
[0077] Among them, the first building block component is the root building block component in the target building block component, and the script file corresponding to each building block component included in the target building block component includes building block dependency information and building block configuration information. The building block dependency information is used to describe the dependency relationship between the corresponding building block component and other building block components. The building block configuration information is used to describe whether several functional modules that constitute the corresponding building block component are set functional modules required to build an embedded operating system. The target parameter information at least includes identification information of the set functional module.
[0078] First, the “building block assembly” is introduced so that those skilled in the art can better understand the “building block assembly” provided by this embodiment.
[0079] See also Figure 2a As shown in the prior art (before the building block componentization transformation), the entire embedded operating system is a unified whole, and different software modules are distinguished within the whole. In this embodiment, the existing software modules can be pre-built into components to obtain building block components corresponding to each software module. When building the embedded operating system in this step, the building block components can be used as the basic units of the embedded operating system. Based on this, the architectural diagram of the built embedded operating system can be seen in Figure 2b shown.
[0080] Optionally, in this embodiment, a building block component transformation tool for component building block processing of software modules can be written in a high-level language (such as Python), and then each existing software module can be processed into a building block component based on the written building block component transformation tool.
[0081] It should be noted that in the prior art, each software module is composed of several functional modules. Accordingly, after the present application performs component building block processing on the software module, each building block component is composed of functional modules. For example, building block component A is composed of functional modules 1 to 5, building block component B is composed of functional modules 6 to 7, building block component C is composed of functional modules 8 to 10, building block component D is composed of functional module 11, and so on.
[0082] In this embodiment, after each software module in the prior art is transformed into a building block component, a corresponding script file can be written for each building block component to describe the relevant information of the building block component required for the embedded operating system construction process through the script file.
[0083] In an optional embodiment, the script file corresponding to any building block component includes at least building block dependency information and building block configuration information.
[0084] Among them, the building block dependency information in the script file corresponding to a building block component is used to describe the dependency relationship between the building block component and other building block components. For example, the script file corresponding to the first building block component contains the dependency relationship between the first building block component and the lower building block component (i.e., the second building block component).
[0085] Optionally, the dependency relationship can be described using a dependency table, that is, the dependency table represents the upper and lower layer dependency relationship between the building block component and other building block components; since the upper layer building block component will call the interface provided by the lower layer building block component, the building block dependency information can optionally include interface dependency information.
[0086] The building block configuration information in the script file corresponding to a building block component is used to describe whether the several functional modules that make up the building block component are set functional modules required for building an embedded operating system (when building an embedded operating system, some or all functional modules of a building block component may be used. In this embodiment, the functional modules used when building an embedded operating system are defined as set functional modules).
[0087] Optionally, in this embodiment, Y and N can be used to indicate whether each functional module is a set functional module, wherein if a functional module is configured as Y, it indicates that the functional module is a set functional module, and if it is configured as N, it indicates that the functional module is not a set functional module. Initially, both can be configured as Y or N.
[0088] For example, the building block configuration information of a building block component (logging component) is:
[0089] Feature_config:
[0090] LOG_SUPPORT_ASYNC N (N can also be Y)
[0091] LOG_SUPPORT_FS N (N here can also be Y)
[0092] LOG_SUPPORT_CLOUD N (N here can also be Y)
[0093] Here, "LOG_SUPPORT_ASYNC", "LOG_SUPPORT_FS" and "LOG_SUPPORT_CLOUD" are the three functional modules that make up the log component. Among them, "LOG_SUPPORT_ASYNC" represents the asynchronous log function. If it is Y, it means that the embedded operating system supports asynchronous log. If it is N, it means it does not support it. "LOG_SUPPORT_FS" represents the log storage to the file system function. If it is Y, it means that the embedded operating system supports log storage to the file system. If it is N, it means it does not support it. "LOG_SUPPORT_CLOUD" represents the log transmission to the cloud service front end function. If it is Y, it means that the embedded operating system supports log transmission to the cloud service front end. If it is N, it means it does not support it.
[0094] It should be noted that the above Y and N are only examples. In addition, other identifiers can also be used, and this application does not limit this.
[0095] Optionally, the script file can be implemented using a scripting language such as YAML, JSON, or XML, which is easy for developers to read and write and easy to process using a high-level language. Preferably, the script file can be implemented using the YAML scripting language.
[0096] It is understandable that some embedded operating systems may need to implement functions for which no relevant code has been developed, meaning that no software module corresponding to such functions exists in the prior art. In such cases, this embodiment can still generate a building block component corresponding to the required function using a pre-programmed building block component modification tool. However, since no relevant code has been developed, the building block component corresponding to the required function will be empty. In order to subsequently add relevant code and other information to the empty building block component based on the required function, the building block component scaffolding code corresponding to the empty building block component can be automatically generated based on the undeveloped relevant code.
[0097] Optionally, the building block component scaffolding code includes the following information: first, a component information file, which is used to automatically add relevant information based on the code directory name; second, a default code directory structure, which is used to scan the code directory and automatically generate directory information; third, default system configuration options, which are used to reserve space for developers to customize as needed; and fourth, default compilation options, which are used to reserve space for developers to customize as needed. Of course, the building block component scaffolding code can also include other information, which is not limited by this application.
[0098] In this step, the first building block component refers to the building block component in the dotted box shown in FIG2 , and the first building block component is the first layer of building block components required for building the embedded operating system.
[0099] Optionally, the first building block component is usually an application-level component. Here, the application-level component includes hardware components and solution components suitable for the current hardware platform (the hardware platform corresponding to the embedded operating system to be built). For example, the first building block component can be a Helloworld component, a device cloud component, etc.
[0100] It is worth noting that the embedded operating system to be built may correspond to only one first building block component, or may correspond to multiple first building block components, for example, Figure 2b A plurality of first building block assemblies are shown.
[0101] This step can also obtain target parameter information of the embedded operating system to be built. Here, the target parameter information at least includes identification information of the set function modules, and the identification information included in the target parameter information can be used to determine which function modules are set function modules and which function modules are not set function modules.
[0102] Optionally, there may be multiple specific implementation methods for the step of "obtaining target parameter information supporting the embedded operating system". This application provides but is not limited to the following two implementation methods.
[0103] The first method is to rewrite the preset initial parameter information to obtain the target parameter information matching the embedded operating system.
[0104] Here, the preset initial parameter information is the parameter information written for other projects (i.e., other embedded operating systems). This step only requires rewriting the initial parameter information into the target parameter information required by this project to obtain the target parameter information matching the embedded operating system to be built in this embodiment.
[0105] The second method: write target parameter information supporting the embedded operating system.
[0106] It is understandable that there may be a situation where the initial parameter information is not pre-written. In this case, the target parameter information can be directly written for the embedded operating system to be built.
[0107] Step S103: Download the first building block component and the script file corresponding to the first building block component to the target environment at least according to the identification information of the first building block component.
[0108] Here, if the first building block assembly includes multiple building block assemblies, the script file corresponding to the first building block assembly refers to the script files corresponding to each building block assembly included in the first building block assembly; similarly, the script file corresponding to the second building block assembly described below refers to the script files corresponding to each building block assembly included in the second building block assembly, and the script file corresponding to the target building block assembly described below refers to the script files corresponding to each building block assembly included in the target building block assembly.
[0109] As described in the aforementioned steps, in this embodiment, a construction tool is pre-installed in the target environment. In this step, the first building block component and the script file corresponding to the first building block component can be downloaded through the construction tool.
[0110] Step S104: Download the second building block component and the script file corresponding to the second building block component to the target environment based at least on the building block dependency information in the script file corresponding to the first building block component.
[0111] The second building block component is the other building block components in the target building block component except the first building block component. Here, the target building block component refers to all the building block components required to build the current embedded operating system, that is, Figure 2b All building blocks shown, then the second building block refers to Figure 2b All building block components outside the dotted box are shown.
[0112] Specifically, in this step, the building block dependency information in the script file corresponding to the first building block component describes the dependency relationship between the first building block component and the second-layer building block component. Through the dependency relationship, the second-layer building block component on which the first building block component depends can be determined, and accordingly, the script file corresponding to each building block component in the second-layer building block component can be determined; the building block dependency information in the script file corresponding to the second-layer building block component describes the dependency relationship between the second-layer building block component and the third-layer building block component. Through the dependency relationship, the third-layer building block component on which the second-layer building block component depends can be determined, and accordingly, the script file corresponding to each building block component in the third-layer building block component can be determined; and so on, the script files corresponding to all the second building block components and the second building block components can be determined, so that the script files corresponding to the second building block components and the second building block components can be downloaded to the target environment.
[0113] As described in the aforementioned steps, in this embodiment, a construction tool is pre-installed in the target environment. In this step, the second building block component and the script file corresponding to the second building block component can be downloaded through the construction tool.
[0114] Through this step and the previous steps, all building blocks required for building an embedded operating system (i.e., target building blocks) and their corresponding script files can be downloaded to the target environment, so that the embedded operating system can be built based on the target building blocks later.
[0115] Step S105 : Compile the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain a compiled executable file as the built embedded operating system.
[0116] As introduced in the above steps, this embodiment will pre-install the build tools and build software in the target environment. In addition, optionally, this step can also automatically download the compiler software from the software warehouse when the build system has not installed the compiler software. Then, the identification information of the functional module can be set according to the building block configuration information and target parameter information in the script file corresponding to the target building block component. The installed build tools, build software and compiler software are used to compile the target building block component downloaded in the above steps, and output the compilation information. When a compilation error occurs, a compilation error message will also be output.
[0117] The method for building an embedded operating system provided in the present application first builds a target environment, then obtains identification information of a first building block component and target parameter information matching the embedded operating system, then downloads the first building block component and a script file corresponding to the first building block component to the target environment based at least on the identification information of the first building block component, then downloads the second building block component and the script file corresponding to the second building block component to the target environment based at least on the building block dependency information in the script file corresponding to the first building block component, and finally compiles the downloaded target building block component based on the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain a compiled executable file as the built embedded operating system. It can be seen that the present application adopts the method of building a target environment, which shields the differences between the operating system and platform software to be run by the compilation and construction of the embedded operating system, so that the present application can build a compilation environment in one stop, and the present application maintains the existing software modules in the form of building block components. When building an embedded operating system, only the target building block components related to the embedded operating system need to be downloaded on demand, and there is no need to download all building block components, which saves download time, and developers do not need to worry about which building block components are needed and which building block components are not needed among the downloaded building block components, which saves developers' time. In addition, the present application only needs to configure the target parameter information supporting the embedded operating system once, and can build the embedded operating system in one stop. The construction process is relatively simple and improves the efficiency of building the embedded operating system.
[0118] Experiments have shown that the target environment provided by this application can allow developers to build an embedded operating system on Windows, Linux, MAC OS and other systems in just a dozen minutes.
[0119] In an optional embodiment, the process of “step S103, downloading the first building block component and the script file corresponding to the first building block component to the target environment at least according to the identification information of the first building block component” is described.
[0120] In one possible implementation, in order to facilitate the maintenance of building block components, this embodiment can split a large building block component software warehouse into multiple software sub-warehouses, each software sub-warehouse storing a building block component, so that this embodiment can maintain software sub-warehouses at different component levels in a large building block component software warehouse in the form of building block components.
[0121] Therefore, when downloading the first building block component and the corresponding script file, it is necessary to know in which software sub-repository the first building block component and the corresponding script file are located. Based on this, this embodiment can maintain a preset repository information, in which the software sub-repository and the building block component are associated, so that the corresponding building block component can be downloaded from the corresponding software sub-repository based on the repository information. Based on this, the process of step S103 can include: downloading the first building block component and the script file corresponding to the first building block component to the target environment based on the identification information of the first building block component and the preset repository information.
[0122] In another possible implementation, a building block component may correspond to multiple versions of information (e.g., version numbers). Therefore, the phrase "each software sub-repository stores one building block component" specifically means that each software sub-repository stores multiple versions of a building block component. In this embodiment, the building block component's version information can be written into the script file. That is, the script information for any building block component also includes the building block component's version information.
[0123] When building an embedded operating system in this embodiment, the building can be based on target building blocks with the same version information or different version information. Based on this, it is necessary to know in advance which version of the first building block component to download before downloading it from the corresponding software sub-warehouse.
[0124] Optionally, the version information that needs to be downloaded (for the convenience of subsequent description, the version information that needs to be downloaded corresponding to the first building block component is defined as the first version information) can be written into the target parameter information supporting the embedded operating system. That is, the target parameter information supporting the embedded operating system can include the first version information of the first building block component. At this time, optionally, the process of step S103 may include: according to the identification information of the first building block component and the preset warehouse information, downloading the first building block component under the first version information and the script file corresponding to the first building block component to the target environment.
[0125] Specifically, the process of “downloading the first building block component and the script file corresponding to the first building block component under the first version information to the target environment according to the identification information of the first building block component and the preset warehouse information” includes:
[0126] Step a1. Determine the software sub-warehouse where the first building block component is located based on the identification information and warehouse information of the first building block component, as the first software sub-warehouse, wherein the warehouse information includes a correspondence between the identification information of the building block component and the identification information of the software sub-warehouse, and the first software sub-warehouse includes the first building block component under several versions and script files corresponding to the first building block component under several versions.
[0127] Step a2: Download the first building block component under the first version information and the script file corresponding to the first building block component under the first version information from the first software sub-warehouse to the target environment.
[0128] The above steps a1 to a2 describe in detail the detailed process of downloading the first building block component itself and the script file corresponding to the first building block component when the target parameter information includes the first version information. It is understandable that there may also be a situation where the target parameter information does not include the first version information. In this case, the process of step S103 may include: downloading the first building block component under the latest version and the script file corresponding to the first building block component to the target environment based on the identification information of the first building block component and the preset warehouse information. Here, the specific implementation process is similar to the process of the above steps a1 and a2. For details, please refer to the introduction in the above steps and will not be repeated here.
[0129] That is, in this embodiment, if the target parameter information does not include the first version information, the process of step S103 may include: downloading the first building block component under the latest version and the script file corresponding to the first building block component under the latest version to the target environment according to the identification information and warehouse information of the first building block component; if the target parameter information includes the first version information, the process of step S103 may include: downloading the first building block component under the first version information and the script file corresponding to the first building block component under the first version information to the target environment according to the identification information and preset warehouse information of the first building block component.
[0130] It should be noted that the above embodiment provides two specific implementation methods of step S103, but the implementation method of step S103 is not limited to these two implementation methods. In addition, there may be other implementation methods. For example, all building block components and corresponding script files can be stored in a large building block component software warehouse. If each building block component in the first building block component has only one version, step S103 can download the first building block component and the script file corresponding to the first building block component to the target environment based only on the identification information of the first building block component. If each building block component in the first building block component includes multiple versions, step S103 can download the first building block component and the script file corresponding to the first building block component to the target environment based on the identification information and the first version information of the first building block component.
[0131] In summary, the above embodiment provides four implementations of step S103, which are as follows:
[0132] In a first implementation, if all building block components and corresponding script files are stored in a large building block component software repository, and each building block component in the first building block component has only one version, the process of step S103 may include: downloading the first building block component and the script file corresponding to the first building block component to the target environment according to the identification information of the first building block component.
[0133] In a second implementation, if all building block components and corresponding script files are stored in a large building block component software repository, and each building block component in the first building block component includes multiple versions, the process of step S103 may include: if the target parameter information does not include the first version information, then according to the identification information of the first building block component, downloading the first building block component under the latest version and the script file corresponding to the first building block component under the latest version to the target environment; if the target parameter information includes the first version information, then according to the identification information of the first building block component, downloading the first building block component under the first version information and the script file corresponding to the first building block component under the first version information to the target environment.
[0134] Here, the first version information refers to the version information of the first building block component that needs to be downloaded. In this embodiment, the first version information can be written into the target parameter information supporting the embedded operating system.
[0135] In a third implementation, if each building block component in the first building block component is stored in a software sub-repository and each building block component in the first building block component has only one version, the process of step S103 may include: downloading the first building block component and the script file corresponding to the first building block component to the target environment according to the identification information and repository information of the first building block component.
[0136] In a fourth implementation, if each building block component in the first building block component is stored in a software sub-warehouse, and each building block component in the first building block component includes multiple versions, the process of step S103 may include: if the target parameter information does not include the first version information, then according to the identification information and warehouse information of the first building block component, downloading the first building block component under the latest version and the script file corresponding to the first building block component under the latest version to the target environment; if the target parameter information includes the first version information, then according to the identification information and warehouse information of the first building block component, downloading the first building block component under the first version information and the script file corresponding to the first building block component under the first version information to the target environment.
[0137] It should be noted that the implementation of step S103 is not limited to the above-mentioned implementation methods. In addition, there may be other implementation methods, which are not specifically limited in this application.
[0138] This embodiment can quickly locate the first building block component and its script file that need to be downloaded through the warehouse information and / or the first version information, thereby saving download time and improving download efficiency.
[0139] An embodiment of the present application describes the process of "step S104, downloading the second building block component and the script file corresponding to the second building block component to the target environment based on at least the building block dependency information in the script file corresponding to the first building block component."
[0140] In this embodiment, the process of step S104 includes multiple implementations, and the following implementations are provided but not limited to.
[0141] In a first implementation, if all building block components and corresponding script files are stored in a large building block component software repository, and each building block component in the second building block component has only one version, the process of step S104 may include: downloading the second building block component and the script file corresponding to the second building block component to the target environment according to the building block dependency information in the script file corresponding to the first building block component.
[0142] In a second implementation method, if all building block components and corresponding script files are stored in a large building block component software warehouse, and each building block component in the second building block component includes multiple versions, the process of step S104 may include: if the target parameter information does not include the second version information, then according to the building block dependency information in the script file corresponding to the first building block component, the second building block component under the latest version and the script file corresponding to the second building block component under the latest version are downloaded to the target environment; if the target parameter information includes the second version information, then according to the building block dependency information in the script file corresponding to the first building block component, the second building block component under the second version information and the script file corresponding to the second building block component under the second version information are downloaded to the target environment.
[0143] Here, the second version information refers to the version information of the second building block component that needs to be downloaded. In this embodiment, the second version information can be written into the target parameter information supporting the embedded operating system.
[0144] In a third implementation, if each building block component in the second building block component is stored in a software sub-repository and each building block component in the second building block component has only one version, the process of step S104 may include: downloading the second building block component and the script file corresponding to the second building block component to the target environment according to the building block dependency information and repository information in the script file corresponding to the first building block component.
[0145] In a fourth implementation, if each building block component in the second building block component is stored in a software sub-warehouse, and each building block component in the second building block component includes multiple versions, the process of step S104 may include: if the target parameter information does not include the second version information, then according to the building block dependency information and warehouse information in the script file corresponding to the first building block component, the second building block component under the latest version and the script file corresponding to the second building block component under the latest version are downloaded to the target environment; if the target parameter information includes the second version information, then according to the building block dependency information and warehouse information in the script file corresponding to the first building block component, the second building block component under the second version information and the script file corresponding to the second building block component under the second version information are downloaded to the target environment.
[0146] It should be noted that the implementation of step S104 is not limited to the above-mentioned implementation methods. In addition, there may be other implementation methods, which are not specifically limited in this application.
[0147] This embodiment can quickly locate the second building block component and its script file that need to be downloaded through the warehouse information and / or the second version information, thereby saving download time and improving download efficiency.
[0148] In an optional embodiment, in the above step S104, the process of "downloading the second building block component under the second version information and the script file corresponding to the second building block component under the second version information to the target environment according to the building block dependency information and repository information in the script file corresponding to the first building block component" may include:
[0149] Step b1: Determine identification information of a second software sub-warehouse based on the building block dependency information and warehouse information in the script file corresponding to the first building block component, wherein the second software sub-warehouse refers to the software sub-warehouse where the second building block component is located.
[0150] Step b2: Construct a dependency tree for the embedded operating system based on the building block dependency information, the second version information, and the identification information of the second software sub-warehouse in the script file corresponding to the first building block component, wherein each node of the dependency tree corresponds to a building block component in the target building block component, the node corresponding to the first building block component includes the first version information and the identification information of the first software sub-warehouse, and the node corresponding to the second building block component includes the second version information and the identification information of the second software sub-warehouse.
[0151] Step b3: Download the second building block component under the second version information and the script file corresponding to the second building block component under the second version information from the second software sub-warehouse indicated by the identification information of the second software sub-warehouse to the target environment according to the dependency tree.
[0152] Specifically, this embodiment can determine the second-layer building block components on which the first building block component depends based on the building block dependency information in the script file corresponding to the first building block component. Based on the building block dependency information contained in the script file corresponding to the second-layer building block component, the third-layer building block components on which each building block component in the second-layer building block component depends can be determined. And so on, a dependency tree for the embedded operating system can be constructed.
[0153] After the dependency tree is constructed, the construction tool can be used to determine the second building block component under the second version information from the second software sub-warehouse indicated by the identification information of the second software sub-warehouse based on the second version information and the identification information of the second software sub-warehouse in the dependency tree, and the script file corresponding to the determined second building block component under the second version information and the second building block component under the second version information can be downloaded to the target environment.
[0154] Optionally, if the second building block component under the second version information is not available, the build tool may also download the second building block component under the latest version.
[0155] Optionally, in order for developers to quickly find the target building block components to be downloaded, corresponding directories can be created based on the classification information files in each building block component. The building block component codes of the same type are stored in each directory, so that the required solution can be built with one click.
[0156] The following describes the step S105 of compiling the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain a compiled executable file in the above embodiment.
[0157] As described in the above embodiment, the target parameter information includes identification information and / or first version information and second version information of the set functional module. For example, the target parameter information includes: building a V2.0 version of the embedded operating system requires functional modules 1 and 3 of building block component A (version V2.0), and functional modules 6 and 7 of building block component B (version V1.8), as well as functional module 10 of building block component C (version V2.0), and so on.
[0158] Optionally, the process of "step S105, compiling the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain a compiled executable file" may include the following steps c1 to c4:
[0159] Step c1: Generate a target configuration file based on the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information.
[0160] Specifically, in this step, the build tool can centrally generate a unified configuration file according to the dependency tree, the building block configuration information contained in the script file corresponding to the target building block component, and the identification information of the setting function module contained in the target parameter information. The unified configuration file is the target configuration file.
[0161] In an optional embodiment, the process of this step may include: modifying the building block configuration information in the script file corresponding to the target building block component according to the identification information of the function module set in the target parameter information, and obtaining the target configuration file from the modified building block configuration information.
[0162] It can be understood that, initially, the building block configuration information in the script file corresponding to the target building block component usually does not match the currently built embedded operating system. It is necessary to modify the building block configuration information in the script file corresponding to the target building block component through the modification process of this step to modify it to configuration information that matches the currently built embedded operating system. In other words, if the currently built embedded operating system requires a functional module, the configuration information of the functional module is modified to the configuration information corresponding to the set functional module.
[0163] For example, taking the log component shown in step S102 as an example, assuming that the target building block component includes the log component, and assuming that the target parameter information includes the identification information of the function modules "LOG_SUPPORT_ASYNC" and "LOG_SUPPORT_CLOUD", after modifying the building block configuration information in the script file of the log component, the modified building block configuration information is:
[0164] Feature_config:
[0165] LOG_SUPPORT_ASYNC Y
[0166] LOG_SUPPORT_FS N
[0167] LOG_SUPPORT_CLOUD Y
[0168] In the above building block configuration information, the "LOG_SUPPORT_ASYNC" contained in the log component is configured as Y, indicating that "LOG_SUPPORT_ASYNC" is a set function module. Similarly, the "LOG_SUPPORT_CLOUD" contained in the log component is configured as Y, indicating that "LOG_SUPPORT_CLOUD" is a set function module.
[0169] In this step, the building block configuration information in the script file corresponding to each building block component included in the target building block component is modified, and the target configuration file can be obtained from the modified building block configuration information corresponding to the target building block component.
[0170] Step c2: according to the target configuration file, the downloaded target building block component is cropped to obtain a cropped target building block component.
[0171] Specifically, in this step, according to the target configuration file, other functional modules except the set functional module in the downloaded target building block component can be cut out to obtain a cut target building block component.
[0172] Because the target configuration file is generated based on the identification information of the set functional modules contained in the target parameter information, the target configuration file can be used to determine how to tailor the downloaded target building block components. For example, based on the target configuration file generated by the modified building block configuration file shown in c1, this step can remove the "LOG_SUPPORT_FS" functional module from the log component, resulting in a tailored log component consisting of "LOG_SUPPORT_ASYNC" and "LOG_SUPPORT_CLOUD."
[0173] Step c3: Generate a target compilation file based on the target configuration file.
[0174] The target compilation file is used to instruct how to compile the tailored target building block components.
[0175] In this step, the target configuration file is used as the input file of the target building block component, and can be used to construct a target compilation file for instructing how to compile the tailored target building block component. Here, the target compilation file is the compilation file required by the pre-installed build software.
[0176] Since this step can automatically generate the target compilation file based on the target configuration file, developers no longer need to manually write the compilation file, saving developers' time.
[0177] Optionally, the target compilation file can be a makefile file or a CMakeLists file.
[0178] Step c4: compile the cut target building block components according to the target compilation file to obtain a compiled executable file.
[0179] In this step, the build system can automatically call the build software according to the target compilation file, and then compile the tailored target building block components according to the target compilation file, the build software and the compilation software to obtain the compiled executable file.
[0180] In summary, this embodiment can perform a process of first cutting and then compiling the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the functional module set in the target parameter information. The entire process is executed automatically, so that the developer does not need to do any additional work (in the prior art, the developer needs to make modifications in each software module, and multiple modifications often occur, or due to the coupling of software modules, the configuration is not unified, which requires the developer to spend a lot of time on debugging), saving the developer's time and greatly reducing the possibility of errors.
[0181] In some scenarios, after the target building block component is compiled in the aforementioned step S105, it may be necessary to perform post-processing on the compiled executable file, such as encryption, header addition, printing, etc.
[0182] Optionally, this embodiment can write the post-processing information into the script file corresponding to one or some building block components of the target building block component. For example, the post-processing information can be written into the script file corresponding to the first building block component, or the post-processing information can be written into the script file corresponding to the target building block component. Subsequently, after step S105, the compiled executable file can be post-processed according to the building block post-processing information written into the script file corresponding to the first building block component (or the target building block component), and the post-processed executable file can be used as the built embedded operating system.
[0183] It should be noted that the building block post-processing information contained in the script file is only used to indicate what post-processing needs to be done on the executable file when building the embedded operating system, but the specific method of performing the post-processing is instructed by external commands.
[0184] For example, if the building block post-processing information in the script file corresponding to the target building block component indicates encryption, this indicates that the executable file needs to be encrypted. However, the method of encryption and the encryption algorithm used are indicated by the external encryption command. In other words, the process of "post-processing the compiled executable file based on the building block post-processing information" in this embodiment includes: if the building block post-processing information includes encryption, obtaining the encryption command from an external specified location, and encrypting the compiled executable file based on the encryption command.
[0185] For another example, if the script file corresponding to the target building block component contains building block post-processing information for adding a header, this indicates that header information needs to be added to the executable file. However, how to add the header and what header information to add are indicated by the external header addition command. In other words, the process of "post-processing the compiled executable file based on the building block post-processing information" in this embodiment includes: if the building block post-processing information includes adding a header, obtaining the header addition command from an externally specified location, and adding header information to the compiled executable file based on the header addition command.
[0186] For another example, if the script file corresponding to the target building block component contains building block post-processing information for function printing, this indicates that the relevant information regarding the function modules used when building the embedded operating system needs to be printed out, but the specific printing method is instructed by an external function printing command. In other words, the process of "post-processing the compiled executable file based on the building block post-processing information" in this embodiment includes: if the building block post-processing information includes function printing, obtaining a function printing command from an external designated location, and printing out function list information corresponding to the compiled executable file based on the function printing command, where the function list information includes relevant information regarding the function modules, such as identification information.
[0187] In summary, this embodiment can perform various post-processing tasks after the building block components are compiled, so that the embedded operating system provided by this embodiment has richer functions.
[0188] In the above embodiments, it is described in detail that the script file corresponding to any building block component includes the version information of the building block component, the building block dependency information used to describe the dependency relationship between the building block component and other building block components, the building block configuration information, the building block post-processing information, etc. In addition, the script file provided in this embodiment may also include other information. For example, in one embodiment, the script file corresponding to a building block component may include the following content:
[0189] First, the basic information of the building blocks, including the name of the building block component, the version information of the building block component managed independently, a brief description of the building block component, the type classification of the building block component, the license information of the building block component, and other information.
[0190] Second, the building block dependency information includes the dependency table of the building block components. The dependency table represents the upper and lower layer dependency relationship of each building block component. Optionally, the building block dependency information can be interface dependency information. The upper-layer building block component will call the interface provided by the lower-layer building block component.
[0191] Third, the appearance information of the building blocks includes information related to the board-level components that run the embedded operating system, including the CPU, chipset, development board components, etc.
[0192] Fourth, the building block compilation information contains the separate compilation information of the building block components independent of the project.
[0193] Fifth, the building block configuration information contains the relevant configuration information of the building block components. Through the configuration information, the components can be freely cut, so that the building block components can be large or small.
[0194] Sixth, building block post-processing information (optional), which includes various post-processing work information after the building block component is compiled.
[0195] It can be seen that this application uses script files to enable each building block component to provide a unified, customizable set of functional components and a unified style of API calling functions.
[0196] It should be noted that the above script files are only examples and are not intended to limit the script files of this application.
[0197] An embodiment of the present application also provides a device for building an embedded operating system. The device for building an embedded operating system provided in an embodiment of the present application is described below. The device for building an embedded operating system described below and the method for building an embedded operating system described above can be referenced to each other.
[0198] See also Figure 3 , shows a schematic diagram of the structure of the device for building an embedded operating system provided in an embodiment of the present application, such as Figure 3 As shown, the apparatus for building an embedded operating system may include: a target environment building module 301 , an information acquisition module 302 , a first downloading module 303 , a second downloading module 304 and a compiling module 305 .
[0199] The target environment building module 301 is used to build the target environment.
[0200] The information acquisition module 302 is used to obtain identification information of the first building block component and target parameter information supporting the embedded operating system.
[0201] The first download module 303 is configured to download the first building block component and the script file corresponding to the first building block component to a target environment based at least on the identification information of the first building block component. The first building block component is a root building block component in the target building block component. The script file corresponding to each building block component included in the target building block component includes building block dependency information and building block configuration information. The building block dependency information is used to describe the dependency relationship between the corresponding building block component and other building block components. The building block configuration information is used to describe whether the functional modules constituting the corresponding building block component are set functional modules required for building an embedded operating system. The target parameter information includes at least the identification information of the set functional modules.
[0202] The second downloading module 304 is configured to download the second building block component and the script file corresponding to the second building block component to the target environment at least according to the building block dependency information in the script file corresponding to the first building block component, wherein the second building block component is a building block component other than the first building block component in the target building block component.
[0203] The compiling module 305 is used to compile the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain the compiled executable file as the built embedded operating system.
[0204] In summary, the working principle of the embedded operating system building device disclosed in this embodiment is the same as the working principle of the embedded operating system building method disclosed in the above embodiment. For details, please refer to the introduction in the above embodiment and will not be repeated here.
[0205] The embodiment of the present application also provides a device for building an embedded operating system. Figure 4 The hardware structure diagram of the embedded operating system is shown in FIG. Figure 4 , the hardware structure of the embedded operating system building device may include: at least one processor 401, at least one communication interface 402, at least one memory 403 and at least one communication bus 404;
[0206] In the embodiment of the present application, the number of the processor 401, the communication interface 402, the memory 403, and the communication bus 404 is at least one, and the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404;
[0207] The processor 401 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention;
[0208] The memory 403 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory;
[0209] The memory 403 stores a program, and the processor 401 can call the program stored in the memory 403, and the program is used to:
[0210] Build the target environment;
[0211] Obtain identification information of the first building block component and target parameter information supporting the embedded operating system;
[0212] Downloading the first building block component and a script file corresponding to the first building block component into a target environment based at least on identification information of the first building block component, wherein the first building block component is a root building block component in the target building block component, and the script file corresponding to each building block component included in the target building block component includes building block dependency information and building block configuration information, the building block dependency information is used to describe the dependency relationship between the corresponding building block component and other building block components, the building block configuration information is used to describe whether several functional modules constituting the corresponding building block component are set functional modules required for building an embedded operating system, and the target parameter information includes at least identification information of the set functional modules;
[0213] Downloading a second building block component and a script file corresponding to the second building block component into a target environment based at least on the building block dependency information in the script file corresponding to the first building block component, wherein the second building block component is a building block component other than the first building block component in the target building block component;
[0214] According to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information, the downloaded target building block component is compiled to obtain the compiled executable file as the built embedded operating system.
[0215] Optionally, the detailed functions and extended functions of the program may refer to the above description.
[0216] An embodiment of the present application also provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for building an embedded operating system as described above is implemented.
[0217] Optionally, the detailed functions and extended functions of the program may refer to the above description.
[0218] Finally, it should be noted that, in this document, relational terms such as and and the like are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
[0219] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0220] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for building an embedded operating system, characterized in that: include: Build the target environment; Obtain identification information of a first building block component and target parameter information supporting the embedded operating system, wherein the first building block component is a root building block component in a target building block component, a script file corresponding to each building block component included in the target building block component includes building block dependency information and building block configuration information, the building block component is a component obtained by performing building block processing on a software module, each of the software modules is composed of a plurality of functional modules, and after the software modules are subjected to component building block processing, each of the building block components is composed of functional modules, the building block dependency information is used to describe a dependency relationship between the corresponding building block component and other building block components, the building block configuration information is used to describe whether the plurality of functional modules constituting the corresponding building block component are set functional modules required to build the embedded operating system, and the target parameter information includes at least identification information of the set functional modules; downloading the first building block component and a script file corresponding to the first building block component to the target environment at least according to the identification information of the first building block component; Downloading a second building block component and a script file corresponding to the second building block component into the target environment based at least on the building block dependency information in the script file corresponding to the first building block component, wherein the second building block component is a building block component other than the first building block component in the target building block component; According to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information, the downloaded target building block component is compiled to obtain a compiled executable file as the built embedded operating system.
2. The method for building an embedded operating system according to claim 1, wherein: The target environment is constructed, including: Use virtual environment technology and target sandbox software to build the target environment, or create a Docker virtual image.
3. The method for building an embedded operating system according to claim 1, wherein: Obtain target parameter information supporting the embedded operating system, including: The preset initial parameter information is rewritten to obtain the target parameter information supporting the embedded operating system, or the target parameter information supporting the embedded operating system is written.
4. The method for building an embedded operating system according to claim 1, wherein: The script information of any building block component also includes the version information of the building block component; The downloading of the first building block component and a script file corresponding to the first building block component to the target environment at least according to the identification information of the first building block component includes: Determining, based on the identification information of the first building block component and preset warehouse information, a software sub-warehouse where the first building block component is located as a first software sub-warehouse, wherein the warehouse information includes a correspondence between the identification information of the building block component and the identification information of the software sub-warehouse, and the first software sub-warehouse includes multiple versions of the first building block component and script files corresponding to the multiple versions of the first building block component; If the target parameter information does not include the first version information, downloading the latest version of the first building block component and the script file corresponding to the latest version of the first building block component from the first software sub-warehouse to the target environment, wherein the first version information is the version information of the first building block component to be downloaded; If the target parameter information includes the first version information, the first building block component under the first version information and the script file corresponding to the first building block component under the first version information are downloaded from the first software sub-warehouse to the target environment.
5. The method for building an embedded operating system according to claim 4, wherein: The downloading of the second building block component and the script file corresponding to the second building block component to the target environment at least according to the building block dependency information in the script file corresponding to the first building block component includes: If the target parameter information does not include the second version information, downloading the latest version of the second building block component and the script file corresponding to the latest version of the second building block component to the target environment based on the building block dependency information in the script file corresponding to the first building block component and the warehouse information, wherein the second version information is the version information of the second building block component to be downloaded; If the target parameter information includes the second version information, the second building block component under the second version information and the script file corresponding to the second building block component under the second version information are downloaded to the target environment according to the building block dependency information and the warehouse information in the script file corresponding to the first building block component.
6. The method for building an embedded operating system according to claim 5, wherein: The step of downloading the second building block component under the second version information and the script file corresponding to the second building block component under the second version information to the target environment according to the building block dependency information in the script file corresponding to the first building block component and the warehouse information includes: Determining identification information of a second software sub-warehouse according to the building block dependency information in the script file corresponding to the first building block component and the warehouse information, wherein the second software sub-warehouse is the software sub-warehouse where the second building block component is located; Constructing a dependency tree for the embedded operating system based on the building block dependency information in the script file corresponding to the first building block, the second version information, and the identification information of the second software sub-warehouse, wherein each node of the dependency tree corresponds to a building block in the target building block, the node corresponding to the first building block includes the first version information and the identification information of the first software sub-warehouse, and the node corresponding to the second building block includes the second version information and the identification information of the second software sub-warehouse; According to the dependency tree, the second building block component under the second version information and the script file corresponding to the second building block component under the second version information are downloaded from the second software sub-warehouse indicated by the identification information of the second software sub-warehouse to the target environment.
7. The method for building an embedded operating system according to claim 1, wherein: The method further comprises compiling the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain a compiled executable file, including: Obtaining a target configuration file according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information; According to the target configuration file, the downloaded target building block component is trimmed to obtain a trimmed target building block component; Generate a target compilation file according to the target configuration file, wherein the target compilation file is used to indicate how to compile the tailored target building block component; The tailored target building block components are compiled according to the target compilation file to obtain the compiled executable file.
8. The method for building an embedded operating system according to claim 7, wherein: The step of obtaining a target configuration file according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information includes: The building block configuration information in the script file corresponding to the target building block component is modified according to the identification information of the function module set in the target parameter information, and the target configuration file is obtained from the modified building block configuration information.
9. The method for building an embedded operating system according to claim 7, wherein: The step of tailoring the downloaded target building block component according to the target configuration file to obtain a tailored target building block component includes: According to the target configuration file, other functional modules except the set functional module in the downloaded target building block component are cut out to obtain the cut target building block component.
10. The method for building an embedded operating system according to claim 1, wherein: The script file corresponding to the target building block component also includes building block post-processing information; After compiling the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain the compiled executable file, the method further includes: The compiled executable file is post-processed according to the building block post-processing information, and the post-processed executable file serves as the built embedded operating system.
11. The method for building an embedded operating system according to claim 10, wherein: The post-processing of the compiled executable file according to the building block post-processing information includes: If the building block post-processing information includes encryption processing, obtaining an encryption command from an external designated location, and performing encryption processing on the compiled executable file based on the encryption command; and / or, If the building block post-processing information includes adding a header, obtaining a header adding command from the external specified location, and adding header information to the compiled executable file based on the header adding command; and / or, If the building block post-processing information includes function printing processing, a function printing command is obtained from the external designated location, and function list information corresponding to the compiled executable file is printed and output based on the function printing command.
12. A device for building an embedded operating system, characterized in that: include: Target environment building module, information acquisition module, first download module, second download module and compilation module; The target environment building module is used to build the target environment; The information acquisition module is configured to obtain identification information of a first building block component and target parameter information supporting the embedded operating system, wherein the first building block component is a root building block component in the target building block component, and the script file corresponding to each building block component included in the target building block component includes building block dependency information and building block configuration information. The building block component is a component obtained by performing building block processing on a software module, and each of the software modules is composed of a plurality of functional modules. After the software modules are subjected to component building block processing, each of the building block components is composed of functional modules. The building block dependency information is used to describe the dependency relationship between the corresponding building block component and other building block components, and the building block configuration information is used to describe whether the plurality of functional modules constituting the corresponding building block component are set functional modules required for building the embedded operating system. The target parameter information at least includes identification information of the set functional modules. The first downloading module is configured to download the first building block component and a script file corresponding to the first building block component to the target environment based at least on the identification information of the first building block component; The second downloading module is configured to download a second building block component and a script file corresponding to the second building block component to the target environment based at least on the building block dependency information in the script file corresponding to the first building block component, wherein the second building block component is a building block component other than the first building block component in the target building block component; The compilation module is used to compile the downloaded target building block component according to the building block configuration information in the script file corresponding to the target building block component and the identification information of the function module set in the target parameter information to obtain a compiled executable file as the built embedded operating system.
13. A device for building an embedded operating system, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the method for building an embedded operating system according to any one of claims 1 to 11.
14. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the method for building an embedded operating system according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
System and method for providing embedded integrated development environment
CN111158645A
Method and devicefor constructing Linux system
CN112214221A