Subject: Looking for a FAQ
Date: Fri, 8 Nov 1991 19:25:43 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>


Right ho, the subject says it all ... Linux could definitely do with a
FAQ (Frequently Asked Questions for all you who haven't been on the net
all your life :-). And as I'm sure anybody who has read my "help-files"
would agree, I'm not the best possible person to write it. Thus a new
project: getting a FAQ done with help from the linux-activists.

I've talked (yes, you can try to talk with me if I'm logged in) with
Robert Blum, and he's promised to help. Our idea was to get as many of
the linux users/would be users to ask questions they think ought to be
in the FAQ, and hopefully you could try to answer them too (and don't be
shy just because you aren't certain you get it right - I'll go through
the FAQ for techical soundness anyway, but your answers will make
editing much easier).

I'm especially interested in some tutorials/"true stories" from people
who installed linux without the help of minix. Not only will they help
make the FAQ, but I could try to make things easier for the next
version. The FAQ should also contain some pointer to what people are
doing, and what has been done (like init/login, the bison port, g++,
etc).

I guess the easiest way to organize this thing is to mail me with a
subject containing "FAQ". I'll then compile it to one big thing and
send it out to whoever wants to edit on it. If you want to be one of
the people working on it, please mail and say so. I'll be happier the
less I have to do with this thing :-), and even if you just think you
could try to check for things you find incomprehensible, mail me and
tell me you'd like to help with it. Alternatively, you can mail Robert
Blum (whom I happily let take over the main responsibility for this
thing if he wants it) at "blum@messua.informatik.rwth-aachen.de".

If you can get your grubby little hands on the minix FAQ, you could try
to make a skeleton one for linux, trying to answer the questions
yourself first, and adding/removing questions of your own. Also, please
resend the questions you've already asked (and hopefully got answered),
as I really cannot sift through all my mail looking for questions, and
rewriting the answers (my mailbox is about 400kB - most of it on linux).
Editing the whole thing would probably be easier if you did some
pre-editing yourself: trying to get the thing to look like part of a
FAQ.

After we have gotten something that looks like a real FAQ (possibly
divided it into several parts: one general FAQ, one on installation
etc), I (or Blum) will post it to the mailing-list and set it up for
ftp. It will take some time: waiting for questions, then editing them,
mailing the new versions to the persons interested in this project,
revising them again after comments ... But hopefully we'll have a
better FAQ after that. I hope enough people mail questions/interest,
that I personally can get on to write the system programs.

I'd suggest a simple form for all the questions/answers: Something that
can easily be (semi-)automatically edited into something more
appropriate:

<empty line>
QUESTION: Xxx xx x x x xxx xxx xx xxx?
<empty line>
ANSWER: try to have some kind of skeleton answer here.
<empty line>

If you honestly haven't got a clue about the answer, please still ask
the question - nobody will flame you (sure, sure).

                Linus (torvalds@kruuna.helsinki.fi)

PS. It seems most people who had problems have got it working now. To
summarize: It works on SX's and with only 2M of memory. It also "works"
with a monochrome card, but you won't be able to see anything. Mtools
doesn't understand DOS 5.0 (big partitions at least), but Linux seems to
boot ok anyway. Anybody who simply cannot get it to boot out there?

PPS. I wrote over my minix-partition yesterday (don't even ask why -
some things are better forgotten :-), and although I got minix-386 up
and running again, it's kind of limping now (no bash, no make). It seems
I'll have to write fdisk/mkfs/fsck for linux just so that I wouldn't
need minix any more. Something good came out of it.

PPPS. As there still isn't a fsck-program for linux, be very careful
about rebooting the computer without syncing. The buffer cache is /at
least/ 500kB, and 1.5M buffer-cache is normal for machines with more
memory, so if you don't sync, there could be A LOT of buffers that
aren't written out to disk.

Original post in KCLUG archives


Subject: Re: Looking for a FAQ
Date: Fri, 8 Nov 1991 15:43:20 -0500
From: tytso@Athena.MIT.EDU (Theodore Ts'o)

I, too, I have managed to bring up Linux without the need of Minux. I
have a 40 MhZ AMD 386 with a 200 Meg clone. A couple of notes:

N1) The Minix demo disk which you can get from plains.novak.edu only
works for 5.25" disks --- this isn't documented anywhere, but I spent a
lot of time trying to get it to boot on my 3.5" A drive. It would print
the first message about "loading Minix system", but it would hang before
printing the menu. I finally had to give up, recable my drives so that
my 5" drive was my A drive to get Minix to come up.

N2) The numbering convestion for partition in Minix and Linux are
different!!! The way I dealt with it is to use a disk editor to write a
message "This is the Linux parittion" in the first sector of the
partition, and then use "head -3 /dev/hd[014]" to find the right
partition number on both Minix and Linux.

N3) I have MS-DOS 5.0, and the mtools worked just fine on my hard disk.
All of my partitions are less than 32 MEG, so I'm still using the FAT-16
filesystem. It would be nice if Linux understood the DOS extended
partitions, though. This would allow mtools could read my other DOS
partitions. In addition, it would mean that I could use one of the DOS
extended partitions as Linux partitions, so I could avoid chewing up
the 4 primary partitions available on my 200 meg drive.

[ Note: whoever decided that IBM hard disks only needed 4 partitions
should be condemned to recabling machine room floors; CP/M on
Heath/Zenith machines had 8 partitions available, and much more friendly
tools to modify said table! ]

N4) I have also experienced the panic which Patrick L. McGillan has
described. I suspect DOS setting some cruft which isn't getting cleaned
up. The panic happens happens right after the "Loading system" and
before the system has a chance to print the "Partition tables ok" message.

N5) I have managed to build the Linux kernel under Linux, using the 16
bit binaries which Linus provided. One little gotcha is that it is
necessary to rename the binaries provided in gccbin.tar.Z to the names
which the Makefile is expecting. Other than that, though, things went
very smoothly.

N6) It wasn't obvious that the "em" program in utilbin.tar.Z was
actually MicroEmacs. I was really happy once I found it, though!
Perhaps there should be a quick note mentioning this fact somewhere. At
the moment, the programs which I seem to be missing the most are 1)
more, 2) gdb, and 3) fsck. The first should be a lot easier to get
working than the last. :-)

And now, for some questions:

Q1) On nic.funet.fi, I found sources to shoelace, which seems to be a
way to boot Minix without needing a floppy boot disk. Is anyone working
on something similar for Linux? The other interesting thing about
shoelace is that it came with a file "shoefsck.c" which seems to contain
the necessary code filesystem checking for Minix. However, there's no
copyright notice on that file, and no email address for the author,
either. Does anyone know what the status of that code is? I was
considering trying to use that code to make a fsck for Minix.

Q2) Similarily, there are sources on nic.funet.fi for a fsck program for
Minix. It looks like it was derived from the Minix fsck, but since it
is available for anonymous FTP with no notices saying "don't touch
this", I wonder if would be consider fair play to base a fsck for Linux
on the code, and either distribute the code or patches to the code with
a note that you can get the rest of the program from nic.funet.fi.

Q3) Linus, can you provide the configuration files for gcc and friends?
It would be interesting to see what's necessary to actually compile
one's own version of gcc/gas/etc.

Thanks to everyone on the list! I don't think I would have managed to
get Linux up and running with out a lot of helpful hints which were
posted on the list --- and I've only been on the list for a couple of
days!

                                                - Ted

Original post in KCLUG archives


Subject: Linux fsck.c V0.10
Date: Sun, 10 Nov 1991 12:07:44 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>

Ok, This is version 0.10 of the fsck program for linux. Everyone is
encouraged to use the (old) minix fsck program available on nic if they
want to, but as it isn't clear what the status of it is, I would rather
have one especially made for linux. This is it.

It's a fast hack (2 days), but it seems to work relatively well. It
doesn't repair a destroyed file-system, but it should tell you about
problems. Repair is on the way...

The reason I'm posting this is that I would like to get all the bugs
ironed out before it starts writing to a disk. Now it just reads, so
this version will not f**k anything up, even if it has bugs (and
hopefully there aren't any). Although it isn't commented, it might give
you an idea of what the file-system looks like.

This is NOT a standalone version to be used at bootup. It is meant to be
compiled and used under linux, on filesystems that aren't mounted. You
can use it on root, assuming there is nothing writing to the disk (and
this includes fsck itself: don't use "fsck -l rootdev > tmp" or
similar). This isn't recommended though (you might have two boot-disks,
one which boots from floppy just to use fsck on the normal
boot-partition).

                Linus
--------- snip snip -----------------------------------------
begin 644 fsck.c.Z
M'YV0+U0H *$"A)DY8]:X& .B!8@P!M.P*0-B3IXY=,JT 3'FC9LY:3"6<3,F
M#T<T91*6D6/P#4LF:=S4P>-BH$""(% ,20$B1HX<,4# E#D'!!67=L*P(3/'
MA5$T(2-.!-$FC$DQ%.64(1.2CIPT8NID)/.P*)R5-D'002DTYDR.;^#D^7H&
M#9V:!%\H4! P+8P<+F+$< $41$/#5<E07$O13!HY&$'(J<.U31DZ8>28-%.'
M))TT'N?83!L#1N#!A0^#J .'3)BQ+$"0>5.FZ!B4"6.>B>WFC>0R<,(\+IKG
M,EX5"1),&4D'Q!NQ:GTSIBJ<C>X6UB.;<:FV]F<W9XZG37+"#D4T8<CV5IO&
M<O2'9,AV;&/9#9VB#M'$+<.9#1N3TW'F&6AN@.!&&):)AE-F%,U7WWT@C/1<
M74X%4=0=::SUD']246212!O=EM(:*\T1VUI1A3''''4DF%: $GEX448;115'
M'6G4-@9SA\WFQ@G-U3$'11DZ5R!$;3QGWU:RE6%'&CNFU=E$*X*0QW,<A5$@
M5A75H96!;XCQ!ADF177'5]^=\5Z1*&A)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]SI7N1]N
MD-1PGD3,3.H_\ 1?( 5$< 52H /R3N\TQ019P)E.<+)RMJRCUYKOH>ZLWFXG
M$(I0>)DBGL(,EF-O\*H?KN$C^>OHD^C63=?Y1LL&)DCPUB'E*0+6-\NU+!N5
M_,8Y$O(CS_$QI#76!',@GW,K7_)IQ34[$O/Z-O,F!4DJGQPB0*I WP(R[_,L
M_\ A?]MHY_&9\7(G7ZTL\*=.<L,P@S)(S]A0K )N7*W)Q ([JA17G_5^]&RE
'?*HH(&<(!_&9
 
end

Original post in KCLUG archives


Subject: corrected buffer.c
Date: Tue, 12 Nov 1991 21:47:49 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>

Ok, here's the new buffer.c-file, hopefully correcting the bug which
caused file system inconsistencies.

NOTE! This file is NOT official, and won't be used as a starting point
for future kernel cdiffs. Thus save the old buffer.c before using this.
It's just a temporary bug fix before a real release (which should come
out in December). Hopefully these kind of rather urgent bug-fixes won't
be too usual.

The changes are mostly to "getblk()", and are not final: it's a bug-fix,
and I'll have to tweak it a bit more for the real version. The current
version works fine, but it's a bit overzealous in trying to avoid
reclaiming dirty blocks: with this kernel patch the buffer-cache VERY
easily fills up with dirty blocks, at the expense of ordinary ones.
Thus "sync"ing is even more important with this fix: the dirty blocks
are kept around longer (too long in my opinion) with this routine.

                Linus (torvalds@kruuna.helsinki.fi)

PS: Re: Math libraries. There aren't any. When I talk about gcc
soft-float, I'm just talking about the general idea - I haven't
implemented (or ported) any real math functions. The only floating
point math that gcc currently knows about is add/sub/neg/mul/div (and
only for doubles, not floats). Gcc in the original 1.40-version cannot
handle soft-floats correctly: linux gcc has this corrected (thanks
mainly to bruce evans), but not used very much.

There might be stubs for sin/ln etc in the library: they should just
return 0.0, and are there (if they are) to get gawk to compile (and yes,
it works - kind of). If you do find routines for floats you can use
(and they are available out there), you can add them to the library with
"gar d libc.a stubs.o" (remove old routines)
"gar rs libc.a sin.o ln.o ..."
------ snip snip ------------------------
begin 644 buffer.c.Z
M'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(!"
M89O_Y9D]"[Q;Q$5L(#^DI&C$.[-$$ 0UNT6>V8W?!HX^5)QF([G=XKR56SZS
M>IX FI[7-KXK&YE&&[2D6@:.NH$H8("'$ZIG]S$!10<H$"4O]3'=8HK_2G<H
MXD&JH7;#<[]G5S.6FANB8TG2Q7=O%@-G"6'O(P9(0SDAS&@V0 ,PH (Q ,R
M0 /E\Z%PH3<N+"\PC!<$\1$6S$SQB9SS&3<@T +R(@1,\ 1#L 1?, 5)H 5%
M\!'3>V:XMB^;@08KD)8? 8O0)WZO)'!E&3Q((V$)<&WRF\9#=&W?NF=F3#@"
M#'1J?&U5 WR\-\="UWPY XQ\O''BIL?"IS?0EQJ7 <23@1Q<+ 9O''J,MR(M
MP*>!O'ESX7Q?_,;%Z$//DT=&L\E2IL1O%L3Z\A'O=<,1%F%Q]L);;,IX$ 2I
M+&$ I#[T.V&?5W4<_$8?;,N7"7KA)WF17%UK[)R1+)U'5F$[<$*;-C%(D,P>
09L@(XXF+Y6,] (('E * ,N7
 
end

Original post in KCLUG archives


Subject: mtools, demand-loading, paging
Date: Thu, 14 Nov 1991 13:22:37 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>

Hi again. Several people have inquired about mtools. The sources I
used are available on nic.funet.fi: pub/unix/386ix/isc/source/mtools*.
I don't know if this is the most recent version. And no - linux
probably cannot read partitions >64MB. The reason is (partly) the minix
file system. See later.

Paging to disk has also come up: It will certainly be implemented (in
fact one of the bigger changes in the 0.10 fs was due to making ready
for this). There are no obvious problems with this, but unless somebody
else wants to try to implement it, it will take some time (I'm talking
March-92 at the earliest, probably not until summer). One of my problems
is (will be) lack of disk-space to try it out on.

As for demand-loaded executables... hmm. There are a couple of problems
with this: the minix filesystem wasn't meant for it, and it would be
MUCH easier to implement if BLOCK_SIZE was 4096 (= one page) instead of
the current 1024. This of course means waste of disk-space. The problem
with the minix filesystem isn't that serious: I'll have to move on to
something else anyway - 64M partitions can be limiting for those who have
disks big enough to hold them (and the afore-mentioned 64Mb limit even
for direct read/writes.. This I can try to do something about).

The more serious problem about demand-loading is that the fs isn't
really designed for it - I doubt the locking mechanism used currently
will suffice. If people would accept a non-locking demand-loading (ie
you could write to the file while it's in use etc...) I could possibly
try to implement it. Again - not until well into -92.

And a little small sad note: I know I said symlinks would probably be in
the next version, but unless I can get the higher priorities completed,
this will be left for later. The things now relatively certain (barring
acts of God etc) are: fsck, mkfs, badblocks, fdisk, non-VGA video and
finally the correction to the serial drivers to change speed by the
ioctl call. I'll look into extended partitions (fdisk will probably
report them), but I doubt they will be accepted by the kernel proper
until later.

                Linus

PS. I try to answer all mail as soon as I get it, but I get MUCH mail.
If you think the mailing-list has been active: think again :-). If you
don't hear from me, I've probably forgotten to answer at once, and once
your mail is in my mailbox, it's likely to be lost among the multitude.
Re-mail your question, and make me feel guilty about not replying the
first time: that's the ticket.

Original post in KCLUG archives


Subject: newest mkfs for linux
Date: Tue, 26 Nov 1991 05:22:04 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>

Ok, here's a mkfs for those that want to try it out. It works on my
system (limited testing), and hopefully we can get possible bugs ironed
out in time for 0.11 (and currently I'm hoping to release that December
8th or something).

This mkfs has two modes: checking and reckless. On a disk that you know
has no problems, you just write "mkfs /dev/hdx size", and you should
have a new system (DON'T do this on a mounted drive: unlike fsck there
is NO way that will work, and you'll probably mess it up completely.)

On a disk with possible read-errors, use "mkfs -c /dev/hdx size", which
will read all the blocks and mark those unreable into a special file
"/.badblocks". I'm not making any guarantees. This is a fast hack
(mainly yesterday and today), and I have tested only on small
filesystems, faking errors by telling mkfs that the filesystem is bigger
than it actually is. If you think the algorithm for marking bad blocks
is weird: you're right.

                Linus

PS. Using -c on a big harddisk or on floppies is slow, even though I try
to speed it up by reading 32kB at a time. Also, the current linux kernel
will print out error messages for all the IO errors - that's normal, and
that's what this mkfs should map out.
---------------- snip snip ----------
/*
 * mkfs.c - make a linux (minix) file-system.
 *
 * (C) 1991 Linus Torvalds. This file may be redistributed as per
 * the Linux copyright.
 */

/*
 * 24.11.91 - time began. Used the fsck sources to get started.
 *
 * 25.11.91 - corrected some bugs. Added support for ".badblocks"
 * The algorithm for ".badblocks" is a bit weird, but
 * it should work. Oh, well.
 *
 * Usuage: mkfs [-c] device size-in-blocks
 *
 * -c for readablility checking (SLOW!)
 *
 * The device may be a block device or a image of one, but this isn't
 * enforced (but it's not much fun on a character device :-).
 */

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <stdlib.h>
#include <termios.h>
#include <sys/stat.h>

#include <linux/fs.h>

#ifndef __GNUC__
#error "needs gcc for the bitop-__asm__'s"
#endif

#ifndef __linux__
#define volatile
#endif

#define ROOT_INO 1
#define BAD_INO 2

#define TEST_BUFFER_BLOCKS 32
#define MAX_GOOD_BLOCKS 512

#define UPPER(size,n) ((size+((n)-1))/(n))
#define INODE_SIZE (sizeof(struct d_inode))
#define INODE_BLOCKS UPPER(INODES,INODES_PER_BLOCK)
#define INODE_BUFFER_SIZE (INODE_BLOCKS * BLOCK_SIZE)

#define BITS_PER_BLOCK (BLOCK_SIZE<<3)

static char * program_name = "mkfs";
static char * device_name = NULL;
static int DEV = -1;
static long BLOCKS = 0;
static int check = 0;
static int badblocks = 0;

#define ROOT_INO_STRING "\001\000"
#define BAD_INO_STRING "\002\000"

static char root_block[BLOCK_SIZE] =
ROOT_INO_STRING ".\0\0\0\0\0\0\0\0\0\0\0\0\0"
ROOT_INO_STRING "..\0\0\0\0\0\0\0\0\0\0\0\0"
BAD_INO_STRING ".badblocks\0\0\0\0";

static char * inode_buffer = NULL;
#define Inode (((struct d_inode *) inode_buffer)-1)
static char super_block_buffer[BLOCK_SIZE];
#define Super (*(struct super_block *)super_block_buffer)
#define INODES ((unsigned long)Super.s_ninodes)
#define ZONES ((unsigned long)Super.s_nzones)
#define IMAPS ((unsigned long)Super.s_imap_blocks)
#define ZMAPS ((unsigned long)Super.s_zmap_blocks)
#define FIRSTZONE ((unsigned long)Super.s_firstdatazone)
#define ZONESIZE ((unsigned long)Super.s_log_zone_size)
#define MAXSIZE ((unsigned long)Super.s_max_size)
#define MAGIC (Super.s_magic)
#define NORM_FIRSTZONE (2+IMAPS+ZMAPS+INODE_BLOCKS)

static char inode_map[BLOCK_SIZE * I_MAP_SLOTS];
static char zone_map[BLOCK_SIZE * Z_MAP_SLOTS];

static unsigned short good_blocks_table[MAX_GOOD_BLOCKS];
static int used_good_blocks = 0;

#define bitop(name,op) \
static inline int name(char * addr,unsigned int nr) \
{ \
int __res; \
__asm__ __volatile__("bt" op " %1,%2; adcl $0,%0" \
:"=g" (__res) \
:"r" (nr),"m" (*(addr)),"0" (0)); \
return __res; \
}

bitop(bit,"")
bitop(setbit,"s")
bitop(clrbit,"r")

#define inode_in_use(x) (bit(inode_map,(x)))
#define zone_in_use(x) (bit(zone_map,(x)-FIRSTZONE+1))

#define mark_inode(x) (setbit(inode_map,(x)))
#define unmark_inode(x) (clrbit(inode_map,(x)))

#define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1))
#define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1))

/*
 * Volatile to let gcc know that this doesn't return. When trying
 * to compile this under minix, volatile gives a warning, as
 * exit() isn't defined as volatile under minix.
 */
volatile void fatal_error(const char * fmt_string)
{
        fprintf(stderr,fmt_string,program_name,device_name);
        exit(1);
}

#define usage() fatal_error("Usage: %s [-c] /dev/name blocks\n")
#define die(str) fatal_error("%s: " str "\n")

void write_tables(void)
{
        if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET))
                die("seek failed in write_tables");
        if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE))
                die("unable to write super-block");
        if (IMAPS*BLOCK_SIZE != write(DEV,inode_map,IMAPS*BLOCK_SIZE))
                die("Unable to write inode map");
        if (ZMAPS*BLOCK_SIZE != write(DEV,zone_map,ZMAPS*BLOCK_SIZE))
                die("Unable to write zone map");
        if (INODE_BUFFER_SIZE != write(DEV,inode_buffer,INODE_BUFFER_SIZE))
                die("Unable to write inodes");
}

void write_block(int blk, char * buffer)
{
        if (blk*BLOCK_SIZE != lseek(DEV, blk*BLOCK_SIZE, SEEK_SET))
                die("seek failed in write_block");
        if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE))
                die("write failed in write_block");
}

int get_free_block(void)
{
        int blk;

        if (used_good_blocks+1 >= MAX_GOOD_BLOCKS)
                die("too many bad blocks");
        if (used_good_blocks)
                blk = good_blocks_table[used_good_blocks-1]+1;
        else
                blk = FIRSTZONE;
        while (blk < ZONES && zone_in_use(blk))
                blk++;
        if (blk >= ZONES)
                die("not enough good blocks");
        good_blocks_table[used_good_blocks] = blk;
        used_good_blocks++;
        return blk;
}

void mark_good_blocks(void)
{
        int blk;

        for (blk=0 ; blk < used_good_blocks ; blk++)
                mark_zone(good_blocks_table[blk]);
}

inline int next(int zone)
{
        if (!zone)
                zone = FIRSTZONE-1;
        while (++zone < ZONES)
                if (zone_in_use(zone))
                        return zone;
        return 0;
}

void make_bad_inode(void)
{
        struct d_inode * inode = &Inode[BAD_INO];
        int i,j,zone;
        int ind=0,dind=0;
        unsigned short ind_block[BLOCK_SIZE>>1];
        unsigned short dind_block[BLOCK_SIZE>>1];

#define NEXT_BAD (zone = next(zone))

        if (!badblocks)
                return;
        mark_inode(BAD_INO);
        inode->i_nlinks = 1;
        inode->i_time = time(NULL);
        inode->i_mode = S_IFREG + 0000;
        inode->i_size = badblocks*BLOCK_SIZE;
        zone = next(0);
        for (i=0 ; i<7 ; i++) {
                inode->i_zone[i] = zone;
                if (!NEXT_BAD)
                        goto end_bad;
        }
        inode->i_zone[7] = ind = get_free_block();
        memset(ind_block,0,BLOCK_SIZE);
        for (i=0 ; i<512 ; i++) {
                ind_block[i] = zone;
                if (!NEXT_BAD)
                        goto end_bad;
        }
        inode->i_zone[8] = dind = get_free_block();
        memset(dind_block,0,BLOCK_SIZE);
        for (i=0 ; i<512 ; i++) {
                write_block(ind,(char *) ind_block);
                dind_block[i] = ind = get_free_block();
                memset(ind_block,0,BLOCK_SIZE);
                for (j=0 ; j<512 ; j++) {
                        ind_block[j] = zone;
                        if (!NEXT_BAD)
                                goto end_bad;
                }
        }
        die("too many bad blocks");
end_bad:
        if (ind)
                write_block(ind, (char *) ind_block);
        if (dind)
                write_block(dind, (char *) dind_block);
}

void make_root_inode(void)
{
        struct d_inode * inode = &Inode[ROOT_INO];

        mark_inode(ROOT_INO);
        inode->i_zone[0] = get_free_block();
        inode->i_nlinks = 2;
        inode->i_time = time(NULL);
        if (badblocks)
                inode->i_size = 48;
        else
                inode->i_size = 32;
        inode->i_mode = S_IFDIR + 0755;
        write_block(inode->i_zone[0],root_block);
}

void setup_tables(void)
{
        int i;

        memset(inode_map,0xff,sizeof(inode_map));
        memset(zone_map,0xff,sizeof(zone_map));
        memset(super_block_buffer,0,BLOCK_SIZE);
        MAGIC = SUPER_MAGIC;
        ZONESIZE = 0;
        MAXSIZE = (7+512+512*512)*1024;
        ZONES = BLOCKS;
/* some magic nrs: 1 inode / 3 blocks */
        INODES = BLOCKS/3;
/* I don't want some off-by-one errors, so this hack... */
        if ((INODES & 8191) > 8188)
                INODES -= 5;
        if ((INODES & 8191) < 10)
                INODES -= 20;
        IMAPS = UPPER(INODES,BITS_PER_BLOCK);
        ZMAPS = 0;
        while (ZMAPS != UPPER(BLOCKS - NORM_FIRSTZONE,BITS_PER_BLOCK))
                ZMAPS = UPPER(BLOCKS - NORM_FIRSTZONE,BITS_PER_BLOCK);
        FIRSTZONE = NORM_FIRSTZONE;
        for (i = FIRSTZONE ; i<ZONES ; i++)
                unmark_zone(i);
        for (i = ROOT_INO ; i<INODES ; i++)
                unmark_inode(i);
        inode_buffer = malloc(INODE_BUFFER_SIZE);
        if (!inode_buffer)
                die("Unable to allocate buffer for inodes");
        memset(inode_buffer,0,INODE_BUFFER_SIZE);
        printf("%d inodes\n",INODES);
        printf("%d blocks\n",ZONES);
        printf("Firstdatazone=%d (%d)\n",FIRSTZONE,NORM_FIRSTZONE);
        printf("Zonesize=%d\n",BLOCK_SIZE<<ZONESIZE);
        printf("Maxsize=%d\n\n",MAXSIZE);
}

void check_blocks(void)
{
        unsigned int current_block=0;
        int try,got;
        static char buffer[BLOCK_SIZE * TEST_BUFFER_BLOCKS];

        while (current_block < ZONES) {
                if (lseek(DEV,current_block*BLOCK_SIZE,SEEK_SET) !=
                current_block*BLOCK_SIZE)
                        die("seek failed in check_blocks");
                try = TEST_BUFFER_BLOCKS;
                if (current_block + try > ZONES)
                        try = ZONES-current_block;
                got = read(DEV, buffer, try * BLOCK_SIZE);
                if (got<0)
                        got = 0;
                if (got & (BLOCK_SIZE-1))
                        printf("Weird values in check_blocks: probably bugs\n");
                got /= BLOCK_SIZE;
                current_block += got;
                if (got == try)
                        continue;
                if (current_block < FIRSTZONE)
                        die("bad blocks before data-area: cannot make fs");
                mark_zone(current_block);
                badblocks++;
                current_block++;
        }
        if (badblocks)
                printf("%d bad block%s\n",badblocks,(badblocks>1)?"s":"");
}

int main(int argc, char ** argv)
{
        char * tmp;
        struct stat statbuf;

        if (argc && *argv)
                program_name = *argv;
        if (INODE_SIZE * INODES_PER_BLOCK != BLOCK_SIZE)
                die("bad inode size");
        while (argc-- > 1) {
                argv++;
                if (argv[0][0] != '-')
                        if (device_name) {
                                BLOCKS = strtol(argv[0],&tmp,0);
                                if (*tmp)
                                        usage();
                        } else
                                device_name = argv[0];
                else while (*++argv[0])
                        switch (argv[0][0]) {
                                case 'c': check=1; break;
                                default: usage();
                        }
        }
        if (!device_name || BLOCKS<10 || BLOCKS > 65536)
                usage();
        DEV = open(device_name,O_RDWR);
        if (DEV<0)
                die("unable to open %s");
        if (fstat(DEV,&statbuf)<0)
                die("unable to stat %s");
        if (!S_ISBLK(statbuf.st_mode))
                check=0;
        else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0305)
                die("Will not try to make filesystem on '%s'");
        setup_tables();
        if (check)
                check_blocks();
        make_root_inode();
        make_bad_inode();
        mark_good_blocks();
        write_tables();
        return 0;
}

Original post in KCLUG archives


Subject: weekly (?) answers, bugreports etc
Date: Sat, 30 Nov 1991 04:46:48 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>

nicholas@cs.uwa.oz.au (Nicholas Yue):
> G'day,
> How do I mount the 2nd hard-disk (automagically ;-). The boot floppy can
> be configured to mount the root file system form /dev/hdX

Minix does this in /etc/rc, but as linux currently ignores that, the
best way is to do it in your .profile (or /etc/.profile). You migh want
to use 'mount /dev/hdX /home &> /dev/null' so that eventual multiple
mounts won't print error messages. Likewise you can unmount in .logout,
but unmounting isn't really necessary (but do remeber to sync).

many:
>
> kermit works, but dies due to ^C. What's wrong? It also complains
> about not being able to lock the line.

This /seems/ to be standard behaviour of unix-kermit, and it is
certainly not of my doing. It's a nuisance. Line-locking is done by
creating a file in the directory /usr/spool/uucp/LCK, and unless that
directory exists, kermit isn't able to lock it.

Then to bug-reports and updates:

hd.c is buggy, and I'm investigating it. When read-errors occur, weird
things can happen, including writing to the disk. This might be the
cause of some peoples problems: there is no problem if you have a
sector-translating controller (eg IDE etc) that never returns errors. I
think I've gotten it working, and hopefully the 0.11 version (due out in
about a week) will be correct.

0.11 will also finally be totally self-sustaining: I have gotten the
source to bruce evans' assembler and linker, and at least I haven't
heard of many problems with mkfs and fsck. I didn't have time to
implement symlinks, so there are no real new features: just bug-fixes
and enhancements. Thanks to everybody who sent diffs etc. You know who
you are, and I've tried to accnowledge everyone in the source. Wolfgang
XXXX, who made the German keyboard patch, please mail me your last name.

Known bugs still unresolved: at least one machine has trouble reading
the floppy, and one 486 seems to have problems with the harddisk even
with my new patches. Another machine seems to get divide by zero
errors, and I have absolutely no idea why this happens. As it looks
now, these won't be corrected in 0.11 unless I can find the reason for
them within the week :-(

                Linus

Original post in KCLUG archives


Subject: last call for diffs for 0.11
Date: Tue, 3 Dec 1991 13:57:58 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>

Yow,
 as the subject says, this is the last call for diffs for the 0.11
kernel. If you have bug-fixes or enhancements, I'll have to get them
before friday (6.12.91) in order for them to find their way into the new
kernel. I'll do the "last rites" for the new kernel during the weekend,
and put it out for ftp after that.

Changes between 0.10 and 0.11:

- fixed bugs in block-device drivers: floppies still have problems when
accessing 2 floppies at the same time, but otherwise everything seems to
work.

- german keyboard (thiel)

- console beeping (jtkohl).

- corrected owner checks, #!-recognition in execve (tytso)

- sticky directories (both me and tytso)

- demand-loading

- page-sharing between all processes.

I doubt demand-loading makes anything any faster, but it made
page-sharing possible, so it was "a good thing". Page sharing means that
when executing a new image, the pages aren't loaded from disk if some
other process has them. Especially on a multi-user setup (when we get
the init/login), this will speed things up and save memory.

I'll also release the bruce evans 86-assembler binaries at about the
same time as 0.11, as well as a new root-disk with the new system
binaries (mkfs, fsck and fdisk). Fdisk doesn't do anything, it just
checks the partition table and prints out the partitions.

                Linus

Original post in KCLUG archives


Subject: linux-0.11 available
Date: Sun, 8 Dec 1991 17:51:24 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>

The subject says it all: I have uploaded linux version 0.11 to
nic.funet.fi and tupac-amaru. They won't show up for a while on nic,
but are already visible in pub/msdos/replace/incoming at amaru. rtx-11
is so slow to use from here that I didn't upload them there: I guess
they'll show up within a couple of days (tytso?).

The files uploaded were:
        bootimage.Z - US keyboard compressed bootimage
        rootimage.Z - 1200kB compressed root image
        linux-0.11.tar.Z - sources
        as86.tar.Z - linux binaries for bruce evans'
                                  16-bit assembler and loader.
        INSTALL-0.11 - updated install-info

This version has a lot of corrections, and is stable at least on my
machine. I /hope/ every known bug is fixed, but no promises (and all
unknown bugs are still there, probably with reinforcements ;-). Those
who like to use caps lock as a ctrl-key, you'll have to re-patch the
kernel. It's not implemented in the standard version.

                Linus

PS. I'll be a bit busy with the #"$/% physics-course I'm taking, so I
might not be as active on the net this coming week as I would like to.

PPS. corsini: the problem you have with the recompiled uemacs sounds
like it isn't resetting the ISIG bit in c_lflags when moving to raw
mode. Search for c_lflags in the source: it should effectively be set to
zero (I think) - no signals, no canonical mode etc.

Original post in KCLUG archives


Subject: VM, version 0.12
Date: Thu, 19 Dec 1991 19:51:45 +0200
From: Linus Benedict Torvalds <torvalds@cc.helsinki.fi>


                   /\
                  / \
                 / \
                 / \ Seasons Greetings
                 / \
                   ||

Ho, ho ho, and a happy X-mas/chanukah/whatever to you all. I'm probably
mailing to a lot of non-listening mail-boxes, but who cares.

This is a warning for all you out there making changes to the linux
kernel: if you want your changes to be in 0.12, I want them by early
January (5th-10th ta the latest). As it looks now, 0.12 will be out
about 15th of January, and will contain at least these new things:

- POSIX job control (by tytso, alpha-release available already)
- VM (by me - I'll probably make alphas available after X-mas)
- Various small corrections (by me, tytso, jtkohl, drew etc)
- Anything else people send me.

I got VM working today (not bad in two days if I may say so :-), but
haven't really tested extensively. I tried some compilations (I remade
uemacs) on a 2M machine (or rather a 8M machine, of which Linux sees
only 2M), and it worked (gcc, make, bash etc in memory ar the same
time), albeit slowly. There are probably still problems, but it seems
VM will definitely be in 0.12.

Note that the earlier I get your fixes, the easier it will be to
implement them all: if I get many fixes 0.12 may be a little late, so
the January 15th date isn't really fixed. Also, after releasing 0.12
I'll probably have to study a bit harder than I did this autumn (which
isn't hard per se :-), which may mean that the new releases won't be
coming once per month or so any more. Hopefully 0.12 will be good
enough to use.

        Linus "Ugly X-mas trees are my speciality" Torvalds

Original post in KCLUG archives


Subject: virtual consoles working.
Date: Mon, 23 Dec 1991 17:00:15 PST
From: pmacdona@sol.UVic.CA (Peter MacDonald)

Hi and merry Xmas.

This note is coming to you from the virtual console of Linux.
Yep. I have virtual consoles working under linux.

Although this is based upon Gordon Irlams minix patches, virtually
no code from there was actually used. This is more a product of
minix's message passing kernel being so different from Linux's
unified approach than by design. But I am trying to adapt
as much of his setterm program as possible, so that a user interface
for setting colors and the like is available. To get around the
problem of no init/login I am using the "doshell" program
posted here earlier. Actually, for standalone machines I
think I prefer it over getty/login.

I will post the patches to 0.11 as soon as I have tested a little
more, and had a chance to bundle it up.

I also have done all of the design and coding, but none of the
testing on a select call, adapted from Mathius Lauttiners design.
But as Proven has requested, I will probably wait until after 0.12
is out before going any further with that. Getting a peek at your
VFS patches early, thought might help.

It's funny how things work out. I was working on select, started
eyeing how they might interact with pty's, and realized that
virtual consoles would probably still be desirable after ptys,
as well as being easier to do.

Anyways, have a good christmas all. I am heading to the ski slopes
so I know I'll have fun. Hope you do to.

Original post in KCLUG archives