path: root/com32/elflink
Commit message (Collapse)AuthorAgeFilesLines
* ldlinux: Dynamically alloc memory for kernel and initrd filenamesMatt Fleming2013-01-041-19/+45
| | | | | | | | | | | | Absolutely no bounds checking is performed when copying filenames to 'cmdline_buf' and 'initrd_name' which means that sufficiently long strings will scribble over the stack. At best, the files will simply fail to load because the name is garbled. Allocate space for the cmdline at runtime to avoid these overflow problems. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* 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.
* Delete 16-bit COMBOOT supportsyslinux-5.00Matt Fleming2012-12-062-3/+0
| | | | | | | | | | | 16-bit COMBOOT files are no longer supported by Syslinux in 5.00 so delete all references and change any 32-bit COMBOOT image references to mention ELF instead. Some of the COMBOOT stuff is still used internally so we can't nuke core/comboot.inc yet, but that will disappear in a future release. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Symbol export whitelistMatt Fleming2012-12-059-13/+15
| | | | | | | | | | | | | | | | 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>
* core: Fix 'NoHalt'Matt Fleming2012-12-051-2/+2
| | | | | | Use the same variable in idle.c and ldlinux.c32. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Reduce the number of global variablesMatt Fleming2012-12-051-1/+1
| | | | | | | | | | In preparation for strictly limiting the list of variables that are exported (global) in the core, delete any unused variables, rewrite variable declarations in C that are not referenced by asm and delete files that are no longer included in other asm files. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Use get_msg_file() for F-keysMatt Fleming2012-12-041-17/+2
| | | | | | | | | The file that we display with the F-keys may contain background or foreground color codes and so needs to be interpreted by get_msg_file() instead of just printing the color codes as ascii to the screen with cat_file(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Remove default bold attribute typoMatt Fleming2012-12-041-1/+1
| | | | | | | | | commit 82cbb1bd4133 ("ldlinux: Move DISPLAY file handling out of the core") introduced a typo where the foreground color was always bold when displaying a DISPLAY file. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* CLI: Don't always start the CLI at column 0Matt Fleming2012-12-041-3/+9
| | | | | | | | | | | If we print files with no newline then it looks better if the CLI prompt is printed immediately after the file content, rather than erasing the line and printing prompt at column 0. This mainly affects files with one line of text and no newline character. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Move DISPLAY file handling out of the coresyslinux-5.00-pre13Matt Fleming2012-12-032-1/+215
| | | | | | | | | | | | | | 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: Don't try reloading ldlinux.c32 unless it's likely to succeedMatt Fleming2012-11-301-1/+3
| | | | | | | | If we can't access ldlinux.c32 with findpath(), reloading it isn't going to work so don't unload it or any of the other modules. Instead return control to the caller. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* CLI: Delete 'temp_cmdline' and put 'cmdline' on the stackMatt Fleming2012-11-291-17/+6
| | | | | | | | | | | | We don't need to preserve the contents of 'cmdline' across calls to edit_cmdline(). In fact, doing so causes things like the TAB key to not function properly because the previous command is used as a prefix to print_labels(), as though the user had typed it explicitly before hitting TAB. Delete 'temp_cmdline' because it no longer serves a purpose. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Complain to user on failure to perform file operationsMatt Fleming2012-11-292-2/+4
| | | | | | | | | | | | | | | If we fail to chdir or to execute a COM32 file we should inform the user so that they can debug the problem. We don't currently print anything if the user tries to execute a regular file, such as a config file, as an COM32 image. We also shouldn't be returning the exit value of the module from spawn_load(), because we have no way of doing anything useful with it, and just because a main() function returns -1 doesn't mean it failed to run. Modules need to take care of printing any error messages themselves. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Only append missing filename extensionsMatt Fleming2012-11-291-3/+6
| | | | | | | | | | | | Don't append an extension like ".c32" if the command already has one! This bug lead to "config.c32" being executed as "config.c32.c32" with the below config snippet, LABEL config COM32 config.c32 /configs/isolinux.cfg Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Merge branch 'coverity' into elflinksyslinux-5.00-pre11Matt Fleming2012-11-271-3/+1
| * chainboot: Delete extraneous free() in chainboot_file()Matt Fleming2012-11-151-3/+1
| | | | | | | | | | | | | | We don't need to call free(buf) if we're jumping to the 'bail' label because 'buf' is always free'd there. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | ldlinux: Reset the console whenever we execute a moduleMatt Fleming2012-11-273-1/+17
| | | | | | | | | | | | | | | | Each module expects the console to start in text mode and will make explicit calls to openconsole() when another console is required, e.g. in vesamenu.c32. This mimics the behaviour found in 4.0x. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | ldlinux: Fix OnError behaviourMatt Fleming2012-11-261-2/+8
| | | | | | | | | | | | | | If the ONERROR directive references a label we need to lookup the label's command line and type. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | ldlinux: Automatically apply ".c32" extension for COM32 filesMatt Fleming2012-11-263-2/+13
| | | | | | | | | | | | | | | | | | | | | | If a type-specifier is used on the command line, e.g. .com32 pwd we should apply the ".c32" filename extension automatically as this works elsewhere and this behaviour was present in 4.0x. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | ldlinux: Don't return NULL on KEY_ESC.Matt Fleming2012-11-261-6/+0
| | | | | | | | | | | | | | | | | | The old command line code in 4.06 ignores KEY_ESC and KEY_CTRL('C') so we should do the same. What currently happens if a user hits ESC is that we return from edit_cmdline() as though we'd timed out waiting for user input. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | ldlinux: Never exit from ldlinux.c32Matt Fleming2012-11-262-23/+29
|/ | | | | | | | | If there's no DEFAULT directive in the config file and the user hits the ENTER key enough times, or we timeout waiting for input, ldlinux.c32 will exit. This should never be allowed to happen, and we need to keep doing the ldlinux_auto_boot()/boot prompt dance. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Delete dead code and useless printfsyslinux-5.00-pre10Matt Fleming2012-11-131-28/+0
| | | | | | | | Seeing the cmdline re-printed every time the user presses enter is very annoying, so delete the offending printf(). Also delete some code that has been commented out for ages. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Delete inaccurate 'insufficient memory' messageMatt Fleming2012-11-131-3/+4
| | | | | | | Instead, use strerror() to print a more useful message if we fail to load a kernel. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* CLI: Add Ctrl + V support for printing the Syslinux versionMatt Fleming2012-11-021-0/+10
| | | | | | | The cli code is missing support for printing the version string that is available in Syslinux 4.06 and earlier. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* CLI: Fix command history traversalMatt Fleming2012-11-021-4/+18
| | | | | | | | The up/down keys were broken with respect to traversing through the command history because it was dereferencing a NULL pointer on the first iteration. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: get_key() requires raw access to user inputMatt Fleming2012-11-022-2/+22
| | | | | | | | | 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>
* ldlinux: Fix logic if no DEFAULT or UI directive is foundMatt Fleming2012-11-023-30/+30
| | | | | | | | | | | | | | Somewhere along the way the code that prints, No DEFAULT or UI configuration directive found! was broken, and now no longer prints at all. While we're fixing this it's a good opportunity to rework the logic to be clearer. Now we only print the message if a config file was found, since these directives are obviously missing if there is no config file (a warning will be printed about the lack of config file anyway). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Print a warning if no config file is foundMatt Fleming2012-11-011-1/+4
| | | | | | | | This behaviour is taken from 4.06, where an error message is printed if no config file is found. A warning is a more user-friendly choice since Syslinux will still function without a config file. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Use stdcon instead of rawcon for the consoleMatt Fleming2012-10-191-1/+1
| | | | | | | | | | | | | Switch to the stdcon input device so things like fgets() work correctly when reading from stdin. I noticed this was broken when running dmitest.c32. fgets() was returning NULL because there was no pending user input instead of waiting for/buffering the input. Modules are expecting stdin to be a line-oriented device, not a raw one where each module has to implement its own line support. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* console: Close stdin, stdout, stderr on ldlinux.c32 unloadMatt Fleming2012-09-041-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | The location of __file_info[] and ansicon_counter are split between the core and ldlinux.c32. We can end up calling __ansicon_close (from fp->oop->close) in the process of reloading ldlinux.c32, and while ansicon_counter is set to its initialised data value of 0 when reloading ldlinux.c32, the core is never reloaded, and so __file_info[] retains its pointers. What this amounts to is that when ldlinux.c32 tries to call openconsole() after being reloaded, the core tries to close the ansicon device (the core still has pointers to __ansicon_close) despite the ansicon code having no knowledge of ever being opened (because ansicon_counter was reinitialised). The most logical way to deal with this is to close stdin, stdout and stderr when unloading ldlinux.c32. It also turns out that sys/openconsole.o was present in two Makefile variables which lead to duplication of code, data, etc. We only need it present in libcom32min.a and not in the core since the core never handles opening consoles, at least not now that we've deleted printf_init() which is safe because we always open a console in ldlinux.c32 anyway. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Use findpath() to lookup filenamessyslinux-5.00-pre7Matt Fleming2012-08-071-4/+5
| | | | | | | We should use the same method of opening files as the module code when searching for extensions. In particular, we should search all of PATH. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Return to command prompt after loading COM32Matt Fleming2012-08-023-29/+44
| | | | | | | | | | | | | The old COM32 loading code would drop the user at a command prompt once execution returned from the COM32 amodule. We need to replicate this because most callers of execute() don't expect it to return. This bug was noticed when loading a COM32 module from vesamenu.c32. Once execution returned from the COM32 module the display became garbled because no code exists to reinitialise the screen for VGA. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* elflink: Replace __intcall() with direct function callsMatt Fleming2012-07-201-1/+1
| | | | | | | | There's no reason to use the COMBOOT API at all now that we can have any undefined symbols resolved at runtime - we can just access functions directly. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Stop using the internal KT_* image typesMatt Fleming2012-07-204-50/+64
| | | | | | | The KT_* image types were never meant to be used outside of com32/menu, so use the external image types from syslinux/boot.h Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Merge branch 'master' into elflinkMatt Fleming2012-07-191-1/+1
| | | | | | | | | | | The reason for this merge is that we need the fix to core/fs/cache.c without which we can potentially dereference an invalid pointer. The below conflict is a result of the new setup_data blob code being merged from the master branch. Conflicts: com32/lib/Makefile
* ldlinux: Return immediately after we execute() a commandMatt Fleming2012-07-191-0/+1
| | | | | | | | | If we successfully lookup the filetype of a command we need to return once we've called execute(), otherwise we'll also end up calling new_linux_kernel(). Reported-by: Sebastian Herbszt <herbszt@gmx.de> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* Fix Makefile install targetsMatt Fleming2012-07-041-5/+3
| | | | | | | | | | | | | | | | | | | | Some Makefiles were still referring to libutil_com.a, even though we stopped producing that file with commit 74518b8b691c ("elflink: Make ELF the default object format"). Delete all references to avoid the following install error, install: cannot stat `libutil_com.a': No such file or directory Remove the install target from com32/elflink as we no longer build any of the test modules, and so don't need to install them. Also, we need to add ldlinux.c32 to the list of modules that *must* be installed for all targets, since it is required for Syslinux to function correctly. Reported-by: Dag Wieers <dag@wieers.com> Reported-by: Michael D. Setzer II <mikes@kuentos.guam.net> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* menu: Supply the command type to execute()Matt Fleming2012-07-031-1/+1
| | | | | | | | | | | | | | The old execute() was much more forgiving when passing a COM32 module as KT_NONE, as the old code for loading a kernel could also handle COM32 modules. This isn't the case with new_linux_kernel(), and COM32 modules really need to take the create_args_and_load() path in execute(). Without this change loading .c32 files from vesamenu.c32/menu.c32 fails. Reported-by: Helmut Hullen <Hullen@t-online.de> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* ldlinux: Don't lfree() 'kernel' twiceMatt Fleming2012-06-201-1/+0
| | | | | | | | | | | | | | | | | | | This lead to serious problems where duplicate free blocks would appear next to each other on the free list, which created an infinite loop in the following code, for ( fp = head->next_free ; fp != head ; fp = fp->next_free ) { if ( ARENA_SIZE_GET(fp->a.attrs) >= size ) { /* Found fit -- allocate out of this block */ p = __malloc_from_block(fp, size, tag); break; } } because fp == fp->next_free, resulting in modules hanging forever at malloc() call sites. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* fs: Add .copy_super to struct fs_opsMatt Fleming2012-06-201-1/+1
| | | | | | | | | | | commit c0d18deeee2 ("elflink: Fix boot sector booting") makes reference to vfat_copy_superblock() which is only implemented for SYSLINUX, resulting in an undefined symbol when booting ISOLINUX or PXELINUX. Move the superblock copy operation to struct fs_ops so that we don't need to add a stub implementation of vfat_copy_superblock() to ISOLINUX and PXELINUX. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* elflink: Fix compiler warningMatt Fleming2012-06-121-1/+1
| | | | | | | | | | Apply the correct cast to fix the following warning, chainboot.c: In function ‘chainboot_file’: chainboot.c:88:7: warning: passing argument 3 of ‘syslinux_add_movelist’ makes integer from pointer without a cast ../../../com32/include/syslinux/movebits.h:57:5: note: expected ‘addr_t’ but argument is of type ‘const void * const’ Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* chainboot: clean up old assemblyismsH. Peter Anvin2012-06-071-57/+38
| | | | | | | | Delete a bunch of stuff related to the old assembly implementation of chainloading. There are still a few, like the use of pm_load_high() that should be cleaned up. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* execute(): move chainbooting code to its own fileH. Peter Anvin2012-06-073-137/+177
| | | | | | To improve readability, move chainbooting to its own source file. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge remote-tracking branch 'mfleming/elflink-dot-zero' into elflinkH. Peter Anvin2012-06-074-1/+258
|\ | | | | | | | | | | | | Resolved Conflicts: com32/elflink/ldlinux/execute.c Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * elflink: Fix boot sector bootingMatt Fleming2012-06-074-1/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | localboot: remove unnecessary real-mode callPaulo Alcantara2012-05-281-4/+2
|/ | | | | | | | | | syslinux_local_boot() used to call local_boot() from INT 0x22 (AX=0x0014) as it should just call local_boot() function. The local_boot() function is now exported by core/include/localboot.h to be used in COM32 library space so that syslinux_local_boot() can use it. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
* CLI: don't highlight the promptsyslinux-5.00-pre2H. Peter Anvin2012-05-182-2/+2
| | | | | | Don't gratuitously highlight the prompt; it is just annoying. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* CLI: Stick to the classic "boot: " prompt rather than "syslinux$"H. Peter Anvin2012-05-181-1/+1
| | | | | | Just for familiarity... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge remote-tracking branch 'mfleming/elflink' into elflinkH. Peter Anvin2012-05-044-50/+57