[syslinux] syslinux efi configuration file name proposal

Prof. Dipl.-Ing. Klaus Knopper syslinux at knopper.net
Wed Aug 27 05:31:17 PDT 2014


Hello Ady,

On Wed, Aug 27, 2014 at 10:52:25AM +0300, Ady wrote:
> > Hello Ady & list,
> > 
> > On Wed, Aug 27, 2014 at 08:17:51AM +0300, Ady wrote:
> > > > Hello Ady,
> > > > 
> > > > On Fri, Aug 01, 2014 at 08:35:27PM +0300, Ady wrote:
> > > > > Goal: To have one USB drive capable of booting UEFI IA32 and UEFI X64 
> > > > > (with an optional Syslinux menu containing multiple entries).
> > > > > 
> > > > > Problem (solved) #1: The default directory location for both 
> > > > > syslinux.efi is the same.
> > > > > 
> > > > > Solution #1: Rename each syslinux.efi to bootx64.efi and to 
> > > > > bootia32.efi.
> > > > > 
> > > > > Problem (solved) #2: Each syslinux.efi needs at least its respective 
> > > > > ldlinux module.
> > > > > 
> > > > > Solution #2: Each ldlinux module is renamed with its corresponding 
> > > > > file name extension according to firmware/architecture. Each 
> > > > > syslinux.efi searches for its respective ldlinux.{e32,e64} module.
> > > > > 
> > > > > Problem (solved) #3: Similarly to the ldlinux module, the other 
> > > > > modules also use the same file names for every firmware/architecture.
> > > > > 
> > > > > Solution #3: Use the PATH directive and a combination of relative and 
> > > > > absolute path notation. This solution allows maintaining current 
> > > > > configurations, tutorials, easy copying, in-common cfg files... as 
> > > > > the same "c32" file name extension is kept for all alternatives.
> > > > > 
> > > > > 
> > > > > Problem #4: The initial configuration file, "syslinux.cfg", is also 
> > > > > using the same default file name and the same default location. The 
> > > > > content of "syslinux.cfg" might not be in-common to both UEFI 
> > > > > architectures (e.g. different values for the PATH directive).
> > > > > 
> > > > >  ---- 
> > > > > 
> > > > > Proposing a solution for Problem #4: syslinux.efi should look first 
> > > > > for a corresponding "sysl<arch>.cfg", and then fallback to 
> > > > > syslinux.cfg in the same searched-for location.
> > > > 
> > > > [...]
> > > > 
> > > > Your suggested proposal is, entirely by chance, almost exactly the same
> > > > solution that I'm currently using in Knoppix since version 7.2, i.e.
> > > > bitness-dependent ldlinux.e32/ldlinux.e64 and also a
> > > > syslnx32.cfg/syslnx64.cfg with a fallback to syslinux.cfg. It's merely
> > > > renaming and adding file names to the syslinux configuration file array,
> > > > just a few lines of code. So far, the patch is only included on Knoppix,
> > > > but feel free to use it on your distro as well.
> > > > 
> > > > I'd vote for acceptance of your proposal.
> > > > 
> > > > Regards
> > > > -Klaus
> > > > 
> > > 
> > > Hello Klaus,
> > > 
> > > Is there any chance to see your customized Syslinux 6.xx source code 
> > > / patch(es) / commits or alike? Is there any public URL?
> > 
> > Apparently, the rename of ldlinux.e32 to ldlinux.e64 for the 64bit
> > variant is already in the mainline git,
>  
> Correct. That's why in my proposal, I wrote "Problem (solved) #2", 
> emphasize in "solved" (see "Solution #2").
>  
> > so the only change left for
> > automatically chosing a different config file is the tiny patch attached
> > here, which will
> > 
> > - prepend syslnx64.cfg to the config file search path for the 64bit variant
> > - prepend syslnx32.cfg to the config file search path for the 32bit variant
>  
> For the BIOS cpu architectures, there is already ifcpu[64].c32.

I'm using this feature in Knoppix 7.4, so far it seems to work well,
though I'm somewhat unhappy with the fact that APPEND options cannot be
transferred to different labels this way (i.e. "auto lang=en" with the
"auto" label being an ifcpu64.c32 "kernel" will kill everything that was
typed at the command line).

> In my proposal, I am focusing on EFIIA32 and EFIX64 only.

I am aware of that. My solution patches the experimental "firmware"
branch of syslinux, which I use exclusively for the EFI binaries. For
BIOS mode, I stay with the official "stable" branch that is included in
Debian. But, the patches don't actually change much of the documented
default behavior in BIOS mode.

> If I understand correctly, your patch seems to be based on 
> "core/fs/lib/loadconfig.c":
> 
>  +#if defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) 
> 
> which means (again, if I understand correctly) that it affects 
> BIOS-based systems too.

Right. It's a compile time peprocessor directive, which means that a
64bit version (which is probably never used in BIOS mode) will also take
into account the syslnx64.cfg config file.

> As potential reference, in 
> "gpxe/src/include/gpxe/efi/Uefi/UefiSpec.h" we have:
> 
> "// EFI File location to boot from on removable media devices"
> 
> So, my goal is to get the *EFI* architecture (only), IA32 or X64, 
> i.e. excluding systems booting with BIOS firmware or in CSM, and then 
> use a similar patch as yours in "loadconfig.c".
> 
> Unfortunately, I am not a developer, so I don't know how to code a 
> selection of:
>  "booted in EFI<Arch> mode, not BIOS nor CSM"

If you don't like the same changes present in the BIOS variant, just add
an additional

#ifndef REGPARM
...
#endif

wrapper. The REGPARM macro is apparently only set in BIOS mode.

> > - add /boot/isolinux and /isolinux plus isolinux.cfg to the search path for
> >   all variants, just for the case that the "rename" was forgotten when copying
> >   over the files from an iso9660 CD/DVD to FAT32 flash disk.
>  
>  
> This part of the patch is unnecessary (and partially 
> counterproductive).

At least /me finds it very productive. :-)
If you don't like it, leave out that part.
I just sent what I'm using for Knoppix.

> The current already-implemented solution is to 
> use the "/[boot/]syslinux/" path for both, isolinux.cfg and 
> syslinux.cfg. For your next release of KNOPPIX, I would suggest 
> getting rid of the "/[boot/]isolinux/" directory. Thus, ISOLINUX will 
> boot with isolinux.cfg, and SYSLINUX will boot with syslinux.cfg, 
> both files located in the same "/[boot/]syslinux/" location. 

It doesn't hurt to keep the old variant for compatibility reasons, does
it?

> Moreover, if both .cfg files have the same content, you can leave 
> syslinux.cfg alone and get rid of isolinux.cfg too; ISOLINUX will 
> boot using syslinux.cfg. IIRC, this is valid since 4.06. See:
>  www.syslinux.org/wiki/index.php/Configuration_location_and_name 

It would save a kilobyte or two, true. But so far, I'm using the older
isolinux version for CD/DVD boot, and the git firmware branch for
syslinux with EFI until the experimental syslinux versions turns into a
"stable" one.

> Thank you for your prompt reply.
> 
> 
> So, going back to:
>  "booted in EFI<Arch> mode, not BIOS nor CSM"
> 
> Any tips / clues / code / patch?

My best guess would be the #ifndef REGPARM preprocessor directive shown
above for leaving BIOS mode as it is.


Regards
-Klaus


More information about the Syslinux mailing list