Electronic device and method for loading configuration files using the same

A method for loading a configuration file from a remote server to an electronic device includes obtaining a default configuration file from the remote server, and executing the default configuration file to boot the electronic device, identifying a corresponding MAC list in the remote server according to hardware configurations of the electronic device, and obtaining a specific MAC value corresponding to an unused status flag from the MAC list. The method further includes obtaining a default MAC value of a network card of the electronic device, replacing the default MAC value of the network card with the specific MAC value, obtaining a specific configuration file from the remote server according to the specific MAC value, and rebooting the electronic device according to the specific configuration file.

BACKGROUND

1. Field of the Disclosure

Embodiments of the present disclosure relate to file loading, and particularly to an electronic device and a method for loading configuration files from a remote server to the electronic device.

2. Description of Related Art

A configuration file is often loaded from a remote server to a client computer to boot the client computer. However, if the remote server is in communication with a plurality of client computers, with varying hardware configurations, loading a specific configuration file to a designated client computer according to the requisite hardware configuration can present a challenge.

DETAILED DESCRIPTION

All of the processes described below may be embodied in, and fully automated via, functional code modules executed by one or more general purpose computers or processors. The code modules may be stored in any type of computer-readable medium or other computer storage device. Some or all of the methods may alternatively be embodied in specialized computer hardware.

FIG. 1is a block diagram of one embodiment of a plurality of electronic devices3in communication with a remote server1via a network2. In some embodiments, the electronic devices3may be sorted into different categories, with the same hardware configuration. For example, first sorted category of the electronic devices3have hardware H1, second sorted category of the electronic devices3have hardware H1and hardware H2, third sorted category of the electronic devices3have hardware H1, the hardware H2, and hardware H3. The network2may be an intranet, the Internet, or any other type of communications link that follows the Transfer Control Protocol (TCP) and the Internet Protocol (IP). The remote server1may include, but is not limited to, a default configuration file of the electronic devices3, specific configuration files of each of the electronic devices3, and a plurality of media access control (MAC) lists.

In one embodiment, the default configuration file may be used to boot all electronic devices3, but may not initialize hardware (e.g., interfaces) of all electronic devices3. Each of the specific configuration files is suitable for a sorted category of the electronic devices3having same hardware configuration. For example, if first sorted category of the electronic devices3have hardware H1, second sorted category of the electronic devices3have hardware H1and hardware H2, third sorted category of the electronic devices3have hardware H1, hardware H2, and hardware H3. The default configuration file may boot the first sorted category of the electronic devices3, the second sorted category of the electronic devices3, and the third sorted category of the electronic devices3, but cannot initialize hardware H1, H2and H3. A first specific configuration file of the specific configuration files may boot the first sorted category of the electronic devices3and initialize the hardware H1, a second specific configuration file of the specific configuration files may boot the second sorted category of the electronic devices3and initialize the hardware H1and H2, and a third specific configuration file of the specific configuration files may boot the third sorted category of the electronic devices3and initialize the hardware H1, H2, and H3.

In one embodiment, each of the MAC lists stores one or more MAC records of a sorted category of the electronic devices3. Each of the MAC records includes a status flag and a MAC value. The status flag includes a used status flag and an unused status flag. The used status flag indicates that a MAC value of the MAC record is under used status, the unused status flag indicates that the MAC value of the MAC record is under unused status. As shown inFIG. 4, M is a MAC list, a1is a status flag of a first MAC record, a2is MAC value of the first MAC record, b1is a status flag of a second MAC record, b2is MAC value of the second MAC record.

Each of the electronic devices3includes a storage device31, and a processor32. In one embodiment, the electronic device3may load a corresponding specific configuration file according to the hardware configurations of each of the electronic devices3from the remote server1. The storage system31may store various kinds of data, such as a temporary file stores default MAC value of a network card of electronic device3. For example, the storage system31may be a smart media card, a secure digital card, a compact flash card, a multi-media card, a memory stick, or an extreme digital card. The processor32executes one or more computerized operations stored in the storage system31and other applications, to provide functions of the electronic devices3.

FIG. 2is a block diagram of one embodiment of the electronic device3ofFIG. 1. In some embodiments, the electronic device3includes an configuration file acquisition module300, an identification module301, a MAC value obtaining module302, a generation module303, and a setting module304. The modules300,301,302,303, and304may comprise computerized code in the form of one or more programs that are stored in the storage system31(or memory). The computerized code includes instructions that are executed by the at least one processor32to provide functions for modules300,301,302,303, and304.

The configuration file acquisition module300obtains the default configuration file from the remote server1, and executes the default configuration file to boot the electronic device3. The default configuration file may include information for the operating system to boot the electronic device3.

The identification module301obtains hardware configurations of the electronic device3, and identifies a corresponding MAC list in the remote server1according to the obtain hardware configurations.

The MAC value obtaining module302obtains a specific MAC value corresponding to an unused status flag from the MAC list, updates the unused status flag of the specific MAC value to a used status flag, and obtains a default MAC value of the network card from the electronic device3. For example, if “0” is the unused status flag and “1” is the used status flag, as shown inFIG. 4, the MAC value obtaining module302may obtain a MAC value “001122334400” corresponding to a unused status flag “0,” and update the unused status flag “0” to a used status flag “1.”

The generation module303generates a temporary file to store the default MAC value.

The setting module304replaces the default MAC value of the network card of the electronic device3with the specific MAC value.

The configuration file acquisition module300further obtains a specific configuration file from the remote server1according to the specific MAC value, reboots the electronic device3according to the specific configuration file. In one embodiment, if the specific MAC value is “001122334400,” the configuration file acquisition module300may add “01” before a first number of the specific MAC value “001122334400” to get a new specific MAC value “01001122334400,” and add “-” between each two numbers of the new specific MAC value. Thus, the name of the specific configuration file is “01-00-11-22-33-44-00.” The specific configuration file may not only include operating system to boot the electronic device3, but also include initialize routine of hardware of the electronic device3.

If the electronic device3is shut down, the setting module304further updates the specific MAC value of the network card to the default MAC value of the temporary file, deletes the temporary file, and updates the used status flag of the specific MAC value in the MAC value list to the unused status flag.

FIG. 3is a flowchart of one embodiment of a method for loading configuration files from a remote server1.

In block S10, the configuration file acquisition module300obtains a default configuration file from the remote server1, and executes the default configuration file to boot the electronic device3.

In block S11, the identification module301obtains hardware configurations from the electronic device3, identifies a corresponding MAC list in the remote server1according to the obtain hardware configurations.

In block S12, the MAC value obtaining module302obtains a specific MAC value corresponding to an unused status flag from the MAC list, updates the unused status flag of the specific MAC value to a used status flag, and obtains a default MAC value of the network card from the electronic device3.

In block S13, the generation module303generates a temporary file to store the default MAC value.

In block S14, the setting module304replaces the default MAC value of the network card of the electronic device3with the specific MAC value.

In block S15, the configuration file acquisition module300further obtains a specific configuration file from the remote server1according to the specific MAC value, and reboots the electronic device3according to the specific configuration file.

If the electronic device3is shut down, in block S16, the setting module304further updates the specific MAC value of the network card to the default MAC value of the temporary file deletes the temporary file, and updates the used status flag of the specific MAC value in the MAC value list to the unused status flag.