119 lines
4.7 KiB
Plaintext
119 lines
4.7 KiB
Plaintext
[ NOTE! I didn't write this: I'm too lazy to write README's etc. I just
|
|
make this available because it might just reduce the number of "how do
|
|
I compile linux" questions on the net (and to me). I'm not
|
|
guaranteeing anything in this README: things might have changed with
|
|
0.97, making this not completely up-to-date. - Linus ]
|
|
|
|
|
|
VERY QUICK AND DIRTY README
|
|
by Lars Wirzenius
|
|
|
|
This is the README for the Linux kernel sources. It tells a few small
|
|
things about kernel configuration and other things that can perhaps be
|
|
useful if you want to compile the kernel from scratch. It leaves out a
|
|
lot as well, probably because the person who wrote it doesn't understand
|
|
very much about operating systems. Linus did his best to help, but all
|
|
problems this causes are my fault.
|
|
|
|
In order to compile this version of the kernel you need GCC 2.2.2 or
|
|
newer. Some makefile targets require special commands which may not be
|
|
available on all machines (see below). Normal utilities like ls etc are
|
|
not explicitly listed, they are assumed to be available on all systems.
|
|
|
|
Kernel sources are usually kept in /usr/src/linux. If you have them
|
|
elsewhere, you will have to change path names in a few places.
|
|
Filenames that aren't absolute are supposed to be relative to the
|
|
toplevel kernel source directory.
|
|
|
|
|
|
* Basic configuration
|
|
|
|
1. Edit Makefile: Check the definitions of macros ROOTDEV, KEYBOARD,
|
|
MATH_EMULATION, RAMDISK and SVGA_MODE before you run make. They are
|
|
explained in the Makefile. MATH_EMULATION does not hurt much even if
|
|
you have an FPU (387 or a 486 with a built in FPU), since Linux uses
|
|
the FPU if it finds one, even with MATH_EMULATION defined. The kernel
|
|
will be slightly bigger. It is probably not worth it to recompile the
|
|
kernel just to get rid of the emulation.
|
|
|
|
2. Create a symlink:
|
|
|
|
ln -s /usr/src/linux/include/linux /usr/include/linux
|
|
|
|
This is required so that tools/build.c will compile and link (it
|
|
requires the standard versions of headers instead of the kernel specific
|
|
headers, as it is a normal application, not kernel code).
|
|
|
|
[ Linus's note: I don't think this is required any more, but it's still
|
|
default installation procedure, and is needed for things like the mkfs
|
|
sources anyway ]
|
|
|
|
* Things you may want to get rid of
|
|
|
|
3. To remove SCSI drivers, do this:
|
|
|
|
- remove kernel/blk_drv/scsi/scsi.a from DRIVERS in the Makefile
|
|
- remove the commands for the subdirs dependency in
|
|
kernel/blk_drv/Makefile
|
|
- add "#undef CONFIG_SCSI" to the end of include/linux/config.h
|
|
|
|
The SCSI drivers take a bit of memory, and also slow the bootup a bit,
|
|
so you may want to get rid of them if you don't have an SCSI drive.
|
|
|
|
4. The kernel contains code for the extended filesystem (extfs) and MS-DOS
|
|
filesystem (dosfs), both of which are in testing phases and are not
|
|
recommended for real use yet. If you don't want to include these in the
|
|
kernel, do the following:
|
|
|
|
- remove references to these in the FILESYSTEMS macro in the
|
|
root Makefile
|
|
- remove directory names from the SUBDIRS macro in fs/Makefile
|
|
- remove the corresponding lines in the initialization of
|
|
file_systems in fs/super.c.
|
|
|
|
5. To configure more ptys do this:
|
|
- change NR_PTYS in include/linux/tty.h to the number you want
|
|
- create the new files in /dev
|
|
- recompile the kernel
|
|
|
|
|
|
* Running make
|
|
|
|
Unless you know what you're doing, don't ever run the makefiles in
|
|
subdirectories by hand. There is a bit of interaction between the
|
|
various makefiles, e.g. in the form of inherited macros and the like.
|
|
|
|
The following targets all apply for the makefile at the root of the
|
|
kernel source tree.
|
|
|
|
"make" or "make all" compiles everything.
|
|
|
|
"make Image" is like "make all", but it doesn't bump the number in
|
|
.version, which tells how many times this version has been compiled
|
|
(helps you differentiate between different configurations etc).
|
|
|
|
"make disk" is like "make Image", but it additionally writes out a copy
|
|
of the boot image to a floppy in your first floppy drive (/dev/fd0;
|
|
change the filename if you want a different floppy). You need to have
|
|
a formatted, overwritable floppy in that drive when it is time to do the
|
|
copy. This requires dd.
|
|
|
|
"make dep" updates all dependencies. This requires sed. It modifies
|
|
the makefiles directly (the end of them, starting at the ###Dependencies
|
|
-line at the end).
|
|
|
|
"make clean" will remove all object files and other files created by the
|
|
compilation. This requires basename.
|
|
|
|
You may wish to redirect compiler error messages to a file so that you
|
|
can review them later and to ease problem fixing. You can do this with
|
|
Bash with:
|
|
|
|
make something 2>&1 | tee make.out
|
|
|
|
The tee part is so that you can check what is going on while the
|
|
compilation runs. If you have GNU emacs and use M-x compile you don't
|
|
need this, of course.
|
|
|
|
Lars Wirzeniu
|