68 - WEE (wee63) and WEEsetup.exe - an alternative bootloader

counter on tumblr

Unique hits

Introduction

Grub4dos is a 2-stage boot manager - the first stage is the boot code which is loaded by directly reading sectors from a disk by the BIOS when it first boots. This Stage 1 boot code then looks for and loads the 2nd stage file grldr which contains all the grub4dos functions that we know and love!

WEE is a small cut-down boot manager which is based on grub4dos. The main advantage of wee is that it does not need to load a secondary file like the grldr file because a much reduced version of the grldr code is contained within the boot code itself (sectors 1-62). Also, wee may be more successful at booting 'difficult' systems that don't seem to want to boot using grub4dos and just display a flashing cursor (as no 2nd stage grldr file is required).

Note that WEE does not access CD-ROMs/DVDs or ext4 filesystems. WEE supports FAT12/16/32, NTFS and ext2/3/4, currently (Jan 2012) - no other file systems are supported. It is best (i.e. more reliable) to use a WEE command to directly find and load a bootloader (such as NTLDR) rather than boot from a partition bootstrap directly..

WEE is part of the grubutils utilities. WEE is not suitable for use with Easy2Boot+Clover.

You can either:

install WEE to the boot disk boot track (it modifies/replaces the MBR and the following sectors, up to 63 sectors)

or

you can load WEE from a wee63.mbr file (for instance, you can use BCDEdit or EasyBCD to add a boot entry to the Windows 7 BCD so that you can boot to WEE and then from there boot to whatever you like.

WEE should only be used on modern systems (after the year 2000) as it only uses Extended Int 13h EBIOS calls. WEE can boot up from IO.SYS (Win9x), KERNEL.SYS (FreeDOS), VMLINUZ (Linux), NTLDR/BOOTMGR (Windows), GRLDR (grub4dos) and GRUB.EXE (grub4dos).

Why is WEE useful?

Here are some reasons why you might want to try WEE

1. You want to create a bootable drive that has a hard-coded (unmodifiable) grub4dos menu and needs no grldr or boot menu.lst file.

2. You have a BitLocker encrypted boot drive and want to run grub4dos. You cannot install grub4dos as this would break the BitLocker protection and Bootmgr will not treat grldr as a valid boot file.

3. You have some 'bad' systems which do not seem to boot to the grub4dos menu (you just get a flashing cursor)

4. You want to use grub4dos but need to place the grldr file in a location other than the root of the boot volume.

5. You want to boot from an ext2/3/4 formatted volume to grub4dos (grub4dos cannot boot from ext2/3/4).

How to install or boot to WEE?

RMPrepUSB v2.1.635 and later versions now includes an 'Install WEE to Track 0' feature. Just press ALT+F12 or CTRL+W (or use the Drive tab menu) and you will be presented with the default WEE menu in NotePad which you may change if you wish ('No user prompts' must be unticked). When it is correct (the menu is limited to 512 bytes, this includes any comment lines), save it and then RMPrepUSB will run WeeSetup.exe for you with the correct parameters to install it into the first track of the selected disk. By default, the included WEE menu will load grldr, so it can be used after installing grub4dos to a disk. If the grldr file is not present, will you be presented with this default menu:

Unsupported embed

Default WEE menu presented if the grldr file cannot be found.

WeeSetup.exe

If you don't want to use RMPrepUSB to install WEE, then the manual way to install WEE is to use weesetup.exe from a command shell. The latest version of weesetup.exe can be found here in the Downloads area (latest = v1.3 2011-09-18 at the time writing). Weesetup.exe should be run from an Administrator Command Prompt or Command Shell under Windows XP or later.

In this example we are going to use WEE to load grub4dos (grldr) - this is just an example, you can make your own WEE menu.

To install WEE to a disk's boot track using weesetup type:

weesetup

You should see the Usage message similar to this:

weesetup v1.3.

Usage:

weesetup [OPTIONS] DEVICE

OPTIONS:

-i wee63.mbr Use a custom wee63.mbr file.

-o outfile Export new wee63.mbr to outfile.

-s scriptfile Import script from scriptfile.

-m mbrfile Read mbr from mbrfile(must use with option -o).

-f Force install.

-u Update.

-b Backup mbr to second sector(default is nt6mbr).

-l List all disks in system and exit

Report bugs to website:

http://code.google.com/p/grubutils/issues

Thanks:

wee63.mbr (minigrub for mbr by tinybit)

Now let's list the drives in your system, type:

weesetup -l

this will list all available 'hard disk' devices (including available card readers and USB Flash drives). Identify the drive that you want to install WEE to (for example it may be (hd2)).

(hd0): 488281250 (233g)

(hd1): 234441648 (112g)

(hd2): 78140160 (37g)

Create a text file called weemenu.txt with the following text in it:

title Load grub4dos

find --set-root /grldr

/grldr

title Boot from HD0

map () (hd0)

map (hd0) ()

map --hook

root (hd0)

chainloader +1

title Boot XP

find --set-root /ntldr

/ntldr

Now install WEE as follows:

weesetup -u -s weemenu.txt -f (hd2) where (hd2) is the drive where you want to overwrite the boot track and install WEE to (e.g. a USB drive)

Example WEE menu

You don't need to have menu entries, simply omit the 'title' lines and the commands will be immediately executed.

As WEE is a cut-down version of grub4dos, it does not support all the nice feature in grub4dos such as help text, many grub4dos commands, live editing of menu entries, etc. you can however use 'C' to get to a primitive command prompt. You may bypass the boot-up script by quickly pressing the key C at startup. You may single-step trace the boot-up script by quickly pressing the Insert key at startup, and you will get the opportunity of step-by-step confirmation on each command in the boot-up script.

List of WEE 'built-in' commands

This is a list of the only menu commands that are supported by WEE (2011-6-27 version).

a command run a 32-bit program designed for WEE

default x specify default menu number to select when menu is displayed

exit quits from a menu sequence

find {--set-root} find a file (and set device as root)

map map a device/file as a drive ???? may be missing in some versions ?????

pause e.g. pause --wait=3 This message will display for 3 seconds

root set the root device or folder

rootnoverify set the root device or folder (don't check contents for valid device/volume)

timeout set a timeout before default menu is automatically run

title defines text that appears as a menu item (note that \nhelp text feature is not supported for this command)

Unsupported embed

Examples:

These examples are taken from the WEE ReadMe file

Boot the MBR

(hd0)+1

Boot the bootsector of a partition

(hd0,0)+1

or equivalently

root (hd0,0)

+1

Find the partition containing ntldr and boot the bootsector

find --set-root /ntldr

+1

or equivalently

find --set-root /ntldr

()+1

Find the partition containing ntldr and boot ntldr

find --set-root /ntldr

/ntldr

Note: bootmgr can boot likewise. And so can GRLDR and GRUB.EXE of grub4dos.

Boot Ubuntu Linux

find --set-root /boot/vmlinuz

uuid () > nul && set UUID=%?%

/boot/vmlinuz /boot/initrd.img root=UUID=%UUID% ro acpi=noirq

Note: The initrd argument should immediately follow the vmlinuz. Like ntldr and others, vmlinuz here is treated as an executable program of WEE.

Find the partition containing io.sys and boot io.sys

find --set-root /io.sys

/io.sys

Note: Only IO.SYS of Win9x can be supported. WinMe, MS-DOS 6.22 and all others are not bootable.

Find the partition containing kernel.sys and boot kernel.sys

find --set-root /kernel.sys

/kernel.sys

Note: KERNEL.SYS is the kernel of FreeDOS.

Run a 32-bit programs designed for WEE, such as echo

/echo Hello World!

Note: This uses the echo executable for grub4dos which also runs under WEE. The echo commans is not an inbuilt command of wee.

Using an mbr/bin file

If you want to run grub4dos from a Windows 7 system that uses BitLocker, you cannot place the grldr file on the encrypted BitLocker system partition because the volume will be encrypted and therefore not recognised by grub4dos. Also grub4dos expects to find the grldr on the boot partition and nowhere else. You can however boot to WEE because bootmgr allows you to specify an MBR file in the BCD and then load grldr from a different partition. grldr will not work when loaded by bootmgr but WEE will. The boot flow looks like this:

MBR (normal Win7 type) -> bootmgr -> reads BCD -> load weegrldr.mbr -> internal wee menu tells wee to load grldr from 2nd partition -> grldr loads and runs grub4dos -> menu.lst is read and displayed -> user selects menu entry...

First create a weemenu.txt file which will just load grldr as follows:

find --set-root /grldr

/grldr

Now run this command to create an mbr file which contains these commands:

weesetup -s weemenu.txt -o weegrldr.bin

This will create a weegrldr.bin file. Now use EasyBCD to add a boot entry to Windows BCD or do it the hard way using BCDEdit.

Adding WEE to your Windows 7/Vista/SVR2K8 boot menu using EasyBCD

    1. Download and install EasyBCD under Windows 7

    2. Click on Add New Entry and choose to install one of these (unused) options - Windows - Win95/98/ME, MSDOS 6.x or MAC - NST Mac OS X & MBR (it doesn't matter which one as long as you are sure you don't want to use that option to really boot to Win95 or DOS or Mac OS X).

    1. Click on Advanced Settings - Basic tab and change the Menu Name to something like 'Boot using WEE' (you can change it later using EasyBCD)

    2. Change the Drive to point to your grub4dos partition - e.g. E:

    3. Click on View Settings and note the Bootloader Path of the new entry - for instance it may be \NST\AutoNeoGrub1.mbr or \NST\nst_mac.mbr or something like that. We need to place our bin file there so the BCD loads our file instead of this one.

    4. Now rename our weegrldr.bin file to nst_mac.mbr (or whatever the name has been set to by EasyBCD) and put the file in a new folder at E:\NST so that the bootmgr can find it - e.g. E:\NST\nst_mac.mbr.

Thats it, the WEE entry should now be present in the boot menu when you next boot your system to Windows!!

Adding WEE to Windows 7/Vista/SVR2K8 using BCDEdit

    1. Copy the weegrldr.bin file to the partition containing your grldr file and your menu.lst file. e.g. E:

    2. Under Win7/Vista, start Command Prompt in Administrator mode by right-clicking on it and choosing "Run as Administrator".

    3. Enter the following commands

    4. bcdedit /create /d "Boot using WEE" /application BOOTSECTOR

    5. You'll get an output similar to:

    6. The entry {some-description-id} was created successfully.

    7. Copy {some-description-id} using the shell edit 'mark' menu. You'll need it for the remaining commands.

    8. Next, type:

    9. bcdedit /set {some-description-id} device partition=E: (where E: is your grub4dos partition)

    10. bcdedit /set {some-description-id} path \weegrldr.bin

    11. bcdedit /displayorder {some-description-id} /addlast

    12. You can change the description you gave it at any later time using EasyBCD (very easy!) or the command:

    13. bcdedit /set {some-description-id} description "your name here"

    14. where {some-description-id} is replaced by the ID you copied previously and "your name here" is whatever name you want it to appear as.

Thats it, the WEE entry should now be present in the boot menu when you next boot your system to Windows!!