Contents of the LINUXSET.DOC file
Some instructions on how to put the LINUX root on your hard drive and be
able to boot to it (as written by someone who doesn't know jack about UNIX)
Current for versions 0.12 and 0.95(a)
In my humble opinion, there isn't any way that following these instructions
(with the limited "doc's" for LINUX close by) can mess anything up;
probably the worst that can happen is you'll have to start the whole setup
process over again. Nonetheless, I hereby wash my hands of any and all
liability for damages sustained as the result of following these
instructions. As long as you do things exactly as they're written here,
and honor the limitations as listed in the doc's for LINUX, I really don't
see any problems... Just be sure to read EVERYTHING before doing this
WHY AM I DOING THIS?
There I was; hard disk containing the successfully transferred filesystem
from LINUX, and no way to access it. After reading the so-called "doc's"
about 100 times, I figured it was time to do a little hacking from the DOS
end. In order for the hard disk to contain the LINUX root, the word
starting at byte 508 in the boot image file had to be changed to 0x0302; no
mention on whether this was a decimal or hex address... (This is for my
configuration; yours may be different...) The problem is, the "doc's"
refer to a sample program that they conveniently forgot to include in the
.ZIP that could take care of this. Nice guys...
Not being the most experienced person in the DEBUG field, I had to do
numerous different alterations to the LINUX boot image file from the DOS
end until I finally got the HD to boot as the root drive. Hopefully, this
text file will clear up a few things that I learned so that others out
there who want to play with this UNIX clone can do so. (Note: these
instructions will tell you how to make the hard drive the "root", but
you'll still need to boot from a LINUX boot floppy. If there's a way to
have the entire operating system bootable from the hard drive from the very
beginning, I haven't seen it yet. Possibly if LINUX is in the first
partition it'll do it, but I'm not adventurous enough to hassle with that.
I still like DOS, and have no intention of making my entire computer run
off of a beta release of LINUX.)
Side note: You may want to print this out, in case you're in LINUX and
can't get back to this file without FDISKing back to DOS...
BEFORE DOING ANY OF THIS...
MAKE ABSOLUTE SURE THAT YOU HAVE "BACKED UP" YOUR HARD DRIVE AND YOU'RE IN
POSSESSION OF A DOS *SYSTEM* FLOPPY CONTAINING A VERSION OF FDISK THAT CAN
SWITCH BETWEEN DIFFERENT PRIMARY PARTITIONS!!!!!!!!!!!!
Without this, it's entirely possible that you will exit DOS and never be
able to get it back until some generous person brings his DOS system
diskette to your house!!!
In addition to this, you should have FORMAT.COM and, I think, SYS.COM, so
that you can set up your hard drive's new DOS partition after wiping out
all of the information on it. If you want to try to manually alter the
partition table, either copy your hex editor or DOS's DEBUG to the disk and
follow the instructions given later in this document; I recommend that you
at least read it through, as you may decide it would be more fun
partitioning that way (what the heck, right? Your data's already going to
be destroyed... Might as well have some fun...).
The first thing that needs to be done is to partition your hard drive with
TWO primary partitions (assuming that you want two operating systems, DOS &
LINUX. You can have up to 4 primary partitions on a hard drive.). LINUX
version 0.12 won't reliably recognize extended partitions, and 0.95(a) will
sort-of-reliably read them, so to be safe you might want to stick to
primary ones. Older versions of FDISK have been known to set up multiple
primary partitions (I used Disk Manager). DOS 5.0's FDISK can't do it
alone; you'll have to either get another partitioning package or follow the
instructions in the second part of this document. If you're using an older
version of DOS, you'll have to refer to your DOS manual to see if you have
After setting up the two partitions, make the XENIX/UNIX partition (or
whatever your FDISK says your soon-to-be-LINUX partition is called) active.
Reboot with the LINUX boot disk (this assumes that you've already set the
boot and root disks up with RAWRITE. If not, refer to the doc's for
Next, after you're in LINUX (at this point, you've booted up with the boot
disk, the root disk is in your floppy drive, and you're at a "#" prompt),
type FDISK to see what partitions LINUX can read from your HD. If you get
garbage, I can't help you; either go back and do the RAWRITE stuff all over
again, or don't bother to continue (stick with DOS...). LINUX needs to use
"AT" type drives. This isn't too clear to me; basically, you can use IDE
drives but not some others. There just isn't any support for some HD's.
Pay special attention to the partition that DOESN'T contain DOS. This is
the one that you're installing LINUX on. At the beginning of the partition
display lines, there should be something that looks like "/dev/hd1" or
"/dev/hd2" ("/dev/hda1" or "/dev/hda2" in version 0.95(a)); these are
device names that LINUX is giving to the partitions. After this
information, there should me a number with the word "blocks" next to it;
this is the amount of space in kilobytes that the partition contains. You
need both the partition device name and the number of "blocks" to transfer
the filesystem to the hard drive.
To transfer the filesystem to the hard drive, you type (at the "#" prompt):
mkfs -c /dev/hdX blocks
in all lower-case letters, replacing the "X" in "/dev/hdX" with the number
that LINUX named the partition, and the number of kilobytes in the
partition in place of "blocks". So if you have a 10 meg partition, and
LINUX's FDISK reported it something like this:
/dev/hda2 : 10200 blocks: undetermined partition device 0x02
("/dev/hd2 : 10200 blocks: undetermined partition device 0x02" in v.0.12)
you would type: mkfs -c /dev/hda2 10200
("mkfs -c /dev/hd2 10200" in v.0.12)
The filesystem transfer may take a while if you have a large partition. It
may look and sound like your controller card is locked up, but bear with it
for a few minutes. The "-c" is for checking the blocks in the partition to
make sure that they're ready for the new operating system. (Think of it as
another form of DOS's FORMAT command.) Note: EVERYTHING in the partition
will be completely wiped out, so make sure that you're performing this on
the correct one!!!
Now you're ready to "mount" the filesystem. *NIX systems don't use a DOS
"C:" type call to log onto a disk drive; instead, you mount the drive to a
directory, and whenever you want to access the data on that drive, you
simply change to the directory that you mounted the disk to. In essense,
your computer operates as one big system, as opposed to many small pieces
that you have to jump back and forth to. Just for clarity, version 0.12
comes with a "/user" directory on the root disk that's meant to be mounted
to. Version 0.95 didn't come with a directory in the root, so you'll have
to create one in the root directory using mkdir (typically, the "/mnt"
directory in the root directory is what's used). Version 0.95a has a
"/mnt" directory, so you're alright if you're using this version.
Basically, you need to mount the filesystem to a directory stemming from
the root directory that isn't vital to any data, *regardless* of the name.
This directory should have no other purpose than to mount filesystems,
because when you've mounted to it, the data in the directory is no longer
For consistency, I'll refer to the drive as /dev/hda2, because that's what
my system is set up to. (By now you should see that the version 0.12
eqivalent for the hard drive device is sans the letter "a". The "a", by
the way, indicates the "first" hard drive in the computer.) Use whatever
drive you used in the "mkfs" line.
mount /dev/hda2 /mnt (or "/user" for v.0.12)
If you get errors, then mkfs screwed up. Try again and see if it helps. If
it doesn't, well... I don't know what to do for you. (I guess, once again,
stick with DOS...)
At this point you need to transfer all of the files from the root floppy
onto the hard drive. To accomplish this, when at the "#" prompt, type
cd /mnt (or "/user" for v.0.12)
for i in bin dev etc usr INSTALL ("INSTALL" in 0.95a only)
cp +recursive +verbose /$i $i
NOTE: Versions 0.95 and 0.95a root images contain very few binaries due to
the lack of room in the image files. You'll need to have a root image
diskette from version 0.12 to get the basic collection on your hard drive.
You'll get to that soon; keep reading...)
After the files are through being transferred, execute "sync" three times,
each time waiting for the sync process to end. Reboot your computer with
your DOS system diskette.
When you're in DOS, you're going to use DEBUG to change the 508th and 509th
byte in the boot image so that it'll look on the hard drive for the root as
opposed to the floppy drive. Here's where things get a little sticky...
First of all, you don't want to do anything with the LINUX boot diskette;
that's going to be overwritten by the new version of the boot image file
that you're going to create. You want to alter a new copy of the boot
image as extracted from the original LINUX archive file. Copy it onto a
floppy, log onto the floppy drive, and call up DEBUG, using the path that
points to it, and passing it the boot image filename:
C:\DOS\DEBUG BOOT95A (or "BOOTU.IMG" in v.0.12,
or "BOOT95" in v.0.95)
When you're at the "-" prompt, type "E 2FC". This will take you to the
508th byte, and will show you the contents. At this point, you enter the
numeric value that points to the device number of the drive partition.
(Keep reading...) After hitting ENTER, type "E 2FD", which takes you to
the 509th byte, at which time you enter "03", which is the LINUX code for a
hard drive. So, if you set up your system for /dev/hda2, you would enter
"02" at 2FC, and "03" at 2FD. Or, if you set it up for /dev/hda4, you
would enter "04" at 2FC and "03" at 2FD. Basically, the value at the 509th
byte will always be "03" for a hard drive; the 508th byte is what you need
to determine for your system. Here's a small list of what we're looking
DEVICE NAME BYTE 508 VALUE
/dev/hda1 or /dev/hd1 01
/dev/hda2 or /dev/hd2 02
/dev/hda3 or /dev/hd3 03
/dev/hda4 or /dev/hd4 04
These cover the 4 possible partitions on the 1st hard drive. From here, we
go to the second hard drive...
/dev/hdb1 or /dev/hd6 06
/dev/hdb2 or /dev/hd7 07
/dev/hdb3 or /dev/hd8 08
/dev/hdb9 or /dev/hd9 09
The 'a' is for the 1st hard drive, and the 'b' is for the 2nd hard drive.
You need to keep this in mind when using version 0.95 or 0.95a, because you
don't make byte 508 read "01" in the boot image for /dev/hdb1; that's the
first partition on the second hard drive, so it's going to be "06". Also,
note that there isn't "/dev/hda0", "/dev/hd0", "/dev/hda5", or "/dev/hd5".
This is because the "0" and "5" values refer to the ENTIRE hard drive; "0"
refering to the whole drive, and "5" refering to the entire drive with all
partition information. It's recommended that you don't even *think* about
using these, even if it doesn't look like they'll cause damage. If you're
using LINUX on an entire hard drive, partition it as one drive and use
"/dev/hda1" (or "/dev/hd1" in v.0.12). It's easier that way...
(The reason that you don't go to the hex address of byte 508 directly is
that DEBUG loads files starting at byte 100h, which is byte 256 in decimal.
You need to add 508 to 256, giving you 764. The address of the 764th byte
in a DEBUG session is 2FC in hexadecimal. It took me TOO LONG to figure
this little trick out, not being the most frequent DEBUG-er...). After
entering the new bytes, type "w" to write the changes to boot image, then
"q" to quit from DEBUG. The process will look something like this (this is
just a visual aid for those people who aren't familiar with DEBUG. The
"XXXX's" will be different for every computer.):
B:>C:\DOS\DEBUG BOOT95A <---(or whatever...)
XXXX:02FC 00.02 <---(the "02" is entered by you)
XXXX:02FD 00.03 <---(the "03" is entered by you)
writing 2A700 <---(I don't remember how many bytes
-q it was... It isn't important...)
The boot image file is now ready to read the hard drive as the root. Use
RAWRITE to copy the boot image to the LINUX boot floppy (overwriting the
old version), and with the newly revised LINUX boot disk in the bootable
disk drive, reboot the computer. If all works well, after hitting ENTER
when prompted to, instead of a prompt to "Insert Root Diskette" you should
be seeing the continuation of the boot process as executed from the hard
At this point, if you have version 0.12, you can stop. But if you have
version 0.95 or 0.95a, read on...
Now that you're able to boot to the hard drive, you need to take that old
root image diskette from version 0.12 and copy all of the binaries from it.
(Remember earlier?...) To do this, you'll need to set up a floppy drive to
mount to so that you can access the old root system. The devices should be
already set up for you; PS0 and PS1 are for 3.5" disk drives "A" and "B"
respectively, and at0 and at1 are for 5.25" "A" and "B" drives
respectively. So, if you have a 3.5" drive as "A" and a 5.25" drive as
"B", the "A" drive will be "/dev/PS0" and the "B" drive will be "/dev/at1".
You need to create directories for these drives to be mounted to, like
"floppyA" and "floppyB", then mount to them. Use the above example to
mount the drive(s) that you need to access (i.e. the hard drive mount
example, except replace "/dev/hda2" with the appropriate floppy drive
device, and the "/mnt" with the floppy mount directory that you made),
insert the 0.12 root diskette in the appropriate drive, and do one of
these: (not too much different from the filesystem transfer earlier)
for i in bin usr
cp +recursive +verbose /floppyA/$i $i
Now, this will probably create some weird directories coming off of the
existing directories, but you'll be able to figure out what can be moved
after the cp is over (if you have a directory called "/bin/bin", chances
are you'll be safe moving all of the files in "/bin/bin" to plain old
"/bin"...) It'll at least get the binaries on your hard drive; you can go
from there. Sorry, but I don't know the ins and outs of the cp binary yet
(I'm getting there, though...).
Side note: In version 0.95a (and I think 0.95 also) the bash shell was
replaced by the ash shell to save space... The ash shell is a piece of
junk as far as I'm concerned, especially after using bash. If you have a
copy of bash on an old root floppy, you may want to rename the ash shell
file that comes with 0.95a (the shell programs are always called "sh") and
experiment with a copy of old bash to see if it all works in 0.95a. I
don't think there will be any trouble, but once again, I'm learning too...
Experiment at your own risk...
From here, if you have version 0.95a, you should execute the mktree program
in the INSTALL directory. This will automatically set up the new standard
directory tree and possibly even move incorrectly placed files to where
That should do it...
Again, this doesn't eliminate the use of the boot diskette. It only
enables you to use the hard drive for the LINUX root (which is a hell of a
lot better than a 1.2meg floppy that has only 30k of space left on it!).
This opens up the operating system to let you use other binaries downloaded
from BBS's and such; otherwise, you'd be stuck with a small amount of space
on a floppy to play with. Besides, the hard drive runs a HELLUVA lot
(Now, to learn UNIX... Iggghhh...)
| Erik Ratcliffe |
| 03-26-92 |
If you modify this file, please let me know if at all possible. I'm as
interested in LINUX discoveries as the first time user is (and I like to
know what kind of information my name is keeping company). I encourage
people to add to this document; until such a time as a LINUX manual is
released (and from what I gather there's one in the works), this may be all
that some people will use to set their systems up. Any little bit will
help. If you do modify this, please leave your name, a date, and somewhere
online where people can contact you (even if it's a national echo on a
I can be contacted at the following locations:
"When Gravity Fails BBS", Washington D.C. (202) 686-9086
(Leave all assaults and inquiries in the "LINUX" message base.)
"Enlightened BBS", Alexandria, VA (703) 370-9528
(Leave all messages in the "UNIX" message base.)
(Just to be safe, the Sysops of these BBSii are in no way responsible for
the information contained in this file. They're absolved just as I and the
rest of this document's authors are, covered by the DISCLAIMER at the
beginning of this file.)
Or, you can contact any of the other people that have decided to modify
Using MS-DOS to make make a Linux partition on a harddisk.
The following was added on 3-21-92 by Gary Kahn. It is heavily based
on an Internet posting by Drew Eckhardt (2-25-92).
Since I don't have any of the MS-DOS "power tools" which edit drive
partitions, I needed to find a way to create a Linux partition using only
my MS-DOS 5.0 tools. Here are the steps I went through to get my harddisk
ready to accept Linux v0.12, and the steps that I recommend that others
try. I started with a 200M harddisk which contained only one partition,
the primary DOS, bootable partition.
0. Read all of the steps first. You may not want to use this method at
all. All data on drive C: will be lost. If you haven't done so already,
get a hardcopy of this text file before beginning the other steps.
1. Back up the harddisk. Using MS-DOS' FDISK.EXE will cause all data on
the drive to be lost.
1A. Make a bootable DOS floppy, of a type which will work in your A: drive,
with (at least) the following on it:
MS-DOS system files (IO.SYS, MS-DOS.SYS, COMMAND.COM)
DEBUG.EXE (the low-tech partition editor)
FDISK.EXE (to examine the partitions)
FORMAT.COM (to format the new, shrunken drive C:
SYS.COM (probably not needed, but 13K isn't that much space)
CHKDSK.EXE (nice to have, not necessary)
ATTRIB.EXE (nice to have, not necessary)
2. Use MS-DOS' FDISK.EXE to
a) Delete the current primary DOS partition.
b) Create a new primary DOS partition which is of the size that you
want to reserve for DOS. Make it the "active" partition. [My system
currently boots with MS-DOS normally. Linux only boots if I insert
the Linux "BOOTU" floppy. I used Erik's instructions, above, to
make the harddisk partition the "root".]
c) Create an extended DOS partition which takes up the rest of the drive.
3. The computer, at this point, can no longer be booted off of drive C:.
Reboot off of the bootable floppy mentioned above. I don't recommend
re-populating the new C: partition yet. That can wait until after
Linux has been successfully installed. There is no need to reformat and
reinstall the DOS files twice (if something goes wrong).
4. Type in the following lines, but not the DOS prompts or the comments
following the ";".
A:>debug ; Start DOS DEBUG.
-a100 ; Start entering a assembly language program
; at 0100H.
xxxx:0100 mov ax,0201 ; The "xxxx:0100" will be generated
; automatically by DEBUG. "xxxx" will be a
; 4-digit hex number. Ignore it.
xxxx:0103 mov bx,0200
xxxx:0106 mov cx,0001
xxxx:0109 mov dx,0080 ; Change this to "0081" if you're working on
; the partition table for the second harddisk.
; 0080 is for the first harddisk.
xxxx:010C int 13
xxxx:010E int 20
;This program reads (AH=02) one sector (AL=01) from head 0 of the first
;harddrive (DH=0, DL=80) into the data buffer at offset 200H (BX=0200)
;from cylinder 0 sector 1 (CX=0001) by calling Interrupt 13H. Then, the
;program terminates in a dangerous and no-longer-recommended manner (INT 20H).
-g=0100 ; Now execute the program which starts at
; 0100H. After execution completes, the
; partition table is in memory at 0200H
Program terminated normally
-a0100 ; Alter the program to write back to disk.
xxxx:0100 mov ax,0301
-d 3be ; Dump the bytes starting with 03BEH. This is
; the partition table, which consists of 4
; entries of 16 (decimal) bytes each.
xxxx:03B0 80 01
xxxx:03C0 01 00 06 0B E4 2A 24 00-00 00 6C 58 05 00 00 00
xxxx:03D0 C1 2B 05 0B E4 B8 90 58-05 00 A0 EF 00 00 00 00
xxxx:03E0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
xxxx:03F0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 55 AA
xxxx:0400 06 2E 89 2E D7 88 F8 59-5D C3 26 80 7E 00 00 74
xxxx:0410 03 45 EB F6 45 C3 2E 80-0E D0 88 10 E8 C6 FF 72
xxxx:0420 4A 2E 80 26 D0 88 EF 50-2E A1 D3 88 2B C6 2E 01
xxxx:0430 06 D1 88 58 2E 8B 36 D3-88 2E 80 3C 00 75
The first byte of each entry in the table indicates bootable ("80")
or not bootable ("00"). If the byte at 03BE is not an 80, as above,
quit and get help from someone else. There's something wrong, since
you made the DOS partition bootable in step 2. The entries in the
partition table start at 03BE, 03CE, 03DE, and 03EE.
The 4th byte of each table entry (bytes 03C2, 03D2, 03E2, and 03F2)
indicates the type of partition. The following are the types recognized
by DOS' FDISK:
01 primary DOS with 12-bit FAT
02, 03 Xenix
04 primary DOS with 16-bit FAT
05 extended DOS
06 primary DOS with 16-bit FAT
The DEBUG dump above shows a primary DOS (16-bit FAT) bootable partition
for the first entry; an extended DOS partition, non-bootable, for the second
entry; and all 0's, meaning non-existent partitions, for the last 2 entries.
Since Erik said (above) that Linux' fdisk doesn't handle extended DOS
partitions very well as of v0.12, I changed the partition type for my
second partition from 05 (extended DOS partition) to 03 (Xenix partition).
-e 3d2 05.03 ; Change the byte.
-g=0100 ; Write the table out to disk again.
Program terminated normally
-q ; quit DEBUG.
Now run DOS' FDISK again to make sure that the changes were done
correctly. Just display the partitions. Don't change them. This is
what I got:
| Display Partition Information
| Current fixed disk drive: 1
| Partition Status Type Volume Label Mbytes System Usage
| C: 1 A PRI DOS 171 FAT16 85%
| 2 XENIX 30 15%
| Total disk space is 201 Mbytes (1 Mbyte = 1048576 bytes)
From this point on, follow Erik's instructions, above. Linux' "fdisk"
program will be able to see the partition, although it won't recognize
it as a XENIX partition. I also tried "FF" as a partition type byte.
It worked. DOS' FDISK showed a partition type of TABLE, and "fdisk"
again showed an "unknown" partition type. I switched to Xenix so that
there would be some indication that there was a Unix partition on the drive.
Note that I did not make the 2nd partition "primary" or "active" in any
way. It doesn't seem to have had any effect, since both DOS and Linux work
on my harddrive. I have not attempted to make Linux boot without a floppy
I can be reached most easily via the RIME. I post and receive messages
at the JIMDREAM node.