aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink/ldlinux/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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>
* 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>
* 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>