home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / linux / 9142 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  9.0 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!unmvax!uservx.plk.af.mil!simonich
  2. From: simonich@uservx.plk.af.mil
  3. Newsgroups: comp.os.linux
  4. Subject: How I LILOed
  5. Message-ID: <1992Aug26.110711.35901@uservx.plk.af.mil>
  6. Date: 26 Aug 92 11:07:10 GMT
  7. Organization: Phillips Laboratory - Kirtland AFB
  8. Lines: 254
  9.  
  10. I am a firm believer in specific examples for software.  Therefore,
  11. for the (possible) help it may provide to other newbies here
  12. is what I did to boot from my hard disk.  
  13.  
  14. Note: most of this information is in the READMEs for pfdisk
  15. and LILO.
  16.  
  17. My configuration is:
  18.  
  19.          386SX20 w/387
  20.          8 mb ram
  21.          SCSI disk ST-02 and 84 mb seagate disk
  22.          2 partitions (20 mb dos/ 64 mb Linux extended fs)
  23.          GCC 2.2.2(d) fix5
  24.          Linux 0.97pl2 installed in /usr/src/linux
  25.  
  26. step 1:  get LILO from tsx-11.mit.edu (pub/linux/???????)
  27.          pfdisk from tsx-11.mit.edu (pub/linux/??????????)
  28.  
  29. step 2:  zcat and untar pfdisk.  (I put the files in usr/src/pfdisk)
  30.  
  31. step 3:  edit pfdisk.c and delete lines 30 and 31:
  32.  
  33.                 typedef unsigned int uint;
  34.                 typedef unsigned long ulong;       
  35.  
  36.          (they're now defined in /usr/include/linux/types.h)
  37.  
  38. step 4:  make pfdisk
  39.  
  40.                 make CC=gcc pfdisk
  41.  
  42. step 5:  uncompress and untar lilo 4 source and binaries into 
  43.          /usr/src/lilo
  44.  
  45.               cd /usr/src
  46.               zcat <lilo.s.4.tar.Z | tar xv
  47.               zcat <lilo.b.4.tar.Z | tar xv
  48.               cd lilo
  49.  
  50. step 6:  get a copy of dparam.com from lilo onto a dos readable
  51.          disk
  52.  
  53.               mount -t msdos /dev/sda1 /mnt
  54.               cp dparam.com /mnt
  55.  
  56. step 7:  reboot MS-DOG
  57.          there should be a file dparam.com in the root -- run it
  58.  
  59.          c>dparam 0x80
  60.            34 6 812
  61.  
  62.          write these numbers down - you'll need them.
  63.          My Seagate has 34 sectors, 6 heads, and 812 cylinders
  64.  
  65.          format a floppy disk for future use.
  66.  
  67. step 8:  reboot Linux
  68.          cd /usr/src/lilo
  69.          apply Werner's one line patch to lilo/geometry.c
  70.  
  71. patch included here:
  72. ______________________________________________________
  73. LILO Alpha.4 fails when running the 0.97-pl2 kernel: it mumbles something
  74. about holes in the map file and refuses to build a new map file.
  75.  
  76. Naturally, there are no such holes. The problem is that it gets confused
  77. about the block size because 0.97-pl2's stat pretends to use 512 byte
  78. blocks, although it still uses 1024 byte blocks.
  79.  
  80. This patch works around it:
  81.  
  82. *** geometry.orig    Mon Aug 24 21:53:28 1992
  83. --- geometry.c    Mon Aug 24 21:53:31 1992
  84. ***************
  85. *** 165,170 ****
  86. --- 165,171 ----
  87.           die("Incompatible block size: %d\n",st.st_blksize);
  88.       geo->spb = st.st_blksize/SECTOR_SIZE;
  89.       }
  90. +     geo->spb = 2;
  91.       return geo->fd;
  92.   }
  93.   
  94.  
  95. Note: alpha.3 and earlier didn't try to determine the block size and
  96. therefore don't have this problem.
  97.  
  98. - Werner
  99. -- 
  100.    _________________________________________________________________________
  101.   / Werner Almesberger, ETH Zuerich, CH      almesber@nessie.cs.id.ethz.ch /
  102.  / IFW A44  Tel. +41 1 254 7213                 almesberger@rzvax.ethz.ch /
  103. /_BITNET:_ALMESBER@CZHETH5A__HEPNET/CHADNET:_[20579::]57414::ALMESBERGER_/
  104. _____________________________________________--
  105.  
  106.          If you know how to apply patchs - do it, else
  107.          insert 
  108.                  geo->spb = 2;
  109.          at line 168 and press on.
  110.  
  111. step 9:  make lilo.  edit the Makefile and change:
  112.             
  113. CC=cc    -->  CC=gcc
  114. CPP=cpp  -->  $(CC) -E
  115. $(CPP) `./lilo -S` first.S first.s
  116.              -->  $(CPP) `./lilo -S` first.S -o first.s
  117. $(CPP) `./lilo -S` second.S second.s  
  118.              -->  $(CPP) `./lilo -S` second.S -o second.s
  119. $(CPP) `./lilo -S` chain.S chain.s  
  120.              -->  $(CPP) `./lilo -S` chain.S -o chain.s
  121.  
  122.           and make LILO
  123.  
  124.                make install
  125.  
  126. step 10:  When you made the Linux kernel a file /usr/src/linux/Image
  127.           was generated.  Move it to /etc
  128.  
  129.               mv /usr/src/linux/Image /etc/lilo
  130.  
  131. step 11:  Edit the /etc/lilo/disktab file to reflect your disks.
  132.           mine looks like this:
  133.  
  134. # /etc/lilo/disktab  -  LILO disk parameter table
  135. #
  136. # This table contains disk parameters for SCSI disks and non-standard
  137. # parameters of IDE disks. Parameters in disktab _always_ override
  138. # auto-detected disk parameters.
  139. # Dev.    BIOS    Secs/    Heads/    Cylin-    Part.
  140. # num.    code    track    cylin.    ders    offset
  141.  
  142. 0x800    0x80    34    6    812    0    # /dev/sda
  143. 0x801    0x80    34    6    812    34    # /dev/sda1
  144. 0x802    0x80    34    6    812    41004    # /dev/sda2
  145.  
  146. Note: the sects, heads, and cyls are from dparam (step 7), part offset
  147. is from the information Linux displays when it boots.
  148.  
  149. Step 12:  Prepare a floppy boot disk using the formatted disk from 
  150.           step 7:
  151.  
  152.               cd /etc/lilo 
  153.               ./lilo -b /dev/fd0 -i boot.b -v -v -v Image
  154. ________________________________________________________________
  155. output:
  156. LILO version 0.4
  157. Written 1992 by Werner Almesberger
  158.  
  159. Reading boot sector from dev/fd0
  160. Merging with /etc/lilo/boot.b
  161. Device 0x0802: BIOS drive 0x80, 6 heads, 812 cylinders,
  162.                34 sectors. Partition offset: 41004 sectors.
  163. Secondary loader: 2 sectors.
  164. Device 0x0802: BIOS drive 0x80, 6 heads, 812 cylinders,
  165.                34 sectors. Partition offset: 41004 sectors.
  166. Boot image: /etc/lilo/Image
  167. Device 0x0802: BIOS drive 0x80, 6 heads, 812 cylinders,
  168.                34 sectors. Partition offset: 41004 sectors.
  169. Mapped 549 sectors.
  170. Added Image
  171.     <dev=0x80,hd=5,cyl=12,sct=83>,root=0x0802,swap=0x0000
  172. Map file size: 4096 bytes.
  173. Writing boot sector.
  174. ________________________________________________________________
  175.  
  176. reboot from the floppy.
  177.  
  178. Step 13:  If that worked, prepare to boot from the hard disk:
  179.  
  180.               cd /etc/lilo 
  181.               ./lilo -b /dev/sda2 -i boot.b -v -v -v Image
  182.  
  183. Note:  the boot file to merge is the partition boot recored 
  184.        (/dev/sda2) not the MBR. 
  185.  
  186. Step 14:  save MBR data
  187.  
  188.            mkfs /dev/fd0 1440 #make floppy a linux fs
  189.            mount /dev/fd0 /a  # mount it
  190.            cd /usr/src/pfdisk
  191.            ./pfdisk /dev/sda  # run pfdisk on the WHOLE disk
  192.            g 812 6 34         # tell pfdisk the disk parameters
  193.            r                  # read the MBR
  194.            w /a/boot.save     # save in case of disaster
  195.            r bootactv.bin     # get the new MBR
  196.            w                  # save it
  197.            l                  # list partition table
  198. ________________________________________________________________
  199. output:
  200. #  ID  First(cyl)  Last(cyl)  Name  # start, length (sectors)
  201. 1   4      0        200             # 34, 40970
  202. 2   5    201        811             # 41004, 124644
  203. 3   0      0          0             # 0, 0
  204. 4   0      0          0             # 0, 0
  205. active: 1
  206. ________________________________________________________________
  207.  
  208.            1  4  0   200 MSDOG    # define partition 1
  209.            2  5  201 811 Linux    # define partition 2
  210.  
  211. Note: the id, first, and last cylinders must match what is
  212.       already on the disk or you will have to reformat the disk.       
  213. ________________________________________________________________
  214.  
  215.            l                  # list partition table
  216. ________________________________________________________________
  217. output:
  218. #  ID  First(cyl)  Last(cyl)  Name  # start, length (sectors)
  219. 1   4      0        200       MSDOG # 34, 40970
  220. 2   5    201        811       Linux # 41004, 124644
  221. 3   0      0          0             # 0, 0
  222. 4   0      0          0             # 0, 0
  223. active: 1
  224. ________________________________________________________________
  225.            wq                 # Write the partition table and exit
  226.  
  227. step 14:  Disable the automatic boot
  228.  
  229.           fdisk /dev/sda
  230.           a                        #toggle the active flag
  231.           1                        #for partition 1
  232.           w                        #write and exit
  233.  
  234. Step 9999:  reboot from the hard disk and select the partition 
  235.             to boot from.
  236.  
  237. Notes:    This is very much a case of the blind leading the blind.
  238.           I have done this once and it worked.  If any of the
  239.           wizards have comments, feel encouraged to post them.
  240.  
  241.           This will probably generate more questions than it
  242.           answers but maybe it will answer at least a few questions.
  243.  
  244.           When in doubt read the READMEs carefully.  I did and I
  245.           didn't have to remake my disk even once. (beginners luck?)
  246.  
  247. WARNING:  This sequence worked for me, however, you are messing
  248.           with the Master Boot Record and the disk partition
  249.           tables.  If you screw it up your ENTIRE disk could
  250.           be trashed.
  251.                   
  252.                      HAVE BACKUP COPIES OF EVERYTHING.
  253.                                            ^^^^^^^^^^
  254.                      Read the READMEs
  255.                      MAKE SURE YOU HAVE BACKUP COPIES OF EVERYTHING.
  256.                                                          ^^^^^^^^^^
  257.                      Make sure your backup copies (see above) are
  258.                        on FLOPPY disks.
  259.                      Can you REALLY regenerate your system from 
  260.                        the FLOPPIES?
  261.                      Ask questions BEFORE you make an irrevocable change
  262.  
  263.  
  264.