Chapter 153 Compiling the Kernel
(New book period, ask for flowers, ask for collection!) When he got home, after dinner, Xiao Yuan didn't go to school for evening self-study, but locked himself in the house and began to operate on the ThinkPad 600.
What he wants to do is to completely control the computer, if you want to do this, then, the first step is to completely delete the original windows98 of the system from the computer, because Microsoft for commercial interests, it is impossible to disclose the source code of Windows, and even in order to ensure the ease of use and stability of the system, many things that can be freely controlled under DOS are encapsulated and restricted, which will not have any impact on ordinary users, and can even be said to be a good thing, But for a hacker like Xiao Yuan, who has a strong desire to control his computer, it is unbearable.
Therefore, he wants to replace his computer system with Linux, a completely open source free operating system that can control and adjust any details of the system, and what he downloaded from Gu Wolf before is actually the Linux kernel source code, and the software package or source code package needed to build a complete operating system using the source code.
Of course, if you want to achieve complete control over a computer, it is not an easy thing, and it is by no means something that ordinary computer users can do, if you don't have a solid foundation, after deleting the pre-installed windows98 of the system, this computer will probably only become a cold black box, and nothing can be done.
Xiao Yuan put the disc that Gu Wolf burned for him into the computer's optical drive, and then booted it from the BIOS to the optical drive, and soon, the system was guided to a black command-line interface.
The first thing he had to do was to repartition the hard disk of his laptop, format it, and completely delete the suffocating FAT32 file system supported by Windows98 and replace it with a file system supported by Linux.
Because the hard disk is very small, only 3.2G, Xiao Yuan did the partition formatting step very quickly, and it was done in ten minutes.
The next thing Xiao Yuan has to do is to delete and configure the Linux kernel source code on the disc according to his own needs, write a compilation script, and then compile the source code to generate truly executable binary machine code, and the tools he uses are also on that CD.
For the Linux kernel configuration, Xiao Yuan has done it countless times in his previous life, so this time, everything is familiar.
The writing of kernel compilation scripts, you can use some automatic script generation tools, of course, if you are very familiar with the syntax and format of this script, you can also write it yourself, here, Xiao Yuan chose to write the operating system source code compilation script by himself, although it is more troublesome, but compared with the compilation script generated by some automatic tools, it has a higher sense of control and freedom.
Xiao Yuan enjoys this process because when writing the compilation script, he is able to control every detail of the compilation process and ensure that only those functions that he needs will be compiled, and those that he does not need will not be compiled and will not appear in his system.
Like this kind of complete control of the system is only an open source operating system can do this, and similar to the Windows system and other closed-source systems, Microsoft provides a compiled binary package, when installing the system, although it also provides some configuration options, but there are very few things that can be configured and controlled, it is impossible to achieve complete control at all, and it can even be said that more than 90% of the content is imposed by Microsoft on users, and some of these functions may never be used by users, But these features have to be installed on the user's computer, and even the user has to pay for it out of pocket.
Or, there are some features that users don't want to use what Microsoft provides, such as the Internet Explorer that has been bundled into the system since Windows 98, but only some technical experts can uninstall it, and ordinary users can't do this at all.
Xiao Yuan after writing the kernel compilation script, retreated from the text editor, ran the script after the command line, followed by a long wait, if it is a computer in the future, this process may only take half an hour, or even one or twenty minutes to complete, but Xiao Yuan is now on this computer, the CPU is only 233MHz, and the memory is only 64M, so it takes a lot of time to compile an operating system kernel on such a computer, according to Xiao Yuan's own experience, the kernel is completely compiled. It takes at least three or four hours, and this is when the kernel compilation script he wrote has no errors, if there is an error in the middle of the script he writes, which causes the compilation to fail, then he has to modify the compilation script again, recompile, and it takes longer.
Waiting for a few hours for the compilation results to come out, Xiao Yuan naturally didn't waste it, the final exam was about to begin, and his homework needed to be reviewed, so he took out his textbook and buried himself in reading.
During this period, Xiao Changtian came in to see Xiao Yuan once, and he saw that Xiao Yuan was immersed in reading, and he didn't say anything, so he left.
At almost half past ten in the evening, the kernel was finally compiled, Xiao Yuan saw the information of the successful compilation given by the compiler at the end, and secretly rejoiced in his heart, packed up the textbook, and then began to carry out the next step on the compiled kernel.
After the kernel is compiled, in fact, a bootable Linux system with the most basic functions, and a basic shell have been installed on the computer, at this time, the computer has been able to boot.
Xiao Yuan copied all the files on the disc to the hard disk in the optical drive system, because at this time, the system that had just been compiled on the hard disk had not yet been configured with the optical drive driver, so once it was started from the hard disk and entered the system that had just been compiled, it was impossible to recognize the optical disc.
Booting from the hard drive, because it only requires a very thin operating system kernel and a few software packages, it only takes a few seconds to boot up, which is about the same time as turning on the TV and seeing the picture.
Looking at the login prompt on the computer screen, Xiao Yuan had an indescribable sense of satisfaction, the Linux system is different from the windows98 system, it is a multi-user system, so the login process is a must.
Xiao Yuan entered the super-user name root with the highest privilege after logging in to the user name, and then hit enter and entered the system, because it was a system that had just been compiled, and the superuser did not have a password yet, Xiao Yuan's first step was to set a password for the superuser.
After setting the password, Xiao Yuan installed the Linux user manual, and then installed the macro assembler, C language compiler, and the most basic text editor, so far, a basic Linux system that can work is done, of course, so far, this system has not done much work, because many hardware of the computer is still lacking drivers, and Xiao Yuan knows that these drivers can not be found even on the Internet, so they can only be written by themselves.
Writing these drivers is not too rare for him, but it takes time, and it is already more than eleven o'clock in the evening, Xiao Yuan thought that he would have to get up early tomorrow, so he turned off the computer and went to bed.