1. Field of the Invention
The present invention is generally related to methods for booting a computer, and more particularly, is related to a method for changing booting devices of a computer.
2. Description of Related Art
A computer can be booted from different booting devices, such as a floppy drive, a hard disk, a compact disk and/or a flash memory according to various requirements of a user. Therefore, a computer needs to pass various tests for booting from different booting devices before being shipped out of factory to customers. It could be a problem to change booting devices of a plurality of computers in mass production, because conventionally changing booting devices requires resetting Complementary Metal-Oxide-Semiconductor Transistor (CMOS) of the computers manually by test engineers. It is time-consuming in mass production, and is a major obstacle to achieve full production automation.
There are however, some advances in computer testing. A typical one is to prepare different CMOSs corresponding to various booting devices by programming. When there is a need in changing booting devices, the CMOSs are loaded for execution. However, computers of different hardware configuration generally have different CMOSs. So, if computers of different hardware configuration are being tested, the CMOSs need to be changed frequently.
What is needed, therefore, is a solution that can change booting devices of a computer conveniently without frequently changing the CMOSs manually.
One embodiment of a computer is provided. The computer includes a memory, a primary booting device, and a secondary booting device. The primary booting device and the secondary booting device each includes a boot program for booting the computer. The primary booting device further includes a boot program reading module, a determining module, and a jumping module. Specifically, the boot program reading module is used for reading the boot program of the secondary booting device into a predetermined portion of the memory of the computer. The determining module is used for determining whether the boot program of the secondary booting device is valid for normal computer booting. The jumping module is used for executing the boot program of the secondary booting device, if the boot program of the secondary booting device is valid for normal computer booting.
One embodiment of a method for switching booting devices of a computer is also provided. The method includes the steps of: powering on the computer and executing basic input/output system power on self test (BIOS POST) program; defaulting to boot the computer from a primary booting device; reading a boot program of a secondary booting device into a predetermined portion of a memory of the computer; determining whether the boot program of the secondary booting device is valid for normal computer booting; executing the boot program of the secondary booting device, if the boot program of the secondary booting device is valid for normal computer booting; and booting the computer from the secondary booting device.
Other systems, methods, features, and advantages of the present invention will be or become apparent to one with skill in the art upon examination of the following drawings and detailed description.
The CPU 11 is used for processing data and codes in the memory 12 that stores the data and codes temporarily. The CMOS 13 is a transistor for storing a basic input/output system (BIOS) that includes information on booting sequences and devices of computer 10, and also for storing a BIOS power on self test (POST) program. The primary booting device 14 includes a boot program 141 which can be executed by the CPU 11 to boot computer 10. The secondary booting device 15 also includes a boot program 151 that can also be executed by the CPU 11 to boot computer 10. The bus 16 is used for exchanging data between the units connected thereto.
The primary booting device 14 and the secondary booting device 15 can be any one from the group consisting of a floppy drive, a hard disk, a compact disk, and a flash memory. The primary booting device 14 and the secondary booting device 15 may be different booting devices, or even the same booting devices. According to the information on the booting sequence recorded in the CMOS 13, the primary booting device 14 is chosen preferentially to boot computer 10, while the secondary booting device 15 is a standby booting device for computer 10.
The booting device switching program 140 has its codes embedded in the primary booting device 14, and includes a boot program reading module 1402, a determining module 1404, and a jumping module 1406. Specifically, the boot program reading module 1402 is used for reading the boot program 151 of the secondary booting device 15 into a predetermined portion of the memory 12 of the computer 10. The predetermined portion of the memory 12 may be, for example, addresses 0000:7C000.
The determining module 1404 is used for determining whether the boot program 151 is valid for normal booting of the computer 10. In this preferred embodiment, the determining module 1404 reads a value of the last two bytes of the zero sector of the boot program 151 loaded in memory 12. If the value is AA55, the boot program 151 is valid for normal booting of the computer 10, otherwise, if the value is not AA55, the boot program 151 is invalid.
The jumping module 1406 is used for executing the boot program 151 of the secondary booting device 15, if the boot program 151 of the secondary booting device 15 is valid for normal booting of the computer 10. When powered on, the computer 10 chooses the primary booting device 14 to boot. The CPU 11 reads codes in the primary booting device 14 and stores the codes into the memory 12, then executes the codes of the booting device switching program 140 first instead of the boot program 141. After executing the booting device switching program 140, if the boot program 151 of the secondary booting device 15 is valid for normal booting the of the computer 10, the CPU 11 jumps to execute the boot program 151 of the secondary booting device 15 to boot the computer 10.
If the boot program 151 is valid for normal booting of the computer 10, in step S308, the jumping module 1406 executes the boot program 151 of the secondary booting device 15. In step S310, the computer 10 boots from the secondary booting device 15 by executing the boot program 151.
On the other hand, if the boot program 151 is invalid for normal booting of the computer 10, in step S312, the computer 10 normally boots from the primary booting device 14 by executing the boot program 141.
It should be emphasized that the above-described embodiments of the present invention, particularly, any “preferred” embodiments, are merely possible examples of implementations, merely set forth for a clear understanding of the principles of the invention. Many variations and modifications may be made to the above-described embodiment(s) of the invention without departing substantially from the spirit and principles of the invention. All such modifications and variations are intended to be included herein within the scope of this disclosure and the present invention and protected by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
200510034748.4 | May 2005 | CN | national |