summaryrefslogtreecommitdiff
path: root/com32/elflink/ldlinux/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* Makefile: make the handling of firmware selection a little sanerH. Peter Anvin2016-02-091-1/+1
| | | | | | Clean up the handling of firmware selection inside the Makefiles. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ldlinux: use platform filename extensionMatt Fleming2013-05-161-2/+10
| | | | | | | | | | | | | | | | | | | 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>
* Merge tag 'syslinux-5.01' into firmwaresyslinux-6.00-pre4Matt Fleming2013-01-291-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile NEWS com32/cmenu/Makefile com32/elflink/ldlinux/Makefile com32/gfxboot/Makefile com32/gpllib/Makefile com32/include/sys/module.h com32/lib/Makefile com32/lib/sys/module/elf_module.c com32/menu/Makefile com32/rosh/Makefile com32/samples/Makefile core/init.c mk/elf.mk Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * ldlinux: Fix serial output and delete eprintf()Matt Fleming2013-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tagging __syslinux_get_serial_info() with __constructor is pretty useless when the global variables it uses, such as SerialPort, etc, are assigned *after* the constructor has run. This constructor made sense when config parsing was done by the core, but parsing is now performed by ldlinux. We need to explicitly invoke the function to initialise __syslinux_serial_console_info once we've parsed any config files. eprintf.c was introduced in commit 086d698c642f ("ldlinux: Add eprintf() to print to VGA and serial") because printf() output wasn't appearing on the serial console. It turns out that the above __constructor confusion was the real bug. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * Always strip all the modulesH. Peter Anvin2013-01-171-3/+3
| | | | | | | | | | | | | | | | Always strip the modules; they are too big unstripped. Specifically, we generate unstripped *.elf files, and then convert them to stripped *.c32 files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Merge branch 'elflink' into firmwareMatt Fleming2013-01-081-5/+7
|\ \ | |/ | | | | | | | | | | | | | | | | | | Merge the changes since Syslinux-5.00. The main reason behind this merge is to pull in the following bug fix, commit 90b5864fc793 ("core/kaboom.c: Export __bad_SEG()"), which allows us to turn on debugging in mk/devel.mk without ldlinux.c32 failing to load. Conflicts: com32/elflink/ldlinux/Makefile version
| * ldlinux: Don't delete ldlinux.c32 with 'make clean'Matt Fleming2013-01-041-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documented command sequence for distributions wishing to package a Syslinux release is, make clean make installer Unfortunately, becaues ldlinux.c32 is deleted by 'make clean' the installer target fails like so, make[1]: *** No rule to make target `../com32/elflink/ldlinux/ldlinux.c32', needed by `ldlinuxc32_bin.c'. Stop. make: *** [installer] Error 2 Follow the example set by core/Makefile for ldlinux.sys, etc and add any build files that are required by the installers to $(BTARGET). $(BTARGET) only gets deleted when running 'make spotless'. Reported-by: László Házy <hazy_l@yahoo.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * elflink: set the sonames of shared librariesH. Peter Anvin2013-01-031-1/+1
| | | | | | | | | | Set the sonames of shared libraries to the filename, so we don't end up with full pathnames embedded in the files.
* | Merge tag 'syslinux-5.00' into firmwaresyslinux-6.00-pre3Matt Fleming2012-12-071-2/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile com32/elflink/ldlinux/Makefile com32/lib/sys/module/elf_module.c core/cleanup.c core/comboot.inc core/conio.c core/fs/fs.c core/init.c core/mem/free.c core/mem/malloc.c core/timer.inc diag/geodsp/Makefile extlinux/main.c mk/embedded.mk modules/Makefile Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * Symbol export whitelistMatt Fleming2012-12-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before modules were dynamically loaded the boundary between GPL and non-GPL code was implicit because of the separate link domains for each module. With dynamic modules we need an explicit whitelist of core symbols that non-GPL code can link against at runtime without needing to be re-licensed under the GPL. Mark such symbols with __export, so that it is explicitly clear which symbols in the core can be linked against by non-GPL code. Reduce the visibility of symbols in both the core and ldlinux.c32 with -fvisibility=hidden. __export changes the visibility to 'default'. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * ldlinux: Move DISPLAY file handling out of the coresyslinux-5.00-pre13Matt Fleming2012-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The code that handles the DISPLAY directive was writing directly to the BIOS VGA page with __intcall(0x10). This caused corruption problems on the screen because the ansi library code was also writing to the screen. The correct way to fix this is to always use the ansi library code (via printf()) instead of going behind its back and using separate code paths to write to the screen. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Merge tag 'syslinux-5.00-pre10' into for-hpa/elflink/firmwareMatt Fleming2012-11-141-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | Pull in the latest prerelease that includes some bug fixes for ldlinux and a realloc() bug in core/. Conflicts: com32/cmenu/Makefile com32/elflink/ldlinux/Makefile com32/lib/Makefile core/pxelinux.asm
| * ldlinux: get_key() requires raw access to user inputMatt Fleming2012-11-021-1/+1
| | | | | | | | | | | | | | | | | | commit 4503e6260c0 ("ldlinux: Use stdcon instead of rawcon for the console") broke get_key() because it was no longer possible to read raw data from stdin. Provide a new function raw_read() that will return user input a character at a time. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Add per-firmware object directory supportMatt Fleming2012-10-161-6/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have multiple firmware backends it no longer makes sense to write object files to the same directory as their source. A better solution is to write the object files to a per-firmware directory under a top-level object directory. The top-level object directory can be specified on the command-line with the O= variable, e.g. make O=/tmp/obj. If no top-level object directory is specified an 'obj' directory is created in the top-level of the Syslinux source repository. All the existing make targets continue to work as before, however now they apply to all firmware backends, e.g. 'make installer' will build the BIOS, 32-bit EFI and 64-bit EFI installers and place them under $(OBJ)/bios, $(OBJ)/efi32 and $(OBJ)/efi64 respectively. Note unlike every other bit of Syslinux, the gpxe objects are still kept in the src directory, e.g. gpxe/src, since gpxe is only required by the BIOS backend. It is possible to specify a make target for a specific firmware or list of firmware with the following syntax, make [firmware[,firmware]] [target[,target]] To clean the object directory for just the BIOS firmware type, 'make bios clean' To build both the 32-bit and 64-bit EFI installers type, 'make efi32 efi64 installer' Since the Syslinux make infrastructure is now more complex a new file doc/building.txt has been created to explain how to build Syslinux. The top-level Makefile now exports some make variables for use in module Makefiles, - topdir - the top-level source directory of the Syslinux repository, e.g. /usr/src/syslinux - objdir - the top-level object directory for the firmware backend currently being built, e.g. /obj/syslinux/bios - SRC - the source directory in the Syslinux repository for the module currently being built, e.g. /usr/src/syslinux/com32/libupload - OBJ - the object directory for the module currently being built, e.g. /obj/syslinux/bios/com32/libupload Since we're rewriting the Makefile infrastructure anyway it seemed like a good idea to add parallel support. By writing subdirectories as prequisites for make targets the objects in those subdirectories can be built in parallel. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* execute(): move chainbooting code to its own fileH. Peter Anvin2012-06-071-1/+1
| | | | | | To improve readability, move chainbooting to its own source file. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* elflink: Fix boot sector bootingMatt Fleming2012-06-071-1/+1
| | | | | | | | | | | | | This adds missing support for booting from a boot sector file such as .bs, .bss or .0, by re-implementing the old asm bootsec code from core/bootsect.inc in C. This has resulted in some external changes. We've had to make StackBuf a global symbol because we access it directly from execute.c. Also, we need to move dsinfo.c into MINLIBOBJS because ldlinux now needs to reference __syslinux_derivative_info. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* elf: Support __constructor and __destructorMatt Fleming2012-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The old way of specifying functions that need to be run before/after a main function has never worked for ELF modules. Instead, the only way to get similiar behaviour was by using the MODULE_INIT() and MODULE_EXIT() macros, but no one seems to have bothered converting the old __constructor users over. Anyway, the old way is superior because it allows multiple functions be specified. Delete the MODULE_* macros as there's only one user of them in the entire tree. We can also get rid of the UNKNOWN_MODULE constant because now a module doesn't need a __module_init_ptr symbol to be classed as a library - if a module isn't an executable, it's a library, there's no such thing as an unknown type. It's no longer necessary to explicitly call __syslinux_get_ipappend_strings() from ldlinux.c because the __constructor tag on the version in com32/lib/syslinux will take care of invoking it before ldlinux.c32's main() is executed. Also, since we've refactored unload_module() to now run a module's destructors let's minimise the number of callers by deleting load_library() and unload_library(), which were only called by the test module in com32/elflink. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* core: Shrink core/ldlinux.sys to be under 64K bytesMatt Fleming2012-03-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It would seem that running from a btrfs file system has been broken for some time. The reason is that core/ldlinux.sys has grown substantially, resulting in it weighing in at a whopping 88K bytes and no longer fitting within the first 64K segment of a btrfs file system. This huge size stems from the fact that the core links with libcom32min.a because it requires various symbols contained within that archive but it includes and exports *all* the symbols from libcom32min.a. The reasoning behind this design decision is that when a module is loaded any undefined symbols that are defined in libcom32min.a can be resolved at runtime by the core, without the module also needing to statically link against libcom32min.a. Unfortunately doing this has increased the size of the core beyond acceptable limits, such that booting from a btrfs file system no longer works. This commit links ldlinux.c32 against libcom32min.a so that now ldlinux.c32 exports all the symbols contained within the archive. Since we will always load ldlinux.c32 before any other modules, any undefined symbols will now be resolved by ldlinux.c32 instead of the core. ldlinux.c32 isn't subject to same size constraints as the core, e.g. fitting within 64K. Here are the sizes in bytes before and after this commit, Before: 33806 com32/elflink/ldlinux/ldlinux.c32 87749 core/ldlinux.sys After: 393871 com32/elflink/ldlinux/ldlinux.c32 45516 core/ldlinux.sys Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Add eprintf() to print to VGA and serialMatt Fleming2011-12-021-1/+1
| | | | | | | | | printf() is used heavily in the ldlinux code but that only displays things on the VGA console, not on serial. Introduce eprintf(), which gives us the benefit of format strings but will also print to both VGA and serial. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Add support for Auxillary Data VectorMatt Fleming2011-05-251-1/+2
| | | | | | | | | | Move all the code for the ADV into ldlinux so that it doesn't have any dependencies on other modules. We also need a way to initialize the ADV from ldlinux, so add another vector to the comboot API. Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* elflink: ldlinux should not have any dependenciesMatt Fleming2011-04-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | | ldlinux currently requires the get_key() symbol, which means it has a dependency on libutil_com.c32. ldlinux.c32 really should be a standalone module so let's move get_key.c into ldlinux/. However, moving get_key.c creates a new problem - native linux applications such as com32/samples/keytest.c require the get_key() symbol which is currently exported by libutil_lnx.a. To fix this, we create a new native linux library that exports any required symbols from ldlinux. With this change we need to update com32/Makefile so that we build com32/elfink/ldlinux before com32/samples, and seeing as ldlinux now has no dependencies, we may as well move it to the front of $SUBDIRS. Also, update elf_gen_dep.sh to skip ldlinux.c32 and not search for dependencies for any of its unresolved symbols. This way, if anyone inadvertently introduces a dependency that cannot be resolved by the core, ldlinux.c32 will fail to load at runtime (which guarantees that the newly introduced dependency won't go unnoticed). Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* elflink: Make ELF the default object formatMatt Fleming2011-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | com32/elflink/modules was originally created to house ELF modules and keep them separate from the COM32 modules as the elflink branch was being developed. However, this has inadvertently created a maintenance nightmare because code was copied from elsewhere in the tree into com32/elflink/modules, resulting in duplication. Bug fixes have been going into the original code but have not been merged onto the elflink branch, leaving the duplicate code in com32/elflink/modules buggy. So let's delete this directory. There really is no reason to keep ELF and COM32 modules separate because there's no reason to need both COM32 and ELF modules to coexist. ELF is a far superior object file format and all modules are not emitted as ELF objects. Now that we're outputting ELF modules we can use dynamic memory instead of the cs_bounce bounce buffer. This commit requires a certain amount of shuffling for some files. quicksort.c isn't a module and belongs as part of the util library. cli.h belongs in com32/include so that other modules can make use of the cli code in ldlinux.c32. All libraries are now ELF shared libraries which are only loaded to fixup unresolved symbols for executable modules and renamed from *.a to *.c32. This reduces the runtime memory footprint because libraries are only loaded when needed and because every executable no longer gets its own copy of code/data (as it would if linking with a static library). Also, remove MINLIBOBJS from libcom32.c32 because it is already part of libcom32min.a and we don't want to have any duplicate symbols between the core (which links with libcom32min.a) and libcom32.c32. Welcome to the New World Order of ELF modules! Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* elflink: Move more code from core/ into ldlinuxMatt Fleming2011-04-261-1/+1
| | | | | | | | | | | | | | | ldlinux now contains all the code necessary to load and execute modules, none is contained in the core. This change also allows us to change the spawn_load() prototype and to push the job of processing arguments to executable functions (e.g. the contents of char *argv[] as passed to a module's main function) into ldlinux/execute.c instead of doing it in spawn_load(). Moving it into ldlinux/ makes sense because the only core user of spawn_load() is load_env32() and we don't require any sort of argument processing in that path. Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* elflink: Move elf MCONFIG to mk/elf.mkMatt Fleming2011-04-261-1/+2
| | | | | | | Catch up with recent changes to the Makefile fragments in the MCONFIG files. Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* ldlinux: Fix the following warningsMatt Fleming2011-03-151-1/+1
| | | | | | | | | ldlinux.c: In function ‘enter_cmdline’: ldlinux.c:15:23: warning: unused variable ‘aux’ ldlinux.c: In function ‘ldlinux_main’: ldlinux.c:75:5: warning: implicit declaration of function ‘kaboom’ Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* elflink: Move code out of core and into ldlinux.c32Matt Fleming2011-03-091-0/+38
Currently, there is a lot of code in core/elflink that is not strictly required for the core to function. There are benefits to keeping the core proper as small as possible, for example so that it can fit within a single 64K block on btrfs. So move the following pieces of code out of core/elflink and into a new ldlinux ELF module which will be automatically loaded by the core: - command line interface code - C configuration parser - refstr implementation - rest of the menu system Below are some measurements of the size of ldlinux.elf before and after this change. Before: text data bss dec hex filename 161328 10439 913468 1085235 108f33 core/ldlinux.elf After: text data bss dec hex filename 142423 10415 909500 1062338 1035c2 core/ldlinux.elf Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>