China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 20:05
中国DOS联盟论坛 » GRUB4DOS、SYSLINUX及其它启动管理软件讨论专区 » Problems with WinGrub View 4,547 Replies 44
Floor 31 Posted 2005-01-16 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
Here's how it is: GRLDR doesn't utilize any stage files, while the setup command installs those stage files. If your stage2 file hasn't been Chinese - localized, then what you get with setup is still non - Chinese - localized GRUB. The GRUB installed by this method doesn't use the GRLDR file at all. On the other hand, only the GRLDR file is needed, that is, GRLDR doesn't need the existence of those stage files either. These are two complementary systems.

For the method of installing GRLDR to the MBR, there are detailed steps on http://grub.linuxeden.com/.
因为我们亲手创建,这个世界更加美丽。
Floor 32 Posted 2005-01-16 00:00 ·  中国 安徽 合肥 教育网
初级用户
Credits 121
Posts 10
Joined 2004-11-19 00:00
21-year member
UID 33822
Gender Male
Status Offline
Methods to install GRUB to the hard disk master boot record (MBR and the next few sectors after MBR):
a. Read the first sector (MBR) of the hard disk into memory area 1, and read the first 5 sectors at the beginning of GRLDR into memory area 2.
b. Copy 66 bytes from 0x01be to 0x01ff in memory area 1 to 0x01be to 0x01ff in memory area 2. (This area is the hard disk partition table).
c. Write the changed memory area 2 (which has a length of 5 sectors) to the first 5 sectors at the beginning of the hard disk (that is, on the MBR and the next 4 sectors after it).

Important correction: The above b. should be changed to:
b. Copy 72 bytes from 0x01b8 to 0x01ff in memory area 1 to 0x01b8 to 0x01ff in memory area 2. (This area is the Windows disk signature and the hard disk partition table).

Because of that important correction, the function of wingrub writing to the MBR can't be used, right? Can you specifically say how to operate with dd under Linux? I'm afraid of getting the byte count wrong, after all, it's troublesome if the MBR or partition table is damaged.
Also, after such an operation, must grldr stay in the original partition, right?
Floor 33 Posted 2005-01-16 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
Manual operations are always a bit nerve - wracking. Mistakes always accompany us often. So, to avoid losses, we need to back up the hard disk partition table to another disk, or it's better to back it up to a USB flash drive. Backing up to a floppy disk is also possible, but it's not very reliable because the floppy disks I've experienced all have a short lifespan. Some floppy disks can be written to, but when you try to read them, they fail. Or they can be read today but not tomorrow, making you shed tears.

After backing up your partition table, you may be relatively at ease, but not 100% at ease because the dd command itself is very dangerous.

When using the dd command, if you forget to type the "count=" parameter, in some cases, it will destroy the entire hard disk, and of course, you won't be able to recover it because it erases all the data on the entire hard disk, not just the partition table. Especially when the input file specified by the if= parameter is a device, the danger is the greatest. For example, if=/dev/zero or if=/dev/hdc, etc.

So, I oppose using the dd command. Even if you are careful, I oppose it because this command is extremely simple to use, giving people the impression that it's very good, and this is likely to induce those who are not proficient in LINUX to try to use this command. It's happy if used well, but a disaster if used badly.

Well, assume you have backed up your partition table to the USB flash drive; otherwise, you may not be able to sleep at ease. Now it's time to start the risky operation.

-----------------------------------------------------------------------------------------------------------------------------------------------

First, read the "Microsoft's disk signature" and the "hard disk partition table", that is, the last 72 bytes of the first sector of the first hard disk:

dd if=/dev/hda of=my_heart bs=1 count=72 skip=440

bs=1 means calculating in bytes.
count=72 means copying 72 units of length to the destination.
skip=440 means skipping the first 440 units of the source input file.

Therefore, what is to be copied is the 72 bytes from the 441st to the 512th byte.

After the command is completed, use

hexedit my_heart

to see if the file content is correct.

Second, read the first 440 bytes at the beginning of GRLDR:

dd if=grldr of=new_mbr_code bs=1 count=440

Third, read the 2nd to 5th sectors at the beginning of GRLDR:

dd if=grldr of=sector_2_to_5 bs=512 count=4 skip=1

Fourth, concatenate the above three files into one file:

cat new_mbr_code my_heart sector_2_to_5 > my_dangerous_mbr_5_sectors

Use ls -l to list the length of my_dangerous_mbr_5_sectors and see if it is correctly 2560 bytes, and then use hexedit to check and confirm that the file format is correct.

Fifth, all the above are writing to temporary files, and now it's really dangerous! To write to the MBR, the consequences are at your own risk! Don't say you regret it later (especially don't say it's my fault)!

You need to confirm again that /dev/hda is indeed where your MBR is stored! If you mistakenly write to another disk, then you have committed involuntary manslaughter, innocently destroying other disks!

In some machines, the MBR is on /dev/sda or on other devices, so this must be clarified! If there is any ambiguity, then stop here and don't continue!

dd if=my_dangerous_mbr_5_sectors of=/dev/hda bs=512 count=5

Sixth, you don't know yet if you have killed the disk. While the machine is still alive, you need to confirm what you just did:

dd if=/dev/hda of=mbr_just_written bs=512 count=5

You use hexedit to see if mbr_just_written is normal. If there is an error, you still have a chance to make amends.

Seventh, you need to run the fdisk -l /dev/hda command to see if your partitions are still there. If there is an anomaly, you know it's caused by what you did, so this is not a time for you to sleep. You'd better operate more large software to see if there are problems, and then feel at ease.

Eighth, it's not too important, but to avoid the machine crashing at startup, check if the GRLDR file is located in the root directory of a primary partition, and the primary partition should be a Microsoft - formatted partition, not a Linux - formatted partition (because currently there is no support for Linux - formatted partitions).

Ninth, you've done all the bad things, and life or death depends on this! By the way, see if your USB flash drive is still there. Restart the machine and see if the GRLDR boot is normal.

After the above operations, if you suffer from insomnia,多梦 and other diseases in the future, it's all normal.

In addition to the above - mentioned limitations, GRLDR has no other limitations. Even if you write the MBR first and then put GRLDR in the root directory of a primary partition, it's also okay. The MBR doesn't contain the location information of the GRLDR file. It finds GRLDR by searching all four primary partitions, and the search process is dynamic. After the MBR takes control, it starts to search for GRLDR.
因为我们亲手创建,这个世界更加美丽。
Floor 34 Posted 2005-01-19 00:00
初级用户
Credits 121
Posts 10
Joined 2004-11-19 00:00
21-year member
UID 33822
Gender Male
Status Offline
-__________- Don't click BT-related things. It's making a big fuss. Originally there was no problem, now it's scaring out a problem.
Floor 35 Posted 2005-01-19 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
I'm really sorry, heh heh.

But you seem to be really fine now , originally it was you who was abnormal, now you're normal (as I said above).
因为我们亲手创建,这个世界更加美丽。
Floor 36 Posted 2005-01-22 00:00 ·  中国 江苏 苏州 电信
中级用户
Credits 230
Posts 37
Joined 2003-05-24 00:00
23-year member
UID 2394
Gender Male
Status Offline
I tried with a 1.44M floppy disk, and everything worked normally. It shows that grldr has no problem reading and writing to ordinary floppy disks. But since the current one is a floppy disk emulated by a USB flash drive, there are differences from the real floppy disk (such as the position and size of FAT), so it's normal to have problems. I estimate that if it's emulated in HDD mode, there won't be problems. If we rewrite the BPB of the USB flash drive according to the BPB of the ordinary floppy disk to make the USB flash drive used as 1.44M, it should also be okay, but it's not very meaningful.
Floor 37 Posted 2005-01-22 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
From these situations, it seems to fully confirm my previous guess, that is, your USB flash drive in fact can only support a bootable floppy disk of 1.44M.

GRLDR has no limit of 1.44M. Even if you use fd0, GRLDR has no limit of 1.44M. It should be that your BIOS has such a limit.

I once emulated a 1GB floppy disk with GRUB for DOS, that is, 1000MB, and it ran well.

If you format the floppy disk as 128M, and copy two files of 2M size to the floppy disk, (note that it is copying two files, not one). Boot the USB flash drive to DOS, if you can open these two files with edit under DOS, then it means that your BIOS does support bootable floppy disks larger than 1.44M. If it freezes or other abnormal phenomena occur, then it means that your BIOS does not support reading and writing of bootable floppy disks larger than 1.44M.

Previously I had 99% confidence, now because the situations you mentioned are all within my expectations, therefore I have 99.99% confidence that your BIOS does not support bootable floppy disks larger than 1.44M.

However, continuing the test is no longer meaningful, because a bootable floppy disk of 1.44M is sufficient, and there is no need for a larger bootable floppy disk originally.

In addition, whether there is a problem when emulating in HDD mode still depends on your BIOS, not GRUB, because GRUB has no such bugs.

Well, no matter whether the problem is in GRUB or in BIOS, it doesn't matter, because after all, GRUB can be used normally on your 1.44M USB flash drive.
因为我们亲手创建,这个世界更加美丽。
Floor 38 Posted 2005-01-22 00:00 ·  中国 江苏 苏州 电信
中级用户
Credits 230
Posts 37
Joined 2003-05-24 00:00
23-year member
UID 2394
Gender Male
Status Offline
The previous test with the 1.44M floppy disk was with a real floppy disk, not an intentionally formatted USB flash drive. Just to see if the BIOS fully supports GRUB boot from a floppy disk. Later, I intentionally formatted the USB flash drive to 1.44M, with BPB all in accordance with the parameters of an ordinary 1.44M floppy disk. As a result, neither DOS nor GRUB could find the boot file. I estimate it's like this: Since it's in USB-ZIP mode, the BIOS firmly recognizes heads = 64 and sectors/track = 32. So the boot code in the DBR fails to find the boot file because the boot code calculates the CHS value of a certain sector according to the BPB parameters (now heads = 2, sectors/track = 18) and passes it to the BIOS. But the BIOS calculates another sector according to heads = 64 and sectors/track = 32 with this CHS value. Whereas before, directly formatting a USB flash drive in USB-ZIP format to a 120M partition worked because the values of heads and sectors/track in the BPB happened to be the same as the BIOS default, so the boot code could find the boot file. Later, I formatted the USB flash drive to 128M, copied two MP3s of more than 2M each (totaling more than 5M), and could open them smoothly with edit. It seems the BIOS can support boot disks larger than 1.44M. Why copy two here instead of one 2M file or one 4M file? A larger boot disk is better. For example, if there are several 1.44M floppy disk images, GRUB can be used to select the boot. It seems I still can't determine where the problem is.
Floor 39 Posted 2005-01-23 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
This problem ultimately belongs to your BIOS mechanism. Either you didn't read its manual, or it doesn't have a manual, so you need to keep trying. Remember the thing where your formatting tool once messed up the total number of sectors? It could mess up that, and it's easy to mess up more things. You check some common functions of int13, including the two functions ah=8 and ah=15h, and it must be wrong. (Remember the thing about crashing动不动before? Crashing under such a simple operation is a crash of the int13 instruction. The other parts of GRUB are written in C language and can only show error messages, not crash.)

You said "the BIOS rigidly recognizes head and sectors/track". What's the basis? Could it also rigidly recognize cylinders? If it rigidly recognizes cylinders, then of course there will be problems if you use a cylinders value that doesn't meet the BIOS requirements. At this time, other operations in DOS may be normal, but GRUB has to calculate the total length of the file system at the beginning, so GRUB happens to use the cylinders value, so GRUB will fail. But this is just a guess. Making these specification data rigid is inherently a problem of the BIOS, right? Even if it is publicly stated, it should be considered a problem because it is after all not beneficial to users.

In short, in my opinion, it can still be affirmed that it is a problem with the BIOS. If this is not the fault of the BIOS and it can be proved to be a mistake in GRUB, then it is a big BUG. I think it's extremely unlikely that there is such a BUG in the relevant processing program of GRUB calling int13. Judging from the performance of this BIOS, it can't be regarded as a good BIOS (I personally think it's very rough), so I think focusing on finding the mistake here is the right way. If you want to start from GRUB, I estimate that in the end, when tracking to int13 and then to the BIOS, the discovered mistake will still be in the BIOS.

It's nothing more than GRUB not being able to be used normally, and there's no need to look for mistakes anymore. The benefit of finding mistakes is that once the root cause is really found, we can have a remedy to let GRUB avoid these reefs and run smoothly. But it doesn't seem likely. If you don't test each int13 function call one by one. Searching in Google should be able to find explanations of some common functions of int13, there are many web pages in both Chinese and English.

Traditional BIOS really is also very unlikely to have BUGs, because it is much older than GRUB. However, the BIOS mentioned here specifically refers to the processing part of the USB boot disk, which is a new thing and has not been tested for many years, so it is reasonable to suspect that it has BUGs.
因为我们亲手创建,这个世界更加美丽。
Floor 40 Posted 2005-02-03 00:00 ·  中国 广东 中移铁通
初级用户
Credits 186
Posts 32
Joined 2004-06-16 00:00
22-year member
UID 26837
Gender Male
Status Offline
The following is the statement made by Budian on January 23, 2005 at 15:44:01:
This problem ultimately belongs to your BIOS setup. Either you haven't read its manual, or there is no manual, so you need to keep trying. Remember the incident before where your formatting tool got the total number of sectors wrong? It could get that wrong, and it's easy to get more things wrong. You check some common functions of int13, including the functions ah=8 and ah=15h. It must have errors. (Remember the frequent freezes before? Freezing under such a simple operation is a freeze caused by the int13 instruction. The other parts of GRUB are written in C and can only display error messages, not freeze.)

You said "the BIOS has fixed values for head and sectors/track". What is the basis? Could it also have fixed values for cylinders? If it has fixed values for cylinders, then if you use a cylinders value that doesn't meet the BIOS requirements, it will naturally cause problems. At this time, other operations in DOS may be normal, but GRUB needs to calculate the total length of the file system at the beginning, so GRUB happens to use the cylinders value, so GRUB will fail. But this is just a guess. Making these specifications fixed itself should be considered a flaw in the BIOS? Even if it is publicly stated, it should be considered a flaw because it is not conducive to users.

In conclusion, in my opinion, it can still be affirmed that it is a BIOS problem. If this is not the fault of the BIOS and it can be proven to be a GRUB error, then it is a big BUG. I think the possibility of a BUG in the relevant processing program of GRUB calling int13 is very small. Judging from the performance of this BIOS, it cannot be considered a good BIOS (I personally think it is very rough), so I think focusing on finding faults here is the right way. If you start from GRUB, I estimate that in the end, tracking to int13 and then to the BIOS, the found error will still be in the BIOS.

It's nothing more than GRUB not working properly, and there's no need to look for faults anymore. The benefit of finding faults is that once the root cause is really found, we can have remedies to let GRUB avoid these reefs and run smoothly. But it doesn't seem likely. If you don't test the int13 function calls one by one. Searching in Google, you should be able to find explanations of some common functions of int13, both in Chinese and English, there are many web pages.

Traditional BIOSs indeed rarely have BUGs because they are much older than GRUB. However, the BIOS mentioned here specifically refers to the USB boot disk processing part, which is a new thing and has not been tested for many years, so it is reasonable to suspect that it has BUGs.



Since I got to know the GRUB software, I have been trying to install it on a USB flash drive. But whether using USB-ZIP or USB-HDD methods, the result is the same. GRUB can be installed on my USB flash drive, but it just can't read the content on the USB flash drive. Or as you said, this is related to my BIOS, and I also think it's correct. But a few days ago, I accidentally made my USB flash drive readable by GRUB. At this time, the USB flash drive was in USB-HDD mode. Why could it be recognized now when it couldn't be recognized before? And when it was recognizable and unrecognizable, the USB flash drive was formatted with the XP built-in tool. However, booting the computer with USB-HDD mode is far less good than USB-ZIP. I really hope that some experts can study how to make GRUB recognize the USB-ZIP USB flash drive. I think that GRUB not being able to read the USB flash drive content is not only related to the BIOS.
Floor 41 Posted 2005-02-04 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
The fact that the USB - HDD mode can make GRUB run normally while the USB - ZIP mode cannot make GRUB run normally does not explain anything. There may be such a situation: when in the USB - HDD mode, the BIOS has no bugs (that is, the bugs do not show up at this time), and when in the USB - ZIP mode, the BIOS has bugs.

If it can be proved that several common calls of int13 in the USB - ZIP mode are all correct, then we can conclude that the problem lies in GRUB, not in the BIOS.

Proving whether int13 has problems is the simplest. If we look for the problems of GRUB, it is like looking for a needle in a haystack. So, I tend to start with int13, that is, first prove that int13 has no problems, and then do further work.

If int13 has problems, since we know where it has problems, it is easy to patch it, so that we can achieve our purpose of using GRUB normally.

If int13 has no problems, we can conclude that there must be unknown bugs in the code of GRUB, and then we will try to find the bugs in GRUB.

It can be seen that checking int13 is the key. Without this, nothing can be explained, unless you really find bugs in the code of GRUB, and finding this is very difficult because the code of GRUB is not so easy to understand.

-----------------------------

I don't believe that among so many people using USB - ZIP, there is not a single one who checks the BIOS's int13 when the USB - ZIP mode works? It is not difficult to do this, just knowing how to use debug. If you are proficient, you can finish the check in a few minutes.
因为我们亲手创建,这个世界更加美丽。
Floor 42 Posted 2005-02-04 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
> But a few days ago, I inadvertently made my USB flash drive readable by GRUB, and at this time the USB flash drive was in USB-HDD mode. Why was it originally unrecognizable, but now it can be recognized? And both times when it was formatted, the USB flash drive was formatted using the XP built-in tool.

This phenomenon also does not indicate where the problem is. It is possible that the BIOS bug manifested in your previous formatting and did not manifest in your subsequent formatting. The solution should still be to check int13.

I think it is very likely that when the abnormal situation occurred the first time, if you checked INT13, you would find the BIOS bug, and when the abnormal situation did not occur the second time, you might not be able to find the BIOS bug.

Searching for debug and int13 in Google should quickly allow you to understand the relevant information about debug and int13.
因为我们亲手创建,这个世界更加美丽。
Floor 43 Posted 2005-02-04 00:00 ·  中国 广东 广州 番禺区 电信
初级用户
Credits 186
Posts 32
Joined 2004-06-16 00:00
22-year member
UID 26837
Gender Male
Status Offline
I don't know how to use DEBUG. I first used WINGRUB "Boot From Bs" and then "Boot From MBR" to process the USB flash drive. Then the files in the USB flash drive can be recognized by GRUB, which has nothing to do with what formatting tool I use. That is to say, as long as I do the above two steps in sequence, my USB flash drive can use GRUB in USB-HDD mode. I tried almost many methods before and none of them worked.
Floor 44 Posted 2005-02-04 00:00 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
When there are no exceptions, you may no longer be able to find bugs. Although abnormal situations are not good for you and you are very reluctant to have such situations, on the other hand, you have the opportunity to find bugs. So, abnormal situations are actually good things. Testing like you did above basically doesn't explain much. When an exception occurs, use this abnormal GRUB to boot a certain DOS on the hard disk (it should be real-mode DOS, not the DOS window of Win98), and then operate debug under DOS, and you can find BIOS bugs. It doesn't matter if you are unwilling to do it (or can't do it); just look forward to others doing it. If this check is not done, no matter how much discussion there is, there will be no result, because it's all guesswork and nothing can be confirmed. This is just like not going to see a doctor when you are sick but finding someone who is not a doctor to treat yourself.
因为我们亲手创建,这个世界更加美丽。
Floor 45 Posted 2005-02-05 00:00 ·  中国 广东 广州 番禺区 电信
初级用户
Credits 186
Posts 32
Joined 2004-06-16 00:00
22-year member
UID 26837
Gender Male
Status Offline
An abnormal situation happened, which was really a good thing for me. I don't need to use that problematic method to install GRUB anymore, and I successfully made a computer that couldn't boot from my USB drive start up. Thanks to Budian's enthusiastic answer.
Forum Jump: