Patent Publication Number: US-7725700-B2

Title: Embedded system, automatic loading system, and method capable of automatically loading a root file system

Description:
BACKGROUND OF THE INVENTION 
   1. Field of the Invention 
   The present invention relates to a system and method capable of loading a root file system, and more particularly, to an embedded system, automatic loading system, and method capable of automatically loading a root file system. 
   2. Description of the Prior Art 
   Embedded systems and their related application devices are increasingly popular. Many devices both in production and in development utilize embedded systems, such as: information appliances (IA), smart phones, and set-top boxes. Embedded systems are typically composed of computer software (e.g., an embedded operating system) and computer hardware (e.g., system single chip). The embedded system is developed based on a specific purpose. Because of this narrow development goal, the embedding system, as compared with a typical personal computer, has advantages including: high stability, small volume, and low cost. Many products such as Palm OS, Windows CE, and Linux utilize embedded systems. The Linux operating system is especially popular because it is available as freeware. 
   The prior art embedded system downloads the root file system in a flash memory (e.g. a non-volatile memory) corresponding to an embedded operating system. Please refer to  FIG. 1 .  FIG. 1  is a block diagram of a related art embedded system  10 . The embedded system  10  comprises a microprocessor  12 , a non-volatile memory  14 , and a volatile memory  16 , wherein the microprocessor  12  is utilized to control operation of the embedded system, the non-volatile memory  14  (e.g. flash memory or ROM) is utilized to record a boot code Boot_Code, a kernel Kernel and a root file system image file RFS. The volatile memory  16  (e.g. DRAM) is utilized to temporarily store program code and operation information required for an operation of the embedded system  10 . The boot code Boot_Code is utilized to control the loading of the kernel Kernel. For example, the boot code Boot_Code is a boot loader, which can supply multi-boot to control booting process of the embedded system  10  to utilize the kernel Kernel to control hardware operation of the embedded system  10  by loading the proper kernel Kernel. 
   Please refer to  FIG. 2 .  FIG. 2  shows a flowchart of loading the embedded system  10 . The flowchart includes the following steps: 
   Step  100 : Turn on the embedded system  10 . 
   Step  105 : The microprocessor  12  automatically loads the boot code Boot_Code that is stored in the non-volatile memory  14  to the volatile memory  16 . 
   Step  110 : The microprocessor  12  retrieves the boot code Boot_Code that is temporally stored in the volatile memory  16  to further execute the boot code Boot_Code to load the kernel Kernel stored in the non-volatile memory  14  to the volatile memory  16 . 
   Step  120 : The microprocessor  12  retrieves the kernel Kernel stored in the volatile memory  16  to further execute the kernel Kernel to configure the hardware of the embedded system  10 . 
   Step  130 : After the kernel Kernel finishes the configuration of the hardware of the embedded system  10 , the microprocessor  12  executes the kernel Kernel to load the root file system image file RFS that is stored in the non-volatile memory  14  to the volatile memory  16 . 
   Step  140 : The microprocessor  12  decompresses the root file system image file RFS to generate the needed root file system. 
   As mentioned above, the embedded system  10  utilizes the non-volatile memory  14  to store the root file system image file RFS applied to the embedded system  10 . However, due to cost considerations, the volume of the non-volatile memory  14  is limited. Therefore, the prior art mechanisms for loading the root file system have several defects, such as: 
   1. Due to the root file system image file RFS size limitation beginning governed by the size of the non-volatile memory  14 , optimization of the application software of the root file system image file RFS is not possible. 
   2. Due to the size limitation of non-volatile memory  14 , the embedded system  10  can only accommodate a single root file system image file RFS; and 
   3. The embedded system  10  can only utilize the root file system image file RFS stored in the non-volatile memory  14  (i.e., the user can not load other root file system image file). These defects make functionality expansion of the embedded system  10  difficult. 
   SUMMARY OF THE INVENTION 
   One objective of the claimed invention is therefore to provide an embedded system, automatic loading system and method of automatically loading the root file system, to solve the above-mentioned problems. 
   According to an exemplary embodiment of the claimed invention, a method capable of automatically loading a root file system to an embedded system is disclosed. The method comprises: turning on the embedded system to execute a boot code; utilizing the boot code to execute a kernel; utilizing the kernel to execute a root file system auto initial program to retrieve a root file system image file stored in an external device external to the embedded system; and loading the root file system into the embedded system according to the root file system image file. 
   According to another exemplary embodiment of the claimed invention, an embedded system is disclosed. The embedded system comprises: a microprocessor for controlling an operation of the embedded system; a first storage device coupled to the microprocessor; and a second storage device coupled to the microprocessor for storing a boot code, a kernel, and a root file system auto initial program. The microprocessor sequentially loads and executes the boot code, the kernel, and the root file system auto initial program from the second storage device, utilizes the kernel to load the root file system auto initial program to retrieve a root file system image file stored in an external device external to the embedded system, and loads a root file system into the first storage device according to the root file system image file. 
   According to another exemplary embodiment of the claimed invention, an automatic loading system of a root file system is disclosed. The automatic loading system comprises: a microprocessor for controlling an operation of the embedded system; a first storage device coupled to the microprocessor; and a second storage device coupled to the microprocessor for storing a boot code, a kernel, and a root file system auto initial program; and an external device external to the embedded system for storing a root file system image file. The microprocessor sequentially loads and executes from the second storage device the boot code, the kernel, and the root file system auto initial program. Next the microprocessor utilizes the kernel to load the root file system auto initial program to retrieve the root file system image file stored in the external device external the embedded system, and loads the root file system into the first storage device according to the root file system image file. 
   The present invention utilizes an external device to provide a larger volume for the storage of the root file system image file. This increases the size of the volatile memory providing sufficient space to store and execute the root file system image file. In other words, the volume of the root file system image file it no longer limited to the volume of the non-volatile memory. Therefore the root file system image file can be optimized and comprises more application programs to make diversity of the embedded system. Additionally, the present invention can load the root file system image file from outside making the embedded system to execute the needed root file system. As a result, there is great flexibility when utilizing embedded systems. Additionally, the present invention loads the root file system auto initial program before application programs load. This allows the present invention to control the booting process and the loading of the root file system image file. Therefore, the present invention can easily be applied to various kinds of embedded systems. In other words, the present invention loading root file system image file is easily to be implemented. 
   These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
       FIG. 1  is a block diagram of a related art embedded system. 
       FIG. 2  shows a flowchart of loading the embedded system. 
       FIG. 3  is a block diagram of an automatic loading system utilized in the present invention. 
       FIG. 4  is a flowchart of the automatic loading system in  FIG. 3  loading the root file system. 
   

   DETAILED DESCRIPTION 
   Please refer to  FIG. 3 .  FIG. 3  shows a block diagram of an automatic loading system  150  utilized in the present invention. The automatic loading system  150  comprises an embedded system  152  and a plurality of external devices  154   a ,  154   b , and  154   c . In this embodiment, the embedded system  152  comprises a microprocessor  156 , a non-volatile memory  158 , a volatile memory  160 , a connection interface  162 , and a network interface  164 . Additionally, the non-volatile memory  158 , such as Flash memory or ROM, records a boot code Boot_Code a kernel Kernel, a root file system auto initial program RFS_AIP, and a plurality of predetermined external device configuration files S 1 , S 2 , and S 3  corresponding respectively to the external devices  154   a ,  154   b , and  154   c . As shown in  FIG. 3 , the external device  154   a  directly couples to the embedded system  152  through the connection interface  162 , such as USB interface, of the embedded system  152 . The external devices  154   b  and  154   c  couple to the network interface (such as network card) of the embedded system  152  through Intranet  166  and Internet  168  respectively. Additionally, the external devices  154   a ,  154   b , and  154   c  (such as HDD, FDD, or CDROM) respectively store the root file system image files RFS a , RFS b , and RFS c . Please note that the elements of the same name in the embedded system  152  of  FIG. 3  and the embedded system  10  of  FIG. 1  have the same functionality and operation. Further description is omitted for the sake of brevity. 
   Please refer to  FIG. 3  and  FIG. 4 .  FIG. 4  shows a flowchart of the automatic loading system  150  in  FIG. 3  loading the root file system. The flowchart includes the following steps: 
   Step  200 : Turn on the embedded system  152 . 
   Step  205 : The microprocessor  156  automatically loads the boot code Boot_Code stored in the non-volatile memory  158  to the volatile memory  160 . 
   Step  210 : The microprocessor  156  retrieves the boot code Boot_Code stored in the volatile memory  160  to execute the boot code Boot_Code to load the kernel stored in the non-volatile memory  158  into the volatile memory  160 . 
   Step  215 : The microprocessor  156  retrieves the kernel temporarily stored in the volatile memory  160  to execute the kernel to configure hardware of the embedded system  152 . 
   Step  220 : After the kernel finishes configuring the hardware of the embedded system  152 , the microprocessor  156  executes the kernel to load the root file system auto initial program RFS_AIP stored in the non-volatile memory  158  to the volatile memory  160 . 
   Step  225 : The microprocessor  156  retrieves the root file system auto initial program RFS_AIP stored in the volatile memory  160  to execute the root file system auto initial program RFS_AIP to retrieve a predetermined expanded external device configuration file S 1 , S 2 , or S 3 . 
   Step  230 : Does the embedded system  152  need to utilize protocol of TCP/IP to access the external device corresponding to the predetermined external device configuration file?. If yes, execute step  235 ; otherwise execute step  245 . 
   Step  235 : Does the embedded system  152  need to utilize the Intranet  166  to access the external device corresponding to the predetermined external device. configuration file?. If yes, execute step  240 ; otherwise execute step  245 . 
   Step  240 : The microprocessor  156  executes the root file system auto initial program RFS_AIP to connect the embedded system  152  to the Internet  168  through the dynamic host configuration protocol (DHCP). 
   Step  245 : The microprocessor  156  executes the root file system auto initial program RFS_AIP to utilize proper protocols to establish a connection between the embedded system  152  and the external device corresponding to the predetermined external device configuration file. 
   Step  250 : The microprocessor  156  executes the root file system auto initial program RFS_AIP to load the root file system image file recorded in the external device into the volatile memory  160  according to the predetermined external device configuration file. 
   Step  255 : The microprocessor  156  decompresses the root file system image file to generate the needed root file system. 
   The operation of the steps  200 .about. 215  is the same as the steps  100 .about. 120  therefore any further discussion is omitted for the sake of brevity. In this embodiment, there is a key difference from the prior art loading mechanism of a root file system that the embedded system  152  includes a root file system auto initial program RFS_AIP for controlling the loading operation of the root file system, wherein the root file system auto initial program RFS_AIP is not the application software of the root file system. After the kernel finishes configuring the embedded systemt&#39;s  152  hardware, the microprocessor  156  executes the kernel to load into the volatile memory  160  the root file system auto initial program RFS_AIP (step  220 ). Next, the microprocessor  156  starts executing the root file system auto initial program RFS_AIP to control the next loading operation. In this embodiment, a user can provide some parameters to the root file system auto initial program RFS_AIP for controlling the root file system auto initial program RFS_AIP to retrieve a predetermined external device configuration file S 1 , S 2 , or S 3  (step  225 ). For example, the root file system image files RFS a , RFS b , and RFS c  correspond to Chinese, English, and Japanese respectively. To utilize the embedded system  152  supporting Chinese, the user can provide parameters to the root file system auto initial program RFS_AIP to control the root file system auto initial program RFS_AIP to retrieve the predetermined external device configuration file S 1 . 
   As to the predetermined external device configuration file S 1 , the predetermined external device configuration file S 1  comprises a path name corresponding to a storage address of the root file system image file RFS a , and a Metadata utilized to configure The access method of the expanded external device  154   a . The Metadata of the predetermined external device configuration file S 1  is a direct external instruction for pointing embedded system  152  not utilizing the network (Intranet  166  and Internet  168 ) to access The root file system image file RFS a  of the external device  154   a . The microprocessor  156  executes the root file system auto initial program RFS_AIP to utilize proper protocols (e.g. USB transmission protocol) to establish a connection between the embedded system  152  and the external device  154   a  (step  245 ). The root file system auto initial program RFS_AIP loads the root file system image file RFS a  into the volatile memory  160  according to the path name of the predetermined external device configuration file S 1  (step  250 ). Finally, the microprocessor  156  decompresses and loads to the root file system image file RFS a  in the volatile memory  160  to generate the needed root file system supporting Chinese. 
   Additionally, if the user wants to utilize the embedded system  152  supporting English, the user can give parameter to the root file system auto initial program RFS_AIP to control the root file system auto initial program RFS_AIP to retrieve another predetermined external device configuration file S 2 . Typically, the predetermined external device configuration file S 2  comprises a path name corresponding to a storage address of the root file system image file RFS b , and a Metadata utilized to configure the access method of the external device  154   b . The Metadata of the predetermined external device configuration file S 2  is a TCP/IP connection instruction for pointing out that the embedded system  152  utilizes the Intranet  166  to access the root file system image file RFS b  of the external device  154   a  (steps  230  and  235 ). Thus, the microprocessor  156  executes the root file system auto initial program RFS_AIP to utilizes proper protocols, for example, Trivial File Transfer Protocol (tftp), File Transfer Protocol (ftp), Hypertext Transmission Protocol (HTTP), Network File System (NFS) or Server Message Block (SMB), to establish a connection between the embedded system  152  and the external device  154   b  (step  245 ). Then, the root file system auto initial program RFS_AIP loads the needed root file system image file RFS b  to the volatile memory  160  according to the path name recorded in the predetermined external device configuration file S 2  (step 250 ). Finally, the microprocessor  156  decompresses and loads into the root file system image file RFS b  in the volatile memory  160  to generate the needed root file system supporting English. 
   Furthermore, if the user wants to utilize the embedded system  152  supporting Japanese, the user can give parameter to the root file system auto initial program RFS_AIP to control the root file system auto initial program RFS_AIP to retrieve another predetermined external device configuration file S 3 . In the present embodiment, the predetermined external device configuration file S 3  comprises a path name corresponding to a storage address of the root file system image file RFS c , and a Metadata utilized to configure the access method of the external device  154   c . The Metadata of the predetermined external device configuration file S 3  is a TCP/IP connection instruction for pointing the embedded system  152  utilizing the Internet  168  to access the root file system image file RFS c  of the external device  154   c  (steps  230 ). In order to connect the embedded system  152  to the Internet  168 , the microprocessor  156  executes the root file system auto initial program RFS_AIP to utilize a protocol of dynamic host configuration protocol (DHCP) to configure network connection information of the embedded system  152 , for example, an IP address (step 240 ). The microprocessor  156  executes the root file system auto initial program RFS_AIP to utilizes proper protocols, for example, Trivial File Transfer Protocol (tftp), File Transfer Protocol (ftp), Hypertext Transmission Protocol (HTTP), Network File System (NFS) or Server Message Block (SMB), to establish a connection between the embedded system  152  and the external device  154   c  (step 245 ). Then the root file system auto initial program RFS_AIP loads the needed root file system image file RFS c  to the volatile memory  160  according to the path name recorded in the predetermined external device configuration file S 3  (step 250 ). Finally, the microprocessor  156  decompresses and loads into the root file system image file RFS c  in the volatile memory  160  to generate the needed root file system supporting Japanese. 
   Please note that the present invention does not limit the number of the external device though only three external devices  154   a ,  154   b , and  154   c  are shown in  FIG. 3 . Additionally, since the predetermined external device configuration file comprises the path name to indicate the storage address of the root file system image file, the present invention does not limit that the external device can only store a root file system image file. In other words, if the same specific external device records a plurality of different root file system image file, the present invention can also read a needed root file system image file from the plurality of root file system image files through a specific path name of a predetermined external device configuration file. The above variations are in the range of the present invention. 
   Compared to the related art, the present invention utilizes an external device to provide a larger volume to store the root file system image file. Therefore, if the volume of the volatile memory is enough and can execute the root file system image file, the volume of root file system image file does not limit to the volume of the non-volatile memory. Therefore the root file system image file can be optimized and comprises more application programs to make diversity of the embedded system. Additionally, the present invention can load the root file system image file from outside to make the embedded system to execute the needed root file system, and then raise the flexibility of utilizing embedded system. Additionally, the present invention loads the root file system auto initial program before application programs loading to control the booting process, and the present invention loading root file system image file can easily be applied to various kinds of embedded systems. In other words, the present invention loading root file system image file is easily to be implemented. 
   Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.