"Linux Gazette...making Linux just a little more fun!"


Loadlin.exe Installer

By Bill Bennet


This makes a loadlin.exe button on a Windows95 desktop

How many times have you sat and waited for Windows to shut down while you rebooted? How many times have you read that "Please wait..." message? If I show you how to reboot in under one minute will you give it a try? Rhetorical questions all, yet there is a need for a fast reboot out of Windows if only to preserve your even temper and a sense of decorum. This little piece will install loadlin as your linux boot program and get you out of the Windows environment in under one minute. The by-product will be a login prompt for linux. I hope I do not get any complaints about this blatant effort to undermine the monopoly OS.

RedHat 5.1 can do this thing

Just about all linux distributions can do this little loadlin button on the desktop of DOS 7.0. The odd cat in the bunch is RedHat; an example is that they insist on loading up the /usr directory when /usr/local will do nicely. They have some quirks, but don't we all? This article fires up RedHat 5.1 and makes them fit in.

The RedHat installer will offer you a chance to add 'DOS and Windows connectivity'. Do it. This will let you mount the old DOS partition from linux and also allow you to copy your kernel image (vmlinuz) to a directory on the DOS partition to be booted by loadlin.exe.

The official RedHat position on LILO is a good one. They always offer to put LILO on the master boot record or the first sector of the first partition. This gives you a solid base to make your bootings work. They also let you skip the LILO installation.

Skip LILO

To use loadlin.exe, we will first skip LILO. The prompt in the RedHat installer asks you where to install LILO and I put the asterisk on the 'first partition' choice and Tab to the 'skip' choice and hit Enter.

When you startx, the control panel's linuxconf program (System Configuration) gives you a chance to set the 'Config-boot mode-LILO defaults' for your machine. Make sure that the 'LILO is used to boot this system' button is left 'up'.

All hail thenerd and his incessant questions!

(I got this idea from 'thenerd' in Portage la Prairie, Manitoba. The parents who own the machine did not want anything to change in the way that they played with their DOS. They did not want to have any changes in the bootup of their machine. So, if we boot from DOS to linux, they will never know about or see any 'LILO boot:' messages and they can remain fossilized.)

Make a bootdisk please

The RedHat installer asks you nicely if you will be making a boot disk and you will always answer 'yes'. Do not pass go. Go directly to 'yes'. You will thank me if you get those 'signal 11' errors (a whole other article). The beauty of this bootdisk is that you can experiment with boot time options for the kernel. Once you get linux rolling you can make a boot disk with the mkbootdisk command.

Fasten seatbelts during re-entry

After the install is complete, you will be rebooted. Pull out the boot disk because we are going back to DOS to set up the boot button. Since we do not have LILO on the master boot record, the system will boot DOS as usual. Yes I have made a big assumption about you installing linux AFTER the DOS is installed. It only makes sense when dealing with a predatory OS like DOS to let it think it has the whole system to itself. Once the master boot record is erased and overwritten by DOS you then can install a more sophisticated system like linux.

Special note on PartitionMagic 4.0

Direct from the technical support guru Will Erickson at powerquest.com: "PartitionMagic 4.0 does fully support Linux ext2 partitions. It is able to re-size them without any problems."

This is also the program to get for re-sizing your single FAT32 partition into something more reasonable, like maybe a linux web server and a personal linux workstation as well as a DOS game machine.

"The illegal operation occurred in this directory, Mr. Gates."

The directory for your linux kernel is your choice. Make one called 'c:\linux\kernels' and you can copy the 'linux.bat' verbatim. Now that we have a place for loadlin.exe to work, put it IN THE PATH. Do this by putting it in a DIRECTORY that is in the path. I already have a 'c:\utils' directory on the path and that is where you will find loadlin.exe.

The batch

The edit program works nicely for this batch file writing, but notepad will work for those of you without the command prompt. Here is the abbreviated linux.bat:

rem This ensures that any unwritten disk buffers are flushed

smartdrv /C

rem This loads up the kernel and boots linux

loadlin c:\linux\kernels\vmlinuz root=/dev/hda2 ro

Root equals what?

The '/dev/hda2' assumes that your linux boot partition is the second one on the first hard disk. Your special and unique installation gets entered as the 'root=your_root_partition_here'. The 'ro' will mount it 'read only' and that is just standard procedure. Do not make it 'rw' if you have not read about what pitfalls await.

Special linux power

My RedHat 5.1 partition is booting happily from /dev/hdc9 which is not any where near the 1024 cylinder limit; in fact it is 2 gigabytes over the limit. It is also on an extended partition. This is called a logical partition as opposed to a primary partition. The linux system of GNU components has got to be the most super-powered and adaptable OS on the market. It is booting without the BIOS from a logical partition in an extended partition that is 2 gigabytes over the 1024 cylinder limit. This is because loadlin.exe was developed by the linux web hacker method and the kernel folks and the LILO folks were included in the process. It is a powerful development model.

What is vmlinuz?

The vmlinuz is not there yet. It is the name you will give to your kernel image. We need to use the boot disk in a moment so that we can put a kernel in 'c:\linux\kernels'.

Save your 'linux.bat' in a directory ON THE PATH. I already have a 'c:\batches' directory that holds '.bat' files and this is where you will find 'linux.bat'.

The shortcut

At the DOS 7.0 desktop (Windows95 is just a window manager for DOS 7.0) you will now right click your rodent for the momentous creation of a new shortcut. Select your new 'linux.bat' with the 'browse' button beside the little command line window. Choose 'open' and it will be entered as the command line for your new shortcut.

Do a right click with your rodent on the new shortcut and select 'properties'. Then select 'program' and then the 'advanced' button. You need to make sure that your new batch will use the MS-DOS mode. You also need to use the current configuration, whatever that may be. The job is done.

Also give Microsoft a bit of credit for letting you choose a different icon.

The icon

If you right click your rodent on your new shortcut, the menu item 'properties' will get you to the 'change icon' button. Push de button and make it go.The choices are very nice and I have a personal attachment to the 'dynamite' icon. Perhaps you will choose the lightning bolt. Suffice it to say that what is about to happen to Windows is very swift and violent. My icon shows a detonator and some red sticks of dynamite and it is labelled 'LINUX'. It looks ominous and tempting, especially when Windows gets itself into a jam.

The last look at 'that message from Gates'.

You know, since I have installed the LINUX button, I use it to shut down Windows. The best part of this trick is that since I started using the LINUX button I have not seen 'that message'. You have seen it and you are just as ticked off by it as the rest of us. It says "It is now safe to turn off your computer." This one and that infernal "Your program has performed an illegal operation and will be shut down" message are probably the most offensive and arrogant messages from a supplier to its clients in the history of business relations. I thank the boys in Redmond, Washington for offending so many nice people. We are enjoying our linux boxes so much more when we reflect on the nice manners of our fellow travellers.

Time to test our work:

  1. make a new linux box without LILO
  2. make a boot disk for linux
  3. boot to DOS
  4. make a directory for the kernel
  5. write a batch file for loadlin.exe
  6. put the batch file on the path
  7. copy loadlin.exe to a directory on the path
  8. make a shortcut to the batch file on the desktop
  9. select or make a groovy icon for the shortcut
  10. select 'shutdown windows' for perhaps the last time
  11. boot the boot disk to linux
  12. read the rest of this drivel

The rest of this drivel

Now that the boot disk has you in linux, you "log in". You did remember your password and you are now called 'root' by your staff. Type the mc command and Enter. You will now be using mc (Midnight Commander) to finish the job.

The arrow keys will take you to '/boot'. Select 'vmlinuz-2.0.34-0.6' and then press Tab. Your cursor will jump to the other window.

Now we will actually do some 'linuxing'. Enter this:

mkdir /dos

Then Enter this:

mount -t vfat /dev/hda1 /dos

This '/dev/hda1' assumes that this is your DOS partition. Your special and unique setup will be entered as the "/dev/your_DOS_partition_here". It gets mounted on the /dos directory that you just created.

Then Enter this one:

cp /boot/vmlinuz-2.0.34-0.6 /dos/linux/kernels/vmlinuz

Oh yeah? Eat LeftAlt-F2!

Once these little commands are done, you will be able to navigate over to the '/dos' directory where your DOS partition is now visible and accessible from linux. Cool, eh?

If things are just too busy on the mc screens, you can hold Ctrl and press the letter 'o' to get back to the shell prompt. Ctrl-o again to get back to mc.

If you want to read documents and switch back and forth you can hold LeftAlt and press F2 to open another console; a virtual console. LeftAlt-F3 opens a third console. You get 64 of them with linux. Just log in again and fire up another version of mc or lynx or whatever. To get back, you select LeftAlt-F1. Four or five consoles should keep the average 'frantic reader' happy.

Copy the kernel to vmlinuz

The mc cursor is put on the kernel. It is in '/boot' and it is called 'vmlinuz-2.0.34-0.6' in RedHat 5.1. Tab to get your cursor into the other window. Here is why there are two of those windows:

"You get to see what you are doing."

Navigate to the '/dos' directory and then to the '/linux/kernels' directory.

Make sure the cursor is on the kernel. Tab over there now.

The kernel is highlighted in one window in '/boot' and the other window is in '/dos/linux/kernels'.

"F5 copy on two. Block somebody! Ready, break!"

Press F5. Voila! You get the copy window and all you have to do is hit Enter. The result? You now have a kernel image with the wrong name in the DOS partition.

Better yet, before you hit 'enter', type in the new name of your kernel:

/dos/linux/kernels/vmlinuz

The command line for these fiddlings is this:

cp /boot/vmlinuz-2.0.34-0.6 /dos/linux/kernels/vmlinuz

But I already did that

Caught me again. Yes, I got you to do something two different ways. Welcome to linux. Forgive me. I need you to open up your 'brain pathways', you see. The very best part of linux for me and a whole crew of other linuxians is that the computer is fun again. Isn't that why you got one in the first place?

The force is with you

Well, we have put a 'vmlinuz' kernel image in the DOS partition. Time to reboot.

Do NOT use the reset button. Your file system needs to be cleanly unmounted. Linux can 'fsck' and fix its way out of trouble but why tempt fate?

Type in this powerful command:

shutdown -r "now" (it also works without the quotes) This one does the reboot.

More power: shutdown -h "now" (this one does the halt of everything so you can turn off the machine)

Alternatively, RedHat and other distributions have implemented the 'Vulcan nerve pinch' so that folks switching from the 'crashing OS' can use Ctrl-Alt-Del to reboot.

Boot to DOS to boot to Linux

The Windows95 machine lets you select plain DOS mode at boot up. If you are just so impatient to see your test results, then boot to plain DOS mode.

Type in this fateful command:

linux

If you do want to see the fun stuff, let DOS do the bootgui thing all the way to the desktop.

"Thar she blows"

Sitting on your desktop is the ultimate affront to the 'powers that be' at Microsoft. Push that button and you destroy fifteen years of monopolistic avarice. Push that button and declare your right to freedom of expression. Push that button and stand up and be counted. Push that button and boot linux.

That about wraps it up from this desktop. Adios. Dynamite that sucker!

Reference reading and links:

BootPrompt-HOWTO - required reading for all linuxians

Bootdisk-HOWTO

Loadlin+Win95 mini-HOWTO

The RedHat Linux Installation Support FAQ - good basic stuff here

The Boycott Microsoft Page at www.vcnet.com/bms/

The home of RedHat at www.redhat.com

The home of PartitionMagic 4.0 at www.powerquest.com

The place to get ComputerHelperGuy easy-install files

The electronic mailbox of Bill Bennet

Windows footnote

It is a good idea to close all other programs before pushing your LINUX button. The boot process takes about three seconds before you are uncompressing linux and an elapsed time of 58 seconds to the login prompt. Your mileage may vary. Your DOS file system is left a-ok and properly 'unmounted', if it is correct to talk about a rebooting 'crashing OS' that way.

Example: I have seven little programs running at startup and I added Netscape and an editor. Then I pushed the LINUX button. Elapsed time to the linux login prompt was 65 seconds.

Make sure you save your work before you hit that button!

Booting footnote

If the darn thing won't 'mount -t vfat' the /dos partition, it probably can not find the module dependencies file in '/lib/modules/preferred'. This is no sweat. Type this:

man symlink

Read the manual page for symlink. Then cd to '/lib/modules' and make a symlink called 'preferred' that points to your '/lib/modules/your_kernel_name_here'.

The command line for this is:

ln -s /lib/modules/your_kernel_directory_name_here(put a single space here)/lib/modules/preferred

This is very easy with mc. Start with the mc command. Navigate over to '/lib/modules'.

Put the cursor on the '/lib/modules/your_kernel_name_here' directory.

Type F-9, then f (for file), then s (for symlink), then arrow down to 'Symbolic link filename:'.

Enter this:

/lib/modules/preferred

Then Enter this:

depmod -a

The job is done.

It is ok to delete it and redo it if you wish. Also, you can 'Esc-Esc' the Symlink window to cancel.


made with GNU Emacs 20.2.1 on an i486
running RedHat 5.1 Linux 2.0.35-2
No animals were eaten during the testing of these procedures.
All references to Mr. Gates are purely intentional.


Copyright © 1998, Bill Bennet
Published in Issue 34 of Linux Gazette, November 1998


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back  Next