03Mar2004 Here are some notes regarding my recent project to repartition my Armada 7730 laptop in order to add a 100MB MSDOS partition to the (primary) Slackware 8.1.01 Linux setup. The resulting configuration has these partitions: 1) The Compaq diagnostics/setup partition; this partition was completely rebuilt using the diagnostics/setup floppies. 2) The new 100MB DOS 6.22 partition. 3) A Linux swap partition. 4) An "extended partition", which is the last primary partition, and whose space overlaps the 5th and 6th (secondary) partitions. 5) A Linux partition, which constitutes the bulk of the disk. 6) A small MSDOS partition at the end of the disk, which exists solely as a data partition for the Compaq diagnostics and setup program. LESSONS LEARNED 1) It _does_ work to recreate the diagnostic partition from the Compaq diagnostics and setup floppies, but the diagnostics partition evidently MUST be the FIRST PARTITION on the disk. 2) It definitely works out better to specify partition sizes in 'cylinders' instead of megabytes, and using the Linux 'fdisk' program is the most straight-forward way to accomplish this. 3) Creating and altering DOS 6.22 compatible partition tables and partitions using Linux tools, as suggested in the HOWTOs, _is_ more than a little tricky, but it _can_ be done. The successful approach that I arrived at and describe here used a second Linux tool, 'parted', in addition to Linux 'fdisk'. But beware; besides writing itself to a floppy disk, 'parted' ended up being used ONLY to write an empty partition table to the harddrive at the start of the installation. An earlier attempt to use 'parted' itself to create the partition table entries failed ignominiously when it declared that it was impossible to align the last partition properly because of way _someone_ (itself!) had aligned the second-last partition. This episode motivated me to revert to using units of cylinders for specifying the partitions sizes and consequently to using Linux fdisk for that purpose. PREPARING A 'PARTED' FLOPPY I downloaded 'parted-1.6.6.tar.gz' on my desktop Linux system, unpacked it, and then: # ./configure --disable-shared --enable-all-static --disable-nls # make This created a 2357583 byte statically linked executable, so I manually ran # strip parted which reduced the executable size to 833508 bytes. Then: # make install which just copied the executable to /usr/local/sbin/parted. Then, following the suggestions in 'parted.txt' file from the 'parted' site, I used the new executable to format a floppy and write itself to the floppy: # cd /usr/local/sbin [put a floppy in the drive] # ./parted /dev/fd0 mklabel loop mkpartfs primary ext2 0 1.4 # mount -t ext2 /dev/fd0 /mnt/floppy # cp parted /mnt/floppy GENERAL PROCEDURE TO CREATE PARTITIONS 1) Boot the Slackware boot/installation floppies, which creates a ramdisk based filesystem, and using the root shell to write zeroes to the first 10000 sectors on the harddrive: # dd if=/dev/zero of=/dev/hda bs=512 count=10000 This step is to get rid of all traces of the old partition table and of the first old Compaq diagnostics partition's copy of the partition table. 2) Still in the root shell on ramdisk, mount the 'parted' floppy' and use 'parted' to write a new empty partition table on the harddrive: # cd / # mkdir floppy [insert the 'parted' floppy] # mount -t ext2 /dev/fd0 /floppy # /floppy/parted [ I believe that at this point 'parted' displayed something like this: ] [ ] [ Using /dev/hda ] [ Error: unable to open /dev/hda - unrecognized disc label. ] [ Information: The operating system thinks the geometry ] [ on /dev/hda is 525/128/63. ] [ ] [ Ignore it and carry on. ] (parted) mklabel msdos [accepted without complaint] (parted) help [to discover the 'quit' command] (parted) quit 3) Still in the root shell on ramdisk, create the partitions using 'fdisk': - Define the first primary partition starting at cylinder 1 and ending at cylinder 3, and set the type code to 0x12. - Define the second primary partition, starting at cylinder 4 and ending at cylinder 28, and set the type to 0x06. - Define the third primary partition, starting at cylinder 29 and ending at cylinder 60, and set the type to 0x82. - Make the second partition "active" (bootable) instead of the first partition, which somehow became bootable by default. - Define the extended (fourth) partition, starting at cylinder 61 and ending at cylinder 525. - Define the first [logical] partition, starting at cylinder 61 and ending at cylinder 518, and set the type to 0x83. - Define the second [logical] partition, starting at cylinder 519 and ending at cylinder 525, and set the type to 0x04. - Write the partition table to the harddrive Here are the resulting partition lists (cylinders and sectors): Disk /dev/hda: 128 heads, 63 sectors, 525 cylinders Units = cylinders of 8064 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 1 3 12064+ 12 Compaq diagnostics /dev/hda2 * 4 28 100800 6 FAT16 /dev/hda3 29 60 129024 82 Linux swap /dev/hda4 61 525 1874880 5 Extended /dev/hda5 61 518 1846624+ 83 Linux /dev/hda6 519 525 28192+ 4 FAT16 <32M Disk /dev/hda: 128 heads, 63 sectors, 525 cylinders Units = sectors of 1 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 63 24191 12064+ 12 Compaq diagnostics /dev/hda2 * 24192 225791 100800 6 FAT16 /dev/hda3 225792 483839 129024 82 Linux swap /dev/hda4 483840 4233599 1874880 5 Extended /dev/hda5 483903 4177151 1846624+ 83 Linux /dev/hda6 4177215 4233599 28192+ 4 FAT16 <32M 4) Still in the root shell on ramdisk, cleared the first sector of the two DOS partitions: # dd if=/dev/zero of=/dev/hda2 bs=512 count=1 # dd if=/dev/zero of=/dev/hda6 bs=512 count=1 5) Boot the DOS 6.22 floppy and checked the partitions from the DOS fdisk point of view: Partition Status Type Volume Label Mbytes System 1 Non-DOS 12 C: 2 A PRI-DOS 98 FAT16 3 Non-DOS 126 4 EXT DOS 1831 and logical drive information: Drv Volume Label Mbytes System D: 28 FAT16 6) Formated the DOS partitions using the DOS format program: a:\> format c: /s a:\> format d: 7) Copy autoexec.bat, config.sys, and as much of DOS as desired from floppy to the harddrive. 8) Write a master boot record on the harddrive using DOS fdisk: a:\> fdisk /mbr At this point you can boot DOS from the harddrive, and I actually did this in order to experiment with a 'umsdos' file system on the DOS partition as a source for the basic Slackware installation 'packages'. This was really unnecessary, though; see below. REINSTALLING SLACKWARE LINUX I reinstalled Slackware in several stages because both the floppy drive and the CDROM drive on the 7730 kept failing; but when I finally realized that just turning off power and waiting an hour or so would restore them to normal operation, the Linux installation went routinely. Since I did the Linux installation in several sessions anyway, I took the trouble to manually restore and adapt several important configuration files from _the previous_ Slackware installation before ever booting from the harddrive, and this paid off ... the first boot went without a hitch. Here are the files: vvvvvvvvvvvvvvvvvvvvvvv /etc/sysconfig/pcmcia vvvvvvvvvvvvvvvvvvvvvvvvvvv # 02/01/2004 Manually edited for Slackware 8.1.01 on the 7730 as per # suggestion posted by Mark A Phillips and successful # with two earlier 7730 installations. PCMCIA=yes PCIC=i82365 PCIC_OPTS="irq_list=9,10" # any 2 free IRQ's will do CORE_OPTS= ^^^^^^^^^^^^^^^^^^^^^^^ /etc/sysconfig/pcmcia ^^^^^^^^^^^^^^^^^^^^^^^^^^^ vvvvvvvvvvvvvvvvvvvvvvvvvv /etc/modules.conf vvvvvvvvvvvvvvvvvvvvvvvvvvvv alias sound-slot-0 sb options opl3 io=0x388 options sb io=0x220 irq=5 dma=1 ^^^^^^^^^^^^^^^^^^^^^^^^^^ /etc/modules.conf ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ vvvvvvvvvvvvvvvvvvvvvvvvvv /etc/X11/XF86Config vvvvvvvvvvvvvvvvvvvvvvvvvv # Compaq Armada 7730MT, on XF86 4.2.0, 09/30/2002, LGE # # Copyright (c) 1999 by The XFree86 Project, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # # Except as contained in this notice, the name of the XFree86 Project shall # not be used in advertising or otherwise to promote the sale, use or other # dealings in this Software without prior written authorization from the # XFree86 Project. # Section "Module" Load "dbe" # Double buffer extension SubSection "extmod" Option "omit xfree86-dga" # don't initialise the DGA extension EndSubSection Load "type1" Load "freetype" EndSection Section "Files" RgbPath "/usr/X11R6/lib/X11/rgb" FontPath "/usr/X11R6/lib/X11/fonts/local/" FontPath "/usr/X11R6/lib/X11/fonts/misc/" FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/Type1/" FontPath "/usr/X11R6/lib/X11/fonts/Speedo/" FontPath "/usr/X11R6/lib/X11/fonts/75dpi/" EndSection Section "ServerFlags" EndSection Section "InputDevice" Identifier "Keyboard1" Driver "Keyboard" Option "AutoRepeat" "500 30" Option "XkbRules" "xfree86" Option "XkbModel" "pc101" Option "XkbLayout" "us" EndSection Section "InputDevice" Identifier "Mouse1" Driver "mouse" Option "Protocol" "PS/2" Option "Device" "/dev/mouse" Option "Emulate3Buttons" EndSection Section "Monitor" Identifier "LCD Panel 800x600" HorizSync 31.5-48.5 VertRefresh 50-90 Modeline "800x600" 36 800 824 896 1024 600 601 603 625 EndSection Section "Device" Identifier "S3 Aurora64V+" Driver "s3" VideoRam 2048 EndSection Section "Screen" Identifier "Screen 1" Device "S3 Aurora64V+" Monitor "LCD Panel 800x600" DefaultDepth 16 Subsection "Display" Depth 16 Modes "800x600" "640x480" ViewPort 0 0 EndSubsection Subsection "Display" Depth 24 Modes "800x600" "640x480" ViewPort 0 0 EndSubsection EndSection Section "ServerLayout" Identifier "Simple Layout" Screen "Screen 1" InputDevice "Mouse1" "CorePointer" InputDevice "Keyboard1" "CoreKeyboard" EndSection ^^^^^^^^^^^^^^^^^^^^^^^^^^ /etc/X11/XF86Config ^^^^^^^^^^^^^^^^^^^^^^^^^^ vvvvvvvvvvvvvvvvvvvvvvvvvvvv /etc/lilo.conf vvvvvvvvvvvvvvvvvvvvvvvvvvvvv # LILO configuration file /etc/lilo.conf # # 02/01/2004 LGE's Compaq 7730MT on Slackware 8.1.01. Note: disk has been # repartitioned to add a _real_ DOS 6.22 partition, and now # the partitions are in disk order. # # Global parameters boot = /dev/hda vga = normal prompt timeout = 50 default = linux lba32 # Individual boot options image = /boot/vmlinuz root = /dev/hda5 label = linux read-only other = /dev/hda2 label = dos other = /dev/hda1 label = compaq ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /etc/lilo.conf ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv /etc/fstab vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv /dev/hda3 swap swap defaults 0 0 /dev/hda5 / ext2 defaults 1 1 /dev/hda2 /dos_c msdos defaults,ro 0 0 /dev/hda6 /dos_d msdos defaults,ro 0 0 /dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner 0 0 none /dev/pts devpts gid=5,mode=620 0 0 none /proc proc defaults 0 0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /etc/fstab ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NOTE NOTE NOTE: the above files were installed while running on a ramdisk system, after booting from a floppy or the CDROM; at _that_ time, the hard drive Linux partition was mounted on /mnt of the ramdisk system so that, for example, the '/etc/sysconfig/pcmcia' file given above appeared as '/mnt/etc/sysconfig/pcmcia', and so forth. Once I had /etc/lilo.conf as I wanted it, here is how I installed the lilo loader from the installation shell: # cd # lilo -C /mnt/etc/lilo.conf One final detail of the Linux installation worth noting came up only because I had manually installed the X series of packages instead of using the Slackware 'setup': I had to manually create the file /etc/X11/xinit/xinitrc; but since I had installed KDE and wanted to use _it_, this step amounted only to creating a symbolic link, which I did _after_ booting the Linux system from the harddrive: # cd /etc/X11/xinit # ln -s xinitrc.kde xinitrc After this, I manually created my user account, logged in, ran 'startx', and went through the KDE setup procedure. REINSTALLING COMPAQ DIAGNOSTICS AND SETUP I discovered during previous experiments that this procedure works: 1) Use Linux 'fdisk' to reset the type code of the first (compaq diagnostics) partition to 0x00 (empty). 2) Boot the Compaq diagnostics floppy, and just follow the prompts to install the diagnostics and setup on the harddrive. 3) The next time you boot Linux, use 'fdisk' to check the partition table and observe that the type code of the first partition has been set back to 0x12 (Compaq diagnostics). Note that the way you actually use the Compaq diagnostics with the setup described here is to select 'compaq' from the Lilo boot prompt instead of 'linux' (the default). If you run Compaq diagnostics and want to save the data to disk, just change the (offered) default file name to "d:inspect.out" (for example) to save to the small DOS partition that was created for this purpose; it will appear as '/dos_d/inspect.out' under Linux. To run Compaq SETUP, boot 'compaq' as above, choose to run SETUP, and then boot 'compaq' _again_ when the system restarts.