MINIX Guide - Operating System Design and Implementation | CS 551, Study notes of Operating Systems

MINIX Guide Material Type: Notes; Professor: Leung; Class: Operating System Design and Implementation; Subject: Computer Science; University: Illinois Institute of Technology; Term: Fall 2009;

Typology: Study notes

2010/2011

Uploaded on 06/06/2011

sachimahajan
sachimahajan 🇺🇸

5

(1)

4 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
WHAT YOU NEED :
Boot Floppy (Root + Usr Floppy)
Set of floppies for USR.TAZ, SYS.TAZ, and CMD.TAZ.
Free Hard disk partition
INTRODUCTION :
Before installing Minix, you will have to transfer Minix on floppies. For any 386/486/586 system, you will
first need to make a four sets of floppies of 1.44 MB.
Fdvol 1440 A: i386\ROOT i386\USR => This is a combination of ROOT + USR floppy
Fdvol 1440 A: i386\USR.TAZ => This is a base system (total 3 floppies)
Fdvol 1440 A: SYS.TAZ => System Resources (total 2 floppies)
Fdvol 1440 A: CMD.TAZ => Command Sources (Total 3 floppies)
To reconstruct a .TAZ file on a sequence of 1.44 MB floppies via drive A:, boot MINIX, log in, and type:
setup dir
Where 'dir' is the directory where a package is to be installed. Use 'install -d dir' to create the directory
if it doesn't yet exist.
PROCEDURE FOR INSTALLATION:
The objective of the installation is to create a partition on your disk and to put MINIX into it.
MINIX really requires two partitions however, so the single "primary" partition is split into two
subpartitions. The a subpartition will contain the root file system, and the c subpartition will contain
the /usr file system. What MS-DOS calls"drives", i.e C:, D:, E:, MINIX calls "file systems". MINIX does
not use drive letters, but requires that one file sys tem is made a part of another file system by
"mounting" one on the other. The "root" file system is always present and starts with the directory "/",
the root of the directory tree. The root file system contains a few programs in /bin, device files in
/dev, and configuration files in /etc. This is just enough to get the system started. MINIX will soon
extend its directory tree by mounting a file system on the /usr directory. What is henceforth known as
the /usr file system contains all MINIX programs in /usr/bin, file system sources in /usr/src, etc,
etc. The ROOT image contains the complete MINIX root file system, but USR contains just a
small subset of the /usr file system, with just enough utilities to install MINIX. The complete /usr file
system is split up into the USR.TAZ, SYS.TAZ and CMD.TAZ archives that are installed later to fill
/usr.
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download MINIX Guide - Operating System Design and Implementation | CS 551 and more Study notes Operating Systems in PDF only on Docsity!

WHAT YOU NEED :

Boot Floppy (Root + Usr Floppy)

Set of floppies for USR.TAZ, SYS.TAZ, and CMD.TAZ.

Free Hard disk partition

INTRODUCTION :

Before installing Minix, you will have to transfer Minix on floppies. For any 386/486/586 system, you will

first need to make a four sets of floppies of 1.44 MB.

Fdvol 1440 A: i386\ROOT i386\USR => This is a combination of ROOT + USR floppy Fdvol 1440 A: i386\USR.TAZ => This is a base system (total 3 floppies) Fdvol 1440 A: SYS.TAZ => System Resources (total 2 floppies) Fdvol 1440 A: CMD.TAZ => Command Sources (Total 3 floppies)

To reconstruct a .TAZ file on a sequence of 1.44 MB floppies via drive A:, boot MINIX, log in, and type:

setup dir

Where 'dir' is the directory where a package is to be installed. Use 'install -d dir' to create the directory if it doesn't yet exist.

PROCEDURE FOR INSTALLATION:

The objective of the installation is to create a partition on your disk and to put MINIX into it. MINIX really requires two partitions however, so the single "primary" partition is split into two subpartitions. The a subpartition will contain the root file system, and the c subpartition will contain the /usr file system. What MS-DOS calls"drives", i.e C:, D:, E:, MINIX calls "file systems". MINIX does not use drive letters, but requires that one file sys tem is made a part of another file system by "mounting" one on the other. The "root" file system is always present and starts with the directory "/", the root of the directory tree. The root file system contains a few programs in /bin, device files in /dev, and configuration files in /etc. This is just enough to get the system started. MINIX will soon extend its directory tree by mounting a file system on the /usr directory. What is henceforth known as the /usr file system contains all MINIX programs in /usr/bin, file system sources in /usr/src, etc, etc. The ROOT image contains the complete MINIX root file system, but USR contains just a small subset of the /usr file system, with just enough utilities to install MINIX. The complete /usr file system is split up into the USR.TAZ, SYS.TAZ and CMD.TAZ archives that are installed later to fill /usr.

Let's suppose your first hard disk, which has device name /dev/hd0, has MS-DOS already present in the first primary partition (/dev/hd1), and some free space left after that. After MINIX is installed in that free space the disk will look like this:

/dev/hd0 Whole hard disk # /dev/hd1 MS-DOS C: drive /dev/hd2 MINIX primary partition /dev/hd2a MINIX root partition /dev/hd2c MINIX /usr partition

/dev/hd0 is the sum of a partition table, /dev/hd1 and /dev/hd2. Likewise is /dev/hd2 the sum of a subpartition table, /dev/hd2a and /dev/hd2c. Read the "DEVICES" sections for more information on MINIX devices.

To install the system you need two diskettes: a bootable root diskette and a diskette full of binaries to use as /usr. These diskettes are named ROOT and USR.

Insert the ROOT diskette, boot the machine and type '=' to the menu. The MINIX kernel is loaded and takes control when you see the copyright banner. After loading the root diskette into the RAM disk you will be asked to finish the name of the device to mount on /usr. Type fd0c for a diskette that contains both ROOT and USR, otherwise replace ROOT by USR and type fd0. Login as root.

DISK SPACE

The maximum file system size is 1 GB for MINIX-386 and 128 MB for MINIX-86. (MINIX-86 can handle larger file systems, but fsck can't check them.) Note that a MINIX file system can only contain 65535 inodes (files), so the average file should be 16 kb to completely fill it. It may be better to make two smaller file systems. Besides, fsck takes forever on a large file system.

FIPS

FIPS is freely available from Tucows and the GNU archives. It is a dos based program that will allow you to resize your partitions on your hardrive. Make sure you read all the documentation that comes with FIPS. Mistakes made on your partition table can cause loss of data or even clear your whole hardrive. If you are trying to split your existing partition from dos , win3.1x, or win95, you have to run scandisk (or chkdsk for old version dos) first. Then run defrag tool to defragment your current partition. For win3.1x and win95 users, you have to disable the virtual memory before defragmentation. You can find it from control panel, after you split your partition successfully then enable it back. There probably are some problems to split a winNT's partition or you want to make MINIX co-exist with your NT. I won't suggest you to do this. Since NT and MINIX always need to save their code of boot and partition table in the MBR (Master Boot Record). If you do want to install them on one machine, I suggest you to buy SysCommander or try Linux LiLo that can allow multiple OS on one system. Notice for large size disk users (> 512 Mbytes): Since lots of students mess their system now. You have to be very careful to backup your whole system before you start to make a new partition for MINIX. As I knew, most of you have some large disks whose spaces are over 512 Mbytes. This may derive serious troubles to make a new partition for any PC unix system if you have already partitioned them by dos, win95, or nt partition tools. Because all ot these large size disks need to use some tools embedded in your EIDE or SCSI card to extend the partition table such that the O.S. can read the maximum size of the hard disks. For EIDE, it is LBA, for SCSI, there should have an options to enable the functions similar to the LBA. But this action actually fool the OS with the fake number of cylinders, sectors and heads. That is what the large disk space you

Note 3: The installation procedure is described in the manual page usage(8). It will be hard without it.

Note 4: Some questions have default answers, like this: [y] Simply hit RETURN (or ENTER) if you want to choose that answer.

Note 5: If you see a colon (:) then you should hit RETURN to continue. :

+------------------------------------------------------- ------------------ + | I hit the ENTER key and am asked about my keyboard | +------------------------------------------------------- ----------------- +

What type of keyboard do you have? You can choose one of:

french italian latin-am scandinavn uk us-swap german japanese olivetti spanish us-std

Keyboard type? [us-std]

+----------------------------------------------------------------------+ | I have a standard U.S. keyboard so I type | | ENTER again. Now it gets serious: | +----------------------------------------------------------------------+

Minix needs one primary partition of at least 30 Mb (it fits in 20 Mb, but it needs 30 Mb if fully recompiled. Add more space to taste.)

If there is no free space on your disk then you have to back up one of the other partitions, shrink, and reinstall. See the appropriate manuals of the the operating systems currently installed. Restart your Minix installation after you have made space.

To make this partition you will be put in the editor "part". Follow the advice under the '!' key to make a new partition of type MINIX. Do not touch an existing partition unless you know precisely what you are doing! Please note the name of the partition (hd1, hd2, ..., hd9, sd1, sd2, ... sd9) you make. (See the devices section in usage(8) on Minix device names.) : +-------------------------------------------------------------------+ | ENTER brings up the 'part' partition editor. The | | question marks indicate that no partition table is | | loaded yet. I must first choose a disk. | +-------------------------------------------------------------------+

Select device ----first---- --geom/last-- ------sectors----- Device Cyl Head Sec Cyl Head Sec Base Size Kb /dev/hd0??? ????????? Num Sort Type ????????????? ????????????? ????????????? ?????????????

Type '+' or '-' to change, 'r' to read, '?' for more help, '!' for advice

+-----------------------------------------------------------------+

| This notebook has only one disk, so I type 'r': | +-----------------------------------------------------------------+

Select device ----first---- --geom/last-- ------sectors----- Device Cyl Head Sec Cyl Head Sec Base Size Kb /dev/hd0 485 16 63 0 0 0 488 15 62 0 492912 246456 Num Sort Type 1 hd1 12 0 1 0 4 15 62 63 4977 2488 2* hd2 81 MINIX 5 0 0 426 14 52 5040 425303 212651 3 hd3 00 None 0 0 0 0 0 -1 0 0 0 4 hd4 00 None 0 0 0 0 0 -1 0 0 0

at-hd0: Conner Peripherals 240MB - CP

+----------------------------------------------------------------------+ | There are two partitions already present on the disk, | | one that contains setup stuff for the notebook and a | | 208 megabyte partition that already contains Minix. | | The AT disk driver has tickled the IDE disk to make | | it tell its type and make. It is a message from deep | | in the kernel, not from part. | | For this install I want a new partition, so I move | | over to the Size field of the first unused slot, line | | 3 with type "None". I could type a number now, but | | I want to use the rest of the disk, so I hit 'm' | | there once or twice to let part propose something. | +---------------------------------------------------------------------+

Size in sectors ----first---- --geom/last-- ------sectors----- Device Cyl Head Sec Cyl Head Sec Base Size Kb /dev/hd0 485 16 63 0 0 0 488 15 62 0 492912 246456 Num Sort Type 1 hd1 12 0 1 0 4 15 62 63 4977 2488 2* hd2 81 MINIX 5 0 0 426 14 52 5040 425303 212651 3 hd3 81 MINIX 426 14 53 488 15 62 430343 62569 31284 4 hd4 00 None 0 0 0 0 0 -1 0 0 0

+---------------------------------------------------------------------+ | Note that the end of partition 2 and the start of | | partition 3 are not on a cylinder boundary. Minix | | doesn't care about that, but Linux fdisk would throw | | a fit if it would see this. In this case I'm happy, | | so I type 'q' to quit, and 'y' to save the table: | +---------------------------------------------------------------------+

Size in sectors ----first---- --geom/last-- ------sectors----- Device Cyl Head Sec Cyl Head Sec Base Size Kb /dev/hd0 485 16 63 0 0 0 488 15 62 0 492912 246456 Num Sort Type 1 hd1 12 0 1 0 4 15 62 63 4977 2488 2* hd2 81 MINIX 5 0 0 426 14 52 5040 425303 212651 3 hd3 81 MINIX 426 14 53 488 15 62 430343 62569 31284 4 hd4 00 None 0 0 0 0 0 -1 0 0 0

Save partition table? (y/n) y

Minix 2.0.0 Copyright 1997 Prentice-Hall, Inc.

Executing in 32-bit protected mode

at-hd0: Conner Peripherals 240MB - CP

Memory size = 8010K MINIX = 295K RAM disk = 1024K Available = 6692K

Tue Oct 1 16:39:24 MET 1996 /dev/hd3c is read-write mounted on /usr Starting standard daemons: update.

Login as root and run 'setup /usr' to install floppy sets.

Minix Release 2.0 Version 0

noname login:

+-----------------------------------------------------------------------+ | Type 'root' and 'setup /usr'. ENTER, ENTER, input | | floppy 1 of the USR.TAZ set, and ENTER. | +-----------------------------------------------------------------------+

noname login: root

setup /usr

What is the size of the images on the diskettes? [all] What floppy drive to use? [0] Please insert input volume 1 and hit return

created directory: local/lib created directory: local/man created directory: local/src created directory: man Can't make directory mdec: File exists

+------------------------------------------------------------------------+ | Usage(8) warns about this "File exists" message, and | | that it doesn't matter. Otherwise this would go | | wrong: | | +------------------------------------------------------------------------+

mdec/boot, 050 tape blocks mdec/bootblock, 01 tape blocks mdec/extboot, 01 tape blocks

+--------------------------------------------------------------------------+ | Lots of files installed, I add floppy 2 and 3 of | | USR.TAZ when it asks for them. When done I type | | "setup /usr" again for SYS.TAZ, and once more for | | CMD.TAZ. Five floppies later and I'm done. | +-------------------------------------------------------------------------+

src/commands/talkd/talk.h, 03 tape blocks src/commands/talkd/talkd.c, 03 tape blocks src/commands/talkd/talkd.h, 01 tape blocks /tmp/LAST, 0 tape blocks Done.

| As an example I give the system the name "finiah", | | but seeing one of Michael Temari's network programs | | extracted inspires me to make a network kernel. Log | | in as 'bin' and bring into the one | | true editor of the aging computer geek: | +-------------------------------------------------------------------------+

echo finiah >/etc/hostname.file

^D

Minix Release 2.0 Version 0

finiah login: bin ! vi /usr/include/minix/config.h

+-------------------------------------------------------------------------+ | I change the following parameters for more processes, | | a bigger cache, no 2nd level cache, networking, only | | the AT/IDE disk driver and 4 pseudo ttys for remote | | login: | +-------------------------------------------------------------------------+

#define NR_PROCS 40

#if (MACHINE == IBM_PC && _WORD_SIZE == 4) #define NR_BUFS 1024 /* # blocks in the buffer cache / #define NR_BUF_HASH 2048 / size of buf hash table; MUST BE POWER OF 2*/ #endif

#define ENABLE_CACHE2 0

#define ENABLE_NETWORKING 1 /* enable TCP/IP code / #define ENABLE_AT_WINI 1 / enable AT winchester driver / #define ENABLE_BIOS_WINI 0 / enable BIOS winchester driver / #define ENABLE_ESDI_WINI 0 / enable ESDI winchester driver / #define ENABLE_XT_WINI 0 / enable XT winchester driver / #define ENABLE_ADAPTEC_SCSI 0 / enable ADAPTEC SCSI driver */

#define NR_PTYS 4 /* # pseudo terminals (0 to 64) */

+-----------------------------------------------------------------------------+ | The main kernel Makefile is in /usr/src/tools. The | | command 'make hdboot' compiles a new image and puts | | it in /minix/, next to the distribution kernel: | +-----------------------------------------------------------------------------+

! cd tools/ ! make hdboot

+-------------------------------------------------------+

generic/tcp_send.o generic/udp.o exec cc -c -m -I. -I.. -I/usr/include putk.c exec cc -o inet -i inet.a putk.o install -S 10k inet exec cc -O -D_MINIX -D_POSIX_SOURCE init.c -o init install -S 192w init

Starting network services: shell login telnet ftp.

Minix Release 2.0 Version 0

127.36.93.27 login: root

shutdown -r

COMPILING KERNEL :

The kernel is not compiled from the master Makefile. To make a new kernel you have to step into the tools directory. There you can run four different make commands:

make This makes all the different kernel parts and combines Them in the file named image.

make fdboot As above and then makes a boot floppy that you can use to restart your system with. You are prompted for the floppy device name.

make hdboot First makes the image file and then copies it into the directory /minix. If there are already two images in that directory then the newest image will be removed to Make space for this newer image. It is assumed that the oldest image is the most stable system image, one that always works, and that the newest image is experimental. Check beforehand what /minix contains before you run make hdboot. Remove the oldest image if you want another image to become the stable image. The Boot Monitor chooses the newest image in /minix to boot. You can use the monitor command ls minix to view the images present, and set the image variable to the full name of the image you want to use instead if the newest doesn't work. The images in /minix are named using the MINIX release and version numbers with an extra revision number added to distinguish the images.

HOW TO DO “FDBOOT” :

You should go to the tools directory by typing cd /usr/src/tools and with blank (formatted) floppy inside the floppy drive, type ‘make fdboot’at the prompt on tools directory. That will copy your kernel image to floppy. After it finishes you should halt the system by typing ‘halt’at prompt and then type ‘book fd0’. Thus the system will boot from floppy.

HINTS FOR DOING PROGRAMMING ASSIGNMENTS :

For all your assignments, you have to mount all modified source files to the bootable disk. To mount you can use the following commands :

-mount /dev/fd0 /fd -make sure you are in the directory where modified source files exist. If not, go there by simple cd command -copy files you want using the cp command. For example – cp proc.c /fd -After copying all the files go to the tools directory, umount it by command, umount /dev/fd -You can check the files before and after the umount, by the command ls /fd

The above commands are for making the copy of your source files on your bootable floppies. You cannot access those in DOS or Windows.

For using files to copy and paste for your documentation, you have to take another dos formatted disk and follow as below (for doswrite)

-To copy source files from system to floppy, go to the directory and give the command

doswrite fd0 (name of the file you want on floppy) < proc.c (or any name from the directory) ie doswrite fd0 (name of file on floppy) < proc.c

  • To copy your file from disk to system, go to the corresponding directory. Then do

dosread –a fd0 (name of the file on floppy) > (name of the file you want on the system)

ie dosread –a fd0 proc.c > proc.c

  • You can use dosdir –l fd0 to see your files on the floppy

Then you can access this floppy from the Windows Explorer of your machine and open it in Visual C++ ( or any editor) , copy/paste it to your Word Document. This second DOS floppy is just for your use, you just have to submit MINIX bootable floppy (with source files mounted on it)

Printing

lp test.c

prints test.c file to your printer. type man lp to get more info.

Floppies

You can use dos formatted floppies to transfer files to and from MINIX using the

dosread command :

dosread -a fd0 prog.c > myprog.c ( copying prog.c from floppy to current

directory as myprog.c)

doswrite fd0 test.c < prog.c ( copy prog.c from MINIX to floppy as test.c)

dosdir -l fd0 ( show the files of a dos floppy )

You could format your disks though with

format /dev/fd0 720 : formats 720 KB diskettes on floppy A

format /dev/fd0 1440 : formats 1440 KB diskettes on floppy A

and then use

mkfs /dev/fd0 : makes file system on floppy A

to create the minix filesystem on the floppy.

Using the ps command you can view processes that are currently running on your

machine along with their PID if you need to manually terminate one of them.

Editor

VI is the MINIX editor.Basic vi commands are attached with this document

Shutdown/Reboot

You could use

reboot

or

shutdown -r now

to reboot the machine.

shutdown -h now

will shutdown the machine in order to turn it off.

Grep

If you want to find out in which other file you can find the string " pid " you could use :

grep pid *.c

This will look into all the files in the current directory with extension .c for the string pid

and output the name of the file and the line that contains pid. Look up grep in the man

pages for more information on this powerful command. See the attached vi Editor

Reference Card