中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-11-17 20:15
47,820 topics / 349,938 posts / today 0 new / 48,296 members
GRUB4DOS、SYSLINUX及其它启动管理软件讨论专区 » A Beginner's Tutorial on grub4dos
Printable Version  196,129 / 140
Floor106 bjsfwei Posted 2008-12-04 11:00
新手上路 Posts 1 Credits 2 From 廊坊
Where is the picture???????
Floor107 pxgxtao Posted 2008-12-13 23:52
新手上路 Posts 1 Credits 2 From 江西九江
Thanks!
Floor108 ludertk Posted 2008-12-16 02:17
新手上路 Posts 3 Credits 4
Got it, thanks to the landlord.
Floor109 a102135 Posted 2008-12-17 13:18
新手上路 Posts 2 Credits 4
Print it out first and then read it slowly.

[ Last edited by a102135 on 2008-12-17 at 13:19 ]
Floor110 a102135 Posted 2008-12-17 13:18
新手上路 Posts 2 Credits 4
Finally found a place to study! I've always wanted to learn knowledge in this area!

[ Last edited by a102135 on 2008-12-17 at 13:20 ]
Floor111 kukuer Posted 2008-12-20 20:02
新手上路 Posts 6 Credits 14
Getting started...
Floor112 lianjiang2004 Posted 2009-01-18 10:19
金牌会员 Posts 1,884 Credits 3,946
GRUB4DOS Beginner's Tutorial

2009-01-18:

GRUB4DOS has entered the countdown to the release of the final official version, so the beginner's tutorial is updated for the last time.
This tutorial will not be updated in the future.

New Content:

Advanced Section:
3.3b Automatically Rename grldr with Batch (Applicable to the Latest Version of grldr) NEW!
3.6 Method and Application of Passing Parameters Using dd Command NEW!

Appendix:
4.07 Introduction to GRUB2 Usage by bean NEW!
4.08 Advanced GRUB2 Tutorial by bean NEW!
4.09 Advanced Tutorial on gfxmenu Customization (New Customizable Menu) by bean NEW!

CHM Graphic Version Download:
http://gghost.qupan.com/1557049.html
http://lianjiang2007.ys168.com
http://lianjiang2004.ys168.com
Floor113 regvip2008 Posted 2009-01-19 22:39
初级用户 Posts 87 Credits 187
This tutorial is of great use for us novices. Thanks, brother lianjiang2004!
Floor114 marrow Posted 2009-03-08 04:25
新手上路 Posts 1 Credits 2
The beginner's tutorial on grub4dos by lianjiang2004 is very useful for beginners, helping us avoid many detours and gain a deeper understanding of grub4dos. As a beginner, I have sorted out lianjiang2004's grub4dos beginner's tutorial - entry level according to my own understanding, which may be useful for newbies just getting in touch with grub4dos to quickly understand. Any errors are welcome for correction by experts.

grub4dos Beginner's Tutorial - Basic Level

History of grub4dos: GRUB for DOS (abbreviated as GRUB4DOS) is a secondary development version based on GNU GRUB. A big difference from the official GNU GRUB is the diversity of startup methods.

  grub4dos is a multi-boot guide management tool, which can be used to activate many operating systems such as Linux, BSD, OS/2, BeOS, Windows 95/98/NT, etc. All things are integrated in two files: grldr and grub.exe (GRUB is a boot program independent of the operating system, and menu.lst cooperates with it to achieve loading). In addition, in order to be compatible with the startup of Vista (Vista cannot load a boot file exceeding 64K), grub4dos has an additional grldr.mbr. grldr.mbr is equivalent to the boot sector of grub4dos, similar to bootsect.dos used when booting DOS under NT. Its main function is to search for the grldr file in the root directory of the local hard disk, floppy disk, and USB flash drive and load it. Any boot software that supports loading the boot sector can boot into grub4dos by loading grldr.mbr.

I. Obtaining grub4dos
Download grub4dos (http://nufans.net/grub4dos、http://grub4dos.nufans.net、http://download.gna.org/grub4dos、http://grub4dos.sourceforge.net/grub4dos、http://sites.google.com/site/grubdos), and you can use it after decompression. The core files are as follows: grldr (for VISTA system, also need grldr.mbr) and grub.exe, and menu.lst (this is a sample). If you need Chinese support, use the files in the chinese subdirectory.

II. Common loading methods of GRUB4DOS
1. Load through boot.ini under NT: The partition type supports FAT (12/16/32), NTFS, EXT (2/3). Copy the grldr file to c:\, modify the c:\boot.ini file, add a line at the end of boot.ini: c:\grldr="Start GRUB4DOS" and set the timeout value in boot.ini to be greater than 0. The grldr does not have to be placed in the root directory. Their final purpose is to search for the grldr file in the root directory of each partition and load the first found grldr.
Another way is to rename grldr to ntldr to replace NT's ntldr (bootmgr of Vista), which is to directly load grldr through the boot sector of NT/Vista.
Enter grub4dos through the boot menu of Windows VISTA/Window 7, and use a batch file to automatically load grub4dos into the Vista startup item (loading grub4dos into the Vista startup item is relatively safer than loading into the MBR). See the appendix: Batch file to load into the VISTA startup item.
Note: The advantage of this method is that there is no need to modify the MBR

2. Load through grub.exe
grub.exe is a three-in-one program,
As a real-mode DOS program, it is directly loaded from a pure DOS environment. Boot to the DOS environment (preferably a pure DOS environment), then run grub.exe under DOS or in AUTOEXEC.BAT to enter grub4dos.
As a DOS setup driver, load it from DOS's config.sys in any way such as device=grub.exe, install=grub.exe, shell=grub.exe.
Load in the Linux kernel format using the kernel method (any program that supports loading the Linux kernel can use this method, for example: Linux, syslinux series, GNU GRUB, lilo).
Use in Linux:
# kexec -l grub.exe
# kexec -e
Use in syslinux, syslinux.cfg:
kernel grub.exe
Use in GNU GRUB:
kernel ((hd0,x)/)/PATH/grub.exe
Use in lilo: Use in lilo.conf:
image=/boot/grub.exe
The configuration file menu.lst can be saved in the directory where the grub file is located or other specified paths (can also be placed in the root directory of other partitions or other specified directories).
Note: The advantage of this method is that there is no need to modify the MBR; GRUB4DOS can be started in scripts or other DOS programs as needed

3. Load grub through MBR (boot directly into it)
Use bootlace (run in DOS/Win9x/linux environment), grubinst, grubinst_gui (run in 2000/xp/2003/vista environment) to install the boot code of GRUB4DOS into the MBR of the hard disk (or the master boot record of the hard disk image file), or install it into the boot sector of a floppy disk or floppy disk image. The MBR boot code does not point to a certain partition fixedly, but searches all partitions, finds and loads grldr. As long as there is a copy of grldr on a certain partition, it can be started. And when installing, the original Microsoft MBR can be backed up. If grldr is not found during startup, the backed-up MBR will be automatically loaded to start. After installing the boot code of grub4dos into the MBR, copy the grldr file to the root directory of a certain partition. If the boot code of grub4dos is installed into the boot sector of a partition, the grldr file must be placed in the root directory of that partition (the grldr file has a built-in menu, which can be edited with a built-in menu editor and does not depend on menu.lst).
When the computer starts, press the hot key (the default is the space bar, which can be customized) to start grub.
Example: Install the GRLDR code into the master boot record under DOS: bootlace.com 0x80
Example: Install the GRLDR code into a floppy disk under DOS: bootlace.com --floppy --chs 0x00
Example: Install the GRLDR code into a floppy disk image under DOS: bootlace.com --floppy --chs floppy.img
Example: Install the GRLDR code into the master boot record of the Windows XP system disk:
bootlace --force-backup-mbr --boot-prevmbr-first --time-out=3 --hot-key=0x3920 --mbr-disable-floppy 0x80 means that when installing the GRLDR code into the MBR, the original MBR is backed up (--force-backup-mbr), the original MBR is started by default, that is, the original Windows XP system is started (--boot-prevmbr-first), wait for 3 seconds (--time-out=3), the hot key is the space bar (--hot-key=0x3920), and the GRLDR on the floppy disk is not searched (--mbr-disable-floppy). That is, wait for 3 seconds when starting. If the hot key is not pressed within 3 seconds, Windows XP is started; if the hot key is pressed within 3 seconds, grub4dos is started. For other parameters of bootlace and the usage of custom hot keys, refer to the readme.txt file.
Note: The advantage of this method is that it does not depend on the operating system; it can automatically search for the grldr file in each partition of the hard disk.

After starting GRUB4DOS, start other operating systems through it:
Start the Linux kernel, method: kernel (DEVICE)/PATH/vmlinuz
Start the MS-DOS kernel, method: chainloader (DEVICE)/io.sys
Start the FreeDOS kernel, method: chainloader (DEVICE)/kernel.sys
Start the NTLDR of Windows NT, method: chainloader (DEVICE)/ntldr
Start the CMLDR of the recovery console of Windows NT, method: chainloader (DEVICE)/cmldr. Note: A similar method can be used to start setupldr.bin of NT
Start DOS/Windows9x from a disk image file through disk emulation (memory disk)
Start from the CD-ROM

III. Basic concepts and descriptions
1. Naming method of devices and partitions
In GRUB, hard disk devices are named in the following way:
(hdm) m is the serial number of the hard disk. The serial number 0 corresponds to the first hard disk of the BIOS.
(hdm,n) n is the serial number of the partition in hard disk m (that is, the partition on the hard disk). There are up to 4 primary partitions, and their serial numbers are 0-3, and the serial number of the extended partition starts from 4.
Example: (hd0,0) The first primary partition on the first hard disk, that is, the C drive. (hd0,4) The first extended partition on the first hard disk. That is, the D drive.
(0x80,0) is represented by the corresponding BIOS device number. The device number of the first hard disk device is 0x80.

In GRUB, floppy disk devices are named in the following way:
(fdm) m is the serial number of the floppy disk. The serial number 0 corresponds to the first floppy disk of the BIOS. The floppy disk device can also be followed by the serial number of the partition or sub-partition.
GRUB also has some other devices, such as (cd) is the CD-ROM device, and (nd) is the network device.

2. File name and file path
The file name of GRUB is based on the device name plus the file path
(hd0,0)/boot/grub/aa.img, the absolute path is (hd0,0)/boot/grub/ , the relative path is /boot/grub/ . Note: The directory separator is /, not \ commonly used under Windows/DOS. Example: (fd0)/boot/aa.img means the aa.img file in the boot directory on the floppy disk 0 with a relative path.
Data can also be specified by the sector offset and number
(hd0,0)0+100,200+1,300+300 means in the first primary partition on hard disk 0, 100 sectors starting from sector 0, then 1 sector starting from sector 200, and finally 300 sectors starting from sector 300. When the offset is zero, it can be omitted. Therefore, (hd0,0)+1 means 1 sector starting from sector 0 in the first primary partition on hard disk 0, that is, the first sector of the partition.
The file on the root device can omit the device name. For example: The root+1 command is equivalent to root(hd0,0)+1.
The meaning of the file name used in the map (hd0,0)+1 command is different from the above. In the map command, +1 does not mean the first sector of the first primary partition on hard disk 0, but the entire partition of the first primary partition on hard disk 0.

IV. Usage and description of main commands For more command usage, see the appendix Grub Command Index

chainloader - Load the content of the boot sector into memory. The parameter +1 means load the first sector of the partition into memory to start other operating systems. Note: Mainly used to boot the boot sector (MBR) of the corresponding device, such as the hard disk MBR, CD-ROM, floppy disk, primary partition boot sector, etc.
displaymem - Display the current memory usage, this information is based on the BIOS. This command is helpful to determine how much memory the system has before booting.
kernel - When using the direct loading method to boot the operating system, the kernel command specifies that the kernel is loaded from the GRUB root file system. The options option follows the kernel command and is passed to the kernel when the kernel is loaded.
root - Set the GRUB root partition to a specific device and partition, such as (hd0,0). And mount this partition so that files can be read.
rootnoverify - Do the same thing as the root command, but do not mount the partition.
Both root and Rootnoverify can be used to specify the root device. root tests whether the file system of the partition can be recognized before setting the root device, while rootnoverify omits this test.
boot – Start the operating system or file that has been specified and loaded previously. Before using this command, the system kernel or boot sector, boot file must be loaded into memory using kernel or chainloader. This
Floor115 LDGD Posted 2009-05-16 06:03
新手上路 Posts 4 Credits 8
Been looking for it all the time, and it's here originally.
Floor116 cisheng97 Posted 2009-05-21 19:35
初级用户 Posts 24 Credits 31
Thanks to the thread starter
Floor117 tanglang Posted 2009-05-23 03:51
新手上路 Posts 1 Credits 2
Thank you so much, sincerely thank you
Floor118 loveheartrain Posted 2009-06-12 05:04
初级用户 Posts 81 Credits 174
Not bad. Thanks for your hard work.
Floor119 5556667788 Posted 2009-08-31 00:30
新手上路 Posts 2 Credits 4
Three years, it's rare for the LZ to persevere, thanks
Floor120 duanweibin Posted 2009-09-02 09:48
新手上路 Posts 1 Credits 2
Finally, I have a little bit of understanding. It seems that the road I need to learn is still very long.
Prev  1 … 5 6 7 8 9 10  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023