201106269 0004-09-003 31538twf.doc/n 六、發明說明: 【發明所屬之技術領域】 本發明是有關於一種安裝驅動程式的機制,且特別是 有關於一種應用於嵌入式系統之驅動程式-的安裝方法、系 統及編譯裝置。 【先前技術】201106269 0004-09-003 31538twf.doc/n VI. Description of the Invention: [Technical Field] The present invention relates to a mechanism for installing a driver, and more particularly to a driver for an embedded system - Installation method, system and compilation device. [Prior Art]
在現今的電腦架構設計中’每―種硬體設備如:顯示 卡、音效卡等,皆需要驅動程式(Driver)以做為與作業 系統溝通的橋樑。而透過驅動程式的運作,這些硬體設備 才能正確地運作。因此’當增加或是更換硬體設備時,便 需重新安裝驅動程式。 … 文衣如籾枉八的方法大致是在電腦系統知 作業系統安裝完畢之後,制者再逐步將各硬體設備所堡 應^驅動程式絲至作業祕中。㈣此安裝方式不㈣ 耗費許多時間,對使用者來說亦相當不方便。 則自動安裝驅動程式的機制(例如n 系統)並不適用於嵌入式系統產品。 據所搭配1硬體設備tn與硬體的綜合體’其是食 依昭傳统相關軟體也會有所不同。 :十分龐旦有新增硬體或是升級硬體時將會邊 【發明内容】 201106269 0004-09-003 3l538lwf.d〇c/n 本發明提供一種驅動程式的安裝方法、系統及編譯裝 置’透過自動化機制來加速載入驅動程式及編譯。 本發明提出一種驅動程式的安裳方法,適用於一目標 板上’其中目標板應用於嵌入式系統。此安裝方法包括: 债測目標板上所有硬體設備,以取得這些硬體設備的相關 資訊’接著’將相關資訊記錄至硬體分析檔;之後,依據 硬體分析檔載入各硬體設備的驅動程式;然後,將這些驅 動程式與嵌入式系統的核心編譯為影像檔;最後,將影像 下載至目標板。 在本發明之一實施例中’上述偵測目標板上所有硬體 設備的步驟是透過各硬體設備所連接的匯流排來進行偵 測’藉以取得各硬體設備的相關資訊。 在本發明之一實施例中,上述依據硬體分析檔載入各 硬體設備的驅動程式的步驟’包括:建立多個子目錄至嵌 入式系統的原始碼目錄,其中這些子目錄對應各硬體設 備’接著’在嵌入式系統的核心組態設定建立主選單項目; 之後,修改製作檔(Makefile)中的相關參數;以及將各 驅動私式分別載入至對應的子目錄中。另外,上述子目錄 亦可僅針對新增的硬體設備而建立。 本發明另提出一種驅動程式的安裝系統,此系統包括 目標板、編譯裝置以及載入模組。在此,目標板是應用於 、肷入式系統。編譯裝置包括硬體資訊擷取模組、驅動程 式貧料庫以及編譯模組。上述驅動程式資料庫中了儲存多 個驅動程式;硬體資訊擷取模組用以擷取目標板上所有硬 201106269 0004-09-003 31538twf.doc/n ,設備的相關資訊’並將這些相關資訊記錄至硬體分析 棺;編譯模組則是依據硬體分析槽自驅動程式資料庫中戴 ^各硬體設備的驅練式,並轉這些鶴程式與嵌 糸統的,編·影像構。載人模纟謂是时將影像槽栽 入至目標板。 本發明更提出一種編譯裝置,適用 影像檔,其中上述目標板應用於—嵌入式系統。此編譯Ϊ i包括:硬體資訊齡模組、驅動程式資料庫以及編譯根 組。上达驅動程式資料庫中了儲存多個驅動程式;硬體資 訊擷轉組用關取目標板上所有硬體設備的相關資訊,、 並將這二相關貝。fU己錄至硬體分析檔,,編譯模組則是依據 硬體分析棺自驅動程式資料庫中載入各硬體設備的驅動輕 式’亚且將适些驅動程式触人式系統的核心編譯為影像 檔。 、在本發!L之—實施例中,上述硬體資訊擷取模組更包 括处過各硬^備所連接的匯流排來债測目標板上所設置 籲⑽體設備;’ H以取得硬體設備_關:#訊,並將相關資 I己錄至=備檔。之後,硬體資訊擷取模組再自設備標 中擷取硬體設餚的相關資訊。 在本發明之-實施例中,上述編譯模組依據硬體分析 播載入各硬體設備的驅動程式的步驟包括:建立多個子目 錄至嵌入式^統的原始碼目錄,其中這些子目錄對應各硬 體設備;接著,在丧入式系統的核心組態設定建立主選單 項目;之後’修改製作檔(Makefile)中的相關參數;以 201106269 0004-09-003 31.538t\vf.doc/n 及將各驅動程式分別載入至對應的子目錄中。另外,上述 子目錄亦可僅針對新增的硬體設備而建立。 基於上述,本發明在偵測出有新增硬體設備時,便將 其相關資訊記錄至硬體分析檔,再依據硬體分析檔的記錄 來下載驅動程式,藉此達到自動化載入驅動程式的步驟, 使得嵌入式系統在更新硬體設備上更為方便。 為讓本發明之上述特徵和優點能更明顯易懂,下文特 舉實施例,並配合所附圖式作詳細說明如下。 【貫施方式】 一 I又肷入式系統—旦新增硬體設備或是升級硬體設備 日^,倘若依照傳統的開發模式,則驅動程式的安裝將會是 一件龐大的工程。為此,本發明提出—種驅動程式的安裝 方法、系統及編譯裴置,藉以在新增硬體設備時能夠將對 應的驅動程式安裝至嵌入式系統中。為了使本發明之内容 更為明瞭,以下特舉實施例作為本發明確實能夠據以實施 的範例。 圖1疋依照本發明一實施例所繪示的驅動程式的安裝 方法流程圖。請參照圖1,為了方便說明,本實施例是以 Linux系統作為實施平台。然,在其他實施例中亦可應用 於其他嵌入式系統。 首先,在步驟Sl〇5中,偵測目標板上所有硬體設備, 二取得這些硬體設備的相關資訊。具體而言,可透過各硬 體没備所連接的匯流排,例如周邊元件連接介面 201106269 0004-09-003 31538twf.doc/n (Peripheral Component Interconnect,PCI)或是通用序列 匯流排(Universal Serial Bus,USB),來偵測目標板上所設 置的硬體5又備,藉以取得這些硬體設備的相關資訊。上述 -相關資·訊包括製造商、硬體設備型號、尺寸大小等。In today's computer architecture design, every hardware device, such as a video card or sound card, requires a driver as a bridge to communicate with the operating system. These hardware devices work correctly through the operation of the driver. Therefore, when adding or replacing hardware devices, you need to reinstall the driver. ... The method of the cloak is like the computer system. After the installation of the operating system is completed, the manufacturer will gradually drive the hardware of the hardware to the job secret. (4) This installation method does not (4) It takes a lot of time and is quite inconvenient for the user. The mechanism for automatically installing drivers (such as the n system) is not suitable for embedded system products. According to the 1 hardware device tn and the hardware complex, it is also different from the food related to the traditional food. : Very Pang Dan has new hardware or upgrade hardware will be [invention] 201106269 0004-09-003 3l538lwf.d〇c / n The present invention provides a driver installation method, system and compiler device ' Accelerate loading drivers and compilation through automated mechanisms. The present invention proposes a driving method for a driver, which is applied to a target board in which a target board is applied to an embedded system. This installation method includes: Debt testing all hardware devices on the target board to obtain information about these hardware devices 'Next' to record relevant information to the hardware analysis file; then, load the hardware devices according to the hardware analysis file Drivers; then, compile these drivers with the core of the embedded system into image files; finally, download the images to the target board. In an embodiment of the present invention, the step of detecting all hardware devices on the target board is to perform detection by using a bus bar connected to each hardware device to obtain information about each hardware device. In an embodiment of the present invention, the step of loading the driver of each hardware device according to the hardware analysis file includes: establishing a plurality of subdirectories to the source code directory of the embedded system, wherein the subdirectories correspond to the hardware The device 'follows' the main menu item in the embedded system's core configuration settings; after that, the relevant parameters in the Makefile are modified; and the drivers are loaded into the corresponding subdirectories. In addition, the above subdirectories can also be established only for new hardware devices. The present invention further provides a driver installation system including a target board, a compiling device, and a loading module. Here, the target board is applied to, and the intrusion system. The compiling device includes a hardware information capturing module, a driver poor library, and a compiling module. The above driver database stores multiple drivers; the hardware information capture module captures all hard 201106269 0004-09-003 31538twf.doc/n on the target board, and the related information of the device 'and related The information is recorded to the hardware analysis; the compiling module is based on the hardware analysis device to drive the hardware devices in the hardware library, and convert these crane programs and embedded systems. . The manned model is to load the image slot into the target board. The invention further proposes a compiling device for image files, wherein the target board is applied to an embedded system. This compilation includes: a hardware age module, a driver database, and a compiled root group. The driver data library stores multiple drivers; the hardware information transfer group uses information about all hardware devices on the target board, and these two related. fU has been recorded to the hardware analysis file, and the compilation module is based on the hardware analysis. The driver that loads the hardware devices from the driver database is light and will be the core of the driver-friendly system. Compile to image file. In this hair! In the embodiment, the hardware information capture module further includes a bus bar connected to each hardware device to be used on the debt test target board; 'H to obtain a hardware device_off : #讯, and related assets I have been recorded to = file. After that, the hardware information capture module retrieves information about the hardware set from the device identifier. In the embodiment of the present invention, the step of the compiling module loading the driver of each hardware device according to the hardware analysis includes: establishing a plurality of subdirectories to the source code directory of the embedded system, wherein the subdirectories correspond to Each hardware device; then, the main menu item is established in the core configuration setting of the dormant system; then the relevant parameters in the Makefile are modified; to 201106269 0004-09-003 31.538t\vf.doc/n And load each driver into the corresponding subdirectory. In addition, the above subdirectories can also be established only for new hardware devices. Based on the above, when detecting the new hardware device, the invention records the related information to the hardware analysis file, and then downloads the driver according to the record of the hardware analysis file, thereby achieving automatic loading of the driver. The steps make the embedded system more convenient to update hardware devices. The above described features and advantages of the present invention will become more apparent from the description of the appended claims. [Commonly applied method] An I-intrusion system—adding hardware devices or upgrading hardware devices. If the traditional development mode is used, the driver installation will be a huge project. To this end, the present invention proposes a driver installation method, system, and compilation device, so that the corresponding driver can be installed into the embedded system when a new hardware device is added. In order to make the content of the present invention clearer, the following specific embodiments are illustrative of the embodiments of the present invention. FIG. 1 is a flow chart showing a method of installing a driver according to an embodiment of the invention. Please refer to FIG. 1. For convenience of description, this embodiment uses a Linux system as an implementation platform. However, it can be applied to other embedded systems in other embodiments. First, in step S1, all the hardware devices on the target board are detected, and the related information of the hardware devices is obtained. Specifically, the busbars connected to each hardware are not provided, for example, the peripheral component connection interface 201106269 0004-09-003 31538twf.doc/n (Peripheral Component Interconnect, PCI) or the universal serial bus (Universal Serial Bus) , USB), to detect the hardware 5 set on the target board, in order to obtain information about these hardware devices. The above - related information includes manufacturers, hardware equipment models, size and so on.
接著,在步驟S110中,將相關資訊記錄至硬體分析 樓。圖2疋依照本發明一實施例所緣示的記錄硬體分析檔 的流程圖。請參照圖2’在步驟S2〇5中,偵測是否有新增 的硬體設備。料,則執行步驟S21Q ;若無,則執行步ς 以初次啟用的目標板而言,將制到之第一組硬體設 =相^訊記錄至硬體分析標,之後再持續偵測其餘設 置在目W反上的硬體設備,直到全部镇測完畢為止。另外, 言,當偵測到目標板上的硬體 設備時,則將料硬於備:=本)、献新增硬體 中。 一更篮。又備的相關貧訊更新至硬體分析檔 設備U動ίΐ=115中,依據硬體分析檔載入各硬體 吸備的型如’依據硬體分析樓中所記錄的硬體 式資料庫中搜尋對應的驅動程式。 備之相知目前所連接的硬體設 樓(例如上述㈣目將會被記錄至—個設備 設備檔便能夠得知目桿板巾。據此,讀取此一 訊' 板上所連接的硬體設備的相關資 201106269 UUU4-uy-〇03 31538twf.doc/n 以Linux而言,識別周邊元件連接介面的方法例如為 言買取/proc/bus/pci/devices (即上述設備標)或 /sys/bus/devices/*來取得硬體設備的製造商(vend〇r)、設 備型號(device)、再製造商(subven<i〇r).、再製造之設 備型號(subdevice)。之後,便可將這些相關資訊記錄至 硬體分析槽中。 然後’在偵測完目標板上所新增的全部硬體設備之 後’再依據硬體分析檔來下載相關的驅動程式。例如,將 硬體分析槽中的相關資訊與Linux核心(kernel)所提供的 modules.pcumap做比對,以得到此硬體設備所對應的模組 .名稱。據以透過模組名稱來載入對應的模組(也就是驅動 程式)。 而若是同一個硬體設備在m〇dules.pcimap中存在兩種 可使用的模組名稱時,便依照一優先順序來挑出最適合的 模組名稱。例如以vend〇r: device為10ec:8139去尋找,同 時找到8139cp和8139too兩個模組名稱。此時,比對的優 先順序由大至小為 vend〇r:device 和 subvendor:subdevice 相 同者,device 和 subvendor:subdevice 相同者,device 相同 者’以及vendor:device相同者。 另外’在Linux中,USB驅動程式共有三種不同的 USB主控制器選項’分別為:加強型主控制器介面 (Enhanced Host Controller Interface,EHCI),開放主機 控制器介面(Open Host Controller Interface,OHCI),以 及萬用式主機控制器介面(Universal Host Controller 201106269 0004-09-003 3l538twf.doc/nNext, in step S110, the related information is recorded to the hardware analysis building. Figure 2 is a flow chart showing the recording of a hardware analysis file in accordance with an embodiment of the present invention. Referring to FIG. 2', in step S2〇5, it is detected whether there is a new hardware device. If yes, execute step S21Q; if not, execute step ς to the first target enabled board, record the first set of hardware settings = phase information to the hardware analysis target, and then continue to detect the rest. Set the hardware device on the opposite side of the target until all the tests are completed. In addition, when the hardware device on the target board is detected, it will be hard to prepare: = this), and the new hardware is added. A more basket. The related poor information is updated to the hardware analysis file device U ΐ ΐ 115 115 115 , , , , , 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 115 Search for the corresponding driver. It is known that the hardware building currently connected (for example, the above (4) items will be recorded to a device and equipment file to be able to know the target board towel. According to this, read the message on the board. Related equipment 201106269 UUU4-uy-〇03 31538twf.doc/n For Linux, the method for identifying the peripheral component connection interface is, for example, buy /proc/bus/pci/devices (ie the above device) or /sys /bus/devices/* to get the manufacturer of the hardware device (vend〇r), device model (device), remanufacturer (subven<i〇r)., remanufactured device model (subdevice). These related information can be recorded in the hardware analysis slot. Then, after detecting all the hardware devices added on the target board, the related driver can be downloaded according to the hardware analysis file. For example, the hardware will be downloaded. The relevant information in the analysis slot is compared with the modules.pcumap provided by the Linux kernel (kernel) to obtain the module name corresponding to the hardware device. The corresponding module is loaded by the module name ( That is the driver). And if it is the same hardware When there are two module names that can be used in m〇dules.pcimap, the most suitable module name is selected according to a priority order. For example, find vend〇r: device for 10ec:8139, and find 8139cp and 8139too two module names. In this case, the priority of the comparison is from large to small for vend〇r:device and subvendor:subdevice are the same, device and subvendor:subdevice are the same, device is the same as 'and vendor:device The same. In 'Linux, the USB driver has three different USB host controller options': Enhanced Host Controller Interface (EHCI), Open Host Controller Interface (Open Host Controller Interface) , OHCI), and universal host controller interface (Universal Host Controller 201106269 0004-09-003 3l538twf.doc/n
Interface ’ XJHCI)。在 Linux 下可查詢/proc/pci 所記錄的 pci子系統資源配置情況,或是藉由指令lspci從中分辦出 USB主控器屬於那種規格,據以載入USB類型所對應之 驅動程式。 ........ " 值得注意的是’如果驅動程式資料庫未提供對應的驅 動程式’則可上網下載驅動程式’或是由廠商所提供之光 碟來下载驅動程式,並且將驅動程式儲存至驅動程式資料 庫中,以待日後使用。 ' 鲁 以下再舉一實施例來說明載入驅動程式的方法各步 驟。圖3是依照本發明一實施例所緣示的載入驅動程式方 法的流程圖。請參照圖3,首先’在步驟S3〇5中,在原始 碼目錄中建立子目錄。其中,這些子目錄是用以對應目標 板上的硬體設備。在Linux下,驅動程式會分成不同的種 類’如果有新增的硬體設備則在原始碼目錄底下新增—個 子目錄以對應此硬體設備。 〇接著,在步驟S310中,在核心組態設定中建立主選 # 單項目。在編譯核心的時候會建立一個主選單項目,用以 記錄目前有哪些東西是要編譯進影像檔(image)裡面。 之後,在步驟S315中,修改製作檔(Makefile)。製 作檔中記錄了許多參數資料,因此當有新增硬體設備時 便需要修改製作檔中對應的參數。最後,如步驟S32〇所 不’载入驅動程式至對應的子目錄中。 接著返回圖1 ’在載入驅動程式之後’如步驟所 示,將這些驅動程式與嵌入式系統的核心編譯為影像檔。 201106269 0004-〇y-〇〇3 31538twf.doc/n 最後,在步驟S125中,將影像檔下載至目標板以進行測 試。 另外,本發明另提供一種驅動程式的安裝系統。圖4 是依照本發明一實施例所繪示的驅動程式安裝系統的方塊 圖。請參照圖4,安裝系統4〇〇包括目標板41〇、編譯裝置 420以及載入模組430。在本實施例中,目標板41〇是應用 於嵌入式系統中,例如Linux。編譯裝置420是用來偵測 目標板410上的硬體設備,以在載入這些硬體設備對應的 驅動程式之後,將這些驅動程式與核心編譯為影像檔。 上述編譯裝置420包括硬體資訊擷取模組421、驅動 擇式資料庫423以及編譯模組425。硬體資訊操取模組421 是用以擷取目標板410上所有硬體設備的相關資訊,並將 這些相關資訊記錄至硬體分析檔,如上述步驟sl〇5〜Su〇 所述。驅動程式資料庫423中則儲存了多個驅動程式。編 譯模組425用來依據硬體分析檔而自驅動程式資料庫423 中載入各硬體設備的驅動程式,並且將這些驅動程式與傲 入式系統的核心編譯為影像樓,如上述步驟S115〜S 120所 述。而載入模組430則是用來將編譯裝置420所編譯之影 像檔載入至目標板410上,如上述步驟S125所述。 綜上所述,本發明先將全部所新增的硬體設備之相關 資訊記錄至硬體分析檔,之後,再依據硬體分析檔來載入 對應的驅動程式,以將這些驅動程式與核心編譯為影像 檐。據此,透過自動化機制來載入驅動程式,使得嵌入式 糸統在更新硬體設備上更為方便。此外,將驅動程式與核 201106269 0004-09-003 3l538twf.d〇c/n 〜編#至影像檔’使得嵌入式系统在運作上更為穩定。 雖r'、i本發明已以實施例揭露如上,然其並非用以限定 本叙月任何所屬技術領域中具有通常知識者,在不脫離 本發明之精神和範圍内,當可作些許之更動與_,故本 《明之保圍當視後附之中請專利範圍所界定者為準。 【圖式簡單說明】 '是依照本發明一實施例所繪示的驅動裎式的安裝 方法流程圖。 圖2疋依照本發明-實施例所繪示的記錄硬體 的流程圖。 圖3疋依照本發明一實施例所繪示的載入驅動程 法的流程圖。 圖4是依照本發明一實施例所緣示的驅動程式 統的方塊圖。 【主要元件符號說明】 S105〜S125 .本f㈣—實施例之驅動程式的安裝方法 各步驟 S205〜S215 .本發明-實施例之記錄硬體分析槽的各 步驟 S305〜S320 :本發明-實施例之載入驅動程式方法的 各步驟 400 .安裝糸統 201106269 υυυπ- υ^-ν;03 31538twf.doc/n 410 目標板 420 編譯裝置 421 硬體資訊擷取模組 423 驅動程式貢料庫 425 編譯模組 430 載入模組 12Interface ’ XJHCI). Under Linux, you can query the configuration of the pci subsystem resources recorded by /proc/pci, or use the command lspci to separate the USB host controller from the specification, and load the driver corresponding to the USB type. ........ " It is worth noting that 'If the driver database does not provide the corresponding driver', you can download the driver online' or the CD provided by the manufacturer to download the driver and drive it. The program is saved to the driver database for later use. 'Lu Here's another example to illustrate the steps to load the driver. 3 is a flow diagram of a method of loading a driver in accordance with an embodiment of the present invention. Referring to Figure 3, first, in step S3〇5, a subdirectory is created in the original code directory. Among them, these subdirectories are used to correspond to the hardware devices on the target board. Under Linux, the drivers are divided into different categories. If there are new hardware devices, a new subdirectory is added under the source directory to correspond to the hardware device. Then, in step S310, a main selection #单 item is established in the core configuration setting. When compiling the kernel, a main menu item is created to record what is currently being compiled into the image file. Thereafter, in step S315, the makefile is modified. A lot of parameter data is recorded in the production file, so when there is a new hardware device, the corresponding parameters in the production file need to be modified. Finally, the driver is not loaded into the corresponding subdirectory as in step S32. Then return to Figure 1 'after loading the driver'. As shown in the steps, compile these drivers and the core of the embedded system into image files. 201106269 0004-〇y-〇〇3 31538twf.doc/n Finally, in step S125, the image file is downloaded to the target board for testing. In addition, the present invention further provides a mounting system for a driver. 4 is a block diagram of a driver installation system in accordance with an embodiment of the invention. Referring to FIG. 4, the mounting system 4 includes a target board 41, a compiling device 420, and a loading module 430. In this embodiment, the target board 41 is applied to an embedded system such as Linux. The compiling device 420 is configured to detect hardware devices on the target board 410 to compile the drivers and cores into image files after loading the drivers corresponding to the hardware devices. The compiling device 420 includes a hardware information capturing module 421, a driving database 423, and a compiling module 425. The hardware information operation module 421 is configured to capture information about all the hardware devices on the target board 410, and record the related information to the hardware analysis file, as described in the above steps sl5~Su. A plurality of drivers are stored in the driver database 423. The compiling module 425 is configured to load the drivers of the hardware devices from the driver database 423 according to the hardware analysis file, and compile the drivers and the core of the proud system into the image building, as in step S115 above. ~S 120 described. The loading module 430 is used to load the image file compiled by the compiling device 420 onto the target board 410, as described in step S125 above. In summary, the present invention first records all the information about the newly added hardware devices to the hardware analysis file, and then loads the corresponding drivers according to the hardware analysis file to load the drivers and the core. Compile to image 檐. As a result, the driver is loaded through an automated mechanism, making it easier for embedded systems to update hardware devices. In addition, the driver and core 201106269 0004-09-003 3l538twf.d〇c/n ~ edit # to image file ' makes the embedded system more stable in operation. Although the present invention has been disclosed in the above embodiments, it is not intended to limit the scope of the present invention, and it is possible to make some changes without departing from the spirit and scope of the present invention. And _, therefore, the title of the patent scope is subject to the provisions of the patent. BRIEF DESCRIPTION OF THE DRAWINGS 'A flow chart of a driving method according to an embodiment of the present invention. Figure 2 is a flow chart showing the recording of hardware in accordance with an embodiment of the present invention. FIG. 3 is a flow chart of a load driving method according to an embodiment of the invention. Figure 4 is a block diagram of a drive system in accordance with an embodiment of the present invention. [Description of main component symbols] S105 to S125. The f-fourth embodiment of the method for mounting the driver of the embodiment S205 to S215. The steps S305 to S320 of the recording hardware analysis slot of the present invention-embodiment: the present invention - the embodiment Steps of loading the driver method 400. Installing the system 201106269 υυυπ- υ^-ν; 03 31538twf.doc/n 410 target board 420 compiling device 421 hardware information capturing module 423 driver program library 425 compiling Module 430 loading module 12