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-08-12 00:29
中国DOS联盟论坛 » GRUB4DOS、SYSLINUX及其它启动管理软件讨论专区 » Question about grub4dos, can it be solved? View 1,654 Replies 5
Original Poster Posted 2006-04-06 17:02 ·  中国 天津 联通
新手上路
Credits 10
Posts 3
Joined 2006-04-06 16:32
20-year member
UID 53439
Status Offline
I want to boot a DOS floppy disk image through PXE and enter a DOS environment. In this DOS environment, use a DOS RAM disk to create a virtual drive. In this virtual drive, put the Linux kernel and initrd. Can the Linux kernel be booted through grub4dos?
Floor 2 Posted 2006-04-07 11:46 ·  中国 上海 联通
金牌会员
★★★★
Credits 3,467
Posts 1,616
Joined 2004-06-21 00:00
22-year member
UID 27148
Status Offline
The most basic function of grub is to boot the Linux kernel; all the other functions were added later.
Floor 3 Posted 2006-04-07 14:58 ·  中国 天津 联通
新手上路
Credits 10
Posts 3
Joined 2006-04-06 16:32
20-year member
UID 53439
Status Offline
The problem is this: when grub4dos reads the Linux kernel, it does so from a real hard disk or floppy disk, root(hd*,*). It seems there is no way to directly read the kernel file from a DOS RAM virtual drive.
Floor 4 Posted 2006-04-07 15:10 ·  中国 河南 南阳 联通
初级用户
★★
Credits 137
Posts 57
Joined 2005-09-29 21:23
20-year member
UID 42974
Status Offline
That depends on whether you're lucky or not. Since the floppy disk image is in memory, if after entering GRUB you can still find that image in memory, and preferably the image is also contiguous in memory, then it can succeed; otherwise, I'm afraid you'll have to think of another way.

What can be confirmed now is that all sectors in your floppy disk are already in memory. You can use the format (md)XXXXXX+XXXXXX to access a sequence of sectors in memory (you need to fill in suitable values for XXXXXX):

map (md)XXXXXX1+YYYYYY1,XXXXXX2+YYYYYY2,XXXXXX3+YYYYYY3 (fd0)
map --hook

Then you can access the files in the floppy disk.

But the difficulty lies in determining the value of XXXXXX; you'll need to decide it manually, which is quite troublesome.

So I suggest that the floppy disk image executed from PXE directly use a GRUB-booted floppy, that is, the boot sector of the floppy directly uses the boot sector of GRLDR (such a floppy boot sector can be created with the bootlace command). To put it more clearly, this floppy does not contain DOS, and you should never have a step of entering DOS. That way, when GRUB gets control, GRUB can access the floppy passed in from PXE; in fact, it is just (fd0). In this way, anything on your floppy can be conveniently operated on under GRUB (you won't even need to use the map command anymore).

If the latter method doesn't suit your taste, then you can still consider modifying the former method. Under DOS, find a way to place the entire floppy image into some fixed, contiguous area of memory, for example at physical address 0x400000, that is, at 4M, then enter GRUB and use

map (md)0x2000+2880 (fd0)
map --hook

to emulate it, and that will be OK. To explain: 0x2000 multiplied by the sector size 0x200 is 0x400000
2880 indicates the total number of sectors on the floppy disk.
Floor 5 Posted 2006-04-07 16:47 ·  中国 天津 联通
新手上路
Credits 10
Posts 3
Joined 2006-04-06 16:32
20-year member
UID 53439
Status Offline
Many thanks for tinybit's reply.
The second solution you mentioned really cannot meet my needs. I must first boot DOS from PXE, do some other operations in DOS, and then switch into Linux.
Originally I was using loadlin for this, but loadlin has size limits on both kernel and initrd, so I want to try grub4dos.
I will test according to the first solution you mentioned.
Thanks again.
Floor 6 Posted 2006-04-07 18:38 ·  中国 河南 南阳 联通
初级用户
★★
Credits 137
Posts 57
Joined 2005-09-29 21:23
20-year member
UID 42974
Status Offline
Since you have this special requirement, if possible, I can also consider having GRUB.EXE copy the DOS floppy to one contiguous area right at the beginning of startup. Use int13 to read the contents of the DOS RAM disk, then write them into extended memory, while making sure overlapping problems are properly handled. But I don't have time to deal with this at the moment, so let's talk about it later (this may be delayed a long time, several months, maybe even a year). For now you'll have to think of a way to make do with it yourself first.
Forum Jump: