[syslinux] syslinux efi configuration file name proposal

Ady ady-sf at hotmail.com
Wed Aug 27 05:40:16 PDT 2014


> > 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.
> 
> In my proposal, I am focusing on EFIIA32 and EFIX64 only.
> 
> 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.
> 
> 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"
>  
>  
>  
> > - 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). 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. 
> 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 
>  
>  
> > 
> > Regards
> > -Klaus
> > 
> Thank you for your prompt reply.
> 
> 
> So, going back to:
>  "booted in EFI<Arch> mode, not BIOS nor CSM"
> 
> Any tips / clues / code / patch?
> 
> (Perhaps Matt might have some pointers?)
> 
> TIA,
> Ady.
> 
 
Here is my first (yet not ideal) attempt.

Now, is there any way to improve the '#if defined' expression so to 
only evaluate for EFIX64 first (for "syslx64.cfg"), then evaluate for 
EFIIA32 (for "syslia32.cfg"), and then continue with the fallback 
alternatives, while leaving BIOS and CSM as it was (i.e. without 
disrupting the original list of file names for BIOS and for CSM 
cases)?

Again, potential reference for improvement:
 "gpxe/src/include/gpxe/efi/Uefi/UefiSpec.h"
"// EFI File location to boot from on removable media devices"

Perhaps someone with relevant knowledge can improve it?

TIA,
Ady.

diff U3 loadconfig.c loadconfig.c
--- loadconfig.c	Wed Aug 27 00:01:00 2014
+++ loadconfig.c	Wed Aug 27 00:02:00 2014
@@ -21,6 +21,11 @@
 	NULL
     };
     static const char *filenames[] = {
+#if defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
+	"syslx64.cfg",
+#else
+	"syslia32.cfg",
+#endif
 	"extlinux.conf",
 	"syslinux.cfg",
 	NULL



More information about the Syslinux mailing list