TWI733157B - Method and system for accelerating startup embedded system - Google Patents
Method and system for accelerating startup embedded system Download PDFInfo
- Publication number
- TWI733157B TWI733157B TW108127687A TW108127687A TWI733157B TW I733157 B TWI733157 B TW I733157B TW 108127687 A TW108127687 A TW 108127687A TW 108127687 A TW108127687 A TW 108127687A TW I733157 B TWI733157 B TW I733157B
- Authority
- TW
- Taiwan
- Prior art keywords
- boot image
- external storage
- image file
- storage
- memory
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
Description
本申請涉及電腦技術領域,特別係關於一種加快嵌入式系統啟動速度的方法及其嵌入式系統。 This application relates to the field of computer technology, in particular to a method for accelerating the startup speed of an embedded system and its embedded system.
隨著資訊化、智慧化、網路化的發展,嵌入式系統也獲得更加廣闊的發展空間。目前,一般嵌入式系統均將啟動鏡像檔放在主儲存器中。在系統啟動過程中,必須將主儲存器所儲存的全部的啟動鏡像檔載入到記憶體中。但是該段載入過程耗時一般較長,從而減慢嵌入式系統的啟動速度。 With the development of informatization, intelligence, and networking, embedded systems have also gained broader development space. At present, general embedded systems store the boot image file in the main storage. During the system startup process, all the startup image files stored in the main memory must be loaded into the memory. However, the loading process of this segment generally takes a long time, which slows down the startup speed of the embedded system.
本發明主要解決的技術問題是提供一種加快嵌入式系統啟動速度的方法及其嵌入式系統,能夠縮短載入啟動鏡像檔到記憶體中所耗費的時間,從而達到加快嵌入式系統啟動速度的目的。 The main technical problem solved by the present invention is to provide a method for accelerating the startup speed of an embedded system and its embedded system, which can shorten the time spent loading the startup image file into the memory, thereby achieving the purpose of accelerating the startup speed of the embedded system .
為解決上述技術問題,本發明採用的一個技術方案是:提供一種加快嵌入式系統啟動速度的方法,該方法包括以下操作:嵌入式系統啟動開始時判斷是否存在外部儲存器;在判斷存在外部儲存器時,將主儲存器所儲存的啟動鏡像檔和外部儲存器所儲存的啟動鏡 像檔並行載入到記憶體中,從主儲存器載入到記憶體中的啟動鏡像檔和從外部儲存器載入到記憶體中的啟動鏡像檔是不相同的。 In order to solve the above technical problems, a technical solution adopted by the present invention is to provide a method for accelerating the startup speed of the embedded system. The method includes the following operations: when the embedded system starts, it is judged whether there is an external storage; when it is judged that there is an external storage When the device is installed, the boot image file stored in the main storage and the boot mirror stored in the external storage Image files are loaded into the memory in parallel, and the boot image file loaded from the main memory into the memory is different from the boot image file loaded from the external storage into the memory.
為解決上述技術問題,本發明採用的另一個技術方案是:提供一種嵌入式系統,包括:處理器、與處理器耦接的主儲存器以及外部儲存介面,其中,處理器在嵌入式系統啟動開始時透過外部儲存介面判斷是否存在外部儲存器;在判斷存在外部儲存器時,將主儲存器所儲存的啟動鏡像檔和外部儲存器所儲存的啟動鏡像檔並行載入到記憶體中,從主儲存器載入到記憶體中的啟動鏡像檔和從外部儲存器載入到記憶體中的啟動鏡像檔是不相同的。 In order to solve the above technical problems, another technical solution adopted by the present invention is to provide an embedded system, including: a processor, a main memory coupled with the processor, and an external storage interface, wherein the processor is started in the embedded system At the beginning, the external storage interface is used to determine whether there is an external storage; when it is judged that there is an external storage, the startup image file stored in the main storage and the startup image file stored in the external storage are loaded into the memory in parallel, from The boot image file loaded into the memory from the main storage is different from the boot image file loaded into the memory from the external storage.
以上方案,本發明充分利用可用的外部儲存器,將啟動鏡像檔儲存到外部儲存器中,在系統啟動階段,同時將主儲存器和外部儲存器中分別儲存的啟動鏡像檔載入到記憶體中,減少載入全部啟動鏡像檔耗費的時間,拓寬了載入啟動鏡像檔的頻寬,加快了嵌入式系統啟動速度。 With the above solution, the present invention makes full use of the available external storage to store the boot image file in the external storage. During the system startup phase, the boot image file stored in the main storage and the external storage is loaded into the memory at the same time. , Reduce the time spent loading all boot image files, widen the bandwidth of loading boot image files, and speed up the startup speed of the embedded system.
101、102、201、202、203、204、2031、2032、2033、301、302、303、304‧‧‧步驟 101, 102, 201, 202, 203, 204, 2031, 2032, 2033, 301, 302, 303, 304‧‧‧ steps
41‧‧‧主儲存器 41‧‧‧Main Memory
42‧‧‧處理器 42‧‧‧Processor
43‧‧‧嵌入式系統 43‧‧‧Embedded System
44‧‧‧外部儲存介面 44‧‧‧External storage interface
45‧‧‧外部儲存器 45‧‧‧External storage
46‧‧‧記憶體 46‧‧‧Memory
第1圖是本發明加快嵌入式系統啟動速度的方法第一個實施方式的流程示意圖。 Figure 1 is a schematic flow chart of the first embodiment of the method for accelerating the startup speed of an embedded system according to the present invention.
第2圖是本發明加快嵌入式系統啟動速度的方法第一個實施方式中主儲存器和外部儲存器中儲存的不同分區的啟動鏡像檔的示意圖。 Figure 2 is a schematic diagram of the boot image files of different partitions stored in the main storage and the external storage in the first embodiment of the method for accelerating the startup speed of an embedded system according to the present invention.
第3圖是本發明加快嵌入式系統啟動速度的方法第二個實施方式的流程示意圖。 Fig. 3 is a schematic flowchart of a second embodiment of the method for accelerating the startup speed of an embedded system according to the present invention.
第4圖是本發明加快嵌入式系統啟動速度的方法第二個 實施方式中將主儲存器中的啟動鏡像檔貼上至外部儲存器的流程示意圖。 Figure 4 is the second method for accelerating the startup speed of the embedded system of the present invention In the embodiment, the schematic diagram of the process of pasting the boot image file in the main storage to the external storage.
第5圖是本發明加快嵌入式系統啟動速度的方法第三個實施方式的流程示意圖。 Figure 5 is a schematic flowchart of a third embodiment of the method for accelerating the startup speed of an embedded system according to the present invention.
第6圖是本發明嵌入式系統一實施方式的結構示意圖。 Figure 6 is a schematic structural diagram of an embodiment of the embedded system of the present invention.
下面結合圖式和實施方式對本發明進行詳細說明。 The present invention will be described in detail below in conjunction with the drawings and embodiments.
請參閱第1圖,第1圖是本發明加快嵌入式系統啟動速度的方法第一個實施方式的流程示意圖。如第1圖所示,該方法包括以下步驟。 Please refer to Fig. 1. Fig. 1 is a schematic flowchart of a first embodiment of the method for accelerating the startup speed of an embedded system according to the present invention. As shown in Figure 1, the method includes the following steps.
步驟101:嵌入式系統啟動開始時判斷是否存在外部儲存器。 Step 101: When the embedded system starts, it is judged whether there is an external storage.
其中,嵌入式系統是以電腦技術為基礎,以應用為中心,並且軟硬體可裁剪的專用電腦系統。外部儲存器可以是USB隨身碟、SD卡、移動硬碟、記憶棒、微驅動器、密緻快閃記憶體和介質卡中的至少一種,或者是其他類別的記憶體。判斷是否存在外部儲存器的過程可以是外部儲存器插接到系統後系統識別外部儲存器是否成功的過程。當系統識別外部儲存器成功,就可以判斷外部儲存器存在;當系統識別外部儲存器不成功,就可以判斷外部儲存器不存在。判斷是否存在外部儲存器的過程也可以是在系統啟動時直接判斷外部儲存器是否插接到嵌入式系統的過程。 Among them, the embedded system is a dedicated computer system based on computer technology, application-centric, and software and hardware can be tailored. The external storage can be at least one of a USB flash drive, an SD card, a removable hard drive, a memory stick, a micro drive, a compact flash memory, and a media card, or other types of memory. The process of judging whether there is an external storage may be a process in which the system recognizes whether the external storage is successful after the external storage is plugged into the system. When the system recognizes the external storage successfully, it can judge that the external storage exists; when the system recognizes the external storage unsuccessfully, it can judge that the external storage does not exist. The process of judging whether there is an external storage can also be a process of directly judging whether the external storage is plugged into the embedded system when the system is started.
其中一個應用場景中,主儲存器所儲存全部啟動鏡像檔,外部儲存器所儲存部分啟動鏡像檔。若判斷的結果為外部儲存器不存在,就可以直接將主儲存器中的全部的啟動鏡像檔載入到記憶體中。 使用該方法的嵌入式系統即使沒有外部儲存器的存在,也能照常運行,不依賴於外部儲存器。 In one of the application scenarios, all the boot image files stored in the main storage, and some boot image files stored in the external storage. If the result of the judgment is that the external storage does not exist, you can directly load all the boot image files in the main storage into the memory. The embedded system using this method can run as usual even if there is no external storage, and does not depend on the external storage.
步驟102:在判斷存在外部儲存器時,將主儲存器所儲存的啟動鏡像檔和外部儲存器所儲存的啟動鏡像檔並行載入到記憶體中。 Step 102: When it is determined that there is an external storage, the boot image file stored in the main storage and the boot image file stored in the external storage are loaded into the memory in parallel.
其中,全部啟動鏡像檔按照不同的分區類型可以分為多個啟動鏡像檔。多個啟動鏡像檔的名稱不相同。在車機系統中,可以有系統Preloader啟動階段的鏡像、系統LK啟動階段的鏡像、系統一些常用環境變數的鏡像、倒車啟動的鏡像、內核啟動的鏡像……並且這些啟動鏡像檔儲存在系統記憶體(可以是主儲存器和外部儲存器)中不同位址空間,具體可如第2圖所示。可以理解的,從主儲存器載入到記憶體中的啟動鏡像檔和從外部儲存器載入到記憶體中的啟動鏡像檔可以是完全不相同的,並且兩者能夠構成一個完整的啟動鏡像檔,這樣能夠最大限度的利用外部儲存器加快嵌入式系統的啟動速度。 Among them, all boot image files can be divided into multiple boot image files according to different partition types. The names of multiple boot image files are different. In the car machine system, there can be a mirror of the system Preloader startup phase, a mirror of the system LK startup phase, a mirror of some common environment variables of the system, a mirror of a reverse boot, a mirror of a kernel boot... and these boot image files are stored in the system memory. The different address spaces in the body (which can be the main storage and the external storage), as shown in Figure 2. It is understandable that the boot image file loaded from the main storage into the memory and the boot image file loaded into the memory from the external storage can be completely different, and the two can form a complete boot image File, which can maximize the use of external storage to speed up the startup speed of the embedded system.
其中一個應用場景中,主儲存器所儲存全部啟動鏡像檔,外部儲存器所儲存部分啟動鏡像檔。此時,系統將主儲存器中與外部儲存器中不同的啟動鏡像檔、外部儲存器中的啟動鏡像檔並行載入到記憶體中,使記憶體載入全部的啟動鏡像檔。可以理解的是,外部儲存器所儲存的部分啟動鏡像檔只能是唯讀的啟動鏡像檔,也就是說從外部儲存器中讀取的啟動鏡像檔不能在嵌入式系統運行過程中被寫。這樣就不要求在系統關機時將啟動鏡像檔重新更新到外部儲存器,在嵌入式系統運行的任意時間均可操作,可以避免在嵌入式系統異常斷電時不能及時將啟動鏡像檔拷貝給外部儲存器的情況,適用性強。 In one of the application scenarios, all the boot image files stored in the main storage, and some boot image files stored in the external storage. At this time, the system loads the different boot image files in the main storage and the external storage, and the boot image files in the external storage into the memory in parallel, so that the memory loads all the boot image files. It is understandable that part of the boot image files stored in the external storage can only be read-only boot image files, which means that the boot image files read from the external storage cannot be written during the operation of the embedded system. In this way, it is not required to re-update the boot image file to the external storage when the system is shut down. It can be operated at any time when the embedded system is running, which can avoid the failure to copy the boot image file to the external in time when the embedded system is abnormally powered In the case of the storage device, the applicability is strong.
其中,在將主儲存器和外部儲存器所儲存的啟動鏡像檔並行載入到記憶體之前,先判斷外部儲存器是否儲存有啟動鏡像檔。透過判斷外部儲存器是否儲存有啟動鏡像檔,可以判斷外部儲存器有沒有儲存啟動鏡像檔,還可以判斷外部儲存器所儲存啟動鏡像檔的內容是否完整。其中判斷外部儲存器是否儲存有啟動鏡像檔的方式是:判斷外部儲存器中是否有標識檔;獲取標識檔中的第一校驗碼,透過校驗第一校驗碼檢查標識檔的內容完整性。若判斷結果是外部儲存器中沒有儲存啟動鏡像檔後,直接將主儲存器中全部的啟動鏡像檔直接載入到記憶體中,待嵌入式系統系統啟動成功後將主儲存器中的部分啟動鏡像檔貼上儲存到外部儲存器中。若判斷結果是外部儲存器中儲存有但未儲存完整的啟動鏡像檔後:可以繼續判斷外部儲存器所儲存的哪些啟動鏡像檔是有效的,將判定為有效的啟動鏡像檔和主儲存器的啟動鏡像檔並行載入到記憶體中,其中從主儲存器載入到記憶體中的啟動鏡像檔可以是與外部儲存器所儲存的有效的啟動鏡像檔不相同的;或者直接將主儲存器中儲存的全部的啟動鏡像檔載入到記憶體中。若判斷結果為外部儲存器所儲存完整的啟動鏡像檔,繼續判斷外部儲存器是否儲存有有效的啟動鏡像檔。判斷外部儲存器是否儲存有效的啟動鏡像檔的方式可以是:先獲取多個啟動鏡像檔各自的第二校驗碼,透過校驗第二校驗碼判斷多個啟動鏡像檔的內容是否完整。若判斷結果是外部儲存器沒有儲存有效的啟動鏡像檔,可以直接將主儲存器中全部的啟動鏡像檔直接載入到記憶體中。若判斷結果是外部儲存器所儲存有效的啟動鏡像檔,將主儲存器和外部儲存器所儲存的啟動鏡像檔並行載入到記憶體。 Among them, before the startup image files stored in the main storage and the external storage are loaded into the memory in parallel, it is first determined whether the external storage has the startup image files. By judging whether the boot image file is stored in the external storage, it can be judged whether the boot image file is stored in the external storage, and it can also be judged whether the content of the boot image file stored in the external storage is complete. The way to determine whether the external storage has a boot image file is: determine whether there is an identification file in the external storage; obtain the first check code in the identification file, and check the integrity of the content of the identification file by verifying the first check code sex. If the judgment result is that there is no boot image file stored in the external storage, directly load all the boot image files in the main storage into the memory, and after the embedded system is successfully booted, start part of the main storage The image file is pasted and stored in the external storage. If the result of the judgment is that a complete boot image file is stored in the external storage but not stored: you can continue to determine which boot image files stored in the external storage are valid, and it will be judged as a valid boot image file and the main storage The boot image file is loaded into the memory in parallel, and the boot image file loaded into the memory from the main storage can be different from the effective boot image file stored in the external storage; or directly to the main storage Load all the boot image files stored in the file into the memory. If the judgment result is a complete boot image file stored in the external storage, continue to judge whether the external storage has a valid boot image file. The method of judging whether the external memory stores a valid boot image file may be: first obtain the respective second check codes of multiple boot image files, and determine whether the contents of the multiple boot image files are complete by checking the second check codes. If the judgment result is that the external storage does not store a valid boot image file, you can directly load all the boot image files in the main storage into the memory. If the judgment result is a valid boot image file stored in the external storage, the boot image file stored in the main storage and the external storage is loaded into the memory in parallel.
另一個應用場景中,主儲存器和外部儲存器分別儲存不同的啟動鏡像檔。此時,將主儲存器中的啟動鏡像檔和外部儲存器中的啟動鏡像檔並行載入到記憶體中,使記憶體載入全部的啟動鏡像檔。 In another application scenario, the main storage and the external storage respectively store different boot image files. At this time, load the boot image file in the main storage and the boot image file in the external storage into the memory in parallel, so that the memory loads all the boot image files.
在此實施方式中,主儲存器和外部儲存器分別儲存有啟動鏡像檔,在系統啟動階段,同時將主儲存器和外部儲存器所儲存的啟動鏡像檔載入到記憶體中,減少載入全部啟動鏡像檔耗費的時間,拓寬了載入啟動鏡像檔的頻寬,加快了嵌入式系統啟動速度。在主儲存器所儲存有全部啟動鏡像檔時,嵌入式系統中不存在外部儲存器或者外部儲存器中沒有儲存有效的啟動鏡像檔,系統也能正常運作,不依賴於外部儲存器,實用性強。另外,透過幾步判斷過程可以得出對嵌入式系統本身最有利的結論,便於實際操作且不耗時。 In this embodiment, the main storage and the external storage respectively store the boot image files. During the system startup phase, the boot image files stored in the main storage and the external storage are loaded into the memory at the same time to reduce loading. The time it takes for all boot image files to widen the bandwidth of loading boot image files and speed up the startup of embedded systems. When all the boot image files are stored in the main storage, there is no external storage in the embedded system or there is no valid boot image file stored in the external storage, the system can also operate normally, independent of the external storage, practicality powerful. In addition, the most favorable conclusion for the embedded system itself can be drawn through a few steps of judgment process, which is convenient for practical operation and not time-consuming.
請參閱第3圖,第3圖是本發明加快嵌入式系統啟動速度的方法第二個實施方式的流程示意圖。主儲存器所儲存有全部的啟動鏡像檔。本實施方式中,該方法包括以下步驟。 Please refer to Fig. 3, which is a schematic flowchart of a second embodiment of the method for accelerating the startup speed of an embedded system according to the present invention. All boot image files are stored in the main storage. In this embodiment, the method includes the following steps.
步驟201:嵌入式系統啟動開始時判斷是否存在外部儲存器。 Step 201: When the embedded system starts, it is judged whether there is an external storage.
可如步驟101,在此不做贅述。
It can be the same as
步驟202:判斷外部儲存器是否儲存有啟動鏡像檔。 Step 202: Determine whether a boot image file is stored in the external storage.
其中,透過判斷外部儲存器是否儲存有啟動鏡像檔,還可以判斷外部儲存器所儲存啟動鏡像檔的內容是否完整。其中判斷外部儲存器是否儲存有啟動鏡像檔的方式可以是,判斷外部儲存器中是否有標識檔;獲取標識檔中的第一校驗碼,透過校驗第一校驗碼檢查標識檔的內容完整性。 Among them, by judging whether the boot image file is stored in the external storage, it can also be judged whether the content of the boot image file stored in the external storage is complete. The way to determine whether the external storage has a boot image file can be to determine whether there is an identification file in the external storage; obtain the first check code in the identification file, and check the content of the identification file by verifying the first check code Completeness.
步驟203:若判斷結果是外部儲存器中沒有儲存啟動鏡像檔後,將主儲存器的部分啟動鏡像檔貼上至外部儲存器。 Step 203: If the judgment result is that the boot image file is not stored in the external storage, paste part of the boot image file in the main storage to the external storage.
其中,該貼上操作(將主儲存器中的部分啟動鏡像檔貼上至外部儲存器操作)是在嵌入式系統啟動成功後進行的。在貼上操作之前,主儲存器中儲存著全部的啟動鏡像檔時,可以先判斷外部儲存器是否處於閒置狀態:當判斷結果是外部儲存器處於閒置狀態,就進行貼上操作;當判斷結果為外部儲存器不處於閒置狀態,就不進行貼上操作;這樣就不會影響其他正常服務對外部儲存器的讀寫請求。該嵌入式系統可以是車機系統或智慧電視系統等等。在將主儲存器中的部分啟動鏡像檔貼上至外部儲存器之前,可以透過複製或剪下貼上的方式從主儲存器獲取部分啟動鏡像檔。更加優選的是透過複製方式從主儲存器獲取部分啟動鏡像檔,這樣在嵌入式系統後續啟動時,即使外部儲存器不存在,也可以載入主儲存器中的全部啟動鏡像檔完成啟動過程,不依賴於外部儲存器,增加該方法的實用性。可以理解的是,貼上至外部儲存器的啟動鏡像檔是唯讀的,這樣在後續嵌入式系統啟動過程中,只需將外部儲存器中唯讀的啟動鏡像檔載入到記憶體中,在系統運行過程中這些唯讀的啟動鏡像檔一般不會被更改,這樣就不用頻繁更換外部儲存器中的啟動鏡像檔,也不需要在系統關機前將主儲存器中的啟動鏡像檔再次貼上至外部儲存器中,不依賴于關機操作,提高效率,節省資源。 Wherein, the pasting operation (the operation of pasting part of the boot image file in the main storage to the external storage) is performed after the embedded system is successfully booted. Before the paste operation, when all the boot image files are stored in the main storage, you can first determine whether the external storage is idle: when the judgment result is that the external storage is idle, the paste operation is performed; when the judgment result is Because the external storage is not in an idle state, the paste operation is not performed; this will not affect the read and write requests of other normal services to the external storage. The embedded system can be a car-machine system or a smart TV system and so on. Before pasting part of the boot image file in the main storage to the external storage, you can obtain a part of the boot image file from the main storage by copying or cutting and pasting. It is more preferable to obtain part of the boot image file from the main storage by copying, so that when the embedded system is subsequently booted, even if the external storage does not exist, all the boot image files in the main storage can be loaded to complete the boot process. It does not rely on external storage, increasing the practicality of this method. It is understandable that the boot image file pasted to the external storage is read-only, so in the subsequent embedded system startup process, only the read-only boot image file in the external storage needs to be loaded into the memory. These read-only startup image files will generally not be changed during system operation, so there is no need to frequently replace the startup image files in the external storage, and there is no need to paste the startup image files in the main storage again before the system is shut down. Up to the external storage, it does not depend on the shutdown operation, which improves efficiency and saves resources.
在將主儲存器中的部分啟動鏡像檔貼上至外部儲存器操作完成後,在外部儲存器上可以創建標識檔,該標識檔可以包含第一校驗碼以及貼上至外部儲存器上的啟動鏡像檔的名稱和大小、多個啟動鏡像檔的版本號至少一種內容。第一校驗碼是用來判斷外部儲存器 上標識檔的完整性。多個啟動鏡像檔各自的版本號是用來判斷外部儲存器上儲存的多個啟動鏡像檔的時效性--即是從貼上至外部儲存器的時間到嵌入式系統該次使用啟動鏡像檔的時間,主儲存器上的對應的啟動鏡像檔有沒有更新。貼上至外部儲存器上的啟動鏡像檔的名稱是用來在嵌入式系統啟動時判斷外部儲存器和主儲存器應該將哪些啟動鏡像檔並行載入到記憶體中。貼上操作過後,主儲存器還可以儲存有全部的啟動鏡像檔,這樣即使外部儲存器不存在,也可以載入主儲存器中的全部啟動鏡像檔,因而完成啟動過程可以不依賴於外部儲存器,增加該方法的實用性。 After pasting part of the boot image file in the main storage to the external storage, an identification file can be created on the external storage. The identification file can include the first verification code and the file pasted to the external storage. At least one of the name and size of the boot image file, and the version numbers of multiple boot image files. The first check code is used to determine the external storage The integrity of the logo file. The respective version numbers of multiple boot image files are used to determine the timeliness of the multiple boot image files stored on the external storage-that is, from the time of pasting to the external storage to the time when the embedded system uses the boot image file At the time, has the corresponding boot image file on the main storage been updated? The name of the boot image file pasted on the external storage is used to determine which boot image files should be loaded into the memory in parallel by the external storage and the main storage when the embedded system is started. After the paste operation, the main storage can also store all the boot image files, so even if the external storage does not exist, all the boot image files in the main storage can be loaded, so the completion of the boot process does not depend on the external storage , Increase the practicability of this method.
進一步的,如第4圖所示,將主儲存器中的部分啟動鏡像檔貼上至外部儲存器步驟可以包括以下操作。 Further, as shown in Figure 4, the step of pasting part of the boot image file in the main storage to the external storage may include the following operations.
步驟2031:獲取主儲存器和外部儲存器的讀寫速度。 Step 2031: Obtain the read and write speeds of the main storage and the external storage.
其中,讀寫速度的獲取方式可以是測量計算主儲存器和外部儲存器的讀寫速度。測量計算主儲存器和外部儲存器的讀寫速度的方式可以包括:首先在主儲存器和外部儲存器分別建立測試文件;然後將主儲存器和外部儲存器分別儲存的測試檔讀取出來,計量該讀取過程所耗費的時間;最終透過主儲存器和外部儲存器分別儲存的測試檔的大小和其對應的耗費的時間計算出主儲存器和外部儲存器的讀寫速度。測試檔的大小可以相同或相近,也可以不同,可以是1KB。 Among them, the reading and writing speed can be obtained by measuring and calculating the reading and writing speed of the main storage and the external storage. The method of measuring and calculating the read and write speed of the main memory and the external memory can include: firstly create test files in the main memory and the external memory respectively; then read the test files stored in the main memory and the external memory respectively, The time spent in the reading process is measured; finally, the read and write speeds of the main storage and the external storage are calculated through the size of the test files stored in the main storage and the external storage and the corresponding time consumed. The size of the test files can be the same or similar, or different, and can be 1KB.
步驟2032:根據讀寫速度計算從主儲器和外部儲存器讀取啟動鏡像檔的讀取量的比例。 Step 2032: Calculate the ratio of the read volume of the boot image file from the main storage and the external storage according to the reading and writing speed.
例如,當系統啟動過程中需要讀取的啟動鏡像檔的大小總計為S,主儲存器的讀寫速度為M,外部儲存器的讀寫速度為N。S可以是需要讀取的啟動鏡像檔的總大小、或者是需要讀取的啟動鏡像 檔中唯讀檔案的大小。計算所得的主儲存器讀取啟動鏡像檔的讀取量的比例為,外部儲存器讀取啟動鏡像檔的讀取量的比例為 。 For example, when the total size of the boot image file that needs to be read during system startup is S, the read and write speed of the main storage is M, and the read and write speed of the external storage is N. S can be the total size of the boot image file that needs to be read, or the size of the read-only file in the boot image file that needs to be read. The calculated ratio of the read volume of the boot image file from the main memory is , The ratio of the read volume of the boot image file from the external storage is .
步驟2033:根據比例,將主儲存器中的部分啟動鏡像檔貼上至外部儲存器。 Step 2033: According to the ratio, paste part of the boot image file in the main storage to the external storage.
其中,貼上至外部儲存器中的啟動鏡像檔是完整的,不能被分割貼上至外部儲存器中。假如按照該外部儲存器的讀取量的比例所占的啟動鏡像檔中包含W個完整的啟動鏡像檔和一個分割的啟動鏡像檔,可以將W個或(W+1)個完整的啟動鏡像檔貼上到外部儲存器。這樣在後續嵌入式系統啟動時,從外部儲存器載入啟動鏡像檔所耗費的時間與從主儲存器載入啟動鏡像檔所耗費的時間相同或相近,在主儲存器和外部儲存器中的其中一個器件載入過程已經完畢的情況下,不需等待或只需等待少許時間另一個器件的載入過程也會完畢,實現了資源的最大利用化。當S為需要讀取的啟動鏡像檔的總大小時,如果按照外部儲存器的讀取量的比例所占的啟動鏡像檔大小比需要讀取啟動鏡像檔中唯讀檔案的大小大,此時只將主儲存器中的唯讀啟動鏡像檔貼上到外部儲存器。在嵌入式系統啟動時,從主儲存器載入啟動鏡像檔耗費的時間可以略長於或等於、略短於從外部儲存器載入啟動鏡像檔耗費的時間。 Among them, the boot image file pasted to the external storage is complete and cannot be divided and pasted to the external storage. If the boot image file in proportion to the read volume of the external storage contains W complete boot image files and a split boot image file, W or (W+1) complete boot images can be combined The file is pasted to the external storage. In this way, when the subsequent embedded system starts, the time it takes to load the boot image file from the external storage is the same or similar to the time it takes to load the boot image file from the main storage. In the case where the loading process of one of the devices has been completed, there is no need to wait or only a little time for the loading process of the other device to be completed, achieving the maximum utilization of resources. When S is the total size of the boot image file that needs to be read, if the size of the boot image file in proportion to the read volume of the external storage is larger than the size of the read-only file in the boot image file that needs to be read, then Paste only the read-only boot image file in the main storage to the external storage. When the embedded system is started, the time it takes to load the boot image file from the main storage can be slightly longer than, equal to, or slightly shorter than the time taken to load the boot image file from the external storage.
步驟204:將主儲存器所儲存的啟動鏡像檔和外部儲存器所儲存的啟動鏡像檔並行載入到記憶體中。 Step 204: Load the boot image file stored in the main storage and the boot image file stored in the external storage into the memory in parallel.
其中,該步驟是在貼上操作後直接進行的。並且只要外部儲存器中儲存的啟動鏡像檔未出現丟失、失效、版本號過期和其他 情況中至少一種,就可以在貼上操作步驟後的任一次嵌入式系統啟動過程中進行。 Among them, this step is carried out directly after the pasting operation. And as long as the boot image file stored in the external storage is not lost, invalid, version number expired and other At least one of the cases can be carried out during any embedded system startup process after the operation steps are posted.
在此實施方式中,將主儲存器的部分啟動鏡像檔儲存到外部儲存器中,在系統啟動階段,就可以同時將主儲存器和外部儲存器分別儲存的啟動鏡像檔載入到記憶體中,減少載入全部啟動鏡像檔耗費的時間,拓寬了載入啟動鏡像檔的頻寬,加快了嵌入式系統啟動速度,同時此舉也相當於在外部儲存器上作了啟動鏡像檔案備份,可以避免後續主儲存器中的啟動鏡像檔損毀帶來系統無法正常運行的情況。 In this embodiment, part of the boot image file of the main storage is stored in the external storage. During the system startup phase, the boot image files stored in the main storage and the external storage can be loaded into the memory at the same time. , Reduce the time spent loading all boot image files, widen the bandwidth of loading boot image files, and speed up the startup speed of embedded systems. At the same time, this action is equivalent to making a boot image file backup on an external storage. This prevents the system from failing to operate normally due to damage to the subsequent boot image file in the main storage.
請參閱第5圖,第5圖是本發明加快嵌入式系統啟動速度的方法第三個實施方式的流程示意圖。升級卡儲存有全部啟動鏡像檔,並將升級卡作為外部儲存器。本實施方式中,該方法包括以下步驟。 Please refer to FIG. 5, which is a schematic flowchart of a third embodiment of the method for accelerating the startup speed of an embedded system according to the present invention. The upgrade card stores all boot image files, and the upgrade card is used as an external storage. In this embodiment, the method includes the following steps.
步驟301:嵌入式系統啟動開始時判斷是否存在外部儲存器。 Step 301: When the embedded system starts, it is judged whether there is an external storage.
其中,升級卡的類型可以是SD卡。可以理解的是,升級卡是從上位機獲取到全部的啟動鏡像檔後,將啟動鏡像檔貼上至下位機上。本實施方式中的下位機是本發明中該的嵌入式系統。上位機將全部的啟動鏡像檔貼上至升級卡後,並將標識檔儲存在升級卡上。該標識檔可以包含第一校驗碼以及需要貼上至主儲存器上的啟動鏡像檔的名稱和大小、多個啟動鏡像檔的版本號至少一種內容。第一校驗碼是用來判斷外部儲存器上標識檔的完整性。在上位機選擇主儲存器的型號與外部儲存器的型號,從資料庫中獲取對應的主儲存器與外部
儲存器的讀寫速度,依據步驟2032該的方法,自動計算需要分配給外部儲存器與主儲存器的啟動鏡像檔的比例,並儲存在標識檔中。
Among them, the type of the upgrade card may be an SD card. It is understandable that after the upgrade card obtains all the boot image files from the upper computer, it pastes the boot image files to the lower computer. The lower computer in this embodiment is the embedded system in the present invention. After the host computer pastes all the boot image files to the upgrade card, and stores the identification file on the upgrade card. The identification file may include at least one of the first verification code, the name and size of the boot image file that needs to be pasted on the main storage, and the version numbers of multiple boot image files. The first check code is used to determine the integrity of the identification file on the external storage. Select the model of the main memory and the model of the external memory on the host computer, and obtain the corresponding main memory and external memory from the database.
The read and write speed of the storage is automatically calculated according to the method in
步驟302:判斷主儲存器是否儲存有啟動鏡像檔。 Step 302: Determine whether a boot image file is stored in the main storage.
步驟303:若主儲存器沒有儲存啟動鏡像檔,則將外部儲存器的部分啟動鏡像檔貼上至主儲存器。 Step 303: If the main storage does not store the boot image file, paste part of the boot image file of the external storage to the main storage.
其中,在將外部儲存器中的部分啟動鏡像檔貼上至主儲存器之前,可以透過複製或剪下貼上的方式從外部儲存器獲取部分啟動鏡像檔。更加優選的是透過剪下貼上的方式從外部儲存器獲取部分啟動鏡像檔,這樣在系統後續啟動時,不需要判斷讀取外部儲存器和主儲存器中的哪些內容,提高嵌入式系統啟動效率。該嵌入式系統可以是測試系統或其他系統。 Among them, before pasting a part of the boot image file in the external storage to the main storage, a part of the boot image file can be obtained from the external storage by copying or cutting and pasting. It is more preferable to obtain a part of the boot image file from the external storage by cutting and pasting, so that when the system is subsequently started, there is no need to determine which content to read in the external storage and the main storage, which improves the startup of the embedded system. efficiency. The embedded system can be a test system or other systems.
其中一個應用場景中,將外部儲存器中的部分啟動鏡像檔貼上至主儲存器步驟可以包括:先從外部儲存器中的標識檔讀取出啟動鏡像檔的分配信息;根據分配信息將外部儲存器中的部分啟動鏡像檔貼上至主儲存器中。其中,該標識檔包含第一校驗碼以及啟動鏡像檔的分配信息、啟動鏡像檔中的多個啟動鏡像檔的版本號的至少一種內容,第一校驗碼是用來判斷外部儲存器上標識檔的完整性。可以理解的是,啟動鏡像檔的分配信息可以包括下述內容的至少一種:需要貼上到主儲存器的部分啟動鏡像檔的大小及名稱;可以包括在嵌入式系統後續啟動時需要從外部儲存器中載入的部分啟動鏡像檔的大小及名稱;可以包括將部分啟動鏡像檔貼上至主儲存器後外部儲存器所儲存的部分啟動鏡像檔的大小及名稱。 In one of the application scenarios, the step of pasting part of the boot image file in the external storage to the main storage may include: firstly reading the distribution information of the boot image file from the identification file in the external storage; Part of the boot image file in the storage is pasted to the main storage. Wherein, the identification file contains at least one of the first check code and the distribution information of the boot image file, and the version numbers of multiple boot image files in the boot image file. The first check code is used to determine whether the The integrity of the logo file. It is understandable that the distribution information of the boot image file may include at least one of the following: the size and name of the part of the boot image file that needs to be pasted to the main storage; it may include the need to store externally when the embedded system is subsequently booted The size and name of the part of the boot image file loaded in the device; it can include the size and name of the part of the boot image file stored in the external storage after the part of the boot image file is pasted to the main storage.
另一個應用場景中,將外部儲存器中的部分啟動鏡像檔貼上至主儲存器步驟可以包括:獲取主儲器和外部儲存器的讀寫速度; 根據讀寫速度計算從主儲器和外部儲器讀取啟動鏡像檔的讀取量的比例;根據比例,外部儲存器的部分鏡像檔貼上至外部儲存器。 In another application scenario, the step of pasting part of the boot image file in the external storage to the main storage may include: obtaining the read and write speeds of the main storage and the external storage; Calculate the ratio of the read volume of the boot image file from the main storage and the external storage according to the read and write speed; according to the ratio, part of the image file of the external storage is pasted to the external storage.
步驟304:將主儲存器所儲存的啟動鏡像檔和外部儲存器所儲存的啟動鏡像檔並行載入到記憶體中。 Step 304: Load the boot image file stored in the main storage and the boot image file stored in the external storage into the memory in parallel.
其中,該步驟是在貼上操作後直接進行的。並且只要外部儲存器中儲存的啟動鏡像檔未出現丟失、失效、版本號過期和其他情況中至少一種,就可以在貼上操作步驟後的任一次嵌入式系統啟動過程中進行。 Among them, this step is carried out directly after the pasting operation. And as long as the boot image file stored in the external storage does not appear to be lost, invalid, version number expired, or at least one of the other conditions, it can be performed during any embedded system boot process after the operation steps are pasted.
在此實施方式中,將啟動鏡像檔儲存到外部儲存器中,在系統啟動階段,同時將主儲存器和外部儲存器中分別儲存的啟動鏡像檔載入到記憶體中,減少載入全部啟動鏡像檔耗費的時間,拓寬了載入啟動鏡像檔的頻寬,加快了嵌入式系統啟動速度。 In this embodiment, the boot image file is stored in the external storage. During the system startup phase, the boot image files stored in the main storage and the external storage are loaded into the memory at the same time, reducing the loading of all booting The time consumed by the image file broadens the bandwidth of loading the boot image file and speeds up the startup speed of the embedded system.
請參閱第6圖,第6圖是本發明嵌入式系統一實施方式的結構示意圖。嵌入式系統包括以下操作。 Please refer to FIG. 6, which is a schematic structural diagram of an embodiment of the embedded system of the present invention. The embedded system includes the following operations.
處理器42、與處理器42耦接的主儲存器41以及外部儲存介面44。
The
其中,處理器42在嵌入式系統43啟動開始時透過外部儲存介面44判斷是否存在外部儲存器45。
The
在判斷存在外部儲存器45時,將主儲存器41儲存的啟動鏡像檔和外部儲存器45儲存的啟動鏡像檔並行載入到記憶體46中,從主儲存器41載入到記憶體46中的啟動鏡像檔和從外部儲存器45載入到記憶體46中的啟動鏡像檔是不相同的。
When it is determined that the
在此實施方式中,本發明充分利用可用的外部儲存器,將啟動鏡像檔儲存到外部儲存器中,在系統啟動階段,同時將主儲存 器和外部儲存器中分別儲存的啟動鏡像檔載入到記憶體中,減少載入全部啟動鏡像檔耗費的時間,拓寬了載入啟動鏡像檔的頻寬,加快了嵌入式系統啟動速度。 In this embodiment, the present invention makes full use of the available external storage to store the boot image file in the external storage. During the system startup phase, the main storage is at the same time The boot image files stored in the external storage device and the external storage are loaded into the memory, which reduces the time spent loading all boot image files, widens the bandwidth of loading boot image files, and speeds up the startup speed of the embedded system.
以上所述僅為本發明的實施方式,並非因此限制本發明的專利範圍,凡是利用本發明說明書及圖式內容所作的等效結構或等效流程變換,或直接或間接運用在其他相關的技術領域,均同理包括在本發明的專利保護範圍內。 The above is only the implementation of the present invention, and does not limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the description and drawings of the present invention, or directly or indirectly applied to other related technologies In the same way, all fields are included in the scope of patent protection of the present invention.
101、102‧‧‧步驟 101, 102‧‧‧ steps
Claims (10)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910048625.8 | 2019-01-18 | ||
CN201910048625.8A CN111538540B (en) | 2019-01-18 | 2019-01-18 | Method for accelerating starting speed of embedded system and embedded system thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
TW202028971A TW202028971A (en) | 2020-08-01 |
TWI733157B true TWI733157B (en) | 2021-07-11 |
Family
ID=71978451
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW108127687A TWI733157B (en) | 2019-01-18 | 2019-08-05 | Method and system for accelerating startup embedded system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111538540B (en) |
TW (1) | TWI733157B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200620044A (en) * | 2004-12-09 | 2006-06-16 | Lite On Technology Corp | Embedded system and related method capable of automatically updating system software |
TW201005645A (en) * | 2008-07-25 | 2010-02-01 | Universal Scient Ind Co Ltd | Method and system for updating electronic devices firmware |
CN102637461A (en) * | 2012-03-07 | 2012-08-15 | 山东华芯半导体有限公司 | Start method supporting bad block flash memory scanning |
CN108628641A (en) * | 2018-04-26 | 2018-10-09 | 珠海亿智电子科技有限公司 | A kind of quick start method based on embedded system |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4512201B2 (en) * | 2007-12-21 | 2010-07-28 | 株式会社日立製作所 | Data processing method and system |
CN101676871B (en) * | 2008-09-18 | 2013-10-30 | 晨星软件研发(深圳)有限公司 | Embedded electronic device and starting-up method thereof |
US9177172B2 (en) * | 2012-11-15 | 2015-11-03 | Microsoft Technology Licensing, Llc | Single system image via shell database |
JP2014106546A (en) * | 2012-11-22 | 2014-06-09 | Mitsubishi Electric Corp | Resume method and information processing device |
CN102968326A (en) * | 2012-12-04 | 2013-03-13 | 中国北方车辆研究所 | Field programmable gate array (FPGA) parallel dynamic loading method |
CN103955389B (en) * | 2014-05-06 | 2017-09-29 | 中国科学院微电子研究所 | System starting method based on PCM |
CN104778066B (en) * | 2015-04-21 | 2018-01-23 | 北京凌阳益辉科技有限公司 | The quick start method and its device of a kind of embedded OS |
-
2019
- 2019-01-18 CN CN201910048625.8A patent/CN111538540B/en active Active
- 2019-08-05 TW TW108127687A patent/TWI733157B/en active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW200620044A (en) * | 2004-12-09 | 2006-06-16 | Lite On Technology Corp | Embedded system and related method capable of automatically updating system software |
TW201005645A (en) * | 2008-07-25 | 2010-02-01 | Universal Scient Ind Co Ltd | Method and system for updating electronic devices firmware |
CN102637461A (en) * | 2012-03-07 | 2012-08-15 | 山东华芯半导体有限公司 | Start method supporting bad block flash memory scanning |
CN108628641A (en) * | 2018-04-26 | 2018-10-09 | 珠海亿智电子科技有限公司 | A kind of quick start method based on embedded system |
Also Published As
Publication number | Publication date |
---|---|
TW202028971A (en) | 2020-08-01 |
CN111538540B (en) | 2022-12-27 |
CN111538540A (en) | 2020-08-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9811369B2 (en) | Method and system for physical computer system virtualization | |
US8205070B2 (en) | Device bootup from a NAND-type non-volatile memory | |
JP5636034B2 (en) | Mediation of mount times for data usage | |
CN103365696B (en) | BIOS image file acquisition methods and device | |
US8468334B1 (en) | Efficient initial RAM disk creation | |
US20110213954A1 (en) | Method and apparatus for generating minimum boot image | |
US20140325203A1 (en) | Backing up firmware during initialization of device | |
US11544223B2 (en) | Write operation verification method and apparatus | |
US10606677B2 (en) | Method of retrieving debugging data in UEFI and computer system thereof | |
EP1631905B1 (en) | Dynamic bios execution and concurrent update for a blade server | |
CN110502281A (en) | A kind of method of embedded device starting linux kernel and file system | |
CN115390996B (en) | Virtual machine migration method and device, computing equipment and storage medium | |
US20160026474A1 (en) | Caching based operating system installation | |
US9852028B2 (en) | Managing a computing system crash | |
CN113342365A (en) | Operating system deployment method, device, equipment and computer-readable storage medium | |
TWI733157B (en) | Method and system for accelerating startup embedded system | |
CN111913753A (en) | Method and system for changing starting mode in cloud migration of windows system | |
CN117093247A (en) | Firmware upgrading method and device of embedded device, chip and computing device | |
CN110825421A (en) | Firmware upgrading method and system and readable storage medium | |
US10838737B1 (en) | Restoration of memory content to restore machine state | |
CN102799451B (en) | WINCE system mirror image construction method and system, WINCE system mirror image | |
US11354109B1 (en) | Firmware updates using updated firmware files in a dedicated firmware volume | |
CN115437856A (en) | Memory test method, device, equipment and storage medium | |
US20160266960A1 (en) | Information processing apparatus and kernel dump method | |
CN117009308B (en) | Executable file loading method and system based on compatible layer |