13.08.2013 Views

grub24dos

grub24dos

grub24dos

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>grub24dos</strong><br />

Grub24dos is a follow-on to the popular legacy grub4dos project. It supports booting the<br />

more modern grub2 directly from Windows 7, Vista, XP and 2000. Download this simple<br />

set of scripts and instructions that allow you to get grub2 booting quickly.<br />

All the files for <strong>grub24dos</strong> reside on the Windows C: drive so you don't have to depend<br />

on the availability of any Linux partition to boot your computer. The Windows MBR is<br />

not touched so multiboot of Windows and Linux can be accomplished safely.<br />

Grub2 supports extremely large disks (over 4 TB) and GPT partitions allowing you to<br />

have many OS images on a single physical disk drive. Grub2 also supports search,<br />

advanced scripting and many partition types including fat, Mac hfsplus, CD and USB.<br />

Grub24dos boot is controlled by native BCD in Windows 7, Windows 2008 Server and<br />

Vista. In the Windows XP, Windows 2003 and Windows 2000 environment, it is<br />

controlled by C:\boot.ini.<br />

Grub24dos is a shim. It uses a native GNU grub2 version 1.98 boot image created on<br />

Ubuntu Linux and copied to boot from Windows. This leveraging means that as grub2 is<br />

updated and enhanced in the Linux world, the updates should be quickly available in<br />

Windows.<br />

Quick Start<br />

These instructions assume that you boot the Windows native MBR.<br />

Disclaimer: Make sure you have properly backed up your disks and data before<br />

you try this. I believe the procedure to be safe, but you never know. I assume<br />

no responsibility for your system.<br />

License: Grub24dos, GNU grub and associated modules are distributed under the<br />

terms of the GNU GENERAL PUBLIC LICENSE. A copy of the license can be<br />

found on the web at http://www.gnu.org/licenses/gpl.html and in<br />

C:\grub\winsource\license.txt.<br />

1. Download the <strong>grub24dos</strong>.zip file from sourceforge and unzip it.<br />

2. Move the unzipped grub directory to the C: drive root.<br />

In other words the unzipped directory should be located at C:\grub.


3. Go to the C:\grub\install directory and run <strong>grub24dos</strong>.exe. This will require<br />

administrator access.<br />

4. The program will prompt you for your graphics preference, Windows boot<br />

timeout and grub timeout. You can also set the Grub2 boot menu title and default<br />

OS. The defaults should work fine, but you can change them if desired.<br />

Now click OK.<br />

The following actions will now happen automatically:<br />

Check for Windows version and administrative access.<br />

Generation of C:\grub\grub2.cfg with your custom<br />

grub graphics and timeout settings. If the user section exists, it is<br />

preserved as is.<br />

For Windows 7, Windows 2008 and Vista, the BCD will be<br />

updated with an entry for grub2. A backup of the BCD is made<br />

before the update and is located in C:\grub\winbackup.<br />

For Windows XP, Windows 2003 and Windows 2000, C:\boot.ini<br />

will be updated with an entry for grub2. A backup of C:\boot.ini is<br />

made before the update and is located in C:\grub\winbackup.<br />

C:\g2ldr will be created.<br />

5. Shut down and re-boot Windows. Select the "Grub2 For Dos" menu entry.<br />

You should now receive a Grub24dos screen with two selections, "Windows" and<br />

"Grub Invaders". Select "Windows" and verify that Windows comes up.<br />

This confirms that grub2 is functioning properly.<br />

Note: You can run <strong>grub24dos</strong>.exe multiple times and change your options. If<br />

you have customized the user section of C:\grub\grub.cfg, your changes<br />

will be preserved. After the initial run, you can also remove the BCD or<br />

boot.ini entries by clicking the remove checkbox.<br />

The user section is bracketed by the following comment lines:<br />

# start-user-section<br />

# end-user-section


Using Notepad, tailor the user section of C:\grub\grub.cfg to fit your boot<br />

environment by adding commands and menuentries. You can add a nearly<br />

unlimited number of Linux and Windows configurations. Now reboot.<br />

I supplied three sample configuration files in the C:\grub\install directory<br />

sample.cfg , sample.splash.cfg and sample.theme.cfg.<br />

These can be copied to help customize your C:\grub\grub.cfg file.<br />

They show how to boot various flavors of Linux from MBR and GPT<br />

partitions.<br />

Just for fun, try out Grub Invaders from the sample.cfg file.<br />

There is also an experimental OS-X section for Mac.<br />

Documentation covering the syntax for grub.cfg will be found here:<br />

http://www.gnu.org/software/grub/manual/grub.html#Command_002dline-and-menu-entry-commands<br />

Many helpful examples will be found here:<br />

http://members.iinet.net/~herman546/p20/GRUB2%20CLI%20Mode%20Commands.html<br />

Should you need to further manipulate Windows BCD boot entries, I highly<br />

recommend the terrific and free EasyBCD from NeoSmart. It can be downloaded<br />

here: http://neosmart.net<br />

Good luck and enjoy!<br />

drummerdp<br />

For even more boot themes, try burg4dos available<br />

at http://sourceforge.net/projects/burg4dos/


The Grub24dos boot process<br />

Notes on how it works<br />

For Windows 7, Vista and Windows 2008 Server:<br />

The Windows bootmanager / BCD loads C:\grub\winloader\grub2.boot which<br />

then takes over control.<br />

Now grub2.boot searches all disk drives for itself in order to find the disk address<br />

where the grub base directory is installed. This must be the Windows boot drive.<br />

Grub2.boot then sets variable $winboot to point to the Windows boot drive.<br />

$winboot usually has a value of (hd0,msdos1) unless you are booting Windows<br />

from another drive or partition.<br />

Variable $winboot is used as a handy way to boot Windows or Invaders from<br />

grub2.<br />

Likewise, variable $prefix is set by grub2.boot and usually has a value of<br />

(hd0,msdos1)/grub<br />

The $prefix variable is required by grub2 to locate its base directory and files.<br />

If $prefix is not set properly, grub2 initializes in rescue mode (limited command<br />

line).<br />

grub2.boot then dynamically loads several other modules to support various<br />

partition and filesystem types.<br />

Then C:\grub\grub.cfg is read and used to build the grub2 boot menu display.<br />

For Windows XP, Windows 2000 and Windows 2003 Server:<br />

boot.ini points to C:\grub\winloader\xpstage1.img whose only job is to load<br />

C:\g2ldr. When <strong>grub24dos</strong> was installed, C:\g2ldr was created.<br />

xpstage1.img has very limited capabilities and can only find C:\g2ldr in the root<br />

of an MBR partition, not a directory.<br />

g2ldr takes control and searches all disk drives for C:\grub\winloader\grub2.boot<br />

in order to find the disk address where the grub base directory is installed.<br />

The rest of the boot process is identical to Windows 7 and Vista.


Note: The aging Windows XP / 2000 / 2003 bootloader does not work reliably<br />

when loading grub2.boot directly.<br />

This is why xpstage1.img is used instead.<br />

Windows XP / 2000 / 2003 work best in character mode. Graphics sometimes<br />

cause lockups and inconsistent behavior.


Customization of grub2.boot<br />

The grub2.boot module supplied in C:\grub\winloader should work in nearly<br />

every environment. However, if you need to make custom changes to the<br />

grub2.boot module, you will need access to a Ubuntu 10.04 or higher Linux<br />

environment.<br />

Using a flash drive, copy file grub.makeldr.sh and grub.winboot.sh from the<br />

Windows C:\grub\winsource directory to the Ubuntu /tmp directory. This is a<br />

Linux shell script used to generate the grub2.boot module.<br />

The shell script grub.winboot.sh is embedded in the grub2.boot module<br />

generated when you run grub.makeldr.sh, the winboot script searches for<br />

C:\grub\winloader\windows-bootdisk.txt and when it finds the file it sets variables<br />

$winboot and $prefix to include the address where the file is found.<br />

I have included some of the commonly used grub modules in the script. Examples<br />

are ntfs, part_gpt and others. The included modules can be adjusted via alteration<br />

of the $allmods variable in the script.<br />

Now set the script up for execution by entering:<br />

sudo chmod 777 /tmp/grub.makeldr.sh<br />

Then run the script:<br />

sudo /tmp/grub.makeldr.sh<br />

This will create the grub2 loader file /tmp/grub2.boot<br />

Using a flash drive, copy file /tmp/grub2.boot to the Windows<br />

C:\grub\winloader directory.<br />

Go to the Windows C:\grub\install directory and run <strong>grub24dos</strong>.exe. This will<br />

re-install the grub2 modules to reflect your updates.


Change Log<br />

April 11, 2011<br />

April 5, 2011<br />

March 16, 2011<br />

Minor fixes to the install GUI.<br />

Minor fixes and documentation changes.<br />

Added a checkbox to <strong>grub24dos</strong> that allows the user to remove the<br />

Grub24dos BCD and boot.ini.<br />

Documentation updates to reflect the changes.<br />

February 25, 2011<br />

Added support for Windows 2008 Server and Windows 2003 Server to<br />

satisfy user requests.<br />

Established a user section in C:\grub\grub.cfg. This section will not be<br />

updated by <strong>grub24dos</strong>.exe so that user commands and menuentries will be<br />

preserved if <strong>grub24dos</strong>.exe is run multiple times.<br />

Documentation updates to reflect the changes.


February 22, 2011<br />

Grub24dos.exe can now be run as many times as you wish. This lets you<br />

change graphics, title, default and timeout options multiple times. If you<br />

have made changes to the menuentry section of C:\grub2.cfg, your<br />

changes will be preserved.<br />

Enhanced <strong>grub24dos</strong>.exe to allow customization of the default OS that<br />

grub boots.<br />

Added some splash and graphics options for XP / 2000 users.<br />

Documentation updates to reflect the changes.<br />

February 6, 2011<br />

Added a new theme with scroll bar and advanced graphics. The new<br />

theme exercises all currently available grub2 1.98 graphics functions.<br />

There probably won’t be many enhancements to Grub24dos until April<br />

when Ubuntu 11.04 with GNU grub 1.99 is scheduled for release.<br />

Again, this theme is experimental and may not work with all video<br />

cards. If you have problems, run <strong>grub24dos</strong>.exe again and try the<br />

“timeout bar”, “splash screen” or “no graphics” selections.<br />

Minor documentation updates.<br />

February 2, 2011<br />

Added the option to install experimental theme support. Two themes are<br />

supplied, one with an animated progress bar and the other with an<br />

animated circular progress indicator. These themes are experimental<br />

and may not work with all video cards. If you have problems, run<br />

<strong>grub24dos</strong>.exe again and try the “splash screen” or “no graphics”<br />

selections.


February 1, 2011<br />

The grub2 loader is now handled differently depending on your Windows<br />

version. In Windows 7 and Vista, C:\grub\winloader\grub2.boot is<br />

loaded directly by the boot manager / BCD.<br />

For XP and 2000, the boot manager / boot.ini loads<br />

C:\grub\winloader\xpstage1.img, which in turn loads C:\g2ldr.<br />

Also, the grub menu for XP and 2000 is character only – no graphics.<br />

This was done because the older Windows bootloaders had too many<br />

conflicts trying to run grub2 directly and with graphics. Several graphics<br />

functions that work fine in W7 and Vista, fail miserably when booted from<br />

XP or 2000. It’s possible that when grub2 is updated to version 1.99 in<br />

April, I may have to drop support for XP and 2000 altogether.<br />

January 29, 2011<br />

Removed the Linux and Mac support modules from g2ldr. They are now<br />

dynamically inserted after g2ldr loads. This reduces the size of g2ldr by<br />

about 8K which is important at load time. Linux and Mac support are<br />

unaffected, their modules are simply loaded later in the grub boot process.<br />

January 25, 2011<br />

The install GUI has been updated to allow customization of the grub2 boot<br />

menu title. Due to user requests, I added fat16 and fat32 support.<br />

Documentation updates to reflect the change.<br />

January 19, 2011<br />

Changed the configuration in g2ldr so that grub scans for the Windows<br />

boot disk at boot time. Grub now searches for<br />

C:\grub\winloader\windows-bootdisk.txt and when it finds the file it sets<br />

variables $winboot and $prefix to include the boot address. This<br />

eliminates the need to customize g2ldr with the Windows boot address. It<br />

is now determined dynamically at boot time.<br />

The install GUI has been updated to allow simple customization of both<br />

the Windows boot timeout and the grub menu timeout.


Documentation updates to reflect the changes. Added screenshots to the<br />

<strong>grub24dos</strong> page at sourceforge.<br />

January 13, 2011<br />

Added Grub Invaders code (only 5 KB) and an entry in the sample cfg<br />

files to play it.<br />

I have been testing grub themes. Animated scroll bar doesn’t seem to work<br />

in GNU grub 1.98. Have done some testing on various GNU grub 1.99<br />

betas with inconsistent results. Maybe when Ubuntu 11.04 comes out in<br />

March, with a new official release of GNU grub, themes will work better.<br />

January 12, 2011<br />

Included a copy of the GNU GENERAL PUBLIC LICENSE under which<br />

Grub24dos, GNU grub and Gsar are distributed. The location is<br />

C:\grub\winsource\license.txt.<br />

Minor documentation updates.<br />

January 7, 2011<br />

Added the uhci and usbms modules to the g2ldr loader.<br />

This lets you to see flash drives at boot time without the need to manually<br />

insmod additional modules.<br />

January 6, 2011<br />

Created several new C:\grub subdirectories and renamed modules for<br />

clarity. Relocated some of the modules to the appropriate new directories.<br />

The GNU code in C:\grub was not effected.<br />

Documentation updates to reflect name and directory changes.


January 5, 2011<br />

Automated the configuration of splash screen support in the grub.cfg file<br />

during the install process. This is only done if requested.<br />

Documentation updates for splash screen support.<br />

January 4, 2011<br />

Added support for grub splash screen. Created directories for fonts and<br />

images. Created grub.sample.splash.cfg file which includes the entries<br />

needed to get splash screen working.<br />

Documentation updates for splash screen support.<br />

January 1, 2011<br />

Set up all GNU grub2 modules in the C:\grub directory. This eliminates<br />

the need to customize g2ldr for module changes.<br />

Changed the C:\grub\code directory to C:\grub\doscode to contain all<br />

<strong>grub24dos</strong> files. The C:\grub directory now contains only native GNU<br />

grub code.<br />

Grub2.windows.create.exe now creates the initial C:\grub\grub.cfg<br />

with custom disk and partition numbers.<br />

Added an experimental Mac OS-X boot section to the<br />

C:\grub\doscodegrub.sample.cfg file. It doesn’t work yet, but shows<br />

promise for a future release<br />

Documentation updates to reflect the recent changes.<br />

December 30, 2010<br />

Updated g2ldr to include the blocklist, cat & sleep commands.<br />

Revised the grub2.linux.makeldr.sh script for clarity.<br />

Minor documentation updates.


December 23, 2010<br />

Minor documentation updates.<br />

December 22, 2010<br />

Simplified the customizing of drive and partition numbers in g2ldr.<br />

All installation logic is now contained in AutoIt program<br />

grub2.windows.create. This allows much better checking for install<br />

errors and is more user friendly. The source is included.<br />

Refreshed g2ldr from the Ubuntu Linux distribution.<br />

December 17, 2010<br />

Added support for Windows 2000.<br />

Updated the scripts to automate update of the C:\boot.ini file in XP and<br />

2000.<br />

Added bootupdt.exe to scan the BCD and C:\boot.ini and prevent<br />

duplicate entries and inconsistencies if Grub24dos is installed on the<br />

same system multiple times.<br />

December 10, 2010<br />

Added the alternate-locations folder to the <strong>grub24dos</strong> sourceforge<br />

project. This folder includes 7 pregenerated loader modules.<br />

Updated the instructions to include using a pregenerated<br />

loader module in the case of an unusual boot location.<br />

December 9, 2010<br />

Updated the instructions to include new install procedures, advanced<br />

instructions, change log and credits.


Added grub2.windows.setup and grub2.windows.install to automate the<br />

install process.<br />

December 2, 2010 Initial release.


Credits<br />

Credit must be given to the grub4dos folks on sourceforge. They came up with<br />

the original idea and methodology.<br />

The Ubuntu developers deserve a hand for taking the lead with grub2. Most of<br />

the other Linux distributions are still using legacy grub as their bootloader of<br />

choice.<br />

The GNU grub group wrote the code. They are doing a great job on grub2,<br />

bringing us a modern, capable product.<br />

The GNU grub project page is here http://www.gnu.org/software/grub/<br />

Thanks to Towheed Mohammed for “A Beginner’s Guide to Theming Grub2”.<br />

I found this document very helpful and I used a couple of his image files.<br />

Available here http://www.mediafire.com/?amub1vfdyfhj7v2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!