WO2017148171A1 - 一种嵌入式装置的启动方法和装置 - Google Patents

一种嵌入式装置的启动方法和装置 Download PDF

Info

Publication number
WO2017148171A1
WO2017148171A1 PCT/CN2016/104145 CN2016104145W WO2017148171A1 WO 2017148171 A1 WO2017148171 A1 WO 2017148171A1 CN 2016104145 W CN2016104145 W CN 2016104145W WO 2017148171 A1 WO2017148171 A1 WO 2017148171A1
Authority
WO
WIPO (PCT)
Prior art keywords
program segment
fast
segment
quick
boot loader
Prior art date
Application number
PCT/CN2016/104145
Other languages
English (en)
French (fr)
Inventor
刘磊
王米虎
黄节两
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP16892352.2A priority Critical patent/EP3410296B1/en
Publication of WO2017148171A1 publication Critical patent/WO2017148171A1/zh
Priority to US16/115,416 priority patent/US11080066B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system

Definitions

  • the present invention relates to the field of embedded technologies, and in particular, to a method and an apparatus for starting an embedded device.
  • the embedded device includes the host and the target machine.
  • the host and the target are developed based on different architectures.
  • the host is responsible for development and compilation, that is, the development and compilation of the device.
  • the cross tool chain needs to be installed first.
  • the protocol stack and driver development and then run the compiled program downloaded from the host, that is, the embedded device.
  • the startup speed of the system is an important measure, especially for consumer embedded devices such as driving recorders, cameras and intelligent print servers.
  • the startup time of the system directly affects the user experience.
  • the industry cold boot method is: the system boot program loads the system boot image file in the storage space into the memory, and then starts the system.
  • a solution is: configure a non-power-down area in the system, and when the system is shut down, load the program that is started up to the area where the power is off, and when the system starts again, first execute the program of the non-power-down area.
  • the scheme is: in the process of host development and compilation, the code function and variable of the startup program segment in the developed program are crowned, and then when the link is compiled, the related code functions and variables are started in the compiled file.
  • the target system when the target system loads the image file into the memory, it will first load the first half of the run to start the relevant segment, and then load and run the rest of the segment, but in this scenario, the developer needs to know all Source code for code functions and variables related to system startup, and some startup related
  • the code function may be provided as a library file, not in source code, so that it cannot be used for quick startup. Therefore, how to provide a universal method for quickly starting an embedded device is an urgent problem to be solved.
  • the embodiment of the invention provides a method and a device for starting an embedded device, which can improve the startup speed of the embedded device.
  • a method for starting an embedded device including:
  • the one or more services corresponding to the remaining image files of the system image file except the quick boot loader are sequentially loaded according to the service requirements of different services, and the load is performed after the loading.
  • the fast boot loader in the system image file is first loaded, that is, the minimum kernel is loaded first, and after the kernel is started, the fast boot loader is loaded according to the business requirements of different services.
  • One or more services corresponding to the remaining image files which can shorten the startup time of the startup service and improve the startup speed of the embedded device.
  • the one or more services corresponding to the remaining image files of the system image file except the quick boot loader are sequentially loaded according to the service requirements of different services, and the loading is performed after the loading
  • One or more of the business includes:
  • the key service of the system can be loaded and run first, and then the rest of the service corresponding to the image file is loaded and run, so that the key service priority is started to improve the startup speed. .
  • controlling the fast boot loader to load the fast boot program segment in the system image file comprises:
  • the length of the program segment is obtained according to the start address and the end address, and the loading of the program segment according to the length and the starting address can realize the loading precision of the code line level, thereby accurately controlling the loading. opportunity.
  • the loading according to the length can avoid real-time detection whether loading to the end address, and only needs to load the entire program segment according to the starting address and length, thereby improving the service loading speed, thereby improving the startup speed of the embedded device.
  • controlling the fast boot loader to load the non-fast start program segment in the system image file includes:
  • a method for developing and compiling an embedded device including:
  • the program of the system is divided according to a link script of the embedded device system, and the divided program includes a quick start loader and a program segment corresponding to different services divided according to service requirements of different services, and the fast boot loader is used to mirror the system.
  • the file is copied from the load domain to the execution domain;
  • the embedded device can be loaded and run in segments after the image file is downloaded to the embedded device.
  • Mirror file to improve the startup speed of embedded devices.
  • the program segment corresponding to the different services includes: a fast start program segment and a non-fast start program segment, where the fast start program segment corresponds to a key service of the embedded device, and the non-quick start The program segment corresponds to the rest of the embedded device except the key service.
  • the embedded device can load the key file in the image file before loading and running the image file, and then load and run the non-critical service in the image file, thereby improving the user experience when the system startup speed is improved.
  • the host compiling and linking the program segments corresponding to the different services according to the link script includes:
  • the first cross-compilation command is used to decompress the library files corresponding to the respective key services, and the intermediate files corresponding to the respective key services are generated, and any of the intermediate files includes the read-only data (rodata) of the key services corresponding to any of the intermediate files.
  • the library files of the key business can be directly compiled and linked without knowing the source code of the system, that is, the library providing the third-party development is linked. Orchestration, does not rely on the source code of third-party libraries, making compilation and linking more flexible, and can also improve the startup speed of the system.
  • the method before decompressing the library files corresponding to the respective key services by using the first cross-compilation command, the method further includes:
  • the source code of the key service is compiled to generate the library file, and then the library file is compiled and linked, so that the compilation and the link are more flexible.
  • the compiling and linking the program segment corresponding to the quick start loader and the different service includes :
  • the non-critical business library files can be directly compiled and linked without knowing the source code of the system, that is, the library provided by the third-party development is performed.
  • Link orchestration independent of the source code of third-party libraries, makes compilation and linking more flexible, and can also improve the startup speed of the system.
  • the method is prior to using the second cross-compilation command Also includes:
  • the source code of the non-critical business is compiled to generate the library file, and then the library file is compiled and linked, so that the compilation and the link are more flexible.
  • an embedded device including:
  • a system boot program for loading a system image file, the fast boot loader for copying the system image file from a load domain to an execution domain;
  • a running unit configured to run the fast boot loader
  • the quick start loader is configured to sequentially load one or more services corresponding to the remaining image files of the system image file except the fast boot loader program segment according to service requirements of different services, where the operation unit further Used to run one or more services after loading.
  • the fast boot loader in the system image file is first loaded, that is, the smallest kernel is loaded first, and after the kernel is started, the remaining image file is segmentally loaded according to the business requirement by the fast boot loader. Corresponding different services, this can shorten the startup time of the startup service and improve the startup speed of the embedded device.
  • the quick start loader is configured to load a quick start program segment in the system image file, where the fast start program segment includes a key service of the embedded device;
  • the operating unit is configured to run the key service
  • the quick boot loader is configured to load a non-quick start program segment in the system image file, where the non-fast start program segment includes other services in the embedded device except the key service;
  • the running unit is configured to run the remaining services.
  • the key business of the system can be loaded first. And run the purpose, and then load and run the rest of the business corresponding to the image file, so as to achieve critical business priority startup to improve boot startup speed.
  • the fast boot loader is used to:
  • the quick start program segment is loaded according to a start address of the quick start program segment and a length of the quick start program segment.
  • the embedded device loads the key service into the loading domain, the loading precision of the code row level can be realized, so that the timing of loading can be precisely controlled.
  • the fast boot loader is used to:
  • the quick boot loader is used to:
  • the non-quick start block is loaded according to a start address of the non-fast start block and a length of the non-fast start block.
  • the loading precision of the code row level can also be realized, so that the timing of loading can be precisely controlled.
  • a development and compilation apparatus comprising:
  • a dividing unit configured to divide a program of the system according to a link script of an embedded device system, where the divided program includes a quick launch loader and a program segment corresponding to different services divided according to a service requirement, where the fast boot loader is used
  • the system image file is copied from the load domain to the execution domain;
  • Compiling a linking unit configured to separately compile and link the quick boot loader and the program segments corresponding to the different services according to the link script to generate the system image file.
  • the partitioning process of the program of the system by the host and the compiling and linking processing of the divided different program segments enable the embedded device to be loaded and run after the image file is downloaded to the embedded device.
  • the image file improves the boot speed of the embedded device.
  • the program segment corresponding to the different services includes: a fast start program segment and a non-fast start program segment, where the fast start program segment corresponds to a key service of the embedded device, and the non-quick start The program segment corresponds to the rest of the business except the key business.
  • the embedded device can load the key file in the image file before loading and running the image file, and then load and run the non-critical service in the image file, thereby improving the user experience when the system startup speed is improved.
  • the compiling link unit is used to:
  • the first cross-compilation command is used to decompress the library files corresponding to the respective key services, and the intermediate files corresponding to the respective key services are generated, and any of the intermediate files includes the read-only data segments and data of the key services corresponding to any of the intermediate files.
  • the library files of the key business can be directly compiled and linked without knowing the source code of the system, that is, the library providing the third-party development is linked. Orchestration, does not rely on the source code of third-party libraries, making compilation and linking more flexible, and can also improve the startup speed of the system.
  • the compiling link unit is used to:
  • the library file includes a static library file or a dynamic library file.
  • the source code of the key service is compiled to generate the library file, and then the library file is compiled and linked, so that the compilation and the link are more flexible.
  • the compiling link unit is used to:
  • the non-critical business library files can be directly compiled and linked without knowing the source code of the system, that is, the library provided by the third-party development is performed.
  • Link orchestration independent of the source code of third-party libraries, makes compilation and linking more flexible, and can also improve the startup speed of the system.
  • the compiling link unit is used to:
  • the source code of the non-critical business is compiled to generate the library file, and then the library file is compiled and linked, so that the compilation and the link are more flexible.
  • an embodiment of the present invention provides a method and apparatus for starting an embedded device, by segmenting a program of the embedded device system, including a quick start loader and a program segment corresponding to different services, so that after segmentation After the program segment is compiled and linked to generate the image file that is started by the system, the embedded device can first load the quick boot loader in the image file after downloading the image file, and then load the segment according to the business requirement through the quick launch loader.
  • the fast boot loader in the system image file is loaded first, that is, the smallest kernel is loaded first, and after the kernel is started, one or more services corresponding to the remaining image files are segmentally loaded according to the service requirements of different services through the fast boot loader. Then run one or more services after loading, which can shorten the startup time of the startup service and improve the startup speed of the embedded device.
  • FIG. 1 is a schematic diagram of an embedded device according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a method for starting an embedded device according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a compiled link to a library file according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of a method for starting an embedded device according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of loading an ELF according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of an embedded device according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a device for developing and compiling according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of an embedded device according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a device for developing and compiling according to an embodiment of the present invention.
  • the embodiment of the invention can be used for an embedded device, as shown in FIG. 1 , the embedded device includes embedded The input device, the development and the compilation device, wherein the development and compilation device is a host, and the embedded device is a target device, and the invention is used for implementing a quick start of the embedded device.
  • the target machine can be a driving recorder, a smart print server, a camera, etc., correspondingly, the host is responsible for developing and compiling a system program of a target machine such as a driving recorder, a smart print server, or a camera.
  • the host may first modify the link script of the target system, so that the host divides the program of the target system according to the link script for the target system, and the divided program includes a quick start loader program segment and according to business requirements.
  • the program segment corresponding to different services is divided, and the fast boot loader is used to copy the image file of the target system from the loading domain to the execution domain, and then compile the fast boot loader program segment and the program segment corresponding to different services according to the link script.
  • Link to generate a system-initiated image file.
  • the target machine can first load the fast boot loader program segment in the image file through the system boot program, and the fast boot loader is used to copy the image file of the target system from the load domain to the execution.
  • the fast boot loader is run, the one or more services corresponding to the remaining image files are loaded and run in stages according to the business requirements of different services. That is to say, during the boot process of the target machine, the fast boot loader program segment in the system image file is loaded first, that is, the minimum kernel is loaded first, and after the kernel is started, the remaining load is segmented according to the business requirement through the fast boot loader.
  • the image file corresponds to one or more services, and then runs one or more services after loading, so that the startup time of the startup service can be shortened, and the startup speed of the embedded device can be improved.
  • An embodiment of the present invention provides a method for starting an embedded device, as shown in FIG. 2, including:
  • the development and compilation device divides the system according to a program for linking the scripts for the embedded device system, and the divided program includes a quick start loader and a program segment divided according to business requirements of different services, and the fast boot loader is used to mirror the system.
  • the file is copied from the load domain to the execution domain.
  • the load domain can be the area where the system hardware stores the image file. Usually, the area where the power is lost is not lost.
  • the execution domain can be the area where the system runs the image file, usually the memory area, and the power loss is lost.
  • the device is developed and compiled, that is, the host can divide the system program according to the link script of the embedded device system, and the divided program includes a quick boot loader, fast.
  • the link script for the target machine system in the host may be modified first, so that the modified link script may instruct the host to divide the system-initiated program into a fast boot loader, a quick start block, and a non-quick start block.
  • Link scripts can be used to specify certain blocks at a specified location, alignment, and storage style.
  • the fast boot loader can be used to copy the target system image file from the load domain to the execution domain.
  • the loading domain is the area where the system hardware of the target machine stores the image file, and the domain where the domain is the target machine runs the image file. It can be understood that the present application is equivalent to encapsulating the program code copied from the loading domain to the execution domain in the system image file of the target machine into an interface, which can be run separately.
  • the quick start block includes the key business of the target, and the non-quick start block includes the rest of the business except the key business.
  • the key service may be a video service or a wireless connection service
  • the remaining services may include a Bluetooth service and a photo service.
  • the development and compilation device compiles and links the quick start loader program segment and the program segment corresponding to different services according to the link script to generate a system image file.
  • the quick start loader can be compiled and linked, and then the program segments corresponding to different services are compiled and linked, for example, the key business of the target machine and the program segments corresponding to the non-critical business are respectively compiled and linked.
  • the host uses the second cross-compilation command to link the library file corresponding to the quick boot loader to the ELF corresponding to the quick boot loader, and links the library file corresponding to the non-fast start program segment to the corresponding non-quick start program segment.
  • the read-only data (rodata) segment, the data (data) segment, and the code (text) segment corresponding to the fast boot loader are respectively in the same program segment of the ELF, and the rodata segment and the data segment corresponding to the non-fast start program segment and The text segments are in the same block of the ELF.
  • the library file can be a static library file, recorded as a .a file, or a dynamic library file, recorded as a .so file.
  • the library file corresponding to the quick launch loader is linked, or is not fast
  • the respective .a files corresponding to the quick start loader or the rodata segment, the data segment and the text segment in each .a file corresponding to the non-quick start program segment are respectively located in the same program.
  • the rodata segment in each .a file of the library file is linked, and the data segment in each .a file is linked, and the text segment in each .a file is linked, and the generated image file is the ELF fast startup loader.
  • the rodata segment, the data segment, and the text segment in the block are located in the same block.
  • the source code of the quick start loader may be compiled according to the link script.
  • the library file corresponding to the quick start loader is compiled, and the source code corresponding to the non-quick start program segment is compiled to generate a library file corresponding to the non-quick start program segment.
  • the first cross-compilation command can be used to decompress each key service corresponding
  • the library file generates an intermediate file corresponding to each key service, and any intermediate file includes a read-only data segment, a data segment, and a code segment of a key service corresponding to any intermediate file; and then uses a second cross-compilation command to correspond to each key service.
  • the intermediate file is linked to the executable link file ELF corresponding to the quick start program segment, and the executable link file ELF corresponding to the quick start program segment, the read-only data segments of each key service are in the same program segment, and the data of each key service is The segments are in the same block, and the code segments of each key service are in the same block.
  • the first cross-compilation command may be xxx-ar, which is used to extract the library file, that is, the .a file generates an intermediate file (denoted as a .o file), and the xxx is different according to the cross compiler
  • the second cross-compilation The command can be xxx-ld, which is used to link multiple intermediate files to generate ELF, which varies according to the cross compiler.
  • XX.a and XY.a represent two different key business library files, 1.0, 2.0 in XX.a file, and a.0, b.0, etc. in XY.a file.
  • each .a file includes the rodata section, the data section, and the text section.
  • the XX.a file decompresses the corresponding XX.o file, XY.
  • the a file is decompressed and corresponds to the XY.o file, wherein the rodata segment in the XX.o file is linked by each rodata segment in the XX.a file, and the data segment in the XX.o file is composed of each of the XX.a files.
  • the data segment is linked, and the text segment in the XX.o file is in the XX.a file.
  • the text segments are linked together.
  • the rodata segments in the XY.o file are linked by the rodata segments in the XY.a file.
  • the data segments in the XY.o file are represented by the data segments in the XY.a file. Linked, the text segment in the XY.o file is linked by each text segment in the XY.a file. Then, use xxx-ld to link the XX.o file and the XY.o file to the fast start block in the ELF.
  • the quick start block also includes the rodata section, the data section and the text section, and the rodata section of the quick start section is XX.
  • the data segment in the .o file is linked with the rodata segment in the XY.o file.
  • the data segment of the quick start program segment is formed by linking the data segment in the XX.o file with the data segment in the XY.o file.
  • the text segment of the startup block is composed of the text segment in the XX.o file and the text segment in the XY.o file.
  • the host compiles the source code corresponding to each key service according to the link script to generate the library file before using the first cross-compilation command to decompress the library files corresponding to each key service.
  • the library file includes a static library file or a dynamic library file.
  • the driving recorder its key business includes camera business and wireless connection service. Firstly, the source code corresponding to the camera service (denoted as .c file) and the source code corresponding to the wireless connection service are compiled to generate a .a file (static library file).
  • each library file can be linked to different specified segments according to different characteristics, and stored in different designated positions.
  • the ELF can be downloaded from the host to the flash chip of the target machine.
  • the ELF image file is loaded from the flash chip to the embedded device, that is, the memory of the target machine.
  • the target machine starts, and the specific loading process can be:
  • the embedded device loads the fast boot loader in the system image file by using a system boot program.
  • the system boot program can be modified so that the system boot loader loads the fast boot loader in the system image file when the ELF is loaded.
  • the start address and the end address of the fast boot loader can be set in the boot program in advance.
  • the fast boot load is first obtained according to the start address and the end address of the fast boot loader.
  • the length of the device then loaded according to the start address and length of the fast boot loader Quick boot loader.
  • the embedded device runs a fast boot loader.
  • the fast boot loader is used to copy the target system image file from the load domain to the execution domain, which is equivalent to encapsulating the load from the load copy to the execution domain into an interface, which is also the smallest kernel of the system program.
  • the system boots only the minimum kernel is loaded first, so that after the kernel starts running, the remaining segments are loaded.
  • the embedded device After running the fast boot loader, the embedded device loads one or more services corresponding to the remaining image files except the fast boot loader in the system image file according to the service requirements of different services, and runs the loaded one. Or multiple businesses.
  • the different services corresponding to the remaining image files can be loaded by the fast boot loader, instead of all the system image files being loaded and then run, which can improve the startup speed of the target machine.
  • Embodiments of the present invention provide a method for starting an embedded device, which pre-segments a program of an embedded device system by a development and compilation device, including a quick start loader and a program segment corresponding to different services, so that the segment is segmented.
  • the embedded device can load the image file, first load the quick-start loader in the image file, and then segment the data according to the business needs through the quick-start loader. Load and run one or more services corresponding to the remaining image files.
  • the fast boot loader loads one or more services corresponding to the remaining image files according to the service requirements of different services, and then runs one or more services after loading, so that the startup time of the startup service can be shortened, and the embedded time can be improved.
  • the boot speed of the device
  • step 205 may specifically include 401-404:
  • the embedded device controls the quick start loader to load the system image file.
  • the quick start program segment includes the key services of the target machine.
  • the control fast boot loader After the fast boot loader runs, the control fast boot loader first loads the quick start program segment of the system image file, and the fast start program segment corresponds to the key service of the target machine, so that no need is needed.
  • the target machine loads the entire system image file and then starts it, but loads it in segments, and loads the corresponding key services in the system image file first.
  • the quick start block is marked with a start address and an end address
  • the fast boot loader obtains a start address and an end address of the quick start block, and obtains a quick start program according to the start address and the end address of the quick start block.
  • precise loading timing at the line level can be achieved at the timing of the fast start block loading.
  • the embedded device runs a key service.
  • the key business corresponding to the fast start program of the driving recorder includes the camera service and the wireless connection service. Then, when the driving recorder is started, after the quick start loader is loaded, the quick start loader starts the camera service and the wireless connection first. Business, and synchronize the data of key business. At this time, the startup time of the driving recorder will be greatly shortened, and the key business of the system will be loaded and started up.
  • the embedded device controls the fast boot loader to load a non-quick start program segment in the system image file, and the non-fast start program segment includes the remaining services of the target device except the key service.
  • the fast boot loader obtains the start address and the end address of the non-fast start block, and obtains the length of the non-fast start block according to the start address and the end address of the non-fast start block, and then according to the start of the non-fast start block
  • the length of the address and non-quick start block loads the non-quick start block, as shown in Figure 5.
  • the non-critical service of the driving recorder includes the Bluetooth service, and then the Bluetooth service is loaded after the key services are loaded and run, that is, the system loads the services of the target segment according to the service requirements.
  • the embedded device runs the rest of the service.
  • the program of the embedded device system is segmented by the development and compilation device, including the fast startup loader and the program segment corresponding to different services, so that the segmentation is performed.
  • the embedded device can load the image file, first load the quick-start loader in the image file, and then use the quick-start loader according to the business requirements.
  • the segment loads and runs the different services corresponding to the remaining image files, that is, during the startup of the embedded device, First load the quick boot loader in the system image file, that is, load the smallest kernel first.
  • the fast boot loader can load and run the different services corresponding to the remaining image files according to the business requirements. Start the startup time of the service and increase the startup speed of the embedded device.
  • An embodiment of the present invention provides an embedded device 60, as shown in FIG. 6, including:
  • the system boot program 601 is configured to load a quick boot loader in the system image file, where the fast boot loader is configured to copy the system image file from the load domain to the execution domain;
  • a running unit 602 configured to run a fast boot loader
  • the quick start loader 603 is configured to segmentally load one or more services corresponding to the remaining image files in the system image file except the fast boot loader according to service requirements of different services.
  • the running unit 602 is further configured to run one or more services after loading.
  • the fast boot loader 603 is configured to load a quick start 604 program segment in the system image file, where the fast start 604 program segment includes a key service of the embedded device;
  • the operation unit 602 is configured to run a key service
  • the fast boot loader 603 is configured to load a non-quick start 605 program segment in the system image file, where the non-quick start 605 program segment includes other services in the embedded device except the key service;
  • the running unit 602 is configured to run the remaining services.
  • the fast boot loader 603 is used to:
  • the quick start program segment is loaded according to the start address of the quick start 604 program segment and the length of the quick start 604 program segment.
  • the fast boot loader 603 is used to:
  • the non-rapid start 605 program segment is loaded according to the start address of the non-fast start 605 program segment and the length of the non-quick start 605 program segment.
  • the embedded device provided by the embodiment of the present invention loads the quick boot loader in the system image file after downloading the image file, and then loads and runs the corresponding image file according to the service requirement by the fast boot loader.
  • Different services in which, during the startup process of the embedded device, the fast boot loader in the system image file is first loaded, that is, the minimum kernel is loaded first, and after the kernel is started, the fast boot loader is segmented according to the business requirements. Load and run the corresponding different services in the remaining image files, which can shorten the startup time of the startup service and improve the startup speed of the embedded device.
  • the embodiment of the invention provides a development and compilation device 70, as shown in FIG. 7, comprising:
  • the dividing unit 701 is configured to divide the system according to the link script of the embedded device system, and the divided program includes a quick start loader program segment and a program segment corresponding to different services divided according to service requirements of different services, and the fast startup loader is used. Copy the system image file from the load domain to the execution domain;
  • the compiling link unit 702 is configured to compile and link the quick launch loader program segment and the program segment corresponding to different services according to the link script to generate a system image file.
  • the program segment corresponding to the different services includes: a fast start program segment corresponding to a key service of the embedded device, and a non-fast start program segment corresponding to the embedded device The rest of the business except the key business.
  • the compiling link unit 702 is configured to:
  • the first cross-compilation command is used to decompress the library files corresponding to the respective key services, and the intermediate files corresponding to the respective key services are generated, and any of the intermediate files includes the read-only data segments and data of the key services corresponding to any of the intermediate files.
  • the compiling link unit 702 is configured to:
  • the source code corresponding to each key business is compiled to generate a library file
  • the library file includes a static library file or a dynamic library file.
  • the compiling link unit 702 is configured to:
  • Linking by using a second cross-compilation command, a library file corresponding to the quick-start loader program segment to an executable link file ELF corresponding to the quick-start loader program segment, and using the library corresponding to the non-quick start program segment
  • the file is linked to the ELF corresponding to the non-quick start program segment, and the read-only data segment, the data segment and the code segment of the fast boot loader program segment are respectively in the same program segment of the ELF, and the non-quick start
  • the read-only data segment, the data segment and the code segment corresponding to the program segment are respectively in the same program segment of the ELF.
  • the compiling link unit 702 is configured to:
  • the source code corresponding to the quick start loader program segment is compiled to generate a library file corresponding to the fast boot loader program segment
  • the source code corresponding to the non-fast start program segment is compiled to generate a library file corresponding to the non-fast start program segment.
  • the development and compilation apparatus provided by the embodiment of the present invention can perform the process of dividing the image file and compiling and linking the different program segments after the partitioning, so that after the image file is downloaded to the embedded device,
  • the embedded device loads and runs the image file in stages to improve the startup speed of the embedded device.
  • the embodiment of the present invention further provides an embedded device 80, as shown in FIG. 8, including a flash chip 801, a memory 802, and a memory 802 including a system boot program, a fast boot loader, a fast boot, and a non-fast boot.
  • an embedded device 80 including a flash chip 801, a memory 802, and a memory 802 including a system boot program, a fast boot loader, a fast boot, and a non-fast boot.
  • the embodiment of the present invention further provides a development and compilation device 90, as shown in FIG. 9, comprising a memory 901 and a compiler linker 902.
  • the memory 901 includes a source code or a library file, and an ELF or the like.
  • the compiling connector 902 is configured to compile and link the source code or the library file to form an ELF.
  • the implementation manner is as shown in the embodiments shown in FIG. 3 and FIG. No longer.
  • the development and compilation device and the embedded device provided by the embodiments of the present invention segment the program of the embedded device system by the development and compilation device, including the quick start loader and the program segments corresponding to different services, so that After the segmented program segment is compiled and linked to generate the image file initiated by the system, the embedded device can first load the image of the fast boot loader in the image file after downloading the image file, and then use the fast boot loader according to the fast boot loader.
  • the business requirements segmentally load and run the different services corresponding to the remaining image files. That is, during the boot process of the embedded device, the fast boot loader program segment in the system image file is loaded first, that is, the smallest kernel is loaded first, in the kernel. After the startup, the fast startup loader loads and runs the different services corresponding to the remaining image files according to the business requirements. This can shorten the startup time of the startup service and improve the startup speed of the embedded device.
  • the disclosed terminal and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units.
  • the program segment or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium.
  • the software functional unit described above is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the program steps of the method of the various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, and the program code can be stored. Medium.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

一种嵌入式装置的启动方法和装置,应用于嵌入式领域,能够提高嵌入式装置的开机启动速度。其方法为:通过开发和编译装置对嵌入式装置系统程序进行分段,包括快速启动加载器和不同的业务对应的程序段,这样在对分段后的程序段进行编译和链接生成嵌入式装置系统镜像文件后,可使得嵌入式装置在下载该镜像文件后,先加载快速启动加载器,再通过快速启动加载器根据不同业务的业务需求依次加载镜像文件中的一个或多个业务,再运行加载后的一个或多个业务。

Description

一种嵌入式装置的启动方法和装置
本申请要求于2016年2月29日提交中国专利局、申请号为201610113630.9、发明名称为“一种嵌入式装置的启动方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及嵌入式领域,尤其涉及一种嵌入式装置的启动方法和装置。
背景技术
嵌入式设备包括主机和目标机,主机和目标机是基于不同体系架构的开发,主机负责开发和编译,也即开发和编译装置,目标机运行嵌入式开发之前,首先需要安装交叉工具链,网络协议栈以及驱动程序开发,而后运行从宿主机下载的编译后的程序,也即嵌入式装置。
在嵌入式装置中,其系统的启动速度是一个重要的衡量指标,特别是对于消费类的嵌入式装置,例如行车记录仪、相机和智能打印服务器等,系统的启动时间直接影响用户体验。目前,业界的系统冷启动的方式为:通过系统引导程序将存储空间中的系统启动镜像文件加载到内存中,然后再启动系统。例如一种方案为:在系统中配置一个不掉电区域,在系统关机时,将开机启动的程序加载到不掉电的区域,当系统再次启动时,首先执行不掉电区域的程序,可达到快速启动的目的,但是在一些嵌入式设备中,有的产品中并未配置不掉电区域,即关机意味着掉电,因此,该方案并不适用于所有的嵌入式装置;另一种方案为:在主机开发和编译的过程中,对开发的程序中的启动程序段的代码函数及变量进行冠头,然后在编译链接时,使启动相关的代码函数及变量在编译生成的文件的前半部分独立的段中,这样在目标机系统加载镜像文件到内存中时,就会先加载运行前半部分启动相关的段,再加载运行其余的段,但是,该方案中,开发者需要知道所有与系统启动相关的代码函数及变量的源码,且有些启动相关 的代码函数可能是以库文件的方式提供的,并不是以源码的方式提供的,这样就无法使用该方案进行快速启动。因此,如何提供一种通用的快速启动嵌入式装置的方法是一个亟待解决的问题。
发明内容
本发明实施例提供一种嵌入式装置的启动方法和装置,能够提高嵌入式装置的开机启动速度。
第一方面,提供一种嵌入式装置的启动方法,包括:
通过系统引导程序加载系统镜像文件中的快速启动加载器,所述快速启动加载器用于将所述系统镜像文件从加载域拷贝至执行域;
运行所述快速启动加载器;
在运行所述快速启动加载器后,根据不同业务的业务需求依次加载所述系统镜像文件中除所述快速启动加载器以外的剩余镜像文件对应的一个或多个业务,并运行所述加载后的一个或多个业务。
由此,在嵌入式装置启动过程中,先加载系统镜像文件中的快速启动加载器,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据不同业务的业务需求分段加载剩余镜像文件对应的一个或多个业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
在一种可能的设计中,所述根据不同业务的业务需求依次加载所述系统镜像文件中除所述快速启动加载器以外的剩余镜像文件对应的一个或多个业务,并运行所述加载后的一个或多个业务包括:
控制所述快速启动加载器加载所述系统镜像文件中的快速启动程序段,所述快速启动程序段包括嵌入式装置的关键业务;
运行所述关键业务;
控制所述快速启动加载器加载所述系统镜像文件中的非快速启动程序段,所述非快速启动程序段包括所述嵌入式装置中除所述关键业务以外的其余业务;
运行所述其余业务。
由此,在分段加载业务的镜像文件时,可达到系统的关键业务先加载并运行的目的,而后再加载并运行镜像文件对应的其余的业务,从而实现关键业务优先启动以提高开机启动速度。
在一种可能的设计中,所述控制所述快速启动加载器加载所述系统镜像文件中的快速启动程序段包括:
控制所述快速启动加载器获取所述系统镜像文件中所述快速启动程序段的起始地址和结束地址;
控制所述快速启动加载器根据所述快速启动程序段的起始地址和结束地址获取所述快速启动程序段的长度;
控制所述快速启动加载器根据所述快速启动程序段的起始地址和所述快速启动程序段的长度加载所述快速启动程序段。
由此,在将关键业务加载到加载域时,根据起始地址和结束地址得到程序段的长度,根据长度和起始地址加载程序段可实现代码行级的加载精度,从而可以精确控制加载的时机。其中,根据长度加载可避免实时检测是否加载至结束地址,只需根据起始地址和长度加载整段程序段,提升了业务加载速度,从而提升了嵌入式装置的启动速度。
在一种可能的设计中,所述控制所述快速启动加载器加载所述系统镜像文件中的非快速启动程序段包括:
控制所述快速启动加载器获取所述系统镜像文件中所述非快速启动程序段的起始地址和结束地址;
控制所述快速启动加载器根据所述非快速启动程序段的起始地址和结束地址获取所述非快速启动程序段的长度;
控制所述快速启动加载器根据所述非快速启动程序段的起始地址和所述非快速启动程序段的长度加载所述非快速启动程序段。
由此,在将非关键业务加载到加载域时,也可实现代码行级的加载精 度,从而可以精确控制加载的时机。
第二方面,提供一种嵌入式装置的开发和编译方法,包括:
根据嵌入式装置系统的链接脚本划分所述系统的程序,划分后的程序包括快速启动加载器和根据不同业务的业务需求划分的不同业务对应的程序段,所述快速启动加载器用于将系统镜像文件从加载域拷贝至执行域;
根据所述链接脚本对所述快速启动加载器和所述不同业务对应的程序段分别进行编译和链接,以生成所述系统镜像文件。
由此,通过对系统的程序的划分处理,并对划分后的不同的程序段进行编译和链接处理,可使得在将镜像文件下载至嵌入式装置上后,嵌入式装置分段加载并运行该镜像文件,提高嵌入式装置的开机启动速度。
在一种可能的设计中,所述不同业务对应的程序段包括:快速启动程序段和非快速启动程序段,所述快速启动程序段对应所述嵌入式装置的关键业务,所述非快速启动程序段对应嵌入式装置中除所述关键业务以外的其余业务。
由此,可使得嵌入式装置在加载运行镜像文件时,可先加载镜像文件中的关键业务,后加载并运行镜像文件中的非关键业务,从而在提升系统的启动速度时,提升用户体验。
在一种可能的设计中,当所述不同业务对应的程序段为所述快速启动程序段时,所述主机根据所述链接脚本对所述不同业务对应的程序段进行编译和链接包括:
使用第一交叉编译命令解压各个关键业务对应的库文件,生成所述各个关键业务对应的中间文件,任一所述中间文件包括所述任一中间文件对应的关键业务的只读数据(rodata)段、数据(data)段和代码(text)段;
使用第二交叉编译命令将所述各个关键业务对应的中间文件链接至所述快速启动程序段对应的可执行链接文件ELF中,所述快速启动程序 段对应的可执行链接文件(Executable and Linkable Format,ELF)中,所述各个关键业务的只读数据段在同一程序段中,所述各个关键业务的数据段在同一程序段中,所述各个关键业务的代码段在同一程序段中。
由此,通过先对关键业务的库文件进行编译和链接处理,可在不需要获知系统的源码的情况下直接对关键业务的库文件进行编译和链接,即对提供第三方开发的库进行链接编排,不依赖于第三方库的源码,使得编译和链接更加灵活,也可提升系统的启动速度。
在一种可能的设计中,在使用第一交叉编译命令对所述各个关键业务对应的库文件解压之前,所述方法还包括:
根据所述链接脚本将所述各个关键业务对应的源码编译生成所述库文件,所述库文件包括静态库文件或动态库文件。
由此,可在主机提供源码的情况下,将关键业务的源码编译生成库文件,再对库文件进行编译和链接,使得编译和链接更加灵活。
在一种可能的设计中,当所述不同业务对应的程序段为所述非快速启动程序段时,所述对所述快速启动加载器和所述不同业务对应的程序段进行编译和链接包括:
使用第二交叉编译命令将所述快速启动加载器对应的库文件链接至所述快速启动加载器对应的ELF中,并将所述非快速启动程序段对应的库文件链接至所述非快速启动程序段对应的ELF中,所述快速启动加载器的只读数据段、数据段和代码段分别在所述ELF的同一程序段中,所述非快速启动程序段对应的只读数据段、数据段和代码段分别在所述ELF的同一程序段中。
由此,通过对非关键业务的库文件进行编译和链接处理,可在不需要获知系统的源码的情况下直接对非关键业务的库文件进行编译和链接,即对提供第三方开发的库进行链接编排,不依赖于第三方库的源码,使得编译和链接更加灵活,也可提升系统的启动速度。
在一种可能的设计中,在使用所述第二交叉编译命令之前,所述方法 还包括:
根据所述链接脚本将所述快速启动加载器对应的源码编译生成所述快速启动加载器对应的库文件,并将所述非快速启动程序段对应的源码编译生成所述非快速启动程序段对应的库文件。
由此,可提供源码的情况下,将非关键业务的源码编译生成库文件,再对库文件进行编译和链接,使得编译和链接更加灵活。
第三方面,提供一种嵌入式装置,包括:
系统引导程序,用于加载系统镜像文件的快速启动加载器,所述快速启动加载器用于将所述系统镜像文件从加载域拷贝至执行域;
运行单元,用于运行所述快速启动加载器;
所述快速启动加载器,用于根据不同业务的业务需求依次加载所述系统镜像文件中除所述快速启动加载器程序段以外的剩余镜像文件对应的一个或多个业务,所述运行单元还用于运行加载后的一个或多个业务。
由此,在嵌入式装置启动过程中,先加载系统镜像文件中的快速启动加载器,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据业务需求分段加载剩余镜像文件对应的不同业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
在一种可能的设计中,所述快速启动加载器用于,加载所述系统镜像文件中的快速启动程序段,所述快速启动程序段包括所述嵌入式装置的关键业务;
所述运行单元,用于运行所述关键业务;
所述快速启动加载器用于,加载所述系统镜像文件中的非快速启动程序段,所述非快速启动程序段包括所述嵌入式装置中除所述关键业务以外的其余业务;
所述运行单元,用于运行所述其余业务。
由此,在分段加载业务的镜像文件时,可达到系统的关键业务先加载 并运行的目的,而后再加载并运行镜像文件对应的其余的业务,从而实现关键业务优先启动以提高开机启动速度。
在一种可能的设计中,所述快速启动加载器用于:
获取所述系统镜像文件中所述快速启动程序段的起始地址和结束地址;
根据所述快速启动程序段的起始地址和结束地址获取所述快速启动程序段的长度;
根据所述快速启动程序段的起始地址和所述快速启动程序段的长度加载所述快速启动程序段。
由此,嵌入式装置在将关键业务加载到加载域时,可实现代码行级的加载精度,从而可以精确控制加载的时机。
在一种可能的设计中,所述快速启动加载器用于:
所述快速启动加载器用于:
获取所述系统镜像文件中所述非快速启动程序段的起始地址和结束地址;
根据所述非快速启动程序段的起始地址和结束地址获取所述非快速启动程序段的长度;
根据所述非快速启动程序段的起始地址和所述非快速启动程序段的长度加载所述非快速启动程序段。
由此,嵌入式装置在将非关键业务加载到加载域时,也可实现代码行级的加载精度,从而可以精确控制加载的时机。
第四方面,提供一种开发和编译装置,包括:
划分单元,用于根据嵌入式装置系统的链接脚本划分所述系统的程序,划分后的程序包括快速启动加载器和根据业务需求划分的不同业务对应的程序段,所述快速启动加载器用于将系统镜像文件从加载域拷贝至执行域;
编译链接单元,用于根据所述链接脚本对所述快速启动加载器和所述不同业务对应的程序段分别进行编译和链接,以生成所述系统镜像文件。
由此,通过主机对系统的程序的划分处理,并对划分后的不同的程序段进行编译和链接处理,可使得在将镜像文件下载至嵌入式装置上后,嵌入式装置分段加载并运行该镜像文件,提高嵌入式装置的开机启动速度。
在一种可能的设计中,所述不同业务对应的程序段包括:快速启动程序段和非快速启动程序段,所述快速启动程序段对应所述嵌入式装置的关键业务,所述非快速启动程序段对应除所述关键业务以外的其余业务。
由此,可使得嵌入式装置在加载运行镜像文件时,可先加载镜像文件中的关键业务,后加载并运行镜像文件中的非关键业务,从而在提升系统的启动速度时,提升用户体验。
在一种可能的设计中,当所述不同业务对应的程序段为所述快速启动程序段时,所述编译链接单元用于:
使用第一交叉编译命令解压各个关键业务对应的库文件,生成所述各个关键业务对应的中间文件,任一所述中间文件包括所述任一中间文件对应的关键业务的只读数据段、数据段和代码段;
使用第二交叉编译命令将所述各个关键业务对应的中间文件链接至所述快速启动程序段对应的可执行链接文件ELF中,所述快速启动程序段对应的可执行链接文件ELF中,所述各个关键业务的只读数据段在同一程序段中,所述各个关键业务的数据段在同一程序段中,所述各个关键业务的代码段在同一程序段中。
由此,通过先对关键业务的库文件进行编译和链接处理,可在不需要获知系统的源码的情况下直接对关键业务的库文件进行编译和链接,即对提供第三方开发的库进行链接编排,不依赖于第三方库的源码,使得编译和链接更加灵活,也可提升系统的启动速度。
在一种可能的设计中,所述编译链接单元用于:
根据所述链接脚本将所述各个关键业务对应的源码编译生成库文件, 所述库文件包括静态库文件或动态库文件。
由此,可在主机提供源码的情况下,将关键业务的源码编译生成库文件,再对库文件进行编译和链接,使得编译和链接更加灵活。
在一种可能的设计中,当所述不同业务对应的程序段为所述非快速启动程序段时,所述编译链接单元用于:
使用第二交叉编译命令将所述快速启动加载器对应的库文件链接至所述快速启动加载器对应的ELF中,并将所述非快速启动程序段对应的库文件链接至所述非快速启动程序段对应的ELF中,所述快速启动加载器的只读数据段、数据段和代码段分别在所述ELF的同一程序段中,所述非快速启动程序段对应的只读数据段、数据段和代码段分别在所述ELF的同一程序段中。
由此,通过对非关键业务的库文件进行编译和链接处理,可在不需要获知系统的源码的情况下直接对非关键业务的库文件进行编译和链接,即对提供第三方开发的库进行链接编排,不依赖于第三方库的源码,使得编译和链接更加灵活,也可提升系统的启动速度。
在一种可能的设计中,所述编译链接单元用于:
根据所述链接脚本将所述快速启动加载器对应的源码编译生成所述快速启动加载器对应的库文件,并将所述非快速启动程序段对应的源码编译生成所述非快速启动程序段对应的库文件。
由此,可在主机提供源码的情况下,将非关键业务的源码编译生成库文件,再对库文件进行编译和链接,使得编译和链接更加灵活。
因此,本发明实施例提供一种嵌入式装置的启动方法和装置,通过对嵌入式装置系统的程序进行分段,包括快速启动加载器和不同的业务对应的程序段,这样在对分段后的程序段进行编译和链接生成系统启动的镜像文件后,可使得嵌入式装置在下载该镜像文件后,先加载镜像文件中的快速启动加载器,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件对应的一个或多个业务,也就是说,在嵌入式装置启动过程中, 先加载系统镜像文件中的快速启动加载器,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据不同业务的业务需求分段加载剩余镜像文件对应的一个或多个业务,再运行加载后的一个或多个业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种嵌入式设备的示意图;
图2为本发明实施例提供的一种嵌入式装置的启动方法的流程示意图;
图3为本发明实施例提供的一种对库文件的编译链接示意图;
图4为本发明实施例提供的一种嵌入式装置的启动方法的流程示意图;
图5为本发明实施例提供的一种对ELF进行加载的示意图;
图6为本发明实施例提供的一种嵌入式装置的结构示意图;
图7为本发明实施例提供的一种开发和编译装置的结构示意图;
图8为本发明实施例提供的一种嵌入式装置的结构示意图;
图9为本发明实施例提供的一种开发和编译装置的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明实施例可用于嵌入式设备,如图1所示,该嵌入式设备包括嵌 入式装置、开发和编译装置,其中开发和编译装置为主机,嵌入式装置为目标机,本发明用于实现嵌入式装置的快速启动。该目标机可以为行车记录仪、智能打印服务器、相机等,对应的,主机就负责开发和编译行车记录仪、智能打印服务器、相机等目标机的系统程序。
其中,主机可先通过对目标机系统的链接脚本进行修改,以使得主机根据用于目标机系统的链接脚本划分目标机系统的程序,划分后的程序包括快速启动加载器程序段和根据业务需求划分的不同业务对应的程序段,快速启动加载器用于将目标机系统的镜像文件从加载域拷贝至执行域,再根据链接脚本对快速启动加载器程序段和不同业务对应的程序段进行编译和链接,以生成系统启动的镜像文件。
因而,在将镜像文件下载至目标机上后,目标机通过系统引导程序可先加载镜像文件中的快速启动加载器程序段,快速启动加载器用于将目标机系统的镜像文件从加载域拷贝至执行域,而后运行快速启动加载器,在运行快速启动加载器后,根据不同业务的业务需求分段加载并运行剩余的镜像文件对应的一个或多个业务。也就是说,在目标机启动过程中,先加载系统镜像文件中的快速启动加载器程序段,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据业务需求分段加载剩余的镜像文件对应的一个或多个业务,再运行加载后的一个或多个业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
本发明实施例提供一种嵌入式装置的启动方法,如图2所示,包括:
201、开发和编译装置根据用于嵌入式装置系统的链接脚本划分系统的程序,划分后的程序包括快速启动加载器和根据不同业务的业务需求划分的程序段,快速启动加载器用于将系统镜像文件从加载域拷贝至执行域。
其中,加载域可以为系统硬件存放镜像文件的区域,通常为掉电不易失区域,执行域可以为系统运行镜像文件的区域,通常为内存区域,掉电丢失。
一种可实现的方式中,开发和编译装置,即主机可以根据嵌入式装置系统的链接脚本划分系统的程序,划分后的程序包括快速启动加载器、快 速启动程序段和非快速启动程序段,其中,快速启动加载器即为快速启动加载器程序段。
具体地,可先对主机中用于目标机系统的链接脚本进行修改,使得修改后的链接脚本可指示主机将系统启动的程序划分为快速启动加载器、快速启动程序段和非快速启动程序段。链接脚本可用于指定某些程序段位于指定的位置、对齐方式和存放形式等。
其中,快速启动加载器可用于将目标机的系统镜像文件从加载域拷贝至执行域。加载域为目标机的系统硬件存储镜像文件的区域,执行域为目标机的系统运行镜像文件的区域。可以理解的是,本申请相当于将目标机的系统镜像文件中从加载域拷贝至执行域的程序代码封装为一个接口,可单独运行。快速启动程序段包括目标机的关键业务,非快速启动程序段包括除关键业务以外的其余业务。例如,目标机为行车记录仪时,其关键业务可以为录像业务、无线连接的业务,其余业务可以包括蓝牙业务、拍照业务等。
202、开发和编译装置根据链接脚本对快速启动加载器程序段和不同业务对应的程序段分别进行编译和链接,以生成系统镜像文件。
具体可先对快速启动加载器进行编译和链接,然后再对不同业务对应的程序段进行编译和链接,例如将目标机的关键业务和非关键业务对应的程序段分别进行编译和链接。
在一种可能的设计中,对于快速启动加载器和非快速启动程序段的程序来说,如果该程序为第三方提供的库文件,那么不需要获知库文件对应的源码,可直接对库文件进行链接。具体地,主机使用第二交叉编译命令将快速启动加载器对应的库文件链接至快速启动加载器对应的ELF中,并将非快速启动程序段对应的库文件链接至非快速启动程序段对应的ELF中,快速启动加载器对应的只读数据(rodata)段、数据(data)段和代码(text)段分别在ELF的同一程序段中,非快速启动程序段对应的rodata段、data段和text段分别在ELF的同一程序段中。其中,库文件可以为静态库文件,记为.a文件,也可以为动态库文件,记为.so文件。
示例性的,在对快速启动加载器对应的库文件进行链接,或者对非快 速启动程序段对应的库文件进行链接时,将快速启动加载器对应的各个.a文件或对非快速启动程序段对应的各个.a文件中的rodata段、data段和text段分别位于同一程序段中,即将库文件的各个.a文件中的rodata段链接,将各个.a文件中的data段链接,将各个.a文件中的text段链接,生成的镜像文件即ELF中快速启动加载器程序段中rodata段、data段和text段分别位于同一程序段中。
如果快速启动加载器和非快速启动程序段的程序不是第三方提供的库文件,而是源码,在主机使用第二交叉编译命令之前,可先根据链接脚本将快速启动加载器对应的源码编译生成快速启动加载器对应的库文件,并将非快速启动程序段对应的源码编译生成非快速启动程序段对应的库文件。
对于快速启动程序段来说,如果该程序为第三方提供的库文件,由于快速启动程序段对应关键业务,即指定的需优先启动的业务,那么可使用第一交叉编译命令解压各个关键业务对应的库文件,生成各个关键业务对应的中间文件,任一中间文件包括任一中间文件对应的关键业务的只读数据段、数据段和代码段;再使用第二交叉编译命令将各个关键业务对应的中间文件链接至快速启动程序段对应的可执行链接文件ELF中,快速启动程序段对应的可执行链接文件ELF中,各个关键业务的只读数据段在同一程序段中,各个关键业务的数据段在同一程序段中,各个关键业务的代码段在同一程序段中。
示例性的,第一交叉编译命令可以为xxx-ar,用于解压库文件,即.a文件生成中间文件(记为.o文件),xxx根据交叉编译器的不同而不同,第二交叉编译命令可以为xxx-ld,用于将多个中间文件链接生成ELF,xxx根据交叉编译器的不同而不同。如图3所示,XX.a和XY.a代表两个不同的关键业务的库文件,XX.a文件中的1.0、2.0等和XY.a文件中的a.0、b.0等代表不同的.a文件,每个.a文件中包括rodata段、data段和text段,可先使用xxx-ar命令将各个.a文件解压,XX.a文件解压后对应XX.o文件,XY.a文件解压后对应XY.o文件,其中,XX.o文件中的rodata段由XX.a文件中的各个rodata段链接而成,XX.o文件中的data段由XX.a文件中的各个data段链接而成,XX.o文件中的text段由XX.a文件中的 各个text段链接而成;同理,XY.o文件中的rodata段由XY.a文件中的各个rodata段链接而成,XY.o文件中的data段由XY.a文件中的各个data段链接而成,XY.o文件中的text段由XY.a文件中的各个text段链接而成。而后,使用xxx-ld将XX.o文件和XY.o文件链接为ELF中的快速启动程序段,快速启动程序段也包括rodata段、data段和text段,快速启动程序段的rodata段由XX.o文件中的data段和XY.o文件中的rodata段链接而成,快速启动程序段的data段由XX.o文件中的data段和XY.o文件中的data段链接而成,快速启动程序段的text段由XX.o文件中的text段和XY.o文件中的text段链接而成。
如果快速启动程序段不是第三方提供的库文件,而是源码,那么在使用第一交叉编译命令解压各个关键业务对应的库文件之前,主机根据链接脚本将各个关键业务对应的源码编译生成库文件,库文件包括静态库文件或动态库文件。例如对于行车记录仪来说,其关键业务包括摄像业务和无线连接业务,先将摄像业务对应的源码(记为.c文件)和无线连接业务对应的源码编译生成.a文件(静态库文件)或.so文件(动态库文件),而后再将.a文件或.so文件使用xxx-ar解压为各个.o文件,继而再将各个.o文件使用xxx-ld链接为快速启动程序段的ELF。
这样,通过修改链接脚本,可以将各个库文件根据不同的特性链接到不同的指定段,存放在不同的指定位置。
在主机编译链接完成后,可从主机将ELF下载至目标机的Flash芯片中,当目标机启动运行时,ELF即镜像文件就会从Flash芯片中加载至嵌入式装置即目标机的内存中,目标机启动,具体的加载过程可以为:
203、嵌入式装置通过系统引导程序加载系统镜像文件中的快速启动加载器。
具体地,可通过对系统引导程序进行修改,使得系统引导程序在加载ELF时先加载系统镜像文件中的快速启动加载器。其中,快速启动加载器的起始地址和结束地址可预先在引导程序中设置,当系统引导程序在加载快速启动加载器时,先根据快速启动加载器的起始地址和结束地址获取快速启动加载器的长度,而后,根据快速启动加载器的起始地址和长度加载 快速启动加载器。
204、嵌入式装置运行快速启动加载器。
快速启动加载器用于将目标机系统镜像文件从加载域拷贝至执行域,相当于将从加载拷贝至执行域封装成一个接口,也是系统程序的最小内核。当系统启动时,仅先加载最小内核,以便内核启动运行后,再加载其余的分段。
205、嵌入式装置在运行快速启动加载器后,根据不同业务的业务需求分段加载系统镜像文件中除快速启动加载器以外的剩余镜像文件对应的一个或多个业务,并运行加载后的一个或多个业务。
这样在先加载快速启动加载器即内核后,可通过快速启动加载器分段加载剩余镜像文件对应的不同业务,而不是将系统镜像文件中全部加载后再运行,可提升目标机的启动速度。
本发明实施例提供一种嵌入式装置的启动方法,通过开发和编译装置预先对嵌入式装置系统的程序进行分段,包括快速启动加载器和不同的业务对应的程序段,这样在对分段后的程序段进行编译和链接生成系统启动的镜像文件后,可使得嵌入式装置在下载该镜像文件后,先加载镜像文件中的快速启动加载器,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件对应的一个或多个业务,也就是说,在嵌入式装置启动过程中,先加载系统镜像文件中的快速启动加载器,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据不同业务的业务需求分段加载剩余镜像文件对应的一个或多个业务,再运行加载后的一个或多个业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
本发明的一种可实现方式中,参见图4,步骤205具体可以包括401-404:
401、嵌入式装置控制快速启动加载器加载系统镜像文件的快速启动程序段包括目标机的关键业务。
当快速启动加载器运行后,控制快速启动加载器先加载系统镜像文件的快速启动程序段,该快速启动程序段对应目标机的关键业务,这样不需 要目标机加载整个系统镜像文件再启动,而是分段加载,且先加载系统镜像文件中对应的关键业务。
具体地,快速启动程序段中标记有起始地址和结束地址,快速启动加载器获取快速启动程序段的起始地址和结束地址,根据快速启动程序段的起始地址和结束地址获取快速启动程序段的长度,再根据快速启动程序段的起始地址和快速启动程序段长度,再加载快速启动程序段。由此,在快速启动程序段加载的时机上可以做到代码行级别的精确加载时机。
402、嵌入式装置运行关键业务。
例如行车记录仪快速启动程序段对应的关键业务包括摄像业务和无线连接业务,那么在行车记录器启动时,在加载了快速启动加载器后,快速启动加载器就先启动了摄像业务和无线连接业务,并使得关键业务的数据同步,这时,行车记录仪的启动时间就会大大缩短,达到系统关键业务首先加载并启动运行的目的。
403、嵌入式装置控制快速启动加载器加载系统镜像文件中的非快速启动程序段,非快速启动程序段包括目标机中除关键业务以外的其余业务。
快速启动加载器获取非快速启动程序段的起始地址和结束地址,根据非快速启动程序段的起始地址和结束地址获取非快速启动程序段的长度,继而根据非快速启动程序段的起始地址和非快速启动程序段的长度加载非快速启动程序段,如图5所示。例如行车记录仪的非关键业务包括蓝牙业务,那么在其关键业务加载并运行后,再加载蓝牙业务,即系统根据业务需要分段加载目标机的业务。
404、嵌入式装置运行其余业务。
因此,本发明实施例提供的嵌入式装置的启动方法中,通过开发和编译装置对嵌入式装置系统的程序进行分段,包括快速启动加载器和不同的业务对应的程序段,这样在对分段后的程序段进行编译和链接生成系统启动的镜像文件后,可使得嵌入式装置在下载该镜像文件后,先加载镜像文件中的快速启动加载器,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件对应的不同业务,也就是说,在嵌入式装置启动过程中, 先加载系统镜像文件中的快速启动加载器,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件对应的不同业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
本发明实施例提供一种嵌入式装置60,如图6所示,包括:
系统引导程序601,用于加载系统镜像文件中的快速启动加载器,所述快速启动加载器用于将所述系统镜像文件从加载域拷贝至执行域;
运行单元602,用于运行快速启动加载器;
快速启动加载器603,用于根据不同业务的业务需求分段加载所述系统镜像文件中除所述快速启动加载器以外的剩余镜像文件对应的一个或多个业务。
所述运行单元602还用于运行加载后的一个或多个业务。
可选的,快速启动加载器603用于,加载所述系统镜像文件中的快速启动604程序段,所述快速启动604程序段包括所述嵌入式装置的关键业务;
运行单元602,用于运行关键业务;
快速启动加载器603用于,加载所述系统镜像文件中的非快速启动605程序段,所述非快速启动605程序段包括所述嵌入式装置中除所述关键业务以外的其余业务;
运行单元602,用于运行其余业务。
可选的,快速启动加载器603用于:
获取系统镜像文件中所述快速启动604程序段的起始地址和结束地址;
根据所述快速启动604程序段的起始地址和结束地址获取所述快速启动604程序段的长度;
根据所述快速启动604程序段的起始地址和所述快速启动604程序段的长度加载所述快速启动程序段。
可选的,快速启动加载器603用于:
获取所述系统镜像文件中所述非快速启动605程序段的起始地址和结束地址;
根据所述非快速启动605程序段的起始地址和结束地址获取所述非快速启动605程序段的长度;
根据所述非快速启动605程序段的起始地址和所述非快速启动605程序段的长度加载所述非快速启动605程序段。
因此,本发明实施例提供的嵌入式装置,在下载该镜像文件后,先加载系统镜像文件中的快速启动加载器,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件中对应的不同业务,由此,在嵌入式装置启动过程中,先加载系统镜像文件中的快速启动加载器,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件中对应的不同业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
本发明实施例提供一种开发和编译装置70,如图7所示,包括:
划分单元701,用于根据嵌入式装置系统的链接脚本划分系统的程序,划分后的程序包括快速启动加载器程序段和根据不同业务的业务需求划分的不同业务对应的程序段,快速启动加载器用于将系统镜像文件从加载域拷贝至执行域;
编译链接单元702,用于根据链接脚本对快速启动加载器程序段和不同业务对应的程序段分别进行编译和链接,以生成系统镜像文件。
可选的,不同业务对应的程序段包括:快速启动程序段和非快速启动程序段,所述快速启动程序段对应所述嵌入式装置的关键业务,所述非快速启动程序段对应嵌入式装置中除所述关键业务以外的其余业务。
可选的,当不同业务对应的程序段为快速启动程序段时,编译链接单元702用于:
使用第一交叉编译命令解压各个关键业务对应的库文件,生成所述各个关键业务对应的中间文件,任一所述中间文件包括所述任一中间文件对应的关键业务的只读数据段、数据段和代码段;
使用第二交叉编译命令将所述各个关键业务对应的中间文件链接至所述快速启动程序段对应的可执行链接文件ELF中,所述快速启动程序段对应的可执行链接文件ELF中,所述各个关键业务的只读数据段在同一程序段中,所述各个关键业务的数据段在同一程序段中,所述各个关键业务的代码段在同一程序段中。
可选的,编译链接单元702用于:
根据链接脚本将各个关键业务对应的源码编译生成库文件,库文件包括静态库文件或动态库文件。
可选的,当不同业务对应的程序段为非快速启动程序段时,编译链接单元702用于:
使用第二交叉编译命令将所述快速启动加载器程序段对应的库文件链接至所述快速启动加载器程序段对应的可执行链接文件ELF中,并将所述非快速启动程序段对应的库文件链接至所述非快速启动程序段对应的ELF中,所述快速启动加载器程序段的只读数据段、数据段和代码段分别在所述ELF的同一程序段中,所述非快速启动程序段对应的只读数据段、数据段和代码段分别在所述ELF的同一程序段中。
可选的,编译链接单元702用于:
根据链接脚本将快速启动加载器程序段对应的源码编译生成快速启动加载器程序段对应的库文件,并将非快速启动程序段对应的源码编译生成非快速启动程序段对应的库文件。
因此,本发明实施例提供的开发和编译装置,通过对镜像文件的划分处理,并对划分后的不同的程序段进行编译和链接处理,可使得在将镜像文件下载至嵌入式装置上后,嵌入式装置分段加载并运行该镜像文件,提高嵌入式装置的开机启动速度。
本发明实施例还提供一种嵌入式装置80,如图8所示,包括闪客(Flash)芯片801、存储器802、存储器802中包括系统引导程序、快速启动加载器、快速启动和非快速启动,其实现方式可参见上述图3和图6所示的实施例,此处不再赘述。
本发明实施例还提供一种开发和编译装置90,如图9所示,包括存储器901、编译链接器902。其中,存储器901包括源码或库文件,以及ELF等,编译连接器902用于将源码或库文件进行编译和链接,形成ELF,其实现方式如图3和图7所示的实施例,此处不再赘述。
因此,本发明实施例提供的开发和编译装置和嵌入式装置,通过开发和编译装置对嵌入式装置系统的程序进行分段,包括快速启动加载器和不同的业务对应的程序段,这样在对分段后的程序段进行编译和链接生成系统启动的镜像文件后,可使得嵌入式装置在下载该镜像文件后,先加载镜像文件中的快速启动加载器程序段,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件对应的不同业务,也就是说,在嵌入式装置启动过程中,先加载系统镜像文件中的快速启动加载器程序段,即先加载最小的内核,在内核启动后,再通过快速启动加载器根据业务需求分段加载并运行剩余镜像文件对应的不同业务,这样可实现缩短启动业务的启动时间,提高嵌入式装置的开机启动速度。
在本申请所提供的几个实施例中,应该理解到,所揭露的终端和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的程序段或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理包括,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的程序段步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,简称ROM)、随机存取存储器(Random Access Memory,简称RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中程序段技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (20)

  1. 一种嵌入式装置的启动方法,其特征在于,包括:
    通过系统引导程序加载系统镜像文件中的快速启动加载器,所述快速启动加载器用于将所述系统镜像文件从加载域拷贝至执行域;
    运行所述快速启动加载器;
    在运行所述快速启动加载器后,根据不同业务的业务需求依次加载所述系统镜像文件中除所述快速启动加载器以外的剩余镜像文件对应的一个或多个业务,并运行所述加载后的一个或多个业务。
  2. 根据权利要求1所述的方法,其特征在于,所述根据不同业务的业务需求依次加载所述系统镜像文件中除所述快速启动加载器以外的剩余镜像文件对应的一个或多个业务,并运行所述加载后的一个或多个业务包括:
    控制所述快速启动加载器加载所述系统镜像文件中的快速启动程序段,所述快速启动程序段包括嵌入式装置的关键业务;
    运行所述关键业务;
    控制所述快速启动加载器加载所述系统镜像文件中的非快速启动程序段,所述非快速启动程序段包括所述嵌入式装置中除所述关键业务以外的其余业务;
    运行所述其余业务。
  3. 根据权利要求2所述的方法,其特征在于,所述控制所述快速启动加载器加载所述系统镜像文件中的快速启动程序段包括:
    控制所述快速启动加载器获取所述系统镜像文件中所述快速启动程序段的起始地址和结束地址;
    控制所述快速启动加载器根据所述快速启动程序段的起始地址和结束地址获取所述快速启动程序段的长度;
    控制所述快速启动加载器根据所述快速启动程序段的起始地址和所述快速启动程序段的长度加载所述快速启动程序段。
  4. 根据权利要求2或3所述的方法,其特征在于,所述控制所述快速启动加载器加载所述系统镜像文件中的非快速启动程序段包括:
    控制所述快速启动加载器获取所述系统镜像文件中所述非快速启动程序段的起始地址和结束地址;
    控制所述快速启动加载器根据所述非快速启动程序段的起始地址和结束地址获取所述非快速启动程序段的长度;
    控制所述快速启动加载器根据所述非快速启动程序段的起始地址和所述非快速启动程序段的长度加载所述非快速启动程序段。
  5. 一种嵌入式装置的开发和编译方法,其特征在于,包括:
    根据嵌入式装置系统的链接脚本划分所述系统的程序,划分后的程序包括快速启动加载器和根据不同业务的业务需求划分的程序段,所述快速启动加载器用于将系统镜像文件从加载域拷贝至执行域;
    根据所述链接脚本对所述快速启动加载器和所述不同业务对应的程序段分别进行编译和链接,以生成所述系统镜像文件。
  6. 根据权利要求5所述的方法,其特征在于,所述不同业务对应的程序段包括:快速启动程序段和非快速启动程序段,所述快速启动程序段对应所述嵌入式装置的关键业务,所述非快速启动程序段对应所述嵌入式装置中除所述关键业务以外的其余业务。
  7. 根据权利要求6所述的方法,其特征在于,当所述不同业务对应的程序段为所述快速启动程序段时,所述根据所述链接脚本对所述不同业务对应的程序段进行编译和链接包括:
    使用第一交叉编译命令解压各个关键业务对应的库文件,生成所述各个关键业务对应的中间文件,任一所述中间文件包括所述任一中间文件对应的关键业务的只读数据段、数据段和代码段;
    使用第二交叉编译命令将所述各个关键业务对应的中间文件链接至所述快速启动程序段对应的可执行链接文件ELF中,所述快速启动程序段对应的可执行链接文件ELF中,所述各个关键业务的只读数据段在同一程序段中,所述各个关键业务的数据段在同一程序段中,所述各个关键业务的代码段在同一程序段中。
  8. 根据权利要求7所述的方法,其特征在于,在使用第一交叉编译命令对所述各个关键业务对应的库文件解压之前,所述方法还包括:
    根据所述链接脚本将所述各个关键业务对应的源码编译生成所述库文件,所述库文件包括静态库文件或动态库文件。
  9. 根据权利要求6-8任一项所述的方法,其特征在于,当所述不同业 务对应的程序段为所述非快速启动程序段时,所述对所述快速启动加载器和所述不同业务对应的程序段进行编译和链接包括:
    使用第二交叉编译命令将所述快速启动加载器对应的库文件链接至所述快速启动加载器对应的可执行链接文件ELF中,并将所述非快速启动程序段对应的库文件链接至所述非快速启动程序段对应的ELF中,所述快速启动加载器的只读数据段、数据段和代码段分别在所述ELF的同一程序段中,所述非快速启动程序段对应的只读数据段、数据段和代码段分别在所述ELF的同一程序段中。
  10. 根据权利要求9所述的方法,其特征在于,在使用所述第二交叉编译命令之前,所述方法还包括:
    根据所述链接脚本将所述快速启动加载器对应的源码编译生成所述快速启动加载器对应的库文件,并将所述非快速启动程序段对应的源码编译生成所述非快速启动程序段对应的库文件。
  11. 一种嵌入式装置,其特征在于,包括:
    系统引导程序,用于加载系统镜像文件的快速启动加载器,所述快速启动加载器用于将所述系统镜像文件从加载域拷贝至执行域;
    运行单元,用于运行所述快速启动加载器;
    所述快速启动加载器,用于根据不同业务的业务需求依次加载所述系统镜像文件中除所述快速启动加载器以外的剩余镜像文件对应的一个或多个业务,所述运行单元还用于运行加载后的一个或多个业务。
  12. 根据权利要求11所述的嵌入式装置,其特征在于,所述快速启动加载器用于,加载所述系统镜像文件中的快速启动程序段,所述快速启动程序段包括所述嵌入式装置的关键业务;
    所述运行单元,用于运行所述关键业务;
    所述快速启动加载器用于,加载所述系统镜像文件中的非快速启动程序段,所述非快速启动程序段包括所述嵌入式装置中除所述关键业务以外的其余业务;
    所述运行单元,用于运行所述其余业务。
  13. 根据权利要求12所述的嵌入式装置,其特征在于,所述快速启动加载器用于:
    获取所述系统镜像文件中所述快速启动程序段的起始地址和结束地址;
    根据所述快速启动程序段的起始地址和结束地址获取所述快速启动程序段的长度;
    根据所述快速启动程序段的起始地址和所述快速启动程序段的长度加载所述快速启动程序段。
  14. 根据权利要求12或13所述的嵌入式装置,其特征在于,所述快速启动加载器用于:
    获取所述系统镜像文件中所述非快速启动程序段的起始地址和结束地址;
    根据所述非快速启动程序段的起始地址和结束地址获取所述非快速启动程序段的长度;
    根据所述非快速启动程序段的起始地址和所述非快速启动程序段的长度加载所述非快速启动程序段。
  15. 一种开发和编译装置,其特征在于,包括:
    划分单元,用于根据嵌入式装置系统的链接脚本划分所述系统的程序,划分后的程序包括快速启动加载器和根据不同业务的业务需求划分的不同业务对应的程序段,所述快速启动加载器用于将系统镜像文件从加载域拷贝至执行域;
    编译链接单元,用于根据所述链接脚本对所述快速启动加载器和所述不同业务对应的程序段分别进行编译和链接,以生成所述系统镜像文件。
  16. 根据权利要求15所述的开发和编译装置,其特征在于,所述不同业务对应的程序段包括:快速启动程序段和非快速启动程序段,所述快速启动程序段对应所述嵌入式装置的关键业务,所述非快速启动程序段对应嵌入式装置中除所述关键业务以外的其余业务。
  17. 根据权利要求16所述的开发和编译装置,其特征在于,当所述不同业务对应的程序段为所述快速启动程序段时,所述编译链接单元用于:
    使用第一交叉编译命令解压各个关键业务对应的库文件,生成所述各个关键业务对应的中间文件,任一所述中间文件包括所述任一中间文件对应的关键业务的只读数据段、数据段和代码段;
    使用第二交叉编译命令将所述各个关键业务对应的中间文件链接至所述快速启动程序段对应的可执行链接文件ELF中,所述快速启动程序段对应的可执行链接文件ELF中,所述各个关键业务的只读数据段在同一程序段中,所述各个关键业务的数据段在同一程序段中,所述各个关键业务的代码段在同一程序段中。
  18. 根据权利要求17所述的开发和编译装置,其特征在于,所述编译链接单元用于:
    根据所述链接脚本将所述各个关键业务对应的源码编译生成所述库文件,所述库文件包括静态库文件或动态库文件。
  19. 根据权利要求16-18任一项所述的开发和编译装置,其特征在于,当所述不同业务对应的程序段为所述非快速启动程序段时,所述编译链接单元用于:
    使用第二交叉编译命令将所述快速启动加载器对应的库文件链接至所述快速启动加载器对应的ELF中,并将所述非快速启动程序段对应的库文件链接至所述非快速启动程序段对应的ELF中,所述快速启动加载器的只读数据段、数据段和代码段分别在所述ELF的同一程序段中,所述非快速启动程序段对应的只读数据段、数据段和代码段分别在所述ELF的同一程序段中。
  20. 根据权利要求19所述的开发和编译装置,其特征在于,所述编译链接单元用于:
    根据所述链接脚本将所述快速启动加载器对应的源码编译生成所述快速启动加载器对应的库文件,并将所述非快速启动程序段对应的源码编译生成所述非快速启动程序段对应的库文件。
PCT/CN2016/104145 2016-02-29 2016-10-31 一种嵌入式装置的启动方法和装置 WO2017148171A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP16892352.2A EP3410296B1 (en) 2016-02-29 2016-10-31 Starting method and device for embedded device
US16/115,416 US11080066B2 (en) 2016-02-29 2018-08-28 Method for starting embedded apparatus, and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610113630.9A CN105760201B (zh) 2016-02-29 2016-02-29 一种嵌入式装置的启动方法和装置
CN201610113630.9 2016-02-29

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/115,416 Continuation US11080066B2 (en) 2016-02-29 2018-08-28 Method for starting embedded apparatus, and apparatus

Publications (1)

Publication Number Publication Date
WO2017148171A1 true WO2017148171A1 (zh) 2017-09-08

Family

ID=56330428

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/104145 WO2017148171A1 (zh) 2016-02-29 2016-10-31 一种嵌入式装置的启动方法和装置

Country Status (4)

Country Link
US (1) US11080066B2 (zh)
EP (1) EP3410296B1 (zh)
CN (1) CN105760201B (zh)
WO (1) WO2017148171A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112799691A (zh) * 2021-02-02 2021-05-14 百果园技术(新加坡)有限公司 一种应用安装包的处理方法、装置、设备及介质

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105760201B (zh) 2016-02-29 2019-05-28 华为技术有限公司 一种嵌入式装置的启动方法和装置
US11455172B2 (en) * 2017-08-16 2022-09-27 Samsung Electronics Co., Ltd. Method and apparatus for managing scheduling of services during boot-up
CN107766047B (zh) * 2017-09-19 2020-09-08 南京信息工程大学 一种气象模式云部署装置
CN109298891B (zh) * 2018-09-06 2021-09-21 深圳市智美达科技股份有限公司 系统启动方法和装置、系统编译方法和装置
CN109739769B (zh) * 2019-01-02 2022-06-07 深圳忆联信息系统有限公司 Bootrom加载功能自动化测试方法及装置
CN110362518B (zh) * 2019-04-15 2020-12-15 珠海全志科技股份有限公司 一种用于系统引导时出图及平滑过渡到内核的方法
CN110908664B (zh) * 2019-09-29 2023-12-05 惠州蓄能发电有限公司 嵌入式卡件程序处理方法、装置、计算机设备和存储介质
CN112711427A (zh) * 2019-10-24 2021-04-27 华为技术有限公司 一种镜像文件的获取方法以及装置
CN111078642B (zh) * 2019-12-16 2022-08-26 瑞芯微电子股份有限公司 一种分布式快速加载文件的方法和装置
LU101624B1 (en) * 2020-02-03 2021-08-03 Microsoft Technology Licensing Llc Reduce os imaging time using 'just in time' file delivery
US11507383B2 (en) * 2020-03-10 2022-11-22 Dell Products L.P. Configurable boot paths
CN111522591A (zh) * 2020-04-24 2020-08-11 中电科航空电子有限公司 VxWorks cert的快速启动软件实现方法及计算机程序产品
CN111552479A (zh) * 2020-05-06 2020-08-18 湖南国科微电子股份有限公司 镜像文件编译方法、装置和电子设备
CN111596932B (zh) 2020-06-22 2021-03-02 腾讯科技(深圳)有限公司 一种镜像文件生成方法、装置和计算机可读存储介质
CN117707626A (zh) * 2022-10-09 2024-03-15 荣耀终端有限公司 系统启动方法及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070050762A1 (en) * 2004-04-06 2007-03-01 Shao-Chun Chen Build optimizer tool for efficient management of software builds for mobile devices
CN101334737A (zh) * 2008-07-31 2008-12-31 深圳市同洲电子股份有限公司 一种嵌入式设备的启动或复位方法
CN103793250A (zh) * 2014-02-18 2014-05-14 武汉精立电子技术有限公司 嵌入式系统的快速安全启动装置以及启动方法
CN104778066A (zh) * 2015-04-21 2015-07-15 北京凌阳益辉科技有限公司 一种嵌入式操作系统的快速启动方法及其装置
CN105760201A (zh) * 2016-02-29 2016-07-13 华为技术有限公司 一种嵌入式装置的启动方法和装置

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100499050B1 (ko) * 2003-05-29 2005-07-04 주식회사 팬택 이동통신을 위한 임베디드 시스템의 구현 방법
TWI263939B (en) * 2004-09-22 2006-10-11 Lite On Technology Corp Dynamic boot system and method, machine readable medium thereof, and construction method for an operating system image
CN1904828A (zh) * 2005-07-26 2007-01-31 光宝科技股份有限公司 动态开机系统及方法,与操作系统映像文件建构方法
US7634689B2 (en) * 2005-09-22 2009-12-15 Advanced Micro Devices, Inc. Boot performance optimization for hard drive for personal internet communicator
KR100757441B1 (ko) * 2005-09-23 2007-09-11 엘지전자 주식회사 연료전지시스템
US7814307B2 (en) * 2006-03-16 2010-10-12 Microsoft Corporation Fast booting a computing device to a specialized experience
US20100257514A1 (en) * 2009-04-03 2010-10-07 Samsung Electronics Co., Ltd. Effective mapping of code sections to the same section of secondary memory to improve the security of computing systems
CN101515239A (zh) * 2009-04-08 2009-08-26 南京航空航天大学 X86飞控计算机快速启动方法
CN101539885B (zh) 2009-04-23 2011-06-08 大唐微电子技术有限公司 一种无线通信模块软件自主空中升级的方法、装置及系统
CN101625647A (zh) * 2009-08-06 2010-01-13 青岛海信电器股份有限公司 加快嵌入式软件系统启动速度的方法
US10394570B2 (en) * 2010-02-26 2019-08-27 Hp Printing Korea Co., Ltd. Method of generating boot image for fast booting and image forming apparatus for performing the method, and method of performing fast booting and image forming apparatus for performing the method
CN102455917B (zh) * 2010-10-22 2016-06-29 康佳集团股份有限公司 一种网络电视的启动控制方法及装置
CN102609274B (zh) 2011-01-21 2016-06-29 青岛海信电器股份有限公司 一种系统快速启动运行方法及电视机
US9003175B2 (en) * 2011-04-29 2015-04-07 Lenovo (Singapore) Pte. Ltd. System and method for accelerated boot performance
CN103699412B (zh) 2013-12-23 2018-05-18 深圳Tcl新技术有限公司 终端的快速启动方法和系统
CN104407886B (zh) * 2014-11-05 2017-11-14 中国航天科技集团公司第九研究院第七七一研究所 一种引导与目标分离的嵌入式软件固化、加载方法
US9934120B2 (en) * 2016-02-10 2018-04-03 Western Digital Technologies, Inc. Method and apparatus for updating a system on chip (SOC) image from a host computer system without using DMA
US10445007B1 (en) * 2017-04-19 2019-10-15 Rockwell Collins, Inc. Multi-core optimized warm-start loading approach

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070050762A1 (en) * 2004-04-06 2007-03-01 Shao-Chun Chen Build optimizer tool for efficient management of software builds for mobile devices
CN101334737A (zh) * 2008-07-31 2008-12-31 深圳市同洲电子股份有限公司 一种嵌入式设备的启动或复位方法
CN103793250A (zh) * 2014-02-18 2014-05-14 武汉精立电子技术有限公司 嵌入式系统的快速安全启动装置以及启动方法
CN104778066A (zh) * 2015-04-21 2015-07-15 北京凌阳益辉科技有限公司 一种嵌入式操作系统的快速启动方法及其装置
CN105760201A (zh) * 2016-02-29 2016-07-13 华为技术有限公司 一种嵌入式装置的启动方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3410296A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112799691A (zh) * 2021-02-02 2021-05-14 百果园技术(新加坡)有限公司 一种应用安装包的处理方法、装置、设备及介质

Also Published As

Publication number Publication date
US11080066B2 (en) 2021-08-03
US20180365035A1 (en) 2018-12-20
EP3410296A1 (en) 2018-12-05
EP3410296A4 (en) 2019-03-20
CN105760201B (zh) 2019-05-28
CN105760201A (zh) 2016-07-13
EP3410296B1 (en) 2021-10-27

Similar Documents

Publication Publication Date Title
WO2017148171A1 (zh) 一种嵌入式装置的启动方法和装置
US11599348B2 (en) Container image building using shared resources
KR102010508B1 (ko) 소스 코드 파일을 업데이트하는 시스템 및 방법
US9841953B2 (en) Pluggable components for runtime-image generation
CN110750288A (zh) 原生工程配置方法、装置、电子设备及存储介质
CN105511911A (zh) 系统固件升级包的生成方法及装置
CN111443939A (zh) 一种软件开发工具包的配置方法、装置和存储介质
CN112631600A (zh) 基于Flutter的软件构建方法和系统
CN104503823A (zh) 基于oem操作系统的p2v迁移及配置方法
CN109298891B (zh) 系统启动方法和装置、系统编译方法和装置
JP7410268B2 (ja) コンテナ・ベースの仮想化システムに関する方法
CN106776310B (zh) 一种调试方法及调试装置
US10552135B1 (en) Reducing a size of an application package
CN110806891A (zh) 嵌入式设备软件版本的生成方法及装置
WO2022184112A1 (zh) 安卓系统的应用调试方法、装置、程序、介质及电子设备
US9940334B2 (en) Image forming apparatus and control method thereof
CN113641389B (zh) 基于OpenCPU的软件升级方法、装置及设备
US9098317B2 (en) Optional retargeting of library references
KR102257012B1 (ko) 다양한 클라우드에 적용 가능한 대용량 데이터 처리용 분산 처리 시스템의 설치방법
US8918630B1 (en) System, apparatus, and method for initiating a reboot of a personal computer system by pressing a button on an attached storage device and causing the operating system on the attached storage device to be booted
US9910645B2 (en) Incremental build generation
JP7031569B2 (ja) 情報作成装置、情報作成方法、および、情報作成プログラム
JP7081805B2 (ja) 情報処理装置、ロードモジュール生成方法及びプログラム、並びに、動的プログラム更新システム及び方法
CN107784204B (zh) 应用脱壳方法和装置
JP2017228191A (ja) 画像処理装置、デバッグ支援方法およびデバッグ支援プログラム

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 2016892352

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2016892352

Country of ref document: EP

Effective date: 20180829

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16892352

Country of ref document: EP

Kind code of ref document: A1