Create a minimized Linux system from the source code 1- -
Pucking Teacher Teaching BLOG
Create a minimized Linux system from source code
Greg O'Keefe, gcokeefe@postoffice.utas.edu.au.au.au.au.au.au.au.au.au.au.au
May 5, 2000
-------------------------------------------------- ------------------------------
Hereinafter, the operating instructions for creating a minimized Linux system from the source code. It used to start from the power-up to a part of the Bash prompt (from powerup to bash prompt). But I separated them in order to make them smart and more centralized. The system we have to build here is very small, and it is not ready to use as a work product. If you want to build a system with practical use from the beginning, see the Linux from Scratch Howto written by Gerard Beekmans.
-------------------------------------------------- ------------------------------
1. The conditions you need
We must first install a Linux issued suite such as a small red hat to a partition, and then use it to create a new Linux system on another partition. I am calling the system we have to build as a target (TARGET), and the system we use to create a new system is called source. Don't put this source with the source code we use. Source Code. :)
Therefore, you have to need a machine with two independent partitions. If possible, please try to use a machine without important information to prevent data damage. You can use an existing Linux system as a source system, but I don't recommend this way. If you accidentally miss some of the parameters of our instructions, you may be accidentally installed on this system that there is no necessary things, which may cause incompatible and conflicts.
Old PC hardware, most of the 486 machines or earlier models, their BIOS has some extremely annoying limitations. They have no way to read the space after the hard disk exceeds the top 512 mega. Of course, this is not a big problem for Linux, because as long as Linux can boot, will use Linux's own disk IO, slightly the BIOS call. But in order to enable these old machines to boot Linux, the Linux kernel must be stored in a certain location before the top 512 megabytes of the hard disk. If you have such a older machine, you have to prepare a separate and complete hard disk partition within the top 512 megabytes and mount it as / boot. Other partitions can be anywhere in any location, but not worrying is where the hard disk is.
When I built this system last time, the source system used was a small Red Hat 6.1 (Redhat 6.1), I installed the basic system, with the following software package:
CPP (C compiler)
EGCS (enhanced C compiler)
EGCS-C (Enhanced C Language Compiler)
PATCH (Patch Program) Make (Compilation Batch Interpreter) DEV86 (Device File) NCURSES-DEVEL (NCURSES Library Development Pack) GLIBC-Devel (Glibc Base Development Pack)
Kernel-Headers (kernel source terminal file package)
I also installed the X Window window system and Mozilla web browser to read documents easier, and actually these two stuff do not necessarily. When I was completed, this source system probably used 350 trillion disk space (it looks more, but I am still wondering why). The target system for completion takes up 650 mega disk space, but this value contains all the source code and the files created in the middle. If the space is compact, you should perform Make Clean after each package is finished to clear the temporary file. Of course, I am a little surprised to this.
Finally, you are ready to build the source code package we have to build the system. These are the software packs I have discussed herein. These packages can be found from the source card or found from the Internet. I will give the US site and the address of the mirror site in Australia.
MakeDev (Equipment Builder Pack) The other of the United States is the United States
Lilo (Linux Guarantee) USA, Australia.
The Linux kernel package (kernel) is best not to use the US site download using the mirror site listed on the home page, as these places are usually overuse operation. Australian GNU Libc library bags, and Liuxthreads thread additional libraries can be downloaded to: USA and Australia GNU libc Additional library package You may also need LinuXThreads thread additional libraries and libcrypt encryption additional libraries. If libcrypt is not found in that place, it is because of the reasons for the US export law, then you can get a libcrypt encrypted additional library. Usually the LinuxThreads thread adds the library with the libc library to be placed in the same place. GNU NCURSES Australia Sysvinit (Initialized script package) Australia GNU Bash (Command Interpreter) US Australia GNU SH-Utils (Command Interpreter Toolkit) Australia Util-Linux (Linux Common Toolkit) Another place Australian The package includes Agetty and Login.
Summarize, what you need is:
A machine with two is 400 megabits and 700 mega, maybe you may need less.
A Linux distribution kit (such as a Red HAT CD) and installation method (such as a CD-ROM)
The source code of the source code listed above.
I assume that you can install the source system, and you don't need me to help. From here, I assume that the source system has been installed.
The first milestone of this small project is to make the kernel start up and then dead, because it did not find the init initializer. That is to say we have to install a kernel and install LILO. To successfully install LILO, we have to use the device files under the / dev directory on the target system. LILO requires them to implement the underlying required disk access to write into the boot sector. MakeDev is used to create scripts for these device files (you can of course only need to be copied from the source system, but this is cheating and won). But the most important thing is that we need a file system to place all these things.
2. File system
Our new system is to install on the file system. So we must first use the command MKE2FS to create a file system and mount it to a place. I suggest that it is mounted on / mnt / target. In the next operation, I assume that I use this directory. In order to save your valuable time, you can add this in / etc / fstab file so that you can automatically mount this directory when each source system is started.
When we launched the target system, all things placed on / mnt / target will be placed on / root. We need to establish a fixed directory structure on the target system. See the File Hierarchy Standard (FHS, File Heirarchy Standard ", see the file system section to learn more, or only the CD switch directory to the local system mounted, then do the following command:
Mkdir bin boot dev etc home lib mnt root sbin TMP usr var
CD var; mkdir Lock Log Run Spo
Cd ../usr; mkdir bin incrude lib local sbin share src
CD Share /; mkdir man; cd man
MKDIR Man1 Man2 Man3 ... man9
Because the FHS standard and most of the package are inconsistent with the man page (Man Page), we need to be a symbolic connection:
Cd ..; ln -s share / man man
3. MakeDev (equipment generator)
We want to place the source code to the / usr / src directory of the target system. So, give an example, if your target system is mounted in / mnt / target this place, and your tar package is put in / root, then you have to do it:
CD / MNT / TARGET / USR / SRC
Tar -Xzvf / ROOT/makedev-2.5.tar.gz
Then you will copy these TAR packages to you to unlock them. Don't be confused. ; ->
When you install software, usually you will install them on the system being used. But we don't want to do this, because we have to put / mnt / target as root filesystem, you have to install these software to this place. Different packages have different ways of processing. For example, the MakeDev device generator package, you are going to do ,.
Root = / mnt / target make install
You have to check these options in the ReadMe documentation and install installation instruction file in this package, or execute the command ./configure --Help View Help Description.
Check out the Makefile file in the MakeDev package to see how it handles the root variables set in the command line. Then take the man page by executing man ./makedev.man to see how it works. You will find that the way to generate our own devices is to execute CD / MNT / Target / DeV then ./makedev generic. Please use the ls command to see which device files are all generated for us.