Page 1 of 1

(FDUBCD) reason not to use 'write' command in grub4dos?

Posted: Sat May 04, 2013 10:22 pm
by Explorer09
In UBCD 5.2 and above, the UBCD Freedos image has been switched from an iso image to a superfloppy image.
The GRUB4DOS boot entries for FDUBCD are also changed for this.
However, when I compare the boot entries between UBCD versions, I see that the old UBCD has a 'write' command in each entry, which makes the ubcdcmd thing work in GRUB4DOS as in ISOLINUX.

Code: Select all

write --offset=15 (fd0)/bin/setargs.bat ubcdcmd=program_name\r\n
In my customized UBCD, I have added this command back. But I wonder why is this feature lost in the new UBCD? Is there any reason to not include the write command in the FDUBCD entries?

(Note: I have read this discussion thread but it didn't answer my question.)

For reference, below are the GRUB4DOS entries for FDUBCD between UBCD versions. The 'atapicd' is just one example program.
UBCD 5.2.0 - 5.2.3

Code: Select all

map --mem /ubcd/images/fdubcd.img.gz (fd0)
map --hook
rootnoverify (fd0)
chainloader +1
UBCD 5.1.1

Code: Select all

map --mem /ubcd/images/fdubcd.iso.gz (hd32)
map --hook
root (hd32)
chainloader (hd32)
UBCD 5.0.3

Code: Select all

map --mem /ubcd/images/fdubcd.img.gz (fd0)
map --hook
write --offset=15 (fd0)/bin/setargs.bat ubcdcmd=atapicd\r\n
chainloader (fd0)+1
rootnoverify (fd0)

Re: (FDUBCD) reason not to use 'write' command in grub4dos?

Posted: Sun May 05, 2013 2:32 am
by ady
Explorer09 wrote:I wonder why is this feature lost in the new UBCD?
In UBCD 5.2.3, the file
./ubcd/tools/linux/syslinux2grub4dos/syslinux2grub4dos.sed
, line #125:

Code: Select all

	s|^COM32.*memdisk\nINITRD /ubcd/images/fdubcd.img.gz\nAPPEND raw ubcdcmd=\(.*\)|map --mem /ubcd/images/fdubcd.img.gz (fd0)\nmap --hook\nrootnoverify (fd0)\nwrite --offset=15 /bin/setargs.bat ubcdcmd=\1\\r\\n\nchainloader +1|
needs a correction. It is currently searching for "
APPEND raw ubcdcmd=*
" (so to replace it), but it should be searching for "
APPEND floppy raw c=32 h=16 s=63 ubcdcmd=*
". It would be probably better to search for "
APPEND * raw * ubcdcmd=*
" in this substitution line (I mean, in addition to the initial "
^COM32.*memdisk\nINITRD /ubcd/images/fdubcd.img.gz\n
").

Regarding the additional grub4dos code, in case anyone wonders, the explanation is in this post: viewtopic.php?p=6522#p6522

The "--offset=15" means 15 "characters" (including LF and CR) from the beginning of the setargs.bat file (already in memory); then write the specified text.

Re: (FDUBCD) reason not to use 'write' command in grub4dos?

Posted: Sun May 05, 2013 5:26 pm
by Explorer09
Thanks for the answer.

So it's a regression isn't it?

Re: (FDUBCD) reason not to use 'write' command in grub4dos?

Posted: Sun May 05, 2013 10:18 pm
by ady
I don't know how to call it.

During the 5.2.x development, fdubcd was formatted first as HDD image, and then as floppy image. At the same time, the syslinux2grub4dos scripts were modified. Before the final 5.2.0 release, the Syslinux entries for fdubcd were changed again, adding "floppy" and the CxHxS arguments to memdisk.

My guess is that, at that point, the script should also had to be modified again in order to keep the "ubcdcmd=" functionality when booting from grub4dos.

Whichever format fdubcd will have, it should always have "raw" and "ubcdcmd=" (when booted by memdisk) in the APPEND line. My suggestion (in my previous post) should help in reducing the chances that this could happen again with fdubcd.

In a certain sense, the "same" is happening with other Syslinux menus that changed, like for example the entries for Memtest86 v4.2.x (not to be confused with Memtest86plus).

Re: (FDUBCD) reason not to use 'write' command in grub4dos?

Posted: Tue May 07, 2013 5:01 am
by Victor Chew
Damn! Huge regression.

I have fixed syslinux2grub4dos.sed as per ady's suggestion and the ubcdcmd parameter is now correctly appearing in the grub4dos scripts and tested to work as before.

Thanks for reporting this!