Private messaging system limits 500 characters, and I've lost input content by accident many times. So I'm replying here, which makes me feel more at ease.
====== In your letter on 2003-10-19 2:26:51, you wrote: ======
I want to ask, GRUB for Linux can run locally in pure Linux or even in the Linux window (Linux termin) of X-Window Linux, and you can always use the quit command to exit GRUB and return to the Linux command line. Then why not really use the compiler under DOS to port GRUB to the DOS environment to become a localized DOS software to improve compatibility and adaptability?
=====================================
Indeed, before deciding to develop grub for dos, I once searched for grub.exe on http://www.google.com/, and found relevant web pages, but some key web pages couldn't be opened. I wanted to use GOOGLE's web cache, but this has been prohibited in mainland China, so many precious materials can't be seen.
But I also found a few web pages about grub.exe, which are all bug tracking web pages of GNU GRUB, some letters. From these letters, I slightly knew that the goal of grub for dos was once worked on by someone, but it seemed that there was no follow-up. Among them, some people pointed out the problems of directly compiling GNU GRUB on the DOS/Windows platform. But it seems that no one directly compiled it, or maybe although it was compiled, it wasn't successful.
When I further considered this problem, I found that even if it was successfully compiled, it didn't make much sense. Why? Just look at the GRUB shell under Linux. This GRUB SHELL can only be used to install GRUB and test some commands of GRUB, but it can't be used to directly boot to another operating system from under Linux. Almost all GRUB commands can be executed under the GRUB SHELL of Linux, except the boot command. Imagine, if we implement GRUB for DOS like this, what's the meaning?
The most fundamental reason why the boot command of GRUB can't be used under Linux is that under Linux, it's impossible to return to real mode and execute a user-set program. Under LINUX, only the reboot and halt commands can return to real mode, but they are fixed in use, and the user can't control other behaviors after entering real mode. For example, it's not possible to immediately execute stage2 of grub after entering real mode.
Therefore, under DOS, I chose the method of HACKING DOS to implement GRUB FOR DOS. The purpose of HACK is to restore the BIOS interrupt vectors modified by DOS.
This is different from under Linux. Because under real-mode DOS, we can program freely without restrictions (this is the benefit of real mode). While the environments of LINUX and Windows have many restrictions. They all use the protected mode of CPU, refuse to execute certain instructions, and they don't have known system calls to return to real mode. Therefore, on top of these operating systems, the boot command of grub can't run.
The boot command of GRUB can boot any operating system. A necessary condition to boot these operating systems is that the CPU is in real mode. Because all operating systems in history are designed to start from real mode. The CPU of the computer is in real mode when it starts up.
Because DOS has been HACKED, GRUB can run under DOS. This makes GRUB for DOS probably (currently) the only multi-boot manager that can start running from within an operating system (in this case, from the DOS command line) and can boot any operating system. Usually, after one operating system is started, you can't enter another operating system (unless you restart the machine).
====== In your letter on 2003-10-19 2:26:51, you wrote: ======
I want to ask, GRUB for Linux can run locally in pure Linux or even in the Linux window (Linux termin) of X-Window Linux, and you can always use the quit command to exit GRUB and return to the Linux command line. Then why not really use the compiler under DOS to port GRUB to the DOS environment to become a localized DOS software to improve compatibility and adaptability?
=====================================
Indeed, before deciding to develop grub for dos, I once searched for grub.exe on http://www.google.com/, and found relevant web pages, but some key web pages couldn't be opened. I wanted to use GOOGLE's web cache, but this has been prohibited in mainland China, so many precious materials can't be seen.
But I also found a few web pages about grub.exe, which are all bug tracking web pages of GNU GRUB, some letters. From these letters, I slightly knew that the goal of grub for dos was once worked on by someone, but it seemed that there was no follow-up. Among them, some people pointed out the problems of directly compiling GNU GRUB on the DOS/Windows platform. But it seems that no one directly compiled it, or maybe although it was compiled, it wasn't successful.
When I further considered this problem, I found that even if it was successfully compiled, it didn't make much sense. Why? Just look at the GRUB shell under Linux. This GRUB SHELL can only be used to install GRUB and test some commands of GRUB, but it can't be used to directly boot to another operating system from under Linux. Almost all GRUB commands can be executed under the GRUB SHELL of Linux, except the boot command. Imagine, if we implement GRUB for DOS like this, what's the meaning?
The most fundamental reason why the boot command of GRUB can't be used under Linux is that under Linux, it's impossible to return to real mode and execute a user-set program. Under LINUX, only the reboot and halt commands can return to real mode, but they are fixed in use, and the user can't control other behaviors after entering real mode. For example, it's not possible to immediately execute stage2 of grub after entering real mode.
Therefore, under DOS, I chose the method of HACKING DOS to implement GRUB FOR DOS. The purpose of HACK is to restore the BIOS interrupt vectors modified by DOS.
This is different from under Linux. Because under real-mode DOS, we can program freely without restrictions (this is the benefit of real mode). While the environments of LINUX and Windows have many restrictions. They all use the protected mode of CPU, refuse to execute certain instructions, and they don't have known system calls to return to real mode. Therefore, on top of these operating systems, the boot command of grub can't run.
The boot command of GRUB can boot any operating system. A necessary condition to boot these operating systems is that the CPU is in real mode. Because all operating systems in history are designed to start from real mode. The CPU of the computer is in real mode when it starts up.
Because DOS has been HACKED, GRUB can run under DOS. This makes GRUB for DOS probably (currently) the only multi-boot manager that can start running from within an operating system (in this case, from the DOS command line) and can boot any operating system. Usually, after one operating system is started, you can't enter another operating system (unless you restart the machine).
因为我们亲手创建,这个世界更加美丽。

