3
This utility is used to install GRUB4DOS to the MBR of hard disk or image file.
5
grubinst.exe is a console mode program. It mimics the behavior of the DOS/Linux
6
utility bootlace.com from TinyBit's GRUB4DOS package. But unlike bootlace.com,
7
grubinst is writen completely in C and can be compiled to run in OSs like
8
Windows NT/2K/XP, Linux and FreeBSD.
10
grubinst_gui.exe is a GUI frontend to grubinst.exe. It provides a friendly
11
interface to users who are not familiar whith the command line environment.
12
Currently, grubinst_gui.exe only runs in Windows OSs.
14
Please note that these utilities only install MBR, it DOES NOT copy GRLDR to
15
your partition or configure menu.lst, neither does it modify boot.ini to enable
16
booting from the NT boot manager. To know more about such things, please refers
17
to README_GRUB4DOS.txt which contains information about the GRUB4DOS package.
19
Also note that the current version of grubinst doesn't support modify the MBR
20
of hard disk in Windows 95/98/ME. For those OSs, bootlace.com should be used
23
2. Features of grubinst
25
2.1 Use special name to represent devices
27
In grubinst, you can use special filename to represent hard disks and floppies.
30
Hard disk device N. In Linux, (hd0) - (hd3) equals to /dev/hda - /dev/hdd. In
31
FreeBSD, (hd0) - (hd3) equals to /dev/ad0 - /dev/ad3. In Windows, (hdN) equals
35
Partition P on hard disk N. Primary partition is 0-3, extended partition starts
39
Floppy device N. In Linux/FreeBSD, (fdN) equals to /dev/fdN. In Windows, (fd0)
40
and (fd1) equals to drive A: and B:.
43
Partition P on floppy N.
45
Note 1. bootlace.com use numbers to represent devices. Floppies starts with 0,
46
and hard disks starts with 0x80.
48
Note 2. In bash/csh shell, () have special meaning. So you need to wrap the
49
device name with "" or ''.
51
Note 3. The 6-series of FreeBSD doesn't allow you to access a hard disk device
52
which has been open. This means you can't modify the MBR of your currently used
53
hard disk. Older series of FreeBSD don't have this problem.
55
2.2 Save/Restore function
57
Normally, the original MBR is only one sector long, it's stored in the second
58
sector of the new GRLDR MBR. You can restore it using --restore-prevmbr option.
59
However, if the original MBR is longer than one sector, for instance, you have
60
other boot manager installed, then GRLDR MBR dones't have room to hold it. In
61
this case, you should use --save=FILENAME to save the original MBR to an
62
external file, and use --restore=FILENAME to restore it.
64
Starts from version 1.1, --save=FILENAME and --restore=FILENAME also works for
65
partition boot sector. --restore-prevmbr doesn't work with partitions.
67
Note 1. In version 1.0.1, --save=FN and --restore=FN are called --save-mbr=FN
68
and --restore-mbr=FN, I remove the mbr part becase it now works for mbr and
71
Example 1. Install GRLDR to MBR/BS, and save the original MBR/BS to an external
74
grubinst --save=FILENAME DEVICE_OR_FILE
76
Example 2. Restore MBR from previous one sector MBR
78
grubinst --restore_prevmbr DEVICE_OR_FILE
80
Example 3. Restore MBR/BS from external file
82
grubinst --restore=FILENAME DEVICE_OR_FILE
84
2.3 Partition and floppy support (New in version 1.1)
86
You can use --list-part to list all partitions in device or file.
88
grubinst --list-part DEVICE_OR_FILE
90
This option is diagnostic, it won't actually install GRLDR.
92
To install GRLDR to partition, just use the proper partition name, or use
93
--install-partition=I option to set the partition number. You don't need to
94
worry about file system type, as they are probed automatically. Support file
95
system are FAT12, FAT16, FAT32, NTFS and Ext2.
97
To install GRLDR to floppy image, you need to use the --floppy option.
99
Note 1. If you install GRLDR Boot Record to a floppy or a partition, the floppy
100
or partition will boot solely grldr, and your original IO.SYS(DOS/Win9x/Me) and
101
NTLDR(WinNT/2K/XP) will become unbootable. This is because the original boot
102
record of the floppy or partition was overwritten. There is no such problem
103
when installing GRLDR Boot Record onto the MBR. Update: Some NTLDR/IO.SYS/
104
KERNEL.SYS files can be directly chainloaded in the latest GRUB4DOS.
106
Note 2. You can use --start-sector=B option to specific the absolute address of
107
the start sector of partition, but we don't recommend it, as grubinst can
108
extract the information from the partition table in MBR.
110
Note 3. You can use --verbose option to see more information about the
111
partition on which you install GRLDR. It is good pratice to first use
112
--read-only and --verbose to verify the partition before actually installing
115
grubinst --read-only --verbose (hd0,0)
121
Start sector: 1028160
125
Note 4. Option --floppy=N do exactly the same thing as --install-partition=I.
126
It's here just to improve the compatibility with bootlace.com.
128
2.4 Short options (New in version 1.1)
130
Some options have short counterparts.
142
-p=I --install-partition=I
147
Note 1. In order to achive compatiblility between gcc and vc6, I don't use the
148
getopt function to parse options. Therefore, combining short options doesn't
149
work. For example, -vl is not equal to -v -l.
151
2.5 Key code translation (New in version 1.1)
153
In option --hot-key=K, you can use symbol names instead of raw codes. Raw code
154
is still accepted, but they need to start with the hexadecimal prefix 0x.
156
Support key names are: A-Z, 0-9, F1-F12, - = [ ] ; ' . \ , / , BACKSPACE, DEL,
157
DOWN, END, ENTER, ESC, HOME, INS, KEY-5, KEY-*, KEY--, KEY-+, KEY-/, LEFT,
158
PGDN, PGUP, PRRTSC, RIGHT, SPACE, TAB and UP.
160
Support prefix are: shift-, ctrl- and alt-.
162
Note 1. You can't use more that one prefix. For example ctrl-alt-A is not
165
Note 2. Some character have special meaning to shell, so you need to wrap them
166
with "" or '' ('' can't be used in cmd.exe) . For example,
168
grubinst "--hot-key=;" DEVICE_OR_FILE
172
grubinst "--hot-key=ctrl-\\" DEVICE_OR_DEVICE
174
Note 3. Key name is case insensitive. Therefore, ctrl-a, CTRL-A and Ctrl-A are
177
Note 4. To see the raw code of a key name, you can use --verbose option. For
180
grubinst --verbose --hot-key=ctrl-a
184
grubinst: No filename specified
186
You can ignore the error message as we are not actually installing GRLDR.
188
2.6 Change boot file name and load segment (New in 1.1 beta6)
192
2.7 Grub2 support (New in 1.1 beta6)
194
2.8 Loading via NT boot manager
199
grubinst [OPTIONS] DEVICE_OR_FILE
203
--help,-h Show usage information
205
--pause Pause before exiting (used by GUI)
207
--version Show version information
209
--verbose,-v Verbose output
211
--list-part,-l List all logical partitions in DEVICE_OR_FILE
213
--save=FN,-s=FN Save the orginal MBR/BS to FN
215
--restore=FN,-r=FN Restore MBR/BS from previously saved FN
217
--restore-prevmbr,-r Restore previous MBR saved in the second sector
220
--read-only,-t do everything except the actual write to the
221
specified DEVICE_OR_FILE. (test mode)
223
--no-backup-mbr do not copy the old MBR to the second sector of
226
--force-backup-mbr force the copy of old MBR to the second sector
227
of DEVICE_OR_FILE.(default)
229
--mbr-enable-floppy enable the search for GRLDR on floppy.(default)
231
--mbr-disable-floppy disable the search for GRLDR on floppy.
233
--mbr-enable-osbr enable the boot of PREVIOUS MBR with invalid
234
partition table (usually an OS boot sector).
237
--mbr-disable-osbr disable the boot of PREVIOUS MBR with invalid
238
partition table (usually an OS boot sector).
240
--duce disable the feature of unconditional entrance
243
--boot-prevmbr-first try to boot PREVIOUS MBR before the search for
246
--boot-prevmbr-last try to boot PREVIOUS MBR after the search for
249
--preferred-drive=D preferred boot drive number, 0 <= D < 255.
251
--preferred-partition=P preferred partition number, 0 <= P < 255.
253
--time-out=T,-t=T wait T seconds before booting PREVIOUS MBR. if
254
T is 0xff, wait forever. The default is 5.
256
--hot-key=K,-k=K if the desired key K is pressed, start GRUB
257
before booting PREVIOUS MBR. K is a word
258
value, just as the value in AX register
259
returned from int16/AH=1. The high byte is the
260
scan code and the low byte is ASCII code. The
261
default is 0x3920 for space bar.
263
--floppy,-f if DEVICE_OR_FILE is floppy, use this option.
265
--floppy=N if DEVICE_OR_FILE is a partition on a hard
266
drive, use this option. N is used to specify
267
the partition number: 0,1,2 and 3 for the
268
primary partitions, and 4,5,6,... for the
271
--sectors-per-track=S specifies sectors per track for --floppy.
272
1 <= S <= 63, default is 63.
274
--heads=H specifies number of heads for --floppy.
275
1 <= H <= 256, default is 255.
277
--start-sector=B specifies hidden sectors for --floppy=N.
279
--total-sectors=C specifies total sectors for --floppy.
282
--lba use lba mode for --floppy. If the floppy BIOS
283
has LBA support, you can specify --lba here.
284
It is assumed that all floppy BIOSes have CHS
285
support. So you would rather specify --chs.
286
If neither --chs nor --lba is specified, then
287
the LBA indicator(i.e., the third byte of the
288
boot sector) will not be touched.
290
--chs use chs mode for --floppy. You should specify
291
--chs if the floppy BIOS does not support LBA.
292
We assume all floppy BIOSes have CHS support.
293
So it is likely you want to specify --chs.
294
If neither --chs nor --lba is specified, then
295
the LBA indicator(i.e., the third byte of the
296
boot sector) will not be touched.
298
--install-partition=I Install the boot record onto the boot area of
299
-p=I partition number I of the specified hard drive
300
or harddrive image DEVICE_OR_FILE.
302
--boot-file=F,-b=F Change the name of boot file.
304
--load-seg=S Change load segment for boot file.
306
--grub2,-2 Load grub2 kernel g2ldr instead of grldr.
308
--output,-o Save embeded grldr.mbr to DEVICE_OR_FILE.
310
Example 1: Install GRLDR MBR to the first hard disk
314
Example 2: Install GRLDR MBR to the disk image disk.dsk
318
Example 3: Install GRLDR to the first primary partition
324
grubinst --install-partition=0 (hd0)
328
grubinst --start-sector=63 --install-partition=0 (hd0)
330
If the first partition starts from sector 63. This kind of usage is not
331
recommended, as the value specified in --start-sector will overwrite the one
332
extracted from the partition table.
334
Example 4. Install GRLDR to a floppy device or image
338
grubinst --floppy floppy.img
340
If you use floppy device, you can omit the --floppy option.
342
Example 5: Load GRUB only if you press CRTL-F1 in the first 10 second of
345
grubinst --boot-prevmbr-first --hot-key=ctrl-f1 --time-out=10 (hd0)
347
Example 6: Same as above, but use short options.
349
grubinst --boot-prevmbr-first -k=ctrl-f1 -t=10 (hd0)
351
3. Features of grubinst_gui
353
a) Save/Restore operation
355
The operation of save/restore boxes is described as follows:
357
If neither "Restore from file" nor "Restore from PrevMBR" is cheked, the
358
program would backup the original MBR/BS to FILENAME if it's set in the
361
If "Restore from file" is checked, the program would restore the MBR/BS from
362
FILENAME which is set in "Save File". FILENAME must not be empty, otherwise an
363
error message is printed. In this case, the setting of "Restore from PrevMBR"
366
If "Restore from file" is not checked, but "Restore from PrevMBR" is, the
367
program would restore from previous MBR which is saved in the second sector
368
of GRLDR MBR. If "Save File" box is not empty, it would be the name of file
369
to store the currently used MBR, which in the case is the GRLDR MBR.
371
b) Partition list (New in version 1.1)
373
After you select a image file or disk/floppy device, you can press the
374
"Refresh" button alongside the "Part List" dropdown list to get the partition
375
information. For example, for disk image aa.dsk, the list will be something
381
For FAT12 floppy image aa.img, the list will be something like this:
383
Whole disk (FAT12/FAT16)
385
You can choose the partition by selecting the corresponding item from the list.
387
After you change the image/device name, the list will be reset. You need to
388
press the button again if you want to get the partition list of the new
391
c) Test run (New in version 1.1)
393
You can use "Test" button to see the command line options that will be passed
394
to grubinst.exe, without actually making the call. This can be handy if you
395
want to know about the correspondence between grubinst options and the various
396
checkboxes in the GUI.
398
d) Chinese support (new in version 1.1)
400
The GUI will display Chinese interface if your user locale is set to simplified
401
Chinese. But you can alter its behaviour by using a option:
403
grubinsi_gui --lang=eng
405
Display English interface, regardless your user locale setting.
407
grubinst_gui --lang=chs
409
Display simplified Chinese interface, regardless your user locale setting.
411
In order to display Chinese characters properly, your system locale must also
412
be set to simplified Chinese.
416
To compile the program, you need the GCC toolkit in Linux, FreeBSD or other
417
unix platform, and mingw or Visual C++ 6.0 in Windows NT/2K/XP.
419
To compile using GCC toolkit:
423
To compile using Visual C++ 6.0:
425
nmake -f Makefile.vc6
427
Here are some notes when you are using the GCC toolkit.
429
Note 1. If mingw is detected, make will build the GUI program grubinst_gui.
430
Otherwise, it will only build the console mode program grubinst.
432
Note 2. In Windows, Linux and FreeBSD, partition whose start address go beyond
433
the 4G limit is supported (However, some BIOSes may not boot from such
434
partitions). In other systems, the 4G limit issue depends on the size of
437
Note 3. Two internal utility, bin2h and ver2h, has two forms. This first is
438
a perl script, which can be used directly, but it requires the perl
439
interpreter. The other is a C program, which works in all circumstance, but it
440
needs compilation. Makefile can detect whether or not perl exists, and use it
441
if found. If you want to use the C program even if you have perl, you can set
446
Note 4. You can compile the resource script grubinst_gui.rc in two way. One
447
is to use windres from mingw, the other is to use rc from vc6. By default, rc
448
is used if it's detected. However, if you want to use windres no matter what,
453
Also note that rc expects your INCLUDE environment variable being set to the
454
paths of vc6 include files.
456
Note 5. To compile the Chinese resource properly, you must use rc from vc6, and
457
your system locale must be set to simplified Chinese at the time of the
462
http://grub4dos.sourceforge.net/
463
grubinst and WINGRUB homepage
465
http://grub4dos.jot.com/
466
Latest GRUB4DOS package by TinyBit
468
http://www.znpc.net/bbs
469
Nice forum on GRUB4DOS, but it's in chinese
471
http://grub.linuxeden.com/
472
Misc information by TinyBit, also in chinese