[syslinux] SYSLINUX 3.35 released
Luciano Miguel Ferreira Rocha
strange at nsk.no-ip.org
Thu Feb 1 19:49:18 PST 2007
On Mon, Jan 29, 2007 at 08:19:01AM -0800, H. Peter Anvin wrote:
> Sven Geggus wrote:
> >
> > Any particular reason, why the directory given with -d is not part of the
> > search sequence?
> >
>
> Yes, although one can argue it isn't a *good* reason.
>
> The reason is that the installer would have to be able to do a
> VFAT-to-MSDOS transformation on the entire path in order to encode it in
> ldlinux.sys (encoding something like the starting sector of a directory
> is unsafe in FAT, since it's not guaranteed to stay put.)
Correct me if I'm wrong, but from reading unix/syslinux.c, the
filesystem is mounted as msdos, ergo no VFAT-to-MSDOS translation is
needed for the -d option, as any "vfat" component on -d will fail upon
the rename.
>
> Not all environments can do that natively, which means I would have had
> to write libfat code for it, and that would have made it take a lot longer.
Which ones? Win32?
>
> In general I consider that a potential future addition.
>
After battling for a few hours with ldlinux.lst, I ended up having to do
a string search in syslinux_ldlinux for the place I created for the
specified dir.
The attached patch changes ldlinux.asm (adds a syslinux_cfg0 buffer for
the new location) and unix/syslinux.c (set the reserved region to the
specified directory).
I didn't like that I couldn't find the location of the buffer from the
.lst, I'm probably missing something obvious. The length is easy, but is
hardcoded to 32 bytes for now (counting with suffix "/syslinux.cfg"). 64
bytes also works OK.
PS: After some more battles, I can locate the buffer using ldlinux.map:
<location_of_syslinux_cfg0>-<start_of_.text>-<0x200 (a sector)>. Is
there an easy way of getting that and syslinux_cfg1-syslinux_cfg0
without having to use awk/sed/perl?
--
lfr
0/0
-------------- next part --------------
diff -ur syslinux-3.35/ldlinux.asm syslinux-3.35.1/ldlinux.asm
--- syslinux-3.35/ldlinux.asm 2007-01-29 01:56:21.000000000 +0000
+++ syslinux-3.35.1/ldlinux.asm 2007-02-02 02:56:12.000000000 +0000
@@ -899,6 +899,10 @@
;
; Load configuration file
;
+
+ mov di,syslinux_cfg0
+ call open
+ jnz .config_open
mov di,syslinux_cfg1
call open
jnz .config_open
@@ -1583,6 +1587,7 @@
crlf_msg db CR, LF
null_msg db 0
crff_msg db CR, FF, 0
+syslinux_cfg0: times 32 db 0 ; option for -d
syslinux_cfg1 db '/boot' ; /boot/syslinux/syslinux.cfg
syslinux_cfg2 db '/syslinux' ; /syslinux/syslinux.cfg
syslinux_cfg3 db '/' ; /syslinux.cfg
diff -ur syslinux-3.35/unix/syslinux.c syslinux-3.35.1/unix/syslinux.c
--- syslinux-3.35/unix/syslinux.c 2007-01-29 01:56:21.000000000 +0000
+++ syslinux-3.35.1/unix/syslinux.c 2007-02-02 02:45:36.000000000 +0000
@@ -208,6 +208,22 @@
force = 1; /* Force install */
} else if ( *opt == 'd' && argp[1] ) {
subdir = *++argp;
+ unsigned char *p = (unsigned char *) memmem(syslinux_ldlinux, syslinux_ldlinux_len,
+ "/boot/syslinux/syslinux.cfg", 27) - 32;
+ int l = strlen(subdir);
+
+ int i;
+ for (i = 0; p[i] == '\0'; i++);
+ if (i == 32 && (l + 15) < 32) {
+ /* remove trailing / */
+ while (subdir[l - 1] == '/') l--;
+
+ if (subdir[0] != '/') *p++ = '/';
+ memcpy(p, subdir, l);
+ strcpy(p + l, "/syslinux.cfg");
+ } else {
+ strcpy(p, "/boot/syslinux/syslinux.cfg");
+ }
} else if ( *opt == 'o' && argp[1] ) {
filesystem_offset = (off_t)strtoull(*++argp, NULL, 0); /* Byte offset */
} else {
More information about the Syslinux
mailing list