platform/upstream/syslinux.git
11 years agoxfs: Flush cache of directory blocks once done with readdir()
Paulo Alcantara [Tue, 22 Jan 2013 04:13:47 +0000 (02:13 -0200)]
xfs: Flush cache of directory blocks once done with readdir()

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Remove unnecessary free()'s
Paulo Alcantara [Tue, 22 Jan 2013 03:54:09 +0000 (01:54 -0200)]
xfs: Remove unnecessary free()'s

Those freed memories are all now cached and need to get flushed at some
point.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Fix bug when listing shortform directory entries
Paulo Alcantara [Tue, 22 Jan 2013 03:19:36 +0000 (01:19 -0200)]
xfs: Fix bug when listing shortform directory entries

The xfs_fmt_local_readdir() function should call xfs_readdir_dir2_local()
instead.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Add cache for directory blocks
Paulo Alcantara [Tue, 22 Jan 2013 01:37:16 +0000 (23:37 -0200)]
xfs: Add cache for directory blocks

This cache will avoid lots of malloc() and free() calls for getting an
allocated area for directory blocks whenever listing and finding
directory entries.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Make xfs_dir2_entry_name_cmp() inline
Paulo Alcantara [Mon, 21 Jan 2013 19:42:59 +0000 (17:42 -0200)]
xfs: Make xfs_dir2_entry_name_cmp() inline

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Avoid useless malloc()'s and free()'s
Paulo Alcantara [Mon, 21 Jan 2013 19:38:10 +0000 (17:38 -0200)]
xfs: Avoid useless malloc()'s and free()'s

This patch speeds up the process of retrieving and comparing entry names
while looking up inodes.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Make it more verbose on debug
Paulo Alcantara [Mon, 21 Jan 2013 18:21:51 +0000 (16:21 -0200)]
xfs: Make it more verbose on debug

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Improve error and debug printing
Paulo Alcantara [Mon, 21 Jan 2013 18:03:00 +0000 (16:03 -0200)]
xfs: Improve error and debug printing

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoxfs: Do some refactoring
Paulo Alcantara [Mon, 21 Jan 2013 17:56:48 +0000 (15:56 -0200)]
xfs: Do some refactoring

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
11 years agoMerge branch 'com32lib_spotless_for_mfleming' of git://github.com/geneC/syslinux...
Matt Fleming [Mon, 21 Jan 2013 14:53:41 +0000 (14:53 +0000)]
Merge branch 'com32lib_spotless_for_mfleming' of git://github.com/geneC/syslinux into elflink

Pull clean up patch from Gene Cumm,

* 'com32lib_spotless_for_mfleming' of git://github.com/geneC/syslinux:
  com32/lib: delete *.c32 on key target

11 years agopxe: Add PXELINUX-specific symbols to symbol whitelist
Matt Fleming [Mon, 21 Jan 2013 14:16:12 +0000 (14:16 +0000)]
pxe: Add PXELINUX-specific symbols to symbol whitelist

We need to allow PXELINUX to link with required symbols at runtime
otherwise, when executing prdhcp.c32, the user will be presented with
the following message,

  Error: An undefined symbol was referenced

Add pxe_call, dns_resolv and unload_pxe to the symbol whitelist.

Reported-by: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocom32/lib: delete *.c32 on key target
Gene Cumm [Sun, 20 Jan 2013 12:58:39 +0000 (07:58 -0500)]
com32/lib: delete *.c32 on key target

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
11 years agocore/lzo: move LZO back to uncompressed section
H. Peter Anvin [Fri, 18 Jan 2013 04:38:42 +0000 (20:38 -0800)]
core/lzo: move LZO back to uncompressed section

The LZO decompressor really can't live in the compressed part of the
core, for some odd reason.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agoelf: remove long-since-obsolete shallow module machinery
H. Peter Anvin [Fri, 18 Jan 2013 00:52:20 +0000 (16:52 -0800)]
elf: remove long-since-obsolete shallow module machinery

Meant to handle symbols exported from the core, but we just
pregenerate the dynamic section instead.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agocore: switch LZO decompressor to "fast safe" version
H. Peter Anvin [Fri, 18 Jan 2013 00:16:31 +0000 (16:16 -0800)]
core: switch LZO decompressor to "fast safe" version

Switch LZO decompressor to the "fast safe" version (and bump LZO
source to version 2.06).  This allows us to use that decompressor for
module compression later without carrying another decompressor.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agocore/fs: remove some stale functions, inode refcount debug
H. Peter Anvin [Fri, 18 Jan 2013 00:02:46 +0000 (16:02 -0800)]
core/fs: remove some stale functions, inode refcount debug

Remove some stale (16-bit compatibility) functions in fs.c.

Add some debugging for inode refcounts.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agobios.h: add missing dependent #include
H. Peter Anvin [Thu, 17 Jan 2013 22:18:07 +0000 (14:18 -0800)]
bios.h: add missing dependent #include

io_delay() defined in bios.h depends on outb() defined in <sys/io.h>.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agoRename libcom32gpl.c32 to libgpl.c32
H. Peter Anvin [Thu, 17 Jan 2013 18:59:18 +0000 (10:59 -0800)]
Rename libcom32gpl.c32 to libgpl.c32

Conform to 8.3 filenames for essential files.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agoRename libutil_com.c32 to libutil.c32
H. Peter Anvin [Thu, 17 Jan 2013 18:57:17 +0000 (10:57 -0800)]
Rename libutil_com.c32 to libutil.c32

Conform to 8.3 filenames for essential files.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agoAlways strip all the modules
H. Peter Anvin [Thu, 17 Jan 2013 18:54:40 +0000 (10:54 -0800)]
Always strip all the modules

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>
11 years agodos: obtain the executable pathname, cleanups
H. Peter Anvin [Thu, 17 Jan 2013 17:34:59 +0000 (09:34 -0800)]
dos: obtain the executable pathname, cleanups

DOS actually does provide the fully qualified pathname to the
executable, which would be useful to make ldlinux.c32 data rather than
live inside the executable itself -- it has gotten too large.

Also, move some DOS internals -- inline functions only used inside the
dos directory -- out of libinstaller.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agoldlinux: Perform chdir() before parsing config syslinux-5.01-pre3
Matt Fleming [Wed, 16 Jan 2013 11:14:59 +0000 (11:14 +0000)]
ldlinux: Perform chdir() before parsing config

The old 4.x behaviour for handling CONFIG directives of the form,

    CONFIG foo.cfg /bar

was to lookup the absolute pathname of foo.cfg, then chdir to /bar and
finally to parse foo.cfg. The 5.x behaviour reversed the chdir and
parsing steps. This meant if foo.cfg's contents were simply,

    INCLUDE say.txt

4.x would include /bar/say.txt and 5.x would include
/boot/syslinux/say.txt (assuming the current working directory was
/boot/syslinux).

What's even worse is that because of the way 'config_cwd' is used in
5.x we'd actually perform the chdir() operation after the first
INCLUDE in foo.cfg, e.g.

   INCLUDE say.txt
   INCLUDE say.txt

would include /boot/syslinux/say.txt and /bar/say.txt, respectively.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomodule: Check return value of malloc()
Matt Fleming [Tue, 15 Jan 2013 14:57:45 +0000 (14:57 +0000)]
module: Check return value of malloc()

And return NULL after printing an appropriate error message if the
call failed.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Strip whitespace from LABEL directive
Matt Fleming [Tue, 15 Jan 2013 13:03:51 +0000 (13:03 +0000)]
ldlinux: Strip whitespace from LABEL directive

Any LABEL directive arguments shouldn't include whitespace
characters. If whitespace characters are needed use MENU LABEL.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoPXELINUX: Fix IPAPPEND to include BOOTIF and SYSUUID syslinux-5.01-pre2
Matt Fleming [Mon, 14 Jan 2013 12:16:38 +0000 (12:16 +0000)]
PXELINUX: Fix IPAPPEND to include BOOTIF and SYSUUID

commit 14531c47bc95 ("core: Delete code that is duplicated in
ldlinux") erroneously deleted the BOOTIFStr and SYSUUIDStr entries
from the PXELINUX-version of IPAppends, meaning that IPAPPEND 3 and
IPAPPEND 4 didn't append the corresponding strings to the command
line.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoisolinux: Update LBA in getlinsec loop
Matt Fleming [Thu, 10 Jan 2013 21:33:32 +0000 (21:33 +0000)]
isolinux: Update LBA in getlinsec loop

We need to increment the Logical Block Address in eax by the number of
sectors we passed to getlinsec after every invocation, otherwise we'll
start with the same sector everytime.

This bug was discovered when booting an isohybrid image, which failed
to boot after printing the following error,

    "Image checksum error, sorry..."

because the isolinux.bin was bigger than 32K, and thus invoked the
getlinsec loop that reads the file in chunks.

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomodule: Allow .c32 files to execute themselves
Matt Fleming [Thu, 10 Jan 2013 13:39:50 +0000 (13:39 +0000)]
module: Allow .c32 files to execute themselves

Historically, .c32 files had to explicitly link against ldlinux.c32 in
order to use its exported symbols. This lead to the undesirable
situation during module dependency resolution where loading,
e.g. menu.c32, would cause ldlinux.c32 to be reloaded, thus
re-executing its main() function and dropping the user at a prompt
instead of executing menu.c32.

commit 1357b7e62706 ("elflink: Don't reload the current EXEC_MODULE
module") was the solution to this problem, since you don't need to
reload a module to link against it's symbols. Unfortunately, while
this commit was intended to stop ldlinux.c32 being reloaded, it also
broke the use case where a .c32 wants to load itself, e.g. when
vesamenu.c32 wants to execute vesamenu.c32 with a different config.

Luckily, modules no longer need to include ldlinux.c32 in their
dependency list, since ldlinux.c32 is *always* loaded and any symbols
can be automatically resolved. Which means that the check in
spawn_load() can be deleted.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoextlinux: Fix installation subdirectory patching
Matt Fleming [Thu, 10 Jan 2013 11:47:33 +0000 (11:47 +0000)]
extlinux: Fix installation subdirectory patching

Commit a126f17f663c ("EXTLINUX: Initial XFS filesystem support") broke
the code that inserts the installation subdirectory into the Extended
Patch Area (EPA). The EPA entry is used to set the initial working
directory on boot.

This caused boot failures for users that chose an install directory
other than /boot/syslinux (technically, it failed for any path not in
'search_directories' in load_env32()) due to ldlinux.c32 failing to
load because the initial working directory was not set correctly.

Cc: Paulo Alcantara <pcacjr@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoextlinux: Make sure ldlinux.sys file is installed
Paulo Alcantara [Mon, 7 Jan 2013 08:14:47 +0000 (06:14 -0200)]
extlinux: Make sure ldlinux.sys file is installed

Due to delayed allocation feature on XFS filesystems, a write is not
guaranteed to flushed out to the underlying file system after crash or
something else - so we need to make sure that ldlinux.sys is installed
correctly in the mounted filesystem.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomenugen: Make it compatible with Py3k
Paulo Alcantara [Sun, 6 Jan 2013 20:36:17 +0000 (18:36 -0200)]
menugen: Make it compatible with Py3k

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocore/kaboom.c: Export __bad_SEG()
Matt Fleming [Tue, 8 Jan 2013 15:37:38 +0000 (15:37 +0000)]
core/kaboom.c: Export __bad_SEG()

We need to add __bad_SEG() to the symbol export whitelist, otherwise
ldlinux.c32 will fail to load if compiled with -DDEBUG=1 due to not
being able to resolve __bad_SEG().

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoversion: Bump minor number and year syslinux-5.01-pre1
Matt Fleming [Tue, 8 Jan 2013 12:12:32 +0000 (12:12 +0000)]
version: Bump minor number and year

Welcome to the 5.01 development cycle and 2013.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Dynamically alloc memory for kernel and initrd filenames
Matt Fleming [Fri, 4 Jan 2013 19:16:39 +0000 (19:16 +0000)]
ldlinux: Dynamically alloc memory for kernel and initrd filenames

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>
11 years agoldlinux: Don't delete ldlinux.c32 with 'make clean'
Matt Fleming [Fri, 4 Jan 2013 11:33:21 +0000 (11:33 +0000)]
ldlinux: Don't delete ldlinux.c32 with 'make clean'

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>
11 years agoelflink: set the sonames of shared libraries
H. Peter Anvin [Thu, 3 Jan 2013 17:29:51 +0000 (09:29 -0800)]
elflink: set the sonames of shared libraries

Set the sonames of shared libraries to the filename, so we don't end
up with full pathnames embedded in the files.

11 years agoDelete 16-bit COMBOOT support syslinux-5.00
Matt Fleming [Thu, 6 Dec 2012 10:13:41 +0000 (10:13 +0000)]
Delete 16-bit COMBOOT support

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>
11 years agoSymbol export whitelist
Matt Fleming [Tue, 4 Dec 2012 21:17:47 +0000 (21:17 +0000)]
Symbol export whitelist

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>
11 years agocore: Fix 'NoHalt'
Matt Fleming [Wed, 5 Dec 2012 09:20:38 +0000 (09:20 +0000)]
core: Fix 'NoHalt'

Use the same variable in idle.c and ldlinux.c32.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocom32: Delete unused malloc.c and friends
Matt Fleming [Wed, 5 Dec 2012 13:28:38 +0000 (13:28 +0000)]
com32: Delete unused malloc.c and friends

The memory alloc files haven't been referenced since commit
880f67714ec0 ("elflink: remove the malloc.c/free.c/realloc.c/zalloc.c
from com32"). They live in the core now.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoReduce the number of global variables
Matt Fleming [Tue, 4 Dec 2012 22:00:13 +0000 (22:00 +0000)]
Reduce the number of global variables

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>
11 years agocomboot: Mark API functions obsolete
Matt Fleming [Tue, 4 Dec 2012 21:51:46 +0000 (21:51 +0000)]
comboot: Mark API functions obsolete

Starting with Syslinux 5.00 the COMBOOT API is obsolete and should not
be used by any modules. It is still used internally for some things,
such as the ADV code in ldlinux.c32, but that will change in the
future.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agodoc: Further explanation for the PATH directive and lookup rules
Matt Fleming [Tue, 4 Dec 2012 13:42:24 +0000 (13:42 +0000)]
doc: Further explanation for the PATH directive and lookup rules

The PATH directive can be quite confusing when coupled with the fact
that the current working directory is always searched first when
opening files.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoRevert "menu: Inherit parent menu title"
Matt Fleming [Tue, 4 Dec 2012 12:13:48 +0000 (12:13 +0000)]
Revert "menu: Inherit parent menu title"

This reverts commit 6387f043f7f870e4f0b402dae0b921d99eb82c39.

We got reports of this change causing regressions. The reverted commit
only goes half way to providing proper parent menu title inheritance,
and breaks other configs where the menu label or submenu tagname are
used for the title.

Reported-by: Ady <ady-sf@hotmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Use get_msg_file() for F-keys
Matt Fleming [Tue, 4 Dec 2012 12:02:39 +0000 (12:02 +0000)]
ldlinux: Use get_msg_file() for F-keys

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>
11 years agoldlinux: Remove default bold attribute typo
Matt Fleming [Tue, 4 Dec 2012 11:56:04 +0000 (11:56 +0000)]
ldlinux: Remove default bold attribute typo

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>
11 years agoCLI: Don't always start the CLI at column 0
Matt Fleming [Tue, 4 Dec 2012 11:50:19 +0000 (11:50 +0000)]
CLI: Don't always start the CLI at column 0

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>
11 years agoldlinux: Move DISPLAY file handling out of the core syslinux-5.00-pre13
Matt Fleming [Mon, 3 Dec 2012 13:30:36 +0000 (13:30 +0000)]
ldlinux: Move DISPLAY file handling out of the core

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>
11 years agostdio: Fix unhexchar() for hex digits > 9
Matt Fleming [Mon, 3 Dec 2012 13:27:11 +0000 (13:27 +0000)]
stdio: Fix unhexchar() for hex digits > 9

There was a typographical error in commit 9f51b69d7c050 ("core:
Reimplement lots asm code in C") which re-wrote the asm implementation
of unhexchar() in C. We should be adding 10, not subtracting to get
the equivalent decimal integer. Also be explicit about the sign of
'data' and 'num'.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoMerge branch 'searchdir_leak-5' of git://git.zytor.com/users/sha0/syslinux into elfli...
Matt Fleming [Fri, 30 Nov 2012 13:40:32 +0000 (13:40 +0000)]
Merge branch 'searchdir_leak-5' of git://git.zytor.com/users/sha0/syslinux into elflink-searchdir-leak

Pull a change that fixes a resource leak from Shao Miller,

* 'searchdir_leak-5' of git://git.zytor.com/users/sha0/syslinux:
  fs: Fix searchdir resource leak

11 years agoPATH: Use installation directory for 'PATH'
Matt Fleming [Fri, 30 Nov 2012 09:50:53 +0000 (09:50 +0000)]
PATH: Use installation directory for 'PATH'

Files in the installation directory should be able to be executed
(along with their dependencies) from any directory in the file
hierarchy. Using the installation directory as the default value for
'PATH' is the most sensible way to do this.

The PATH config directive still allows other directories to be
appended to the 'PATH' variable, which is useful when there are other
directories containing modules.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Don't try reloading ldlinux.c32 unless it's likely to succeed
Matt Fleming [Thu, 29 Nov 2012 22:52:42 +0000 (22:52 +0000)]
ldlinux: Don't try reloading ldlinux.c32 unless it's likely to succeed

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>
11 years agomodule: Fix incorrect list_entry() use
Matt Fleming [Thu, 29 Nov 2012 22:40:46 +0000 (22:40 +0000)]
module: Fix incorrect list_entry() use

Correct the bogus use of list_entry() that was introduced in commit
8f1c64acf9c6 ("module: Stop silently failing to load dependency
modules").

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agofs: Fix searchdir resource leak
Shao Miller [Fri, 2 Nov 2012 15:59:10 +0000 (11:59 -0400)]
fs: Fix searchdir resource leak

This is a significant rewrite of the generic lookup logic inside
core/fs/fs.c's searchdir function.  Previously, there was a
memory leak if a path involved multiple directories.  After a
sufficiently large number of invocations, this could be observed.

Reported-by: Ady <ady-sf@hotmail.com>
Signed-off-by: Shao Miller <sha0.miller@gmail.com>
11 years agoCLI: Delete 'temp_cmdline' and put 'cmdline' on the stack
Matt Fleming [Thu, 29 Nov 2012 16:55:33 +0000 (16:55 +0000)]
CLI: Delete 'temp_cmdline' and put 'cmdline' on the stack

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>
11 years agomodule: Stop silently failing to load dependency modules syslinux-5.00-pre12
Matt Fleming [Thu, 29 Nov 2012 11:35:28 +0000 (11:35 +0000)]
module: Stop silently failing to load dependency modules

We should be checking the return value of spawn_load() when loading a
module's dependencies and printing some kind of an error message if
they fail to load (for instance if the file is missing) and returning
an error to the caller.

Track the most recently loaded module in 'head' before we begin
loading dependencies. That way we can unload any dependencies in the
error path that were successfully loaded.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Complain to user on failure to perform file operations
Matt Fleming [Thu, 29 Nov 2012 09:34:18 +0000 (09:34 +0000)]
ldlinux: Complain to user on failure to perform file operations

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>
11 years agomodule: Append '/' to PATH strings if missing
Matt Fleming [Thu, 29 Nov 2012 09:06:41 +0000 (09:06 +0000)]
module: Append '/' to PATH strings if missing

We shouldn't be appending a filename to any path string that isn't
terminated by a '/', otherwise we end up searching for files like
'/isolinuxpwd.c32'

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Only append missing filename extensions
Matt Fleming [Thu, 29 Nov 2012 08:47:15 +0000 (08:47 +0000)]
ldlinux: Only append missing filename extensions

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>
11 years agoMerge branch 'coverity' into elflink syslinux-5.00-pre11
Matt Fleming [Tue, 27 Nov 2012 21:13:45 +0000 (21:13 +0000)]
Merge branch 'coverity' into elflink

11 years agocore/elflink: Fix off-by-one error
Matt Fleming [Tue, 27 Nov 2012 20:12:58 +0000 (20:12 +0000)]
core/elflink: Fix off-by-one error

We need to remember to allocate space for the terminating NULL in
create_args_and_load() otherwise we will write a NUL-byte past the
bounds of 'argv[]' to some random part of the stack.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomodule: Fix off-by-one error in findpath()
Matt Fleming [Tue, 27 Nov 2012 16:25:37 +0000 (16:25 +0000)]
module: Fix off-by-one error in findpath()

We need to make sure that 'path' still has enough space to write the
trailing NUL-byte. Without this patch it's possible to write a
NUL-byte past the end of the on-stack buffer.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomodule: Fix memory leak in spawn_load()
Matt Fleming [Tue, 27 Nov 2012 16:19:17 +0000 (16:19 +0000)]
module: Fix memory leak in spawn_load()

If for some reason we fail to load a module then we need to free the
memory allocated to that module.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agopxe: Don't leak inode on timeout
Matt Fleming [Tue, 27 Nov 2012 16:11:26 +0000 (16:11 +0000)]
pxe: Don't leak inode on timeout

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoscreensize: Dereference pointers when checking cols/rows
Matt Fleming [Tue, 27 Nov 2012 16:03:36 +0000 (16:03 +0000)]
screensize: Dereference pointers when checking cols/rows

Dereference 'rows' and 'cols' to check whether the data they point to
is zero, which would indicate the screen size is bogus, instead of
checking if they point to NULL.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agohdt-cli: Correct malloc() size argument
Matt Fleming [Fri, 16 Nov 2012 14:23:45 +0000 (14:23 +0000)]
hdt-cli: Correct malloc() size argument

We need to be allocating sizeof(char *) (4) not sizeof(char) (1) for
'new_argv'.

Cc: Erwan Velu <erwanaliasr1@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoMerge branch 'xfs-for-hpa' of git://zytor.com/users/pcacjr/syslinux into merge/elflin...
Matt Fleming [Tue, 27 Nov 2012 18:38:18 +0000 (18:38 +0000)]
Merge branch 'xfs-for-hpa' of git://zytor.com/users/pcacjr/syslinux into merge/elflink/xfs

Pull XFS filesystem driver from Paulo Alcantara,

* 'xfs-for-hpa' of git://zytor.com/users/pcacjr/syslinux: (60 commits)
  xfs: Fix the way we check di_mode of an inode
  xfs: Cleanup previous commit
  xfs: Add xfs_readlink()
  xfs: Cleanup and remove some trailing whitespaces
  xfs: Add XFS_DINODE_FMT_BTREE support in xfs_next_extent()
  xfs: Cleanup and remove some trailing whitespaces
  xfs: Rework xfs_dir2_get_right_blk()
  xfs: cleanup unused structure
  xfs: Remove some trailing whitespaces
  xfs: Add full B+tree search support in xfs_dir2_node_find_entry()
  xfs: Add xfs_fmt_btree_find_entry()
  xfs: Fix memory leak in xfs_dir2_node_find_entry() function
  xfs: Cleanup xfs_readdir_dir2_leaf() function
  xfs: Implement xfs_readdir_dir2_node() function
  EXTLINUX: Add sanity check for XFS filesystems
  xfs: Add xfs_fmt_local_readdir() function
  xfs: Add xfs_fmt_local_find_entry() function
  xfs: Move readdir functions to another source file
  xfs: Remove trailing whitespace in xfs_dir2_isleaf() function
  xfs: Move dir2 functions to another source file
  ...

Conflicts:
extlinux/main.c

11 years agoldlinux: Reset the console whenever we execute a module
Matt Fleming [Tue, 27 Nov 2012 15:01:12 +0000 (15:01 +0000)]
ldlinux: Reset the console whenever we execute a module

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>
11 years agoRevert "menu: Make "menu clear" the default"
Matt Fleming [Tue, 27 Nov 2012 13:31:26 +0000 (13:31 +0000)]
Revert "menu: Make "menu clear" the default"

This reverts commit 6ab02b6682c0b693b3e4f9afcc2ab8775f804f0a.

People are reporting that the above commit causes a regression in
behaviour between 4.0x and 5.0x. It also makes the MENU CLEAR
directive obsolete and requires that users change their existing
config files to restore the old behaviour.

The commit was intended to solve the same bug that commit 87320b8de8f3
("ldlinux: Disable VGA graphics when loading a kernel") addresses but
without breaking vesacon, see, commit e04ee714164d ('Revert "ldlinux:
Disable VGA graphics when loading a kernel"') for more details.

Reported-by: Ady <ady-sf@hotmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agogpllib: Distribute libcom32gpl.c32 in releases
Matt Fleming [Mon, 26 Nov 2012 15:27:55 +0000 (15:27 +0000)]
gpllib: Distribute libcom32gpl.c32 in releases

This is a partial revert of commit b26d1c8642a8 ("Clean up $(GPLLIB)
leak"). While we do need to use $(C_LIBS) and respect $(NOGPL), we
should also be distributing libcom32gpl.c32. Now that we have ELF
modules, such as hdt.c32, that need to have some of their symbols
dynamically resolved at runtime we need to distribute libcom32gpl.c32.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomodule: Correct the size of the module symbol table
Matt Fleming [Tue, 27 Nov 2012 11:58:58 +0000 (11:58 +0000)]
module: Correct the size of the module symbol table

We were incorrectly grovelling around in the GNU hash table for the
size of the symbol table. Instead we need to map the section headers
and search for the SHT_DYNSYM entry.

This bug caused hdt.c32 to refuse to load as some symbols were never
resolved because not all of the SHT_UNDEF symbols in hdt.c32 were
processed.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocmenu: Delete __intcall()s
Matt Fleming [Tue, 27 Nov 2012 11:57:59 +0000 (11:57 +0000)]
cmenu: Delete __intcall()s

We can dynamically resolve our symbols and so we don't need to jump
through __intcall(), which is deprecated anyway in favour of dynamic
resolution.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoMakefile: Add libmenu.c32 to list of modules
Matt Fleming [Tue, 27 Nov 2012 11:01:54 +0000 (11:01 +0000)]
Makefile: Add libmenu.c32 to list of modules

We need to install libmenu.c32 as it is required by modules like
hdt.c32.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoisolinux: Make BIOSName global
Matt Fleming [Thu, 22 Nov 2012 14:31:06 +0000 (14:31 +0000)]
isolinux: Make BIOSName global

commit 967ee8a1ed49 ("CLI: Add Ctrl + V support for printing the
Syslinux version") should have made the BIOSName symbol global in
core/isolinux.asm. Without this change ldlinux.c32 will hang because
it cannot resolve the 'BIOSName' symbol.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Fix OnError behaviour
Matt Fleming [Mon, 26 Nov 2012 13:13:07 +0000 (13:13 +0000)]
ldlinux: Fix OnError behaviour

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>
11 years agoldlinux: Automatically apply ".c32" extension for COM32 files
Matt Fleming [Mon, 26 Nov 2012 13:08:06 +0000 (13:08 +0000)]
ldlinux: Automatically apply ".c32" extension for COM32 files

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>
11 years agorunimage.c: Actually pass arguments to execute()
Matt Fleming [Wed, 21 Nov 2012 22:34:19 +0000 (22:34 +0000)]
runimage.c: Actually pass arguments to execute()

Fix the breakage from commit 8486142cf304 ("elflink: Replace
__intcall() with direct function calls"), where we stopped passing
'cmdline' to execute().

This bug resulted in things like config.c32 not respecting the
<directory> argument.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Don't return NULL on KEY_ESC.
Matt Fleming [Thu, 15 Nov 2012 19:46:54 +0000 (19:46 +0000)]
ldlinux: Don't return NULL on KEY_ESC.

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>
11 years agoldlinux: Never exit from ldlinux.c32
Matt Fleming [Wed, 21 Nov 2012 21:03:24 +0000 (21:03 +0000)]
ldlinux: Never exit from ldlinux.c32

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>
11 years agochainboot: Delete extraneous free() in chainboot_file()
Matt Fleming [Thu, 15 Nov 2012 21:32:18 +0000 (21:32 +0000)]
chainboot: Delete extraneous free() in chainboot_file()

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>
11 years agovesa: Fix double close() bug in vesacon_load_background()
Matt Fleming [Thu, 15 Nov 2012 21:27:59 +0000 (21:27 +0000)]
vesa: Fix double close() bug in vesacon_load_background()

We always call fclose() on 'fp' if fopen() was successful, so delete
the extraneous fclose() call in read_jpeg_file().

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoasprintf: Ensure we always call va_end(ap)
Matt Fleming [Thu, 15 Nov 2012 20:56:09 +0000 (20:56 +0000)]
asprintf: Ensure we always call va_end(ap)

There's currently the potential for us to exit early from asprintf()
without calling va_end(ap). Rearrange things so that we always make
the call.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agobufprintf: Add va_end() for our va_copy()
Matt Fleming [Thu, 15 Nov 2012 20:39:30 +0000 (20:39 +0000)]
bufprintf: Add va_end() for our va_copy()

According to the stdarg(3) man page each invocation of va_copy()
should be paired with an invocation of va_end().

Cc: Erwan Velu <erwanaliasr1@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Delete dead code and useless printf syslinux-5.00-pre10
Matt Fleming [Tue, 13 Nov 2012 16:07:18 +0000 (16:07 +0000)]
ldlinux: Delete dead code and useless printf

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>
11 years agoldlinux: Delete inaccurate 'insufficient memory' message
Matt Fleming [Tue, 13 Nov 2012 15:57:01 +0000 (15:57 +0000)]
ldlinux: Delete inaccurate 'insufficient memory' message

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>
11 years agomk: Add Makefile variable for python
Matt Fleming [Mon, 12 Nov 2012 15:38:33 +0000 (15:38 +0000)]
mk: Add Makefile variable for python

Instead of hard-coding the python executable name use a make variable
like we do for all other executables used during the build. This has
the added bonus of allowing $(PYTHON) to be overridden on the command
line, e.g.

   make PYTHON=python2

which is particularly useful for distributions where /usr/bin/python
is actually python3.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomenu: Inherit parent menu title
Matt Fleming [Thu, 25 Oct 2012 10:35:14 +0000 (11:35 +0100)]
menu: Inherit parent menu title

The documentation for the menu system clearly states that all
properties of the parent are inherited in the submenu. Unfortunately
there's a bug that means this isn't true for the parent's menu title,
so fix that.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoMerge branch 'strerror-for-mfleming' of git://github.com/geneC/syslinux into elflink
Matt Fleming [Wed, 7 Nov 2012 07:31:13 +0000 (07:31 +0000)]
Merge branch 'strerror-for-mfleming' of git://github.com/geneC/syslinux into elflink

Pull klibc strerror() patches from Gene Cumm,

  Update strerror() to give english messages

* 'strerror-for-mfleming' of git://github.com/geneC/syslinux:
  com32 strerror(): Remove macro WITH_ERRLIST use
  com32 strerror: add errlist.o to Make
  strerror: Use klibc version

12 years agocom32 strerror(): Remove macro WITH_ERRLIST use
Gene Cumm [Sat, 16 Jun 2012 18:26:11 +0000 (14:26 -0400)]
com32 strerror(): Remove macro WITH_ERRLIST use

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agocom32 strerror: add errlist.o to Make
Gene Cumm [Wed, 7 Nov 2012 04:32:51 +0000 (23:32 -0500)]
com32 strerror: add errlist.o to Make

Exclude in .gitignore

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agostrerror: Use klibc version
Gene Cumm [Sat, 16 Jun 2012 17:33:19 +0000 (13:33 -0400)]
strerror: Use klibc version

Remove old in favor of current klibc version

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agoMerge branch 'hexdump' of git://git.zytor.com/users/sha0/syslinux into elflink
Matt Fleming [Tue, 6 Nov 2012 19:56:01 +0000 (19:56 +0000)]
Merge branch 'hexdump' of git://git.zytor.com/users/sha0/syslinux into elflink

Pull new hexdump.c32 module from Shao Miller,

* 'hexdump' of git://git.zytor.com/users/sha0/syslinux:
  hexdump.c32: Simple file hex-dumper

12 years agoMerge branch 'multi_initrd2-5.00-pre9' of git://git.zytor.com/users/sha0/syslinux...
Matt Fleming [Mon, 5 Nov 2012 15:35:35 +0000 (15:35 +0000)]
Merge branch 'multi_initrd2-5.00-pre9' of git://git.zytor.com/users/sha0/syslinux into elflink

Pull multi-initrd patches from Shao Miller,

  These patches provide two new options for the linux.c32 module.

  The "initrd+=" option allows you to append initramfs-style blobs
  (files which can be produced with 'cpio -o -H newc') to whatever
  "initrd" was specified via the "initrd=" option (or was specified
  indirectly via the INITRD directive).

  The "initrdfile=" option allows you to load a file and encapsulate it
  as though you had used 'cpio -o -H newc', and pass the resulting blob
  alongside the other items that might have been specified with
  "initrd=" or "initrd+=".

* 'multi_initrd2-5.00-pre9' of git://git.zytor.com/users/sha0/syslinux:
  initramfs chain handling: Accounting fixes for padding, etc.
  linux.c32: Introduce initrdfile= option
  linux.c32: Add new initrd+= option for multiple initrds
  linux.c32: Move some initrd=x,y,z code out of main
  linux.c32: Add find_arguments function

12 years agocore: Fix realloc() code transcription error
Shao Miller [Mon, 5 Nov 2012 02:23:09 +0000 (21:23 -0500)]
core: Fix realloc() code transcription error

Commit 79459f631546eea83d4158f535c20ebd4ac18987 copied portions of
com32/lib/realloc.c into core/mem/malloc.c, with minor changes
for accessing allocation arena header attributes.  The previous
code used structure members and the current code uses bitmask
macros.

On a particular line in the original realloc(), there were two
assignments in a single expression that included a compound
assignment.  This fact was missed when the code was copied and
modified to use the bitmask macros.

Signed-off-by: Shao Miller <sha0.miller@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoextlinux: Avoid dereferencing a garbage pointer
Matt Fleming [Fri, 2 Nov 2012 17:02:36 +0000 (17:02 +0000)]
extlinux: Avoid dereferencing a garbage pointer

If opt.reset_adv is set the call to ext_read_adv() is skipped which
would have initialised 'filename'. This means that a pointer
containing random data from the stack is passed to ext_write_adv().

Just delete the opt.reset_adv logic since modify_adv() handles that
case anyway.

Reported-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agohexdump.c32: Simple file hex-dumper
Shao Miller [Sun, 4 Nov 2012 04:26:32 +0000 (00:26 -0400)]
hexdump.c32: Simple file hex-dumper

Usage: %s [<option> [...]] <filename> [<option> [...]]

Options: -p
         --page . . . . . . . Pause output every 24 lines
         --no-buffer . . . .  Load the entire file before dumping
         --extended-ascii . . Use extended ASCII chars in dump
         -?
         -h
         --help  . . . . . .  Display this help

Signed-off-by: Shao Miller <sha0.miller@gmail.com>
12 years agoinitramfs chain handling: Accounting fixes for padding, etc.
Shao Miller [Fri, 26 Oct 2012 06:14:28 +0000 (02:14 -0400)]
initramfs chain handling: Accounting fixes for padding, etc.

Signed-off-by: Shao Miller <sha0.miller@gmail.com>
12 years agolinux.c32: Introduce initrdfile= option
Shao Miller [Fri, 26 Oct 2012 01:25:38 +0000 (21:25 -0400)]
linux.c32: Introduce initrdfile= option

It is useful to be able to load a file and pass it into a kernel's
rootfs via the initramfs scheme.  Given "initrdfile=foo", we will
load the file foo, encapsulate it with the initramfs cpio format,
then pass it alongside any initramfs files that were specified by
"initrd=" and "initrd+=" options.

One can specify the desired path/filename for the file to have
within the rootfs by using the at (@) sign, as in:

  initrdfile=foo@/goes/to/foo

One can also specify multiple files, separated by commas, such as:

  initrdfile=foo,bar@/somewhere/bar,baz

One can also use this option multiple times, as in:

  initrdfile=foo,bar initrdfile=baz@/somewhere/baz

Signed-off-by: Shao Miller <sha0.miller@gmail.com>
12 years agolinux.c32: Add new initrd+= option for multiple initrds
Shao Miller [Thu, 25 Oct 2012 07:58:07 +0000 (03:58 -0400)]
linux.c32: Add new initrd+= option for multiple initrds

linux.c32 now processes the kernel's command-line for "initrd+="
options.

Given "initrd+=foo", linux.c32 will concatenate the file "foo"
to the initrds that it has already loaded due to the "initrd="
option.

Given "initrd+=foo,bar", linux.c32 will concatenate both files
"foo" and "bar" to the initrds that it has already loaded due
to the "initrd=" option.  That is, multiple filenames can be
specified with comma separators.

Given "initrd+=foo initrd+=bar", linux.c32 will concatenate
both files "foo" and "bar" to the initrds that it has already
loaded due to the "initrd=" option.  That is, the "initrd+="
option can be specified multiple times.

The position of any "initrd=" option relative to any "initrd+="
option is irrelevant.  The "initrd=" option is always processed
before all "initrd+=" options.

PLEASE NOTE: It is important to note that there are NO SPACES
involved in using the "initrd+=" option.  "initrd += foo" will
not work.

Signed-off-by: Shao Miller <sha0.miller@gmail.com>
12 years agolinux.c32: Move some initrd=x,y,z code out of main
Shao Miller [Thu, 25 Oct 2012 06:17:36 +0000 (02:17 -0400)]
linux.c32: Move some initrd=x,y,z code out of main

In handling an "initrd=x,y,z" option, it seems reasonable to be able
to handle similar options in a similar fashion, so some of the code
has been moved out of 'main' and into a new 'process_initramfs_args'
function.

Signed-off-by: Shao Miller <sha0.miller@gmail.com>
12 years agolinux.c32: Add find_arguments function
Matt Fleming [Sat, 3 Nov 2012 01:52:52 +0000 (21:52 -0400)]
linux.c32: Add find_arguments function

The 'find_argument' function already finds the last instance of a
command-line option.  For symmetry, we introduce a 'find_arguments'
function which will help to iterate each instance of a command-line
option.

Also, this commit uses 'strncmp' in both, instead of 'memcmp'.

Modified-by: Shao Miller <sha0.miller@gmail.com>
Signed-off-by: Shao Miller <sha0.miller@gmail.com>