Skip to content

Commit

Permalink
[PATCH] Linux-0.97.3 (September 5, 1992)
Browse files Browse the repository at this point in the history
Hey, we switched to the GPL several months ago, but only now do we
include the license text itself.  Apparently everybody expected
everybody else to just know what the GPL was..

Add a README on compiling the kernel (by Lasu)

Add PS/2 mouse driver, make generic "mouse" infrastructure.

Add /proc filesystem, clean up minixfs block mapping.

sys_wait4() and swapoff().

VM gets a "secondary page free" list for things like interrupts
that want a page _now_ and can't wait for the regular free list
to fill up.

[Original announcement below]

Patch3 is almost 100kB even compressed, as there were quite big changes
in the mm and minix fs.  No major new features: there are two new system
calls: swapoff(const char * swapfile) and wait4(), and linux accepts
several swap-files, but the rest of the thing is mostly bug-fixes or
simply rewrites.

Major changes:
 - new swap-page handling: linux no longer uses just one bit to keep
   track of used swap-space, but a counter for each swap-page.  This
   allows processes to share swap-pages after a fork(), and should
   result in /major/ performance increases on machines with less memory.
   I've seen better performance even with 8MB - I wouldn't be surprised
   if 4MB machines would re-compile the kernel noticeably faster under
   pl3.  I'd be interested to hear numbers.
 - The low 1MB memory that isn't used directly by the kernel is now
   swappable memory, instead of being hardcoded for buffer cache.  The
   patches for this were originally by tytso, and I expanded on it a bit
   more.  This might also help better performance on 2-4MB machines.
   Note that this does /not/ mean that you can use 1M machines for
   linux: linux still needs some extended memory.
 - the dosfs has been upgraded to dosfs.8 - patches by almesber.
 - I edited the minix fs pretty heavily to remove a couple of race-
   conditions.  The same races still exist in the extended fs, as I
   didn't have time to edit that yet.  The minix-fs took precedence as I
   know that better, and extfs isn't "official" yet anyway.

other changes:

 - the mouse-driver now handles both Logitech (minor = 0) and PS/2
   (minor = 1) busmice.
 - there is a proc-fs for access to user memory/files etc.
 - better support for the tcp/ip patches (but see below...)
 - corrected symlink and /dev/[k]mem behaviour
 - Lars Wirzenius' README (with minimal comments by me) and the GNU
   COPYING notice are now part of the normal kernel setup, and can be
   found in the tar-archive.
 - the floppy ioctl() to get the FD parameters no longer requires root
   priviledges.  Thus, the msdos emulator runs even for a normal user.

Some comments on patchlevel 3:

        mm:

The swap-page handling resulted in a reduction of swap-file (or
partition) size to a maximum of 16MB per file.  It's nothing inherent to
the code, but it eased some algorithms, so I didn't bother coding around
it.  After all, 16MB is enough for most people, and if you want more,
you can have up to 128 swapfiles of 16MB each.  If I get enough
hate-mail about it, I might just try to find the energy to correct it.
Maybe.

Bigger swapfiles will still work, but linux will take advantage of only
the low 16MB.  Also, there is no nifty logic to try to optimize the
usage of the swap-files: pages are simply allocated from one swap-file
until it fills up, and then the next swap-file is used.

The memory management changes break ps/free once more, but not very
much.  Also, I changed the load-average counting, so 'w' also needs
slight editing.  On the other hand, I made '/dev/kmem' mmap()able, and
'ps' and 'free' should be edited to take advantage of that: it should
result in much faster operation, as well as possibly using less real
memory.

        fs:

The fs changes should remove at least two races - the races don't happen
very often, but they were theoretically possible, and might be the
reason for some fs corruption problems that have been reported.  The
changes are related to the use of bmap() - the bmap interface doesn't
really lend itself to some things that it was used for.  Re-writing
internal fs-functions not to use bmap not only should have removed any
races, but also actually resulted in cleaner code.

The proc-fs code isn't too beautiful, and I'll probably leave it out
from 0.98 unless I can make it loadable.  We'll see.  If anybody wants
to use it, you can do something like

  # mount -t proc /dev/ram /proc

Instead of /dev/ram you can use any block device - it's not used, and is
only a dummy as the proc-fs doesn't actually use any external device.
(but note that the device is still marked as mounted, so you cannot
mount it for anything else).

        kernel/mm/lib:

The TCP/IP patches are also essentially in 0.97.pl3 - not the full
TCP/IP directory, only the patches to the main kernel.  NOTE!! I don't
like the 'grab_malloc_pages()' function, so I left that out, and added a
GFP_ATOMIC priority to get_free_page() that should be used instead.  I
hope this will be used (Ross?), as it's a lot cleaner.

Also, I hope the tcp/ip people will clean up malloc() so that it doesn't
panic instead of returning NULL etc.  Ugly, ugly.  This is related to
the get_free_page(GFP_ATOMIC) changes, and I'd like to have patches as
soon as possible - tcp/ip won't be part of the standard kernel until
that can be cleaned up.

                Linus
  • Loading branch information
Linus Torvalds committed Nov 23, 2007
1 parent eb79918 commit fdb2f0a
Show file tree
Hide file tree
Showing 72 changed files with 3,570 additions and 1,064 deletions.
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

29 changes: 22 additions & 7 deletions Makefile
Expand Up @@ -84,7 +84,7 @@ CPP =$(CC) -E
AR =ar

ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o net/net.o
FILESYSTEMS =fs/minix/minix.o fs/ext/ext.o fs/msdos/msdos.o
FILESYSTEMS =fs/minix/minix.o fs/ext/ext.o fs/msdos/msdos.o fs/proc/proc.o
DRIVERS =kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a \
kernel/blk_drv/scsi/scsi.a
MATH =kernel/math/math.a
Expand All @@ -102,14 +102,21 @@ KERNELHDRS =/usr/src/linux/include

all: Version Image

lilo: Image
if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi
dd if=Image of=/vmlinux
/etc/lilo/lilo -b /dev/hda /vmlinux

linuxsubdirs: dummy
@for i in $(SUBDIRS); do (cd $$i && echo $$i && $(MAKE)) || exit; done

Version:
@./makever.sh
@echo \#define UTS_RELEASE \"0.97.pl2-`cat .version`\" > include/linux/config_rel.h
@echo \#define UTS_VERSION \"`date +%D`\" > include/linux/config_ver.h
touch include/linux/config.h
@echo \#define UTS_RELEASE \"0.97.pl3-`cat .version`\" > tools/version.h
@echo \#define UTS_VERSION \"`date +%D`\" >> tools/version.h
@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h
@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h
@echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h

Image: boot/bootsect boot/setup tools/system tools/build
cp tools/system system.tmp
Expand All @@ -127,11 +134,13 @@ tools/build: tools/build.c

boot/head.o: boot/head.s

tools/version.o: tools/version.c tools/version.h

init/main.o: init/main.c
$(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<

tools/system: boot/head.o init/main.o linuxsubdirs
$(LD) $(LDFLAGS) -M boot/head.o init/main.o \
tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs
$(LD) $(LDFLAGS) -M boot/head.o init/main.o tools/version.o \
$(ARCHIVES) \
$(FILESYSTEMS) \
$(DRIVERS) \
Expand All @@ -156,10 +165,16 @@ boot/bootsect: boot/bootsect.s
fs: dummy
$(MAKE) linuxsubdirs SUBDIRS=fs

mm: dummy
$(MAKE) linuxsubdirs SUBDIRS=mm

kernel: dummy
$(MAKE) linuxsubdirs SUBDIRS=kernel

clean:
rm -f Image System.map tmp_make core boot/bootsect boot/setup \
boot/bootsect.s boot/setup.s init/main.s
rm -f init/*.o tools/system tools/build boot/*.o
rm -f init/*.o tools/system tools/build boot/*.o tools/*.o
for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean); done

backup: clean
Expand Down
121 changes: 121 additions & 0 deletions README
@@ -0,0 +1,121 @@

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.

[ Linus' note1: if you have a correctly installed gcc-2.2.2d, you can
also remove the "-nostdinc -I$(KERNELHDRS)" thing from the main
Makefile CC definition. But it doesn't hurt to have it, as long as
KERNELHDRS is correctly defined ]

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' note2: This is automatically done by the gcc-2.2.2d
installation script, so if you have the new compiler, you should
already have this link ]

* 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),
MS-DOS filesystem (dosfs) and proc-fs (proc), all 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

[ Linus' note3: if you have problems with make not working correctly,
get a new copy of GNU make. pmake may or may not work due to the
macro inheritation assumptions etc ]

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
34 changes: 34 additions & 0 deletions boot/setup.S
Expand Up @@ -120,6 +120,40 @@ no_disk1:
stosb
is_disk1:

! check for PS/2 pointing device

mov ax,#INITSEG
mov ds,ax
mov [0x1ff],#0 ! default is no pointing device
int 0x11 ! int 0x11: equipment determination
test al,#0x04 ! check if pointing device installed
jz no_psmouse
mov ax,#0xc201 ! reset pointing device
int 0x15
jc no_psmouse
mov bh,#0x03 ! 3 bytes/packet
mov ax,#0xc205 ! initialize pointing device
int 0x15
jc no_psmouse
mov ax,#0xc203 ! set resolution
mov bh,#0x03 ! 8 counts/mm
int 0x15
jc no_psmouse
mov ax,#0xc206 ! set scaling
mov bh,0x02 ! 2:1 scaling
int 0x15
jc no_psmouse
mov ax,#0xc202 ! set sample rate
mov bh,#0x05 ! 100 reports per second
int 0x15
jc no_psmouse
mov bh,#0x01
mov ax,#0xc200 ! enable pointing device
int 0x15
jc no_psmouse
mov [0x1ff],#0xaa ! device present
no_psmouse:

! now we want to move to protected mode ...

cli ! no interrupts allowed !
Expand Down
2 changes: 1 addition & 1 deletion fs/Makefile
Expand Up @@ -7,7 +7,7 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...

SUBDIRS =minix ext msdos
SUBDIRS =minix ext msdos proc

.c.s:
$(CC) $(CFLAGS) -S $<
Expand Down
72 changes: 27 additions & 45 deletions fs/buffer.c
Expand Up @@ -497,10 +497,15 @@ void grow_buffers(int size)
}
tmp = bh;
while (1) {
tmp->b_next_free = free_list;
tmp->b_prev_free = free_list->b_prev_free;
free_list->b_prev_free->b_next_free = tmp;
free_list->b_prev_free = tmp;
if (free_list) {
tmp->b_next_free = free_list;
tmp->b_prev_free = free_list->b_prev_free;
free_list->b_prev_free->b_next_free = tmp;
free_list->b_prev_free = tmp;
} else {
tmp->b_prev_free = tmp;
tmp->b_next_free = tmp;
}
free_list = tmp;
++nr_buffers;
if (tmp->b_this_page)
Expand Down Expand Up @@ -558,23 +563,26 @@ static int try_to_free(struct buffer_head * bh)
* Try to free up some pages by shrinking the buffer-cache
*
* Priority tells the routine how hard to try to shrink the
* buffers: 0 means "don't bother too much", while a value
* of 3 means "we'd better get some free pages now".
* buffers: 3 means "don't bother too much", while a value
* of 0 means "we'd better get some free pages now".
*/
int shrink_buffers(unsigned int priority)
{
struct buffer_head *bh;
int i;

if (priority > 2) {
priority = 3;
if (priority < 2)
sync_buffers(0);
}
bh = free_list;
i = nr_buffers >> (3-priority);
i = nr_buffers >> priority;
for ( ; i-- > 0 ; bh = bh->b_next_free) {
if (bh->b_lock || bh->b_count || !bh->b_this_page)
if (bh->b_count || !bh->b_this_page)
continue;
if (bh->b_lock)
if (priority)
continue;
else
wait_on_buffer(bh);
if (bh->b_dirt) {
ll_rw_block(WRITEA,bh);
continue;
Expand All @@ -586,47 +594,21 @@ int shrink_buffers(unsigned int priority)
}

/*
* This initializes the low 1M that isn't used by the kernel to buffer
* cache. It should really be used for paging memory, but it takes a lot
* of special-casing, which I don't want to do.
*
* The biggest problem with this approach is that all low-mem buffers
* have a fixed size of 1024 chars: not good if/when the other sizes
* are implemented.
* This initializes the initial buffer free list. nr_buffers is set
* to one less the actual number of buffers, as a sop to backwards
* compatibility --- the old code did this (I think unintentionally,
* but I'm not sure), and programs in the ps package expect it.
* - TYT 8/30/92
*/
void buffer_init(void)
{
struct buffer_head * bh;
extern int end;
unsigned long mem;
int i;

for (i = 0 ; i < NR_HASH ; i++)
hash_table[i] = NULL;
mem = (unsigned long) & end;
mem += BLOCK_SIZE-1;
mem &= ~(BLOCK_SIZE-1);
free_list = get_unused_buffer_head();
free_list = 0;
grow_buffers(BLOCK_SIZE);
if (!free_list)
panic("unable to get a single buffer-head");
free_list->b_prev_free = free_list;
free_list->b_next_free = free_list;
free_list->b_data = (char *) mem;
free_list->b_size = BLOCK_SIZE;
mem += BLOCK_SIZE;
while (mem + 1024 < 0xA0000) {
bh = get_unused_buffer_head();
if (!bh)
break;
bh->b_data = (char *) mem;
bh->b_size = BLOCK_SIZE;
mem += BLOCK_SIZE;
bh->b_next_free = free_list;
bh->b_prev_free = free_list->b_prev_free;
free_list->b_prev_free->b_next_free = bh;
free_list->b_prev_free = bh;
free_list = bh;
++nr_buffers;
}
panic("Unable to initialize buffer free list!");
return;
}
6 changes: 4 additions & 2 deletions fs/exec.c
Expand Up @@ -80,8 +80,10 @@ int core_dump(long signr, struct pt_regs * regs)
if(current->rlim[RLIMIT_CORE].rlim_cur < PAGE_SIZE/1024) return 0;
__asm__("mov %%fs,%0":"=r" (fs));
__asm__("mov %0,%%fs"::"r" ((unsigned short) 0x10));
if (open_namei("core",O_CREAT | O_WRONLY | O_TRUNC,0600,&inode,NULL))
if (open_namei("core",O_CREAT | O_WRONLY | O_TRUNC,0600,&inode,NULL)) {
inode = NULL;
goto end_coredump;
}
if (!S_ISREG(inode->i_mode))
goto end_coredump;
if (!inode->i_op || !inode->i_op->default_file_ops)
Expand Down Expand Up @@ -415,7 +417,7 @@ int do_execve(unsigned long * eip,long tmp,char * filename,
retval = -EACCES;
goto exec_error2;
}
if (IS_NOEXEC(inode)) { /* FS mustn't be mounted noexec */
if (IS_NOEXEC(inode)) { /* FS mustn't be mounted noexec */
retval = -EPERM;
goto exec_error2;
}
Expand Down
4 changes: 2 additions & 2 deletions fs/ext/namei.c
Expand Up @@ -470,14 +470,14 @@ static int empty_dir(struct inode * inode)
if (inode->i_size < 2 * 12 || !inode->i_data[0] ||
!(bh=bread(inode->i_dev, inode->i_data[0], BLOCK_SIZE))) {
printk("warning - bad directory on dev %04x\n",inode->i_dev);
return 0;
return 1;
}
de = (struct ext_dir_entry *) bh->b_data;
de1 = (struct ext_dir_entry *) ((char *) de + de->rec_len);
if (de->inode != inode->i_ino || !de1->inode ||
strcmp(".",de->name) || strcmp("..",de1->name)) {
printk("warning - bad directory on dev %04x\n",inode->i_dev);
return 0;
return 1;
}
offset = de->rec_len + de1->rec_len;
de = (struct ext_dir_entry *) ((char *) de1 + de1->rec_len);
Expand Down

0 comments on commit fdb2f0a

Please sign in to comment.