aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink/ldlinux
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-05-16 10:16:17 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-05-16 11:01:55 +0100
commit2bd94fb6ed5f7f7472319cd6adaa25ccf9819230 (patch)
tree243d4733e1d319b5b0536eb4fc7a1383028c5219 /com32/elflink/ldlinux
parent34eeaa3d747284fea6eb44ebc971cb513816cb5e (diff)
downloadsyslinux-2bd94fb6ed5f7f7472319cd6adaa25ccf9819230.tar.gz
syslinux-2bd94fb6ed5f7f7472319cd6adaa25ccf9819230.tar.xz
syslinux-2bd94fb6ed5f7f7472319cd6adaa25ccf9819230.zip
ldlinux: use platform filename extension
Users are starting to package all Syslinux versions on one boot medium and are running into problems because all versions of ldlinux have the same filename, ldlinux.c32. The version of ldlinux.c32 compiled for bios will not work with efi32 or efi64, and vice versa. What we need is a way for the Syslinux core to know exactly which filename to load. Use the following extensions for the corresponding platforms, .c32 - bios .e32 - efi32 .e64 - efi64 Now all ldlinux variants can be kept in the same directory without causing any conflicts. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/elflink/ldlinux')
-rw-r--r--com32/elflink/ldlinux/Makefile12
-rw-r--r--com32/elflink/ldlinux/execute.c6
2 files changed, 13 insertions, 5 deletions
diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile
index bfec4503..d948da43 100644
--- a/com32/elflink/ldlinux/Makefile
+++ b/com32/elflink/ldlinux/Makefile
@@ -20,12 +20,20 @@ OBJS = ldlinux.o cli.o readconfig.o refstr.o colors.o getadv.o adv.o \
execute.o chainboot.o kernel.o get_key.o advwrite.o setadv.o \
loadhigh.o msg.o
-BTARGET = ldlinux.c32
+BTARGET = $(LDLINUX)
+
+ifdef EFI_BUILD
+%.e$(BITS): %.elf
+ $(OBJCOPY) --strip-debug --strip-unneeded $< $@
+SONAME = $(patsubst %.elf,%.e$(BITS),$(@F))
+else
+SONAME = $(patsubst %.elf,%.c32,$(@F))
+endif
all: $(BTARGET) ldlinux_lnx.a
ldlinux.elf : $(OBJS)
- $(LD) $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^ $(LIBS)
+ $(LD) $(LDFLAGS) -soname $(SONAME) -o $@ $^ $(LIBS)
LNXCFLAGS += -D__export='__attribute__((visibility("default")))'
LNXLIBOBJS = get_key.lo
diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c
index bf0bd8ce..653c880d 100644
--- a/com32/elflink/ldlinux/execute.c
+++ b/com32/elflink/ldlinux/execute.c
@@ -131,14 +131,14 @@ __export void execute(const char *cmdline, uint32_t type, bool sysappend)
* irrespective of how the COM32 module was loaded,
* e.g. from vesamenu.c32.
*/
- unload_modules_since("ldlinux.c32");
+ unload_modules_since(LDLINUX);
/* Restore the console */
ldlinux_console_init();
ldlinux_enter_command();
} else if (type == IMAGE_TYPE_CONFIG) {
- char *argv[] = { "ldlinux.c32", NULL, NULL };
+ char *argv[] = { LDLINUX, NULL, NULL };
char *config;
int rv;
@@ -155,7 +155,7 @@ __export void execute(const char *cmdline, uint32_t type, bool sysappend)
argv[1] = config;
rv = start_ldlinux(2, argv);
- printf("Failed to exec ldlinux.c32: %s\n", strerror(rv));
+ printf("Failed to exec %s: %s\n", LDLINUX, strerror(rv));
} else if (type == IMAGE_TYPE_LOCALBOOT) {
local_boot(strtoul(kernel, NULL, 0));
} else if (type == IMAGE_TYPE_PXE || type == IMAGE_TYPE_BSS ||