LOADLIN+WIN95 MINI-HOWTO Authored by: Chris Fischer v1.3.4, Revised: September 15, 1997 _________________________________________________________________ 1. Introduction: This document describes how to easily use a combination of Windows 95's Boot Menu and Loadlin.exe to autoboot Linux using the F4 Function Key. This procedure should work with Windows 95 versions 4.00.950 and 4.00.950a, and all versions of Linux that support Loadlin. If you prefer to use the LILO boot manager, please consult the Linux+Win95 Mini-HOWTO. This mini-HOWTO is posted first at The Linux+Windows 95 Reference Page, so check there to make sure you have the most recent revision of this mini-HOWTO. _** A Special Note for Windows 95 OSR2 (version 4.00.950b) users: **_ Do _NOT_ attempt dual booting with Windows 95 without first consulting the Windows 95 OSR2 FAQ. The FAQ also contains a great deal of information regarding FAT32. In a nutshell, if you have OSR2 and are using a FAT16 file system, you can still dual boot using the F4 Function Key. _NOTE: If you have Windows 95 OSR2, and are using a FAT32 file system, then the dual booting methods in this mini-HOWTO __will not work and should not be attempted_. However, there are a couple of alternate methods you can use to automate booting Linux at startup, which are discussed in Section 9. 2. Things that are assumed: A. You have successfully installed Windows 95. B. Windows 95 is installed on Drive C. C. You have successfully installed Linux. D. You know what partition Linux is installed on. E. LILO is NOT installed on your hard drive. F. If you are using Windows 95 OSR2 (version 4.00.950b), you have carefully read the Windows95 OSR2 FAQ. 3. Items you need before you start: A. A bootable floppy disk with DOS 5.0 or DOS 6.x system files (io.sys, msdos.sys, command.com) and a config.sys file. If you are using a DOS 5.0 boot disk, you will also need an autoexec.bat file. If you are using Windows 95 OSR2 (version 4.00.950b), you will also need to create a file called Winboot.sys with a text editor and place it in the root directory of Drive C. Winboot.sys can be an empty file, just so long as you have the file. _NOTE:_ If your hard drive already contains the autoexec.dos, config.dos, io.dos, msdos.dos, and command.dos files, then you will not need the floppy. You can check by typing: _dir __and__ dir /ah_ at the root of Drive C. Also, if you installed the Upgrade version of Windows 95, then it is likely that you have them. B. The Loadlin.exe program file. C. Your kernel image file, usually zImage or vmlinuz. (See the FAQ for INFO). D. A simple text editor, such as Notepad. 4. Getting Started: A. Determine what version of Windows95 you have. Boot your computer to Windows 95 and right click on the My Computer icon. Now left click on Properties. On the General tab, look under the "System:" line. There you will see the version number. _NOTE:_ If you have Windows 95 version 4.00.950b, _make certain you are __not__ using the FAT32 file system_. Double click the My Computer icon, then right click the Drive C icon. Left click on Properties. On the General tab, the "Type:" line will indicate whether or not you have a FAT32 file system. _If you are using the FAT32 file system, then go directly to _Section 9.Otherwise, continue with letter B. B. Run the Windows Explorer file manager program. C. On the Menu Bar, click on View, then click on Options. On the View Tab, make sure that the "Show all files" radio button is marked. Also, make sure that the line with "Hide MS-DOS file extensions for file types that are registered" is unchecked. Click on the OK button. _NOTE:_ If your hard drive already contains the *.dos files mentioned in the "NOTE:" of section 3A, then skip to the "NOTE:" between letters F and G. Otherwise, continue with letter D. D. Insert the DOS 5.0 or DOS 6.x bootable floppy into Drive A. Click on the Drive A icon so you can see the contents on the floppy disk. E. Rename each file to a .dos file extension. You can do this by single clicking on a file, pressing the F2 function key, and typing in the new name. Do not worry if you need the bootable floppy to work properly, just rename the files back after you are finished with this procedure. F. _EXTREMELY IMPORTANT:_ Make sure you rename the files on the floppy _BEFORE_ you copy them to Drive C. Otherwise you will overwrite your Windows 95 system files. _You have been warned_. Now, copy all files to the root directory of Drive C. One method is to click on the Drive A icon, press CTRL+A, press CTRL+C, click on the Drive C icon, and press CTRL+V. _NOTE:_ If you _do not_ have Windows 95 OSR2 (version 4.00.950b), please skip Section G. G. If (and only if) you have Windows95 version 4.00.950b, make sure you have a file named Winboot.sys in the root directory of Drive C, as stated in Section 3 above._Failure to have Winboot.sys in the root directory of Drive C will result in a system lockup should you attempt to boot to an earlier version of DOS._ _NOTE:_ If you are using a DOS 6.x boot disk skip to section 5, otherwise continue with letter H. H. Open Notepad. On the Menu Bar, click on Open. Change "Files of type" to "All files (*.*)". Change "Look in:" from Desktop to Drive C. Now open Config.dos by double clicking on the filename. Delete all the contents. This will create a 0K file...I will explain later. Save the file. I. Use Notepad to open and edit Autoexec.dos and type in the Loadlin command. The Loadlin command must be in the following syntax: Loadlin DriveLetter:\LinuxKernelFile root=/dev/LinuxBootPartition ro Here is my Autoexec.dos file as an example: Loadlin f:\vmlinuz root=/dev/hdc2 ro _NOTE:_ The kernel, as well as the Loadlin.exe, file may be anywhere on your hard drive as long as you reference the correct path. For example, if your kernel file was located in the directory e:\linux\kernels and Loadlin.exe was located in the directory c:\utils, you would use: c:\utils\loadlin e:\linux\kernels\vmlinuz root=/dev/hdc2 ro Save the file. _Please skip section 5 and go to _section 6_._ _________________________________________________________________ 5. *** Use this section ONLY if you are using a DOS 6.x boot disk. *** A. Open Notepad. On the Menu Bar, click on Open. Change "Files of type" to "All files (*.*)". Change "Look in:" from Desktop to Drive C. Now open Config.dos by double clicking on the filename. Delete all the contents. Now, you will need to enter the shell command with the following syntax: shell=loadlin.exe LinuxKernelFile root=/dev/LinuxBootPartition ro Here is my Config.dos file as an example: shell=f:\loadlin.exe f:\vmlinuz root=/dev/hdc2 ro _NOTE:_ The loadlin and kernel file may be anywhere on your hard drive as long as you reference the correct path. For example, if your loadlin file was in the directory f:\utils and the kernel file was located in the directory e:\linux\kernels you would use: shell=f:\utils\loadlin.exe e:\linux\kernels\vmlinuz root=/dev/hdc2 ro B. Save the file. _________________________________________________________________ 6. Almost Finished... A. One last file to edit and then you are finished. Use Notepad to open and edit Msdos.sys. Go to the [Options] section. Look for a line that has BootMulti=. If you do not find one then add it and set the value to 1. It should look something like: [Options] BootMulti=1 B. There may be other items listed. Just leave them. Now save the file. 7. You are Finished! Now all you have to do is reboot (Don't forget to remove the floppy disk). When you see "Starting Windows 95...", press the F4 Function Key and Linux should boot right up. 8. How It Works: Windows 95 has a built in Boot Menu. By default you do not see it at startup (although you can change that if you wish), but you can get to it by pressing the F8 Function Key when you see "Starting Windows 95...". On the menu you will see several options. The last option is "Previous version of MS-DOS". Instead of pressing F8 and then selecting "Previous version of MS-DOS", you can use the F4 shortcut by pressing F4 when "Starting Windows 95..." appears on the screen. When Windows 95 boots to the previous version of MS-DOS, it uses the files that end in the .dos file extension. This is why it is important to have a 0K Config.dos file if you are initiating Linux from the Autoexec.dos file. If Windows 95 does not find the files with a .dos extension while trying to boot the previous operating system, it will load the Windows 95 startup files. Therefore, if you do not have a Config.dos file, Windows 95 will load all the drivers in your Config.sys file. While this will not prevent Linux from loading, it will take longer. Having a 0K Config.dos file prevents Windows 95 from reading your Config.sys file while booting to the previous version of MS-DOS. 9. Alternate Methods for Auto-Booting Linux, Especially for Users With a FAT32 File System: This section will work for all versions of Windows 95 to date, regardless of whether you have a FAT32 file system. There are two methods I will discuss in this section. First, I'll start with the simplest. Method 1 This method uses the Autoexec.bat file to call (or execute) another batch file named Linux.bat, during boot up. A. Creat a Linux.bat file using a simple text editor such as EDIT or Notepad. The contents should be similar to the following: @echo off cls echo. echo. echo. echo. choice /t:y,5 "Do you wish to boot Linux? " if errorlevel 2 goto End c:\loadlin c:\vmlinuz root=/dev/hdc2 ro :End This batch file script clears the screen, adds four blank lines, displays the text in quotes + [Y,N], then waits 5 seconds for you to press a key. If you do not press a key within 5 seconds, it defaults to Y and runs Linux. If you select Y or N, the batch file determines what option you selected, then executes the selected option. For example, if you select 'N' then the batch file terminates and continues to process your Autoexec.bat file, which loads Windows 95. If you select Y, then of course Linux will load. If you do not want four blank lines before the text, modify the number of lines with _echo_. If you do not want the screen to clear, then remove the line with _cls_. The _/t_ switch tells the choice command to wait 5 seconds and, if no key is pressed, to default to Y. Change the _y_ to an _n_ if you want Windows 95 to boot after the 5 second timeout: _choice /t:n,5_. Also, you can change the amount of time to wait from 0 to 99 seconds. For more information on the _choice_ command, change to the c:\windows\command directory and type: _choice /?_ at the command prompt. _NOTE:_ You will have to modify the line that boots Linux to match your configuration. Please see Section 4.I for examples of how to configure Loadlin to boot to Linux. B. Next, create an Autoexec.bat file (if you don't already have one) with a simple text editor. Then, on the _first_ line, add the following: call c:\linux If Linux.bat is in another directory you will have to reference the correct path. For example if Linux.bat is in a directory called C:\batch, you would add: call c:\batch\linux to the first line of your Autoexec.bat file. Save and exit the file. Now all you need to do is reboot. You should be prompted on whether you want to boot Linux. Method 2 This method is a bit more involved, but offers the greatest flexibility. What this method does it create your own custom boot menu, though it does not replace the Windows 95 boot menu. You will need a Config.sys and an Autoexec.bat file. A. First you will need to define a Startup Menu in Config.sys (my comments to you are in parenthesis): [menu] menuitem=Linux, Boot to Linux (This defines a Menu Block and gives it a descri ption). menuitem=Win95, Boot to Windows 95 menucolor=15,1 (This gives a blue background with bright white text) menudefault=Linux, 15 (This sets the default menuitem and waits up to 15 secon ds for input). [linux] shell=f:\loadlin.exe f:\vmlinuz root=/dev/hdc2 ro (Please see Section 5 for exa mples and syntax). [win95] (Include the normal contents of your config.sys file here. If you did not have a config.sys file before now, then leave this section blank). Save and exit your Config.sys file. If you want, you can use this Config.sys template to get started. B. Next, edit your Autoexec.bat file (my comments to you are in parenthesis): goto %config% :linux (Leave this area blank. It's just here because it was defined in Config.sys). :win95 (Include the normal contents of your autoexec.bat file here. If you did not hav e an autoexec.bat file before now, then leave this section blank). Save and exit your Autoexec.bat file. If you want, you can use this Autoexec.bat template to get started. That should do it. The next time you reboot, you should get a Start Up menu with the option to boot to Linux or Windows 95. _________________________________________________________________ Frequently Asked Questions: A. Q: Where can I find more information on using Loadlin? _A:_ The Slackware 96 CD contains a file named loadlin.tgz in the \slackware\A5 directory. Unarchive the file and look in the \docs directory for a file named manual.txt. I do not know about earlier versions of Slackware. The RedHat 4.2 CD contains a file named loadlin16.tgz in the \dosutils directory. Unarchive the file and look in the \docs directory for a file named manual.txt. RedHat 4.1 does not seem to have this archive. The manual.txt is also available for download at: ftp://ftp.eskimo.com/u/p/praxis/manual.txt. Additional info. is available at: http://sunsite.unc.edu/LDP/HOWTO/BootPrompt-HOWTO-2.html#ss2.2 B. Q: I am not sure what partition Linux is installed on. How do I find out? _A:_ At a Linux shell prompt, run the fdisk utility and press "p". From there you should be able to tell. If you need additional help using fdisk, please consult the man pages. C. Q: Where do I find the kernel image file and how do I copy it to my MS-DOS partition? _A:_ To find your linux kernel file type: find / -name vmlinuz at a Linux shell prompt. This will search all Linux partitions for the vmlinuz file. If you have multiple vmlinuz files, then make sure you use the correct one. If you are not sure, then the safest bet would be to use the most recent one. To copy your linux kernel file to your DOS partition, you need to make your DOS partition visible to Linux, then mount the partition if it is not already. Generally, this should have been set up when you installed Linux. All you need to do next is change to the directory the vmlinuz file is in and copy it over to DOS using the cp command. However, if Linux was not set up to recognize your DOS partition, then copy vmlinuz to a floppy. Take any DOS formatted floppy (with enough disk space to hold your kernel image file) and insert it into your floppy drive. Type: mount /dev/fd0 /tmp at a Linux shell prompt. Then change to the directory your kernel image file is in and type: cp vmlinuz /tmp This will copy vmlinuz to your floppy disk and it will be readable by DOS. Shutdown Linux, boot to DOS, then copy vmlinuz to whichever directory you choose. If you recompile your kernel, do not forget to copy the new kernel image file to your DOS partition. This will overwrite your old file, so it might be a good idea to rename the old file first just in case the new one does not work properly. D. Q: Does it matter if I install Linux or Windows 95 first? _A:_ Technically no. However, it would be _much_ simpler to install Win95 first. That way it is easier to setup Linux to recognize your DOS partition(s) as you can usually do this during the Linux installation.. E. Q: What if I already dual boot between Windows 95 and Windows 3.x, and I want to boot to Linux using this method? _A:_ Frankly, if you want to do this I would recommend using LILO. However, if you really do not want to use LILO, you will have to boot to Win 3.x first, then issue the Loadlin command. (Make sure Windows 3.x is NOT running, but that you are in DOS 5.0 or 6.x). F. Q: Is it possible to initiate Linux from the Windows 95 desktop? _A:_ Yes. First create a batch file called linux.bat. For example, edit the file to contain a Loadlin command such as: loadlin f:\vmlinuz root=/dev/hdc2 ro Now save the file in the \windows\desktop directory. Next, right click on the Linux.bat icon, then left click on Properties. Now click on the Program tab, then click on the Advanced button. Click on the box next to MS-DOS mode and make sure the box next to "Warn before entering MS-DOS mode is checked". Click OK, then click on OK again. Now when you double click on the Linux icon, a warning box will appear before going into MS-DOS mode. If you click on Yes, then Windows enters MS-DOS mode and executes the Linux.bat file. _NOTE:_ You must be in MS-DOS mode in order to use Loadlin. Please see the manual.txt file mentioned in question A of this FAQ for more information. G. Q: Where do I get a plain text version of this document? _A:_You can get a plain text version of this document at: ftp://ftp.eskimo.com/u/p/praxis/loadlin.txt _________________________________________________________________ Credits: _A special thanks to Fred Harris and Norm Jacobowitz for helping me sort out the Windows 95 OSR2 issues and for helping me improve this mini-HOWTO._ _________________________________________________________________ Questions, comments, and suggestions are welcome. _Contact information:_ Chris Fischer Protek Computer Solutions protek@brigadoon.com or praxis@eskimo.com _________________________________________________________________ Copyright © 1997 Protek Computer Solutions.