[syslinux] Syslinux search for config file
Gert Hulselmans
hulselmansgert at gmail.com
Thu Aug 30 01:36:44 PDT 2012
2012/8/30 Gert Hulselmans <hulselmansgert at gmail.com>:
> 2012/8/30 Tomas M <tomas at slax.org>:
>>>> I also tested 4.05, and it did NOT search the install directory if such
>>>> directory is not in the "expected" list. Tomas also got the same result (as
>>>> he wrote in a previous email in this same thread).
>>>
>>> He stated such but without more data, I can't be certain he's not
>>> encountering something that's already been resolved.
>>
>> I see symptoms as described by Ady Ady
>> I install syslinux from windows, using syslinux.exe (32bit binary),
>> which I got from syslinux 4.05 source distribution (there is the
>> binary precompiled).
>> # syslinux.exe -maf -d \slax\boot F:
>>
>
> I guess it is a bug in the windows version of the Syslinux installer:
>
>
>
> In win/syslinux.c, the directory path will replace all / characters with \
> (so -d /boot/blabla works the same as -d \boot\blabla):
> ================================================
> /* Move the file to the desired location */
> if (opt.directory) {
> char new_ldlinux_name[strlen(opt.directory) + 16];
> char *cp = new_ldlinux_name + 3;
> const char *sd;
> int slash = 1;
>
> new_ldlinux_name[0] = opt.device[0];
> new_ldlinux_name[1] = ':';
> new_ldlinux_name[2] = '\\';
>
> for (sd = opt.directory; *sd; sd++) {
> char c = *sd;
>
> if (c == '/' || c == '\\') {
> if (slash)
> continue;
> c = '\\';
> slash = 1;
> } else {
> slash = 0;
> }
>
> *cp++ = c;
> }
> ================================================
>
> In the syslinux_patch function of libinstaller/syslxmod.c:
> ================================================
> /* Poke in the base directory path */
> if (subdir) {
> int sublen = strlen(subdir) + 1;
> if (get_16_sl(&epa->dirlen) < sublen) {
> fprintf(stderr, "Subdirectory path too long... aborting
> install!\n");
> exit(1);
> }
> memcpy_to_sl(ptr(boot_image, &epa->diroffset), subdir, sublen);
> }
> ================================================
>
> The subdir name that is written to the extended patch area dir offset
> (epa->diroffset)
> contains always backslashes, when you run the Windows syslinux installer.
> Probably Syslinux can't handle backslashes, when booted (in the configuration
> files you also need to use forward slashes).
>
>
> Run bootinfoscript: http://sourceforge.net/projects/bootinfoscript/
>
> When you install Syslinux from linux, you will see something like this:
>
> sdb1: __________________________________________________________________________
>
> File system: vfat
> Boot sector type: SYSLINUX 4.05 2011-12-09
> Boot sector info: Syslinux looks at sector 952269 of /dev/sdb1 for its
> second stage. SYSLINUX is installed in the
> /boot/syslinux2 directory. No errors found in the Boot
> Parameter Block.
>
>
>
> When you install Syslinux from Windows, I expect that you will see
> something like this:
>
> sdb1: __________________________________________________________________________
>
> File system: vfat
> Boot sector type: SYSLINUX 4.05 2011-12-09
> Boot sector info: Syslinux looks at sector 952269 of /dev/sdb1 for its
> second stage. SYSLINUX is installed in the
> \boot\syslinux2 directory. No errors found in the Boot
> Parameter Block.
>
>
>> Probably you have some syslinux.cfg file or similar somewhere in the
>> common paths. Please try with blank sdb media and only one directory
>> "b" in the root
>
> I installed Syslinux to a different directory in the past (from linux)
> and it worked fine. I tried directories with dots and spaces.
>
>
> - Gert Hulselmans
After a closer look at the source code, the following should work:
syslinux.exe -maf -d /slax/boot F:
The forward slashes are replaced with backward slashes after calling
syslinux_patch.
- Gert Hulselmans
More information about the Syslinux
mailing list