📄 buildmin-1.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>How To Build a Minimal Linux System from Source Code: What You Will Need</TITLE> <LINK HREF="buildMin-2.html" REL=next> <LINK HREF="buildMin.html#toc1" REL=contents></HEAD><BODY><A HREF="buildMin-2.html">Next</A>Previous<A HREF="buildMin.html#toc1">Contents</A><HR><H2><A NAME="s1">1. What You Will Need</A></H2><P>We will install a Linux distribution like Red Hat in one partition,and use that to build a new Linux system in another partition. I will call the system we are building the ``target'' and thesystem we are using to build it with, the ``source'' (not to beconfused with <EM>source code</EM> which we will also be using.)<P><P>So you are going to need a machine with two spare partitions on it.If you can, use a machine with nothing important on it. You could use an existing Linux installation as the source system, but I wouldn't recommend that. If you leave a parameter out of oneof the commands we will issue, you could accidentally install stuff to this system. This could lead to incompatibilites and strife.<P><P>Older PC hardware, mostly 486's and earlier, have an annoying limitationin their bios. They can not read from a hard disk past the first 512M.This is not too much of a problem for Linux, because once it is up, itdoes its own disk io, bypassing the bios. But for Linux to get loaded by these old machines, the kernel has to reside somewhere below 512M. If you have one of these machinesyou will need to have a separate partition completely below the 512Mmark, to mount as <CODE>/boot</CODE> for any partitions that are over that512M mark.<P><P>Last time I did this, I used Red Hat 6.1 as a source system. I installedthe base system plus<P><UL><LI>cpp</LI><LI>egcs</LI><LI>egcs-c++</LI><LI>patch</LI><LI>make</LI><LI>dev86 </LI><LI>ncurses-devel</LI><LI>glibc-devel </LI><LI>kernel-headers </LI></UL> <P>I also had X-window and Mozilla so I could read documentation easily, but that's not really necessary. By the time I had finished working, it had used about 350M of disk space. (Seems a bit high, I wonder why?)<P><P>The finished target system took 650M, but that includes all the source code andintermediate build files. If space is tight, you should do a <CODE>make clean</CODE>after each package is built. Still, this mind boggling bloat is a bit of a worry.<P><P>Finally, you are going to need the source code for the system we are going tobuild. These are the ``packages'' that I have discussed in this document. Thesecan be obtained from a source cd, or from the internet. I'll give URL's forthe USA sites and for Australian mirrors.<P><P><A NAME="downloads"></A> <UL><LI>MAKEDEV<A HREF="ftp://tsx-11.mit.edu/pub/linux/sources/sbin">USA</A>Another <A HREF="ftp://sunsite.unc.edu/pub/Linux/system/admin">USA</A>site</LI><LI>Lilo <A HREF="ftp://lrcftp.epfl.ch/pub/linux/local/lilo/">USA</A>,<A HREF="ftp://mirror.aarnet.edu.au/pub/linux/metalab/system/boot/lilo/">Australia</A>.</LI><LI>Linux Kernel Use one of the mirrors listed at <A HREF="http://www.kernel.org">home page</A>rather than <A HREF="ftp://ftp.kernel.org/pub/linux/kernel">USA</A>because they are always overloaded.<A HREF="ftp://kernel.mirror.aarnet.edu.au/pub/linux/kernel/">Australia</A> </LI><LI>GNU libc itself, and the linuxthreads addon are at<A HREF="ftp://ftp.gnu.org/pub/gnu/glibc">USA</A> <A HREF="ftp://mirror.aarnet.edu.au/pub/gnu/glibc">Australia</A> </LI><LI>GNU libc addonsYou will also need the linuxthreads and libcrypt addons.If libcrypt is not there it is because of some US export laws. You can get it at<A HREF="ftp://ftp.gwdg.de/pub/linux/glibc">libcrypt</A> The linuxthreads addon is in the same places as libc itself </LI><LI>GNU ncurses<A HREF="ftp://ftp.gnu.org/gnu/ncurses">USA</A><A HREF="ftp://mirror.aarnet.edu.au/pub/gnu/ncurses">Australia</A></LI><LI>SysVinit <A HREF="ftp://sunsite.unc.edu/pub/Linux/system/daemons/init">USA</A> <A HREF="ftp://mirror.aarnet.edu.au/pub/linux/metalab/system/daemons/init">Australia</A> </LI><LI>GNU Bash <A HREF="ftp://ftp.gnu.org/gnu/bash">USA</A> <A HREF="ftp://mirror.aarnet.edu.au/pub/gnu/bash">Australia</A> </LI><LI>GNU sh-utils<A HREF="ftp://ftp.gnu.org/gnu/sh-utils">USA</A> <A HREF="ftp://mirror.aarnet.edu.au/pub/gnu/sh-utils">Australia</A> </LI><LI>util-linux<A HREF="ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/">Somewhere else</A><A HREF="ftp://mirror.aarnet.edu.au/pub/linux/metalab/system/misc">Australia</A> This package contains <CODE>agetty</CODE> and <CODE>login</CODE>.</LI></UL><P><P>To sum up then, you will need:<UL><LI>A machine with two spare partitions of about 400M and 700M respectivelythough you could probably get away with less</LI><LI>A Linux distribution (eg. a Red Hat cd) and a way of installing it (eg. a cdrom drive)</LI><LI>The source code tarballs listed above</LI></UL><P><P>I'm assuming that you can install the source system yourself, without anyhelp from me. From here on, I'll assume that its done.<P><P>The first milestone in this little project is getting the kernel to boot upand panic because it can't find an <CODE>init</CODE>. This means we are going to haveto install a kernel, and install lilo. To install lilo nicely though, wewill need the device files in the target <CODE>/dev</CODE> directory. Lilo needs them to do the low level disk access necessary to write the bootsector. MAKEDEV is the script that creates these device files. (You can just copy them from the source system of course, but that's cheating!)But first of all, we need a filesystem to put all of this into.<P><P><HR><A HREF="buildMin-2.html">Next</A>Previous<A HREF="buildMin.html#toc1">Contents</A></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -