home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!unmvax!uservx.plk.af.mil!simonich
- From: simonich@uservx.plk.af.mil
- Newsgroups: comp.os.linux
- Subject: How I LILOed
- Message-ID: <1992Aug26.110711.35901@uservx.plk.af.mil>
- Date: 26 Aug 92 11:07:10 GMT
- Organization: Phillips Laboratory - Kirtland AFB
- Lines: 254
-
- I am a firm believer in specific examples for software. Therefore,
- for the (possible) help it may provide to other newbies here
- is what I did to boot from my hard disk.
-
- Note: most of this information is in the READMEs for pfdisk
- and LILO.
-
- My configuration is:
-
- 386SX20 w/387
- 8 mb ram
- SCSI disk ST-02 and 84 mb seagate disk
- 2 partitions (20 mb dos/ 64 mb Linux extended fs)
- GCC 2.2.2(d) fix5
- Linux 0.97pl2 installed in /usr/src/linux
-
- step 1: get LILO from tsx-11.mit.edu (pub/linux/???????)
- pfdisk from tsx-11.mit.edu (pub/linux/??????????)
-
- step 2: zcat and untar pfdisk. (I put the files in usr/src/pfdisk)
-
- step 3: edit pfdisk.c and delete lines 30 and 31:
-
- typedef unsigned int uint;
- typedef unsigned long ulong;
-
- (they're now defined in /usr/include/linux/types.h)
-
- step 4: make pfdisk
-
- make CC=gcc pfdisk
-
- step 5: uncompress and untar lilo 4 source and binaries into
- /usr/src/lilo
-
- cd /usr/src
- zcat <lilo.s.4.tar.Z | tar xv
- zcat <lilo.b.4.tar.Z | tar xv
- cd lilo
-
- step 6: get a copy of dparam.com from lilo onto a dos readable
- disk
-
- mount -t msdos /dev/sda1 /mnt
- cp dparam.com /mnt
-
- step 7: reboot MS-DOG
- there should be a file dparam.com in the root -- run it
-
- c>dparam 0x80
- 34 6 812
-
- write these numbers down - you'll need them.
- My Seagate has 34 sectors, 6 heads, and 812 cylinders
-
- format a floppy disk for future use.
-
- step 8: reboot Linux
- cd /usr/src/lilo
- apply Werner's one line patch to lilo/geometry.c
-
- patch included here:
- ______________________________________________________
- LILO Alpha.4 fails when running the 0.97-pl2 kernel: it mumbles something
- about holes in the map file and refuses to build a new map file.
-
- Naturally, there are no such holes. The problem is that it gets confused
- about the block size because 0.97-pl2's stat pretends to use 512 byte
- blocks, although it still uses 1024 byte blocks.
-
- This patch works around it:
-
- *** geometry.orig Mon Aug 24 21:53:28 1992
- --- geometry.c Mon Aug 24 21:53:31 1992
- ***************
- *** 165,170 ****
- --- 165,171 ----
- die("Incompatible block size: %d\n",st.st_blksize);
- geo->spb = st.st_blksize/SECTOR_SIZE;
- }
- + geo->spb = 2;
- return geo->fd;
- }
-
-
- Note: alpha.3 and earlier didn't try to determine the block size and
- therefore don't have this problem.
-
- - Werner
- --
- _________________________________________________________________________
- / Werner Almesberger, ETH Zuerich, CH almesber@nessie.cs.id.ethz.ch /
- / IFW A44 Tel. +41 1 254 7213 almesberger@rzvax.ethz.ch /
- /_BITNET:_ALMESBER@CZHETH5A__HEPNET/CHADNET:_[20579::]57414::ALMESBERGER_/
- _____________________________________________--
-
- If you know how to apply patchs - do it, else
- insert
- geo->spb = 2;
- at line 168 and press on.
-
- step 9: make lilo. edit the Makefile and change:
-
- CC=cc --> CC=gcc
- CPP=cpp --> $(CC) -E
- $(CPP) `./lilo -S` first.S first.s
- --> $(CPP) `./lilo -S` first.S -o first.s
- $(CPP) `./lilo -S` second.S second.s
- --> $(CPP) `./lilo -S` second.S -o second.s
- $(CPP) `./lilo -S` chain.S chain.s
- --> $(CPP) `./lilo -S` chain.S -o chain.s
-
- and make LILO
-
- make install
-
- step 10: When you made the Linux kernel a file /usr/src/linux/Image
- was generated. Move it to /etc
-
- mv /usr/src/linux/Image /etc/lilo
-
- step 11: Edit the /etc/lilo/disktab file to reflect your disks.
- mine looks like this:
-
- # /etc/lilo/disktab - LILO disk parameter table
- #
- # This table contains disk parameters for SCSI disks and non-standard
- # parameters of IDE disks. Parameters in disktab _always_ override
- # auto-detected disk parameters.
- # Dev. BIOS Secs/ Heads/ Cylin- Part.
- # num. code track cylin. ders offset
-
- 0x800 0x80 34 6 812 0 # /dev/sda
- 0x801 0x80 34 6 812 34 # /dev/sda1
- 0x802 0x80 34 6 812 41004 # /dev/sda2
-
- Note: the sects, heads, and cyls are from dparam (step 7), part offset
- is from the information Linux displays when it boots.
-
- Step 12: Prepare a floppy boot disk using the formatted disk from
- step 7:
-
- cd /etc/lilo
- ./lilo -b /dev/fd0 -i boot.b -v -v -v Image
- ________________________________________________________________
- output:
- LILO version 0.4
- Written 1992 by Werner Almesberger
-
- Reading boot sector from dev/fd0
- Merging with /etc/lilo/boot.b
- Device 0x0802: BIOS drive 0x80, 6 heads, 812 cylinders,
- 34 sectors. Partition offset: 41004 sectors.
- Secondary loader: 2 sectors.
- Device 0x0802: BIOS drive 0x80, 6 heads, 812 cylinders,
- 34 sectors. Partition offset: 41004 sectors.
- Boot image: /etc/lilo/Image
- Device 0x0802: BIOS drive 0x80, 6 heads, 812 cylinders,
- 34 sectors. Partition offset: 41004 sectors.
- Mapped 549 sectors.
- Added Image
- <dev=0x80,hd=5,cyl=12,sct=83>,root=0x0802,swap=0x0000
- Map file size: 4096 bytes.
- Writing boot sector.
- ________________________________________________________________
-
- reboot from the floppy.
-
- Step 13: If that worked, prepare to boot from the hard disk:
-
- cd /etc/lilo
- ./lilo -b /dev/sda2 -i boot.b -v -v -v Image
-
- Note: the boot file to merge is the partition boot recored
- (/dev/sda2) not the MBR.
-
- Step 14: save MBR data
-
- mkfs /dev/fd0 1440 #make floppy a linux fs
- mount /dev/fd0 /a # mount it
- cd /usr/src/pfdisk
- ./pfdisk /dev/sda # run pfdisk on the WHOLE disk
- g 812 6 34 # tell pfdisk the disk parameters
- r # read the MBR
- w /a/boot.save # save in case of disaster
- r bootactv.bin # get the new MBR
- w # save it
- l # list partition table
- ________________________________________________________________
- output:
- # ID First(cyl) Last(cyl) Name # start, length (sectors)
- 1 4 0 200 # 34, 40970
- 2 5 201 811 # 41004, 124644
- 3 0 0 0 # 0, 0
- 4 0 0 0 # 0, 0
- active: 1
- ________________________________________________________________
-
- 1 4 0 200 MSDOG # define partition 1
- 2 5 201 811 Linux # define partition 2
-
- Note: the id, first, and last cylinders must match what is
- already on the disk or you will have to reformat the disk.
- ________________________________________________________________
-
- l # list partition table
- ________________________________________________________________
- output:
- # ID First(cyl) Last(cyl) Name # start, length (sectors)
- 1 4 0 200 MSDOG # 34, 40970
- 2 5 201 811 Linux # 41004, 124644
- 3 0 0 0 # 0, 0
- 4 0 0 0 # 0, 0
- active: 1
- ________________________________________________________________
- wq # Write the partition table and exit
-
- step 14: Disable the automatic boot
-
- fdisk /dev/sda
- a #toggle the active flag
- 1 #for partition 1
- w #write and exit
-
- Step 9999: reboot from the hard disk and select the partition
- to boot from.
-
- Notes: This is very much a case of the blind leading the blind.
- I have done this once and it worked. If any of the
- wizards have comments, feel encouraged to post them.
-
- This will probably generate more questions than it
- answers but maybe it will answer at least a few questions.
-
- When in doubt read the READMEs carefully. I did and I
- didn't have to remake my disk even once. (beginners luck?)
-
- WARNING: This sequence worked for me, however, you are messing
- with the Master Boot Record and the disk partition
- tables. If you screw it up your ENTIRE disk could
- be trashed.
-
- HAVE BACKUP COPIES OF EVERYTHING.
- ^^^^^^^^^^
- Read the READMEs
- MAKE SURE YOU HAVE BACKUP COPIES OF EVERYTHING.
- ^^^^^^^^^^
- Make sure your backup copies (see above) are
- on FLOPPY disks.
- Can you REALLY regenerate your system from
- the FLOPPIES?
- Ask questions BEFORE you make an irrevocable change
-
-
-