platform/upstream/syslinux.git
12 years agomodule: Actually use last component of DT_NEEDED pathname
Matt Fleming [Fri, 1 Jun 2012 12:24:51 +0000 (13:24 +0100)]
module: Actually use last component of DT_NEEDED pathname

The comment in module_load() claims that we strip everything from the
DT_NEEDED pathnames but the last component. That's not true as we
leave the initial '/', which works fine if the module is in the root
directory, but not so well if we're in a sub-directory. Worse still,
if the DT_NEEDED entry pathname doesn't include a '/' the module is
skipped entirely.

We should also be loading dependencies in reverse order, as modules
loaded because of DT_NEEDED entries may also have dependencies and
their dependencies should be loaded first.

Also, now we need the strrchr() implementation in the core, so move
strrchr.o into $CORELIBOBJS.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: fixes bug that happens when using fullpath for a COM32 module
Andre Ericson [Mon, 28 May 2012 09:54:15 +0000 (06:54 -0300)]
ldlinux: fixes bug that happens when using fullpath for a COM32 module

When using full path for a com32 module, for example,
/boot/syslinux/ls.c32 it fails without any error message. This patch
fixes it by looking first if the argv[0] is the path to a module before
looking for it at PATH.

Since we're using fopen to open module files (which works for both
absolute paths and paths relative to the current working directory) we
no longer need to include "." in PATH and neither the code to handle it.

Signed-off-by: Andre Ericson <de.ericson@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoMerge remote-tracking branch 'mfleming/merge/elflink/master' into elflink
H. Peter Anvin [Thu, 7 Jun 2012 22:54:09 +0000 (15:54 -0700)]
Merge remote-tracking branch 'mfleming/merge/elflink/master' into elflink

12 years agochainboot: clean up old assemblyisms
H. Peter Anvin [Thu, 7 Jun 2012 22:52:57 +0000 (15:52 -0700)]
chainboot: clean up old assemblyisms

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>
12 years agoexecute(): move chainbooting code to its own file
H. Peter Anvin [Thu, 7 Jun 2012 22:23:46 +0000 (15:23 -0700)]
execute(): move chainbooting code to its own file

To improve readability, move chainbooting to its own source file.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoMerge remote-tracking branch 'mfleming/elflink-dot-zero' into elflink
H. Peter Anvin [Thu, 7 Jun 2012 22:12:07 +0000 (15:12 -0700)]
Merge remote-tracking branch 'mfleming/elflink-dot-zero' into elflink

Resolved Conflicts:
com32/elflink/ldlinux/execute.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoelflink: Fix boot sector booting
Matt Fleming [Tue, 1 May 2012 07:55:45 +0000 (08:55 +0100)]
elflink: Fix boot sector booting

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>
12 years agoMerge remote-tracking branch 'zytor/master' into merge/elflink/master
Matt Fleming [Thu, 31 May 2012 11:16:22 +0000 (12:16 +0100)]
Merge remote-tracking branch 'zytor/master' into merge/elflink/master

A lot of development has gone on in the 'master' branch since the last
time we merged; new features, bug fixes, etc, etc.

Conflicts:
Makefile
com32/Makefile
com32/lib/Makefile
com32/lib/syslinux/load_linux.c
com32/modules/Makefile
com32/modules/chain.c
core/bootsect.inc
core/init.inc
version

12 years agocore: remove unused variable in scan_highmem_area()
H. Peter Anvin [Tue, 29 May 2012 21:53:52 +0000 (14:53 -0700)]
core: remove unused variable in scan_highmem_area()

Remove a completely unused variable giving a "set but not used"
warning.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agoMerge commit 'd76af0754db7ddd4c06215d922d213c93178c0af' into elflink
H. Peter Anvin [Tue, 29 May 2012 21:53:07 +0000 (14:53 -0700)]
Merge commit 'd76af0754db7ddd4c06215d922d213c93178c0af' into elflink

12 years agorelocs: Move stop to the end
H. Peter Anvin [Tue, 29 May 2012 21:08:11 +0000 (14:08 -0700)]
relocs: Move stop to the end

The Linux kernel puts the stop word at the beginning of the relocation
list (the list is processed backwards); Syslinux puts the stop word at
the beginning of the relocation list (the list is processed forwards.)

Missed that change when syncing with the kernel version.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agopxe: move hardwired DHCP options into high memory
H. Peter Anvin [Tue, 29 May 2012 19:22:32 +0000 (12:22 -0700)]
pxe: move hardwired DHCP options into high memory

If we have hardwired DHCP options, move them into high memory instead
of into the trackbuf.  This eliminates yet another trackbuf user.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agopxe: remove remaining stray trackbuf reference
H. Peter Anvin [Tue, 29 May 2012 19:01:25 +0000 (12:01 -0700)]
pxe: remove remaining stray trackbuf reference

We aren't using trackbuf, stop referring to it...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agopxe: stop using trackbuf for DHCP packets
H. Peter Anvin [Tue, 29 May 2012 18:56:05 +0000 (11:56 -0700)]
pxe: stop using trackbuf for DHCP packets

Get rid of yet another trackbuf usage.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agocore/font.c: remove another reference to trackbuf
H. Peter Anvin [Tue, 29 May 2012 18:46:41 +0000 (11:46 -0700)]
core/font.c: remove another reference to trackbuf

Remove a dead reference to trackbuf.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agocore/font: clean up and remove trackbuf usage
H. Peter Anvin [Tue, 29 May 2012 18:41:51 +0000 (11:41 -0700)]
core/font: clean up and remove trackbuf usage

This code was pretty messed up; it used the trackbuf for simple file
I/O, but didn't use lowmem for the actual font buffer, which is
touched by BIOS.

This also removes yet another user of trackbuf.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agorelocs: sync with the Linux kernel
H. Peter Anvin [Tue, 29 May 2012 08:02:54 +0000 (01:02 -0700)]
relocs: sync with the Linux kernel

Sync the relocs tool with the Linux kernel.  The new version of this
tool correctly verifies that any absolute symbol is either listed as
allowed absolute or is listed as relative.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agocore: add support for .init/fini_table
H. Peter Anvin [Tue, 29 May 2012 04:39:40 +0000 (21:39 -0700)]
core: add support for .init/fini_table

We don't actually have any constructors/destructors in the core at
this time, but handle .init/fini_table in case that happens...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agocom32.ld: handle .init_array and .fini_array syslinux-4.06-pre5
H. Peter Anvin [Tue, 29 May 2012 04:28:52 +0000 (21:28 -0700)]
com32.ld: handle .init_array and .fini_array

Handle constructors/destructors via .init_array and .fini_array, as
generated by newer gccs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agocom32: fix warning in host module
Paulo Alcantara [Mon, 28 May 2012 04:04:00 +0000 (01:04 -0300)]
com32: fix warning in host module

host.c: In function ‘main’:
host.c:56:9: warning: implicit declaration of function ‘exit’
                            [-Wimplicit-function-declaration]
host.c:56:9: warning: incompatible implicit declaration of built-in
                                function ‘exit’ [enabled by default]

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agocom32: fix warning in elf_module
Paulo Alcantara [Mon, 28 May 2012 03:52:03 +0000 (00:52 -0300)]
com32: fix warning in elf_module

sys/module/elf_module.c: In function ‘module_load’:
sys/module/elf_module.c:454:8: warning: ‘ctors’ may be used
                    uninitialized in this function [-Wuninitialized]
sys/module/elf_module.c:404:17: note: ‘ctors’ was declared here

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agolocalboot: remove unnecessary real-mode call
Paulo Alcantara [Mon, 28 May 2012 03:31:59 +0000 (00:31 -0300)]
localboot: remove unnecessary real-mode call

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>
12 years agoMerge remote-tracking branch 'hdt/master' syslinux-4.06-pre4
H. Peter Anvin [Sun, 27 May 2012 19:57:21 +0000 (12:57 -0700)]
Merge remote-tracking branch 'hdt/master'

12 years agoMerge remote-tracking branch 'genec/diag-mbr-fix-for-hpa'
H. Peter Anvin [Sun, 27 May 2012 19:57:01 +0000 (12:57 -0700)]
Merge remote-tracking branch 'genec/diag-mbr-fix-for-hpa'

12 years agodiag/mbr: Clarify README
Gene Cumm [Sun, 27 May 2012 18:13:05 +0000 (14:13 -0400)]
diag/mbr: Clarify README

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agoUpdate diag/mbr instruction to match the current filename.
Jean-Christian de Rivaz [Sat, 26 May 2012 22:26:42 +0000 (00:26 +0200)]
Update diag/mbr instruction to match the current filename.

I suspect that some instructions about how to use the diag/mbr was not
updated when the source file was renamed to handoff.S. Here is a simple
proposition to fix that only into the handoff.S file.

Jean-Christian de Rivaz

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agopxechn.c32: PXE NBP chainloader
Gene Cumm [Sun, 27 May 2012 13:23:07 +0000 (09:23 -0400)]
pxechn.c32: PXE NBP chainloader

Designed as a more versatile COM32-based alternative to pxechain.com.
It can use the PXE RESTART or chain to the new NBP without the PXE
stack.  It also enables a user to boot Microsoft Windows Server 2008R2
Windows Deployment Services's wdsnbp.com from PXELINUX.

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agoCOM32: add DHCP pack/unpack functions
H. Peter Anvin [Tue, 14 Jun 2011 01:16:46 +0000 (21:16 -0400)]
COM32: add DHCP pack/unpack functions

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agohdt: 0.5.2-pre2 release
Erwan Velu [Sun, 27 May 2012 09:59:25 +0000 (11:59 +0200)]
hdt: 0.5.2-pre2 release

12 years agohdt: Adding say & postexec demo
Erwan Velu [Sun, 27 May 2012 09:58:19 +0000 (11:58 +0200)]
hdt: Adding say & postexec demo

When building official hdt image, let's add a say & postexec example.

12 years agohdt: Adding say command
Erwan Velu [Sun, 27 May 2012 09:46:54 +0000 (11:46 +0200)]
hdt: Adding say command

This command is just for displaing a message to the cli during a defined
period of time.

Syntax is like the following : say `my message`%<number_of_seconds>
An example :

say `This is my text message to display during 5 seconds`%5

12 years agohdt: Adding nomodule support in cli
Erwan Velu [Sun, 27 May 2012 09:41:39 +0000 (11:41 +0200)]
hdt: Adding nomodule support in cli

Some new commands might need being able to manage the argv directly
instead of the much more oriented scheme we had until now.

This commit add a .nomodule option to cli object to explically tell they
don't have a module as parameter but only arguments.

This will be needed for the 'say' command.

12 years agohdt: Fixing argument mgmt in cli
Erwan Velu [Sun, 27 May 2012 09:20:01 +0000 (11:20 +0200)]
hdt: Fixing argument mgmt in cli

Sizeof(char *) is definetly wrong for getting the length of a string.

12 years agohdt: Adding more debug traces in cli
Erwan Velu [Sun, 27 May 2012 06:27:49 +0000 (08:27 +0200)]
hdt: Adding more debug traces in cli

Adding more debug traces in the cli management to ease debugging &
feature adding.

12 years agohdt: Fixing chain32 target in makefile
Erwan Velu [Fri, 25 May 2012 21:31:42 +0000 (23:31 +0200)]
hdt: Fixing chain32 target in makefile

chain32 moved, let's adjust the "release" target.

12 years agoMerge remote-tracking branch 'hpa/master'
Erwan Velu [Fri, 25 May 2012 21:08:35 +0000 (23:08 +0200)]
Merge remote-tracking branch 'hpa/master'

12 years agographics: make use of syslinux_force_text_mode()
Paulo Alcantara [Sat, 19 May 2012 04:58:03 +0000 (01:58 -0300)]
graphics: make use of syslinux_force_text_mode()

The syslinux_force_text_mode() function used in library
space made unnecessary INT 0x22 call that could be simply
used with vgaclearmode() function.

This patche renames vgaclearmode() to
syslinux_force_text_mode() as this naming is generally more
carefully considered and gets rid of "forcetext.c" source
file.

Also all the VGA-related functions and variables that were
exported in core/include/bios.h have been moved out to
core/include/graphics.h which makes more sense actually.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agoCLI: don't highlight the prompt syslinux-5.00-pre2
H. Peter Anvin [Fri, 18 May 2012 23:29:42 +0000 (16:29 -0700)]
CLI: don't highlight the prompt

Don't gratuitously highlight the prompt; it is just annoying.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agosyslinux_boot_linux(): revert to text mode unless vga=current
H. Peter Anvin [Fri, 18 May 2012 23:26:53 +0000 (16:26 -0700)]
syslinux_boot_linux(): revert to text mode unless vga=current

When loading a Linux kernel, revert to text mode before invoking
unless vga=current.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agocom32: make syslinux_dump_*() pure debugging functions
H. Peter Anvin [Tue, 28 Jun 2011 02:06:43 +0000 (19:06 -0700)]
com32: make syslinux_dump_*() pure debugging functions

Make the syslinux_dump_*() functions pure debugging functions; that is
the way that they are used anyway, and this way they log to the same
place as dprintf.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoUse <dprintf.h> instead of an ad hoc definition
H. Peter Anvin [Tue, 28 Jun 2011 01:51:11 +0000 (18:51 -0700)]
Use <dprintf.h> instead of an ad hoc definition

Instead of using ad hoc definitions of dprintf, dprintf2, vdprintf and
vdprintf2, use <dprintf.h> everywhere possible.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agodprintf: always define dprintf2/vdprintf2
H. Peter Anvin [Tue, 21 Jun 2011 04:33:38 +0000 (21:33 -0700)]
dprintf: always define dprintf2/vdprintf2

Always define dprintf2/vdprintf2 even with no debugging at all
enabled.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agolib/shuffle: use <dprintf.h>
H. Peter Anvin [Tue, 21 Jun 2011 04:19:46 +0000 (21:19 -0700)]
lib/shuffle: use <dprintf.h>

Another straggler not yet using <dprintf.h> for debugging.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agodprintf: add the ability to log to stdio
H. Peter Anvin [Tue, 21 Jun 2011 04:19:17 +0000 (21:19 -0700)]
dprintf: add the ability to log to stdio

Add the ability to redirect dprintf to stdio when there is no other
choice.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Resolved Conflicts:

com32/lib/dprintf.c
com32/lib/vdprintf.c

12 years agovdprintf.c: undo double-printing
H. Peter Anvin [Fri, 18 May 2012 23:01:25 +0000 (16:01 -0700)]
vdprintf.c: undo double-printing

Undo double-printing change so we can sync with master.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoCLI: Stick to the classic "boot: " prompt rather than "syslinux$"
H. Peter Anvin [Fri, 18 May 2012 22:42:38 +0000 (15:42 -0700)]
CLI: Stick to the classic "boot: " prompt rather than "syslinux$"

Just for familiarity...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agofs.h: A slighly more useful default PATH
H. Peter Anvin [Fri, 18 May 2012 22:38:08 +0000 (15:38 -0700)]
fs.h: A slighly more useful default PATH

/bin is clearly insane...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoMakefile: install library modules, too
H. Peter Anvin [Fri, 18 May 2012 22:37:32 +0000 (15:37 -0700)]
Makefile: install library modules, too

We need the library modules to be added to MODULES.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoelflink: Make sure to install ldlinux.c32 at install time
H. Peter Anvin [Fri, 18 May 2012 22:00:04 +0000 (15:00 -0700)]
elflink: Make sure to install ldlinux.c32 at install time

We need to reach ldlinux.c32 during early boot...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoelflink: make dprintf() usable in the core
H. Peter Anvin [Fri, 18 May 2012 21:59:15 +0000 (14:59 -0700)]
elflink: make dprintf() usable in the core

Make dprintf() usable in the core, as it it on the mainline branch.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agosyslinux.mk: use $(MAKEDIR) not $(makefiledir)
H. Peter Anvin [Fri, 18 May 2012 21:47:40 +0000 (14:47 -0700)]
syslinux.mk: use $(MAKEDIR) not $(makefiledir)

Everything else in the system seems to use $(MAKEDIR), not
$(makefiledir)...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agographics: report video mode change from protected-mode code
Paulo Alcantara [Fri, 4 May 2012 07:43:34 +0000 (04:43 -0300)]
graphics: report video mode change from protected-mode code

Syslinux used to call __intcall() for calling routines of the old
COMBOOT API to report video mode change (INT 22h, AX=0x0017) that seemed
pointless, since INT 22h, AX=0x0017 does call the protected-mode
function pm_using_vga() already when calling INT 22h, AX=0x0017. So for
reporting video mode changes (VGA in this case) we must call
graphics_using_vga() instead for now.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agocom32: Do not use hard-coded values for PXE flags
Paulo Alcantara [Fri, 4 May 2012 06:58:52 +0000 (03:58 -0300)]
com32: Do not use hard-coded values for PXE flags

There is already a syslinux/pxe_api.h header file which contains PXE
flags, so these hard-coded values are unnecessaries.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agopxe: resolve names via DNS from protected-mode code
Paulo Alcantara [Fri, 4 May 2012 05:17:46 +0000 (02:17 -0300)]
pxe: resolve names via DNS from protected-mode code

Syslinux used to call __intcall() for calling routines of the old
COMBOOT API to resolve names via DNS (INT 22h, AX=0x0010) that seemed
pointless, since INT 22h, AX=0x0010 does call the protected-mode
function pm_pxe_resolv_dns() when calling INT 22h, AX=0x0010. So, for
resolving names via DNS we must call pxe_dns_resolv() (a protected-mode
function) instead for now.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agopxe: rename pxe_dns_resolv() function to pm_pxe_dns_resolv()
Paulo Alcantara [Mon, 30 Apr 2012 05:59:30 +0000 (02:59 -0300)]
pxe: rename pxe_dns_resolv() function to pm_pxe_dns_resolv()

As pxe_dns_resolv() (a protected-mode function) is just a wrapper for
real mode (used in the old COMBOOT API), so it makes more sense to
have it named as pm_pxe_dns_resolv().

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agohost.c32: do not use INT 22h, AX=0x0010 to resolve DNS
Paulo Alcantara [Mon, 30 Apr 2012 04:49:16 +0000 (01:49 -0300)]
host.c32: do not use INT 22h, AX=0x0010 to resolve DNS

Use pxe_dns() function (assigned in syslinux/pxe.h) instead for
resolving DNS.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agoPXELINUX: do not use hard-coded values
Paulo Alcantara [Sat, 28 Apr 2012 18:40:31 +0000 (15:40 -0300)]
PXELINUX: do not use hard-coded values

PXENV_RESTART_TFTP and PXENV_FILE_EXEC flags are already declared in
core/pxe.inc, so we don't need to use hard-coded values there.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agoISOLINUX: use bailmsg string in kaboom()
Paulo Alcantara [Thu, 19 Apr 2012 03:28:40 +0000 (00:28 -0300)]
ISOLINUX: use bailmsg string in kaboom()

Every code which implements kaboom(), uses bailmsg string. So we must
use it in core/isolinux.asm as well.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agoISOLINUX: trivial fix
Paulo Alcantara [Thu, 19 Apr 2012 03:25:57 +0000 (00:25 -0300)]
ISOLINUX: trivial fix

Fix minor typo.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
12 years agoMerge remote-tracking branch 'mfleming/elflink' into elflink
H. Peter Anvin [Fri, 4 May 2012 19:12:47 +0000 (12:12 -0700)]
Merge remote-tracking branch 'mfleming/elflink' into elflink

12 years agoldlinux: Parse ALLOWOPTIONS directive
Matt Fleming [Thu, 3 May 2012 12:54:14 +0000 (13:54 +0100)]
ldlinux: Parse ALLOWOPTIONS directive

Specifying the ALLOWOPTIONS directive doesn't have any effect at the
moment. Fix this so that if ALLOWOPTIONS 0 is used then command line
arguments are ignored.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoelflink: Fix TIMEOUT and TOTALTIMEOUT handling
Matt Fleming [Thu, 3 May 2012 12:19:52 +0000 (13:19 +0100)]
elflink: Fix TIMEOUT and TOTALTIMEOUT handling

Paulo reported that his default command line wasn't being executed
when the timeout specified in his config file elapsed. This is because
mygetkey() wasn't correctly applying the timeout when waiting for
input.

Furthermore, it seems the ONTIMEOUT parsing was also broken.

Reported-by: Paulo Alcantara <pcacjr@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Don't drop args if we auto-lookup cmd extension
Matt Fleming [Tue, 1 May 2012 15:00:12 +0000 (16:00 +0100)]
ldlinux: Don't drop args if we auto-lookup cmd extension

If we automatically lookup the extension for a command and the user
has supplied an argument to that command we incorrectly stamp the NUL
byte after the extension, and not after the argument, thereby
effectively erasing the argument.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoMerge remote-tracking branch 'genec/diag-geodsp-perl-for-hpa'
H. Peter Anvin [Wed, 25 Apr 2012 22:32:34 +0000 (15:32 -0700)]
Merge remote-tracking branch 'genec/diag-geodsp-perl-for-hpa'

12 years agoget_key: Valid key values are positive
H. Peter Anvin [Tue, 17 Apr 2012 18:25:53 +0000 (11:25 -0700)]
get_key: Valid key values are positive

Make sure we return positive values for valid keystrokes.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agocore/graphics.c: Fixes and cleanups
H. Peter Anvin [Tue, 17 Apr 2012 18:22:36 +0000 (11:22 -0700)]
core/graphics.c: Fixes and cleanups

Fix up various conversion bugs from assembly.  Eventually this whole
file should be removed and the functionality moved to using the VESA
framework.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agohw/vga.h: Header file for VGA hardware registers
H. Peter Anvin [Tue, 17 Apr 2012 17:42:17 +0000 (10:42 -0700)]
hw/vga.h: Header file for VGA hardware registers

Header file for VGA hardware registers; so far only the base registers
and sub-register indicies, but no bit masks or bit positions; those
can be added as needed.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agoMerge branches 'auto-extension' and 'fix-build-warnings' into elflink
Matt Fleming [Tue, 17 Apr 2012 10:24:56 +0000 (11:24 +0100)]
Merge branches 'auto-extension' and 'fix-build-warnings' into elflink

Conflicts:
com32/elflink/ldlinux/ldlinux.c

12 years agoMark unused function parameters as __unused
Matt Fleming [Wed, 4 Apr 2012 11:18:47 +0000 (12:18 +0100)]
Mark unused function parameters as __unused

Move the __unused tag from com32/hdt/ to com32/include/klibc/ so that
it can be used by the entire code base, and mark unused function
parameters as __unused to stop the following kind of build warning,

elflink/load_env32.c: In function ‘load_env32’:
elflink/load_env32.c:107:30: warning: unused parameter ‘regs’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoelflink: Remove unused variables
Matt Fleming [Wed, 4 Apr 2012 09:27:42 +0000 (10:27 +0100)]
elflink: Remove unused variables

Reduce the number of build warnings by deleting unused variables.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agofs: Include unistd.h for chdir() prototype
Matt Fleming [Tue, 3 Apr 2012 15:34:25 +0000 (16:34 +0100)]
fs: Include unistd.h for chdir() prototype

fs/lib/chdir.c: In function ‘generic_chdir_start’:
fs/lib/chdir.c:5:2: warning: implicit declaration of function ‘chdir’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agofs: Include header for close() prototype
Matt Fleming [Tue, 3 Apr 2012 15:28:52 +0000 (16:28 +0100)]
fs: Include header for close() prototype

... which avoids the following build warning,

fs/fs.c: In function ‘open_config’:
fs/fs.c:97:2: warning: implicit declaration of function ‘close’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoelflink: Allocate space for 'realname'
Matt Fleming [Tue, 3 Apr 2012 15:17:17 +0000 (16:17 +0100)]
elflink: Allocate space for 'realname'

search_dirs() expects the 'realname' argument to point to space
allocated for storing the real path name. Currently we're passing an
uninitialized pointer which was highlighted by the following build
warning,

elflink/load_env32.c:155:18: warning: ‘realname’ may be used uninitialized in this function

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoelflink: Delete obsolete constructor code
Matt Fleming [Tue, 3 Apr 2012 15:07:09 +0000 (16:07 +0100)]
elflink: Delete obsolete constructor code

Since commit 8e0ed96bff75 ("elf: Support __constructor and
__destructor") the code for looping over ctors in ldlinux has been
unnecessary. Delete since this is all now handled in the core module
loading code.

This also gets rid of the following build warning,

elflink/load_env32.c: At top level:
elflink/load_env32.c:28:15: warning: array ‘__ctors_start’ assumed to have one element
elflink/load_env32.c:28:32: warning: array ‘__ctors_end’ assumed to have one element

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoconio: Fix up compiler warnings
Matt Fleming [Tue, 3 Apr 2012 15:00:53 +0000 (16:00 +0100)]
conio: Fix up compiler warnings

conio.c: In function ‘pm_getchar’:
conio.c:336:2: warning: pointer targets in passing argument 1 of ‘getchar’ differ in signedness
conio.c:268:6: note: expected ‘char *’ but argument is of type ‘uint8_t *’
conio.c: In function ‘pm_pollchar’:
conio.c:261:1: warning: control reaches end of non-void function

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agographics: Fix GXPix* assignment
Matt Fleming [Tue, 3 Apr 2012 14:30:58 +0000 (15:30 +0100)]
graphics: Fix GXPix* assignment

We need assign cols/rows to GXPixCols/GXPixRows separately, we can't
rely on the compiler writing the 32-bit value to two consecutive
16-bit memory locations like the assembly version did. The value we
were storing was actually being truncated by the compiler (see the
warning below),

Also fixup the following warnings,

graphics.c: In function ‘vgasetmode’:
graphics.c:95:18: warning: cast from pointer to integer of different size
graphics.c:102:2: warning: large integer implicitly truncated to unsigned type
graphics.c: In function ‘outputvga’:
graphics.c:222:12: warning: cast from pointer to integer of different size
graphics.c:227:11: warning: cast from pointer to integer of different size
graphics.c: In function ‘vgadisplayfile’:
graphics.c:303:4: warning: passing argument 1 of ‘outputvga’ from incompatible pointer type
graphics.c:213:13: note: expected ‘uint32_t *’ but argument is of type ‘uint8_t *’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agofont: Cast away compiler warning
Matt Fleming [Tue, 3 Apr 2012 14:14:24 +0000 (15:14 +0100)]
font: Cast away compiler warning

font.c: In function ‘adjust_screen’:
font.c:167:30: warning: initialization makes pointer from integer without a cast

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agowritestr: Include core.h for writechr() prototype
Matt Fleming [Tue, 3 Apr 2012 13:57:58 +0000 (14:57 +0100)]
writestr: Include core.h for writechr() prototype

This eliminates the following compiler warning,

writestr.c: In function ‘crlf’:
writestr.c:26:2: warning: implicit declaration of function ‘writechr’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agohello: Delete unused variable 'console_init'
Matt Fleming [Tue, 3 Apr 2012 13:38:08 +0000 (14:38 +0100)]
hello: Delete unused variable 'console_init'

Which also gets rid of the following warning,

hello.c:10:12: warning: ‘console_init’ defined but not used

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoinit: Fix up compiler warnings
Matt Fleming [Tue, 3 Apr 2012 12:55:51 +0000 (13:55 +0100)]
init: Fix up compiler warnings

Fix up the following compiler warnings by including appropriate
headers, applying some casts, and changing some data types,

init.c:7:1: warning: large integer implicitly truncated to unsigned type
init.c: In function ‘check_escapes’:
init.c:32:10: warning: cast from pointer to integer of different size
init.c:46:4: warning: implicit declaration of function ‘writestr’
init.c: In function ‘bios_timer_init’:
init.c:57:19: warning: initialization makes pointer from integer without a cast
init.c:61:8: warning: assignment makes integer from pointer without a cast
init.c: In function ‘init’:
init.c:74:2: warning: implicit declaration of function ‘adjust_screen’
init.c:75:2: warning: implicit declaration of function ‘printf_init’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agolocalboot: Include header files for function prototypes
Matt Fleming [Tue, 3 Apr 2012 11:58:52 +0000 (12:58 +0100)]
localboot: Include header files for function prototypes

... to avoid the following warnings,

localboot.c: In function ‘local_boot’:
localboot.c:38:2: warning: implicit declaration of function ‘vgaclearmode’
localboot.c:40:2: warning: implicit declaration of function ‘writestr’
localboot.c:41:2: warning: implicit declaration of function ‘crlf’
localboot.c:42:2: warning: implicit declaration of function ‘cleanup_hardware’
localboot.c:76:2: warning: implicit declaration of function ‘memcpy’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agomeminfo: If we allocate with lmalloc() we should free with lfree()
Matt Fleming [Tue, 3 Apr 2012 11:12:50 +0000 (12:12 +0100)]
meminfo: If we allocate with lmalloc() we should free with lfree()

Since commit 74518b8b691c ("elflink: Make ELF the default object
format") we've been using lmalloc() with free() instead of lfree().
This bug was pointed out by the following build warnings,

meminfo.c: In function ‘dump_e820’:
meminfo.c:93:5: warning: implicit declaration of function ‘free’
meminfo.c:93:5: warning: incompatible implicit declaration of built-in function ‘free’
vesainfo.c: In function ‘print_modes’:
vesainfo.c:82:2: warning: implicit declaration of function ‘free’
vesainfo.c:82:2: warning: incompatible implicit declaration of built-in function ‘free’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Include write_serial() prototype
Matt Fleming [Tue, 3 Apr 2012 10:49:50 +0000 (11:49 +0100)]
ldlinux: Include write_serial() prototype

Include core.h to avoid the following build warning,

eprintf.c: In function ‘veprintf’:
eprintf.c:23:6: warning: implicit declaration of function ‘write_serial’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agocore: Move write_serial() prototype to core.h
Matt Fleming [Tue, 3 Apr 2012 10:37:36 +0000 (11:37 +0100)]
core: Move write_serial() prototype to core.h

There's nothing inherently BIOS-specific about write_serial(), so it
doesn't make sense to have it in bios.h. Move the prototype to core.h
so that files can access the prototype without pulling in all the BIOS
symbols. Also add some missing function prototypes while we're at it.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Use signed char consistently
Matt Fleming [Tue, 3 Apr 2012 09:48:52 +0000 (10:48 +0100)]
ldlinux: Use signed char consistently

In get_key() we use unsigned chars but seem to use signed chars in
other functions. There's no real reason to use unsigned chars so let's
be consistent. This also eliminates the following warnings,

get_key.c: In function ‘get_key’:
get_key.c:187:2: warning: pointer targets in passing argument 1 of ‘get_key_decode’ differ in signedness
get_key.c:129:5: note: expected ‘char *’ but argument is of type ‘unsigned char *’
serirq.c:29:29: warning: pointer targets in initialization differ in signedness
serirq.c:30:29: warning: pointer targets in initialization differ in signedness

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Fix uninitialized variable warning
Matt Fleming [Mon, 2 Apr 2012 16:11:57 +0000 (17:11 +0100)]
ldlinux: Fix uninitialized variable warning

Fix the following warning by initializing 'kernel_name' to NULL,

kernel.c:18:14: warning: ‘kernel_name’ may be used uninitialized in this function

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Add prototype for new_linux_kernel()
Matt Fleming [Mon, 2 Apr 2012 16:07:59 +0000 (17:07 +0100)]
ldlinux: Add prototype for new_linux_kernel()

Make sure we're passing the correct arguments to new_linux_kernel() by
defining a prototype. This also fixes the following warning,

execute.c:108:3: warning: implicit declaration of function ‘new_linux_kernel’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Fix number of arguments to start_ldlinux()
Matt Fleming [Mon, 2 Apr 2012 14:51:45 +0000 (15:51 +0100)]
ldlinux: Fix number of arguments to start_ldlinux()

Commit 3a316db1 ("ldlinux: Loading a config file should cause
re-initialisation") added a call to start_ldlinux() with an incorrect
number of arguments. Add the prototype to core.h so this error doesn't
go unnoticed again.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Cast some arguments to avoid compiler warnings
Matt Fleming [Mon, 2 Apr 2012 14:14:55 +0000 (15:14 +0100)]
ldlinux: Cast some arguments to avoid compiler warnings

Specifically these warnings,

execute.c: In function ‘execute’:
execute.c:87:3: warning: passing argument 1 of ‘lfree’ discards qualifiers from pointer target type
../../../com32/include/com32.h:125:6: note: expected ‘void *’ but argument is of type ‘const char *’
execute.c:88:3: warning: passing argument 1 of ‘create_args_and_load’ discards qualifiers from pointer target type
execute.c:40:12: note: expected ‘char *’ but argument is of type ‘const char *’
execute.c:111:2: warning: passing argument 1 of ‘lfree’ discards qualifiers from pointer target type
../../../com32/include/com32.h:125:6: note: expected ‘void *’ but argument is of type ‘const char *’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Use '\0' instead of NULL when dealing with characters
Matt Fleming [Mon, 2 Apr 2012 13:44:46 +0000 (14:44 +0100)]
ldlinux: Use '\0' instead of NULL when dealing with characters

We should be using '\0', not NULL when signalling 'end of string'.
Using NULL results in the following warning,

readconfig.c: In function ‘parse_one_config’:
readconfig.c:1355:17: warning: assignment makes integer from pointer without a cast

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agocore: Add open_config() prototype
Matt Fleming [Mon, 2 Apr 2012 13:44:10 +0000 (14:44 +0100)]
core: Add open_config() prototype

... to fix the following warning,

readconfig.c: In function ‘parse_one_config’:
readconfig.c:1339:3: warning: implicit declaration of function ‘open_config’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Fix build warnings caused by refstrdup() usage
Matt Fleming [Mon, 2 Apr 2012 13:26:22 +0000 (14:26 +0100)]
ldlinux: Fix build warnings caused by refstrdup() usage

Sprinkle 'const' qualifiers when dealing with refstrdup() to fix the
following warnings,

readconfig.c: In function ‘parse_config_file’:
readconfig.c:1127:12: warning: assignment discards qualifiers from pointer target type
readconfig.c:1139:12: warning: assignment discards qualifiers from pointer target type
readconfig.c:1152:12: warning: assignment discards qualifiers from pointer target type
readconfig.c:1315:12: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Silence gcc warning about uninitialized variable
Matt Fleming [Mon, 2 Apr 2012 13:12:06 +0000 (14:12 +0100)]
ldlinux: Silence gcc warning about uninitialized variable

Initialize 'comm_counter' so that gcc will no longer complain with the
following,

cli.c: In function ‘edit_cmdline’:
cli.c:142:25: warning: ‘comm_counter’ may be used uninitialized in this function

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Add print_labels() prototype to config.h
Matt Fleming [Mon, 2 Apr 2012 13:07:33 +0000 (14:07 +0100)]
ldlinux: Add print_labels() prototype to config.h

... to fix the following build warning,

cli.c: In function ‘edit_cmdline’:
cli.c:411:3: warning: implicit declaration of function ‘print_labels’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Fix check for last command line entry
Matt Fleming [Mon, 2 Apr 2012 12:50:22 +0000 (13:50 +0100)]
ldlinux: Fix check for last command line entry

The expression that checks to see when we've reached the end of the
command line entries is incorrect, probably because the list macros
weren't used. Use list_is_last() to make the expression correct and
self-documenting.

This bug was highlighted by the following compiler warning,

cli.c: In function ‘cmd_reverse_search’:
cli.c:102:20: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Match arg types to function prototypes
Matt Fleming [Mon, 2 Apr 2012 12:36:17 +0000 (13:36 +0100)]
ldlinux: Match arg types to function prototypes

Change the types of some local variables to match the type in the
function prototypes, thereby avoiding the following warnings,

ldlinux.c:132:2: warning: pointer targets in passing argument 2 of ‘syslinux_getadv’ differ in signedness
../../../com32/include/syslinux/adv.h:55:22: note: expected ‘size_t *’ but argument is of type ‘int *’
ldlinux.c:132:6: warning: assignment discards qualifiers from pointer target type
ldlinux.c:156:3: warning: pointer targets in passing argument 1 of ‘load_kernel’ differ in signedness
ldlinux.c:58:13: note: expected ‘const char *’ but argument is of type ‘uint8_t *’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Tag __syslinux_init() as __constructor
Matt Fleming [Mon, 2 Apr 2012 11:53:59 +0000 (12:53 +0100)]
ldlinux: Tag __syslinux_init() as __constructor

We don't need to have control over exactly when __syslinux_init() is
executed, it just needs to be before we call syslinux_get_adv(). Let's
apply the __constructor tag to __syslinux_init() so that it is
executed before we enter ldlinux.c32's main(). This partially reverts
commit 487b67a9ce ("ldlinux: Remove __constructor attribute") because
we can now have __constructor functions in ldlinux.

By not calling __syslinux_init() directly we also avoid the following
build warning,

ldlinux.c: In function ‘main’:
ldlinux.c:131:2: warning: implicit declaration of function ‘__syslinux_init’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: parse_kernel_type() parameter should be const
Matt Fleming [Mon, 2 Apr 2012 11:41:50 +0000 (12:41 +0100)]
ldlinux: parse_kernel_type() parameter should be const

Since we always pass a const char * to parse_kernel_type(), change the
type of the parameter accordingly to get rid of the following
warnings,

ldlinux.c:66:3: warning: passing argument 1 of ‘parse_kernel_type’ discards qual
ifiers from pointer target type
ldlinux.c:14:25: note: expected ‘char *’ but argument is of type ‘const char *’
ldlinux.c:80:2: warning: passing argument 1 of ‘parse_kernel_type’ discards qual
ifiers from pointer target type
ldlinux.c:14:25: note: expected ‘char *’ but argument is of type ‘const char *’
ldlinux.c: In function ‘main’:

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Include headers for function prototypes
Matt Fleming [Mon, 2 Apr 2012 11:35:33 +0000 (12:35 +0100)]
ldlinux: Include headers for function prototypes

Include the appropriate headers to fix up the following build
warnings,

ldlinux.c: In function ‘parse_kernel_type’:
ldlinux.c:27:2: warning: implicit declaration of function ‘strncmp’
ldlinux.c: In function ‘load_kernel’:
ldlinux.c:64:2: warning: implicit declaration of function ‘find_label’
ldlinux.c:64:5: warning: assignment makes pointer from integer without a cast

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoelflink: Add _module_unload() prototype to module.h
Matt Fleming [Mon, 2 Apr 2012 10:50:03 +0000 (11:50 +0100)]
elflink: Add _module_unload() prototype to module.h

Commit 8e0ed96bff7 ("elf: Support __constructor and __destructor")
failed to add a prototype for the newly introduced _module_unload()
function, which resulted in the following build warning being
introduced,

sys/module/exec.c: In function ‘spawn_load’:
sys/module/exec.c:222:3: warning: implicit declaration of function ‘_module_unload’

Signed-off-by: Matt Fleming <matt.fleming@intel.com>