Skip to content

Commit

Permalink
[PATCH] Linux-0.95 (March 8, 1992)
Browse files Browse the repository at this point in the history
This was the first kernel that got released under the GPL (0.12 had a
time-lapse to make sure the people involved accepted the license change:
nobody ever complained).

Because 0.12 had been so successful, this was supposed to be closer to
1.0.  Yeah, right.  1.0 was eventually released almost exactly two years
later..

The big change here is the first signs of a real VFS layer: while the
only available filesystem is still the Minix-compatible one, the code is
factored out, and the Minix-specific stuff is put in its own directory.
You can clearly see how the thing is moving towards having multiple
different filesystems.

The VFS changes also cause cleanups in various drivers, since we end
up having more clear inode operation structure pointer handling.

Superblock handling is still minix-specific..

NOTE! We also have /bin/init finally.  It still falls through to the old
"run shells forever" case if no init can be found, but it's starting to
look a whole more like real UNIX user-land now..

New developers: Ross Biro shows up, and does ptrace.  He will later end
up doing the first-generation networking code.

Other changes:

 - UK and Danish keyboard maps (and the keyboard driver supported
   "Application mode" keys from vt100+)
 - Make sure interrupts clear the 'D'irection flag
 - Floppy driver gets track buffer, which speeds it up immensely.  This
   was done based on patches by Lawrence Foard (entropy@wintermute.wpi.edu)
 - Lots of buffer cache cleanups.
 - support nonblocking pipe file descriptors
 - recursive symlink support
 - sys_swapon() means that we don't have to select the swap device
   at build (or boot) time ("Written 01/25/92 by Simmule Turner, heavily
   changed by Linus")
 - start some generic timer work (ugh, but these first timers were
   _horrible_ hardcoded things)
 - ptrace for debugging
 - console size query support with TIOC[G|S]WINSZ
 - /dev/kmem ("by Damiano")
 - rebooting (with ctrl-alt-del or sys_reboot()).

From the release notes:

              New features of 0.95, in order of appearance
                      (ie in the order you see them)

      Init/login

Yeah, thanks to poe (Peter Orbaeck (sp?)), linux now boots up like a
real unix with a login-prompt.  Login as root (no passwd), and change
your /etc/passwd to your hearts delight (and add other logins in
/etc/inittab etc).

      Bash is even bigger

It's really a bummer to boot up from floppies: bash takes a long time to
load.  Bash is also now so big that I couldn't fit compress and tar onto
the root-floppy: You'll probably want the old rootimage-0.12 just in
order to get tar+compress onto your harddisk.  If anybody has pointers
to a simple shell that is freely distributable, it might be a good idea
to use that for the root-diskette.

Especially with a small buffer-cache, things aren't fun. Don't worry:
linux runs much better on a harddisk.

      Virtual consoles on any (?) hardware.

You can select one of several consoles by pressing the left alt-key and
a function key at the same time. Linux should report the number of
virtual consoles available upon bootup. /dev/tty0 is now "the current"
screen, /dev/tty1 is the main console, and /dev/tty2-8 can exist
depending on your text-mode or card.

The virtual consoles also have some new screen-handling commands: they
confirm even better to vt200 control codes than 0.11. Special graphic
characters etc: you can well use them as terminals to VMS (although
that's a shameful waste of resources), and the PF1-4 keys work somewhat
in the application-key mode.

      Symbolic links.

0.95 now allows symlinks to point to other symlinks etc (the maximum
depth is a rather arbitrary 5 links). 0.12 didn't like more than one
level of indirection.

      Virtual memory.

VM under 0.95 should be better than under 0.12: no more lockups (as far
as I have seen), and you can now swap to the filesystem as well as to a
special partition. There are two programs to handle this: mkswap to set
up a swap-file/partition and swapon to start up swapping.

mkswap needs either a partition or a file that already exists to make a
swap-area. To make a swap-file, do this:

      # dd bs=1024 count=NN if=/dev/hda of=swapfile
      # mkswap swapfile NN

The first command just makes a file that is NN blocks long (initializing
it from /dev/hda, but that could be anything). The second command then
writes the necessary setup-info into the file. To start swapping, write

      # swapon swapfile

NOTE! 'dd' isn't on the rootdisk: you have to install some things onto
the harddisk before you can get up and running.

NOTE2! When linux runs totally out of virtual memory, things slow down
dramatically. It tries to keep on running as long as it can, but at
least it shouldn't lock up any more. ^C should work, although you might
have to wait a while for it..

      Faster floppies

Ok, you don't notice this much when booting up from a floppy: bash has
grown, so it takes longer to load, and the optimizations work mostly
with sequential accesses.  When you start un-taring floppies to get the
programs onto your harddisk, you'll notice that it's much faster now.
That should be about the only use for floppies under a unix: nobody in
their right mind uses floppies as filesystems.

      Better FS-independence

Hopefully you'll never even notice this, but the filesystem has been
partly rewritten to make it less minix-fs-specific. I haven't
implemented all the VFS-patches I got, so it's still not ready, but it's
getting there, slowly.

      And that's it, I think.

Happy hacking.

                      Linus (torvalds@kruuna.helsinki.fi)
  • Loading branch information
linus1 committed Nov 23, 2007
1 parent 9d4ad8b commit 6d68f3b
Show file tree
Hide file tree
Showing 90 changed files with 4,503 additions and 2,858 deletions.
34 changes: 18 additions & 16 deletions Makefile
Expand Up @@ -2,31 +2,30 @@
# if you want the ram-disk device, define this to be the
# size in blocks.
#
RAMDISK = #-DRAMDISK=512
#RAMDISK = -DRAMDISK=512

AS86 =as86 -0 -a
LD86 =ld86 -0

AS =gas
LD =gld
AS =as
LD =ld
LDFLAGS =-s -x -M
CC =gcc $(RAMDISK)
CFLAGS =-Wall -O -fstrength-reduce -fomit-frame-pointer \
-fcombine-regs -mstring-insns
CFLAGS =-Wall -O -fstrength-reduce -fomit-frame-pointer
CPP =cpp -nostdinc -Iinclude

#
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, /dev/xxxx or empty, in which case the
# default of /dev/hd6 is used by 'build'.
# default of FLOPPY is used by 'build'.
#
ROOT_DEV=/dev/hd6
SWAP_DEV=/dev/hd2
ROOT_DEV=/dev/hdb1

ARCHIVES=kernel/kernel.o mm/mm.o fs/fs.o
DRIVERS =kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a
MATH =kernel/math/math.a
LIBS =lib/lib.a
ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o
FILESYSTEMS =fs/minix/minix.o
DRIVERS =kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a
MATH =kernel/math/math.a
LIBS =lib/lib.a

.c.s:
$(CC) $(CFLAGS) \
Expand All @@ -40,8 +39,7 @@ LIBS =lib/lib.a
all: Image

Image: boot/bootsect boot/setup tools/system tools/build
tools/build boot/bootsect boot/setup tools/system $(ROOT_DEV) \
$(SWAP_DEV) > Image
tools/build boot/bootsect boot/setup tools/system $(ROOT_DEV) > Image
sync

disk: Image
Expand All @@ -54,9 +52,10 @@ tools/build: tools/build.c
boot/head.o: boot/head.s

tools/system: boot/head.o init/main.o \
$(ARCHIVES) $(DRIVERS) $(MATH) $(LIBS)
$(ARCHIVES) $(FILESYSTEMS) $(DRIVERS) $(MATH) $(LIBS)
$(LD) $(LDFLAGS) boot/head.o init/main.o \
$(ARCHIVES) \
$(FILESYSTEMS) \
$(DRIVERS) \
$(MATH) \
$(LIBS) \
Expand All @@ -80,6 +79,9 @@ mm/mm.o:
fs/fs.o:
(cd fs; make)

fs/minix/minix.o:
(cd fs/minix; make)

lib/lib.a:
(cd lib; make)

Expand All @@ -99,7 +101,7 @@ boot/bootsect: boot/bootsect.s

clean:
rm -f Image System.map tmp_make core boot/bootsect boot/setup \
boot/bootsect.s boot/setup.s
boot/bootsect.s boot/setup.s init/main.s
rm -f init/*.o tools/system tools/build boot/*.o
(cd mm;make clean)
(cd fs;make clean)
Expand Down
2 changes: 1 addition & 1 deletion boot/bootsect.S
Expand Up @@ -53,6 +53,7 @@ start:
mov cx,#256
sub si,si
sub di,di
cld
rep
movw
jmpi go,INITSEG
Expand Down Expand Up @@ -83,7 +84,6 @@ go: mov ax,cs
* fs = 0, gs = parameter table segment
*/


push #0
pop fs
mov bx,#0x78 ! fs:bx is parameter table address
Expand Down
53 changes: 43 additions & 10 deletions boot/head.s
Expand Up @@ -12,9 +12,10 @@
* the page directory.
*/
.text
.globl _idt,_gdt,_pg_dir,_tmp_floppy_area
.globl _idt,_gdt,_pg_dir,_tmp_floppy_area,_floppy_track_buffer
_pg_dir:
startup_32:
cld
movl $0x10,%eax
mov %ax,%ds
mov %ax,%es
Expand All @@ -34,17 +35,39 @@ startup_32:
movl %eax,0x000000 # loop forever if it isn't
cmpl %eax,0x100000
je 1b
/* check if it is 486 or 386. */
movl %esp,%edi # save stack pointer
andl $0xfffffffc,%esp # align stack to avoid AC fault
pushfl # push EFLAGS
popl %eax # get EFLAGS
movl %eax,%ecx # save original EFLAGS
xorl $0x40000,%eax # flip AC bit in EFLAGS
pushl %eax # copy to EFLAGS
popfl # set EFLAGS
pushfl # get new EFLAGS
popl %eax # put it in eax
xorl %ecx,%eax # check if AC bit is changed. zero is 486.
jz 1f # 486
pushl %ecx # restore original EFLAGS
popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 386
andl $0x80000011,%eax # Save PG,PE,ET
orl $2,%eax # set MP
jmp 2f
/*
* NOTE! 486 should set bit 16, to check for write-protect in supervisor
* mode. Then it would be unnecessary with the "verify_area()"-calls.
* 486 users probably want to set the NE (#5) bit also, so as to use
* int 16 for math errors.
*/
movl %cr0,%eax # check math chip
1: pushl %ecx # restore original EFLAGS
popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 486
andl $0x80000011,%eax # Save PG,PE,ET
/* "orl $0x10020,%eax" here for 486 might be good */
orl $2,%eax # set MP
movl %eax,%cr0
orl $0x10022,%eax # set NE and MP
2: movl %eax,%cr0
call check_x87
jmp after_page_tables

Expand All @@ -55,8 +78,8 @@ check_x87:
fninit
fstsw %ax
cmpb $0,%al
je 1f /* no coprocessor: have to set bits */
movl %cr0,%eax
je 1f
movl %cr0,%eax /* no coprocessor: have to set bits */
xorl $6,%eax /* reset MP, set EM */
movl %eax,%cr0
ret
Expand Down Expand Up @@ -131,14 +154,22 @@ pg3:
*/
_tmp_floppy_area:
.fill 1024,1,0
/*
* floppy_track_buffer is used to buffer one track of floppy data: it
* has to be separate from the tmp_floppy area, as otherwise a single-
* sector read/write can mess it up. It can contain one full track of
* data (18*2*512 bytes).
*/
_floppy_track_buffer:
.fill 512*2*18,1,0

after_page_tables:
call setup_paging
pushl $0 # These are the parameters to main :-)
pushl $0
pushl $0
pushl $L6 # return address for main, if it decides to.
pushl $_main
jmp setup_paging
cld # gcc2 wants the direction flag cleared at all times
call _start_kernel
L6:
jmp L6 # main should never return here, but
# just in case, we know what happens.
Expand All @@ -148,6 +179,7 @@ int_msg:
.asciz "Unknown interrupt\n\r"
.align 2
ignore_int:
cld
pushl %eax
pushl %ecx
pushl %edx
Expand Down Expand Up @@ -210,6 +242,7 @@ setup_paging:
1: stosl /* fill pages backwards - more efficient :-) */
subl $0x1000,%eax
jge 1b
cld
xorl %eax,%eax /* pg_dir is at 0x0000 */
movl %eax,%cr3 /* cr3 - page directory start */
movl %cr0,%eax
Expand Down
13 changes: 11 additions & 2 deletions boot/setup.S
Expand Up @@ -77,6 +77,7 @@ novga: mov [14],ax
mov es,ax
mov di,#0x0080
mov cx,#0x10
cld
rep
movsb

Expand All @@ -89,6 +90,7 @@ novga: mov [14],ax
mov es,ax
mov di,#0x0090
mov cx,#0x10
cld
rep
movsb

Expand All @@ -106,6 +108,7 @@ no_disk1:
mov di,#0x0090
mov cx,#0x10
mov ax,#0x00
cld
rep
stosb
is_disk1:
Expand Down Expand Up @@ -220,6 +223,10 @@ chsvga: cld
mov es,ax
lea si,msg1
call prtstr
flush: in al,#0x60 ! Flush the keyboard buffer
cmp al,#0x82
jb nokey
jmp flush
nokey: in al,#0x60
cmp al,#0x82
jb nokey
Expand All @@ -230,7 +237,8 @@ nokey: in al,#0x60
mov ax,#0x5019
pop ds
ret
svga: lea si,idati ! Check ATI 'clues'
svga: cld
lea si,idati ! Check ATI 'clues'
mov di,#0x31
mov cx,#0x09
repe
Expand Down Expand Up @@ -354,7 +362,8 @@ l1: inc si
lea di,mogenoa
lea cx,selmod
jmp cx
nogen: lea si,idparadise ! Check Paradise 'clues'
nogen: cld
lea si,idparadise ! Check Paradise 'clues'
mov di,#0x7d
mov cx,#0x04
repe
Expand Down
55 changes: 22 additions & 33 deletions fs/Makefile
@@ -1,9 +1,9 @@
AR =gar
AS =gas
AR =ar
AS =as
CC =gcc
LD =gld
CFLAGS =-Wall -O -fstrength-reduce -fcombine-regs -fomit-frame-pointer \
-fno-defer-pop -mstring-insns -nostdinc -I../include
LD =ld
CFLAGS =-Wall -O -fstrength-reduce -fomit-frame-pointer \
-fno-defer-pop -nostdinc -I../include
CPP =gcc -E -nostdinc -I../include

.c.s:
Expand All @@ -16,27 +16,24 @@ CPP =gcc -E -nostdinc -I../include
$(AS) -o $*.o $<

OBJS= open.o read_write.o inode.o file_table.o buffer.o super.o \
block_dev.o char_dev.o file_dev.o stat.o exec.o pipe.o namei.o \
bitmap.o fcntl.o ioctl.o truncate.o select.o
block_dev.o char_dev.o stat.o exec.o pipe.o namei.o \
fcntl.o ioctl.o select.o

fs.o: $(OBJS)
$(LD) -r -o fs.o $(OBJS)

clean:
rm -f core *.o *.a tmp_make
for i in *.c;do rm -f `basename $$i .c`.s;done
cd minix; make clean

dep:
sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
(for i in *.c;do $(CPP) -M $$i;done) >> tmp_make
cp tmp_make Makefile
cd minix; make dep

### Dependencies:
bitmap.o : bitmap.c ../include/string.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h
block_dev.o : block_dev.c ../include/errno.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
Expand Down Expand Up @@ -65,17 +62,13 @@ fcntl.o : fcntl.c ../include/string.h ../include/errno.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/asm/segment.h \
../include/fcntl.h ../include/sys/stat.h
file_dev.o : file_dev.c ../include/errno.h ../include/fcntl.h \
../include/sys/types.h ../include/linux/sched.h ../include/linux/head.h \
../include/linux/fs.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/asm/segment.h
file_table.o : file_table.c ../include/linux/fs.h ../include/sys/types.h
inode.o : inode.c ../include/string.h ../include/sys/stat.h \
../include/sys/types.h ../include/linux/sched.h ../include/linux/head.h \
../include/linux/fs.h ../include/linux/mm.h ../include/linux/kernel.h \
../include/signal.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/asm/system.h
../include/time.h ../include/sys/resource.h ../include/linux/minix_fs.h \
../include/asm/system.h
ioctl.o : ioctl.c ../include/string.h ../include/errno.h \
../include/sys/stat.h ../include/sys/types.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h \
Expand All @@ -85,20 +78,21 @@ namei.o : namei.c ../include/linux/sched.h ../include/linux/head.h \
../include/linux/fs.h ../include/sys/types.h ../include/linux/mm.h \
../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/segment.h ../include/string.h ../include/fcntl.h \
../include/errno.h ../include/const.h ../include/sys/stat.h
../include/linux/minix_fs.h ../include/asm/segment.h ../include/string.h \
../include/fcntl.h ../include/errno.h ../include/const.h \
../include/sys/stat.h
open.o : open.c ../include/string.h ../include/errno.h ../include/fcntl.h \
../include/sys/types.h ../include/utime.h ../include/sys/stat.h \
../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h ../include/linux/tty.h ../include/termios.h \
../include/asm/segment.h
../include/sys/resource.h ../include/asm/segment.h
pipe.o : pipe.c ../include/signal.h ../include/sys/types.h \
../include/errno.h ../include/termios.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h \
../include/linux/kernel.h ../include/sys/param.h ../include/sys/time.h \
../include/time.h ../include/sys/resource.h ../include/asm/segment.h
../include/errno.h ../include/termios.h ../include/fcntl.h \
../include/linux/sched.h ../include/linux/head.h ../include/linux/fs.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/asm/segment.h
read_write.o : read_write.c ../include/sys/stat.h ../include/sys/types.h \
../include/errno.h ../include/linux/kernel.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/linux/mm.h \
Expand All @@ -120,10 +114,5 @@ super.o : super.c ../include/linux/config.h ../include/linux/sched.h \
../include/linux/head.h ../include/linux/fs.h ../include/sys/types.h \
../include/linux/mm.h ../include/linux/kernel.h ../include/signal.h \
../include/sys/param.h ../include/sys/time.h ../include/time.h \
../include/sys/resource.h ../include/asm/system.h ../include/errno.h \
../include/sys/stat.h
truncate.o : truncate.c ../include/linux/sched.h ../include/linux/head.h \
../include/linux/fs.h ../include/sys/types.h ../include/linux/mm.h \
../include/linux/kernel.h ../include/signal.h ../include/sys/param.h \
../include/sys/time.h ../include/time.h ../include/sys/resource.h \
../include/sys/stat.h
../include/sys/resource.h ../include/linux/minix_fs.h \
../include/asm/system.h ../include/errno.h ../include/sys/stat.h

0 comments on commit 6d68f3b

Please sign in to comment.