win: Use lower-case private definition of STORAGE_DEVICE_NUMBER

Since we can't know if <winioctl.h> actually defines
STORAGE_DEVICE_NUMBER, just use a private definition of the structure
but with a lower-case name.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
fat: Make mangle behavior similar to the standard one

Handle mangle in FAT the same as in the generic version, except for \
-> / conversion.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
com32: Add device tree support

This commit adds support for passing a Flattened Device Tree (FDT) blob
to the Linux kernel.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Change fdt-specific loader into a generic setup_data loader

Make it a generic setup_data loader keyed by type.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Thierry Reding <thierry.reding@avionic-design.de>
<syslinux/linux.h>: add missing setup_data_init() definition

Missing prototype.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
linux.c32: add support for a device tree blob (dtb)

Based on a patch by Thierry Reding, add support for loading a device
tree blob using the generic setup_data framework.

I used the name dtb= instead of fdt= since it looks like dtb= is the
common acronym for the filenames and what is used in the kernel.

Originally-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
setup_data: check to make sure kernel version >= 0x0209

Versions before 2.09 had no setup_data support.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
setup_data: if nothing to load and version < 2.09, no harm no foul

If the setup_data is empty, it is okay if the version is < 2.09.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
linux.c32: allow loading arbitrary setup_data blobs

Allow loading arbitrary setup_data blobs via the syntax
blob.NN=filename where NN is a decimal number.

This also allows loading multiple device tree blobs.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
linux.c32: add missing break;

Add missing break; for ENOMEM.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
elf_module: Remove unused variable

This patch removes an unused variable and fixes the following warning:

sys/module/elf_module.c: In function ‘module_load’:
sys/module/elf_module.c:512:16: warning: variable ‘j’ set but not used
					[-Wunused-but-set-variable]

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
vdprintf: Remove unused variable

This patch removes an unused variable and fixes the following warning:

vdprintf.c: In function ‘vdprintf’:
vdprintf.c:48:13: warning: variable ‘_rv’ set but not used
		  			[-Wunused-but-set-variable]

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
core: Makefile: Do not enable debug by default

The commit 72842b6 has set "DDEBUG=1" as it shouldn't, so the whole core
was being compiled always with debug enabled.

This patch removes the "DDEBUG=1" from CFLAGS in Makefile, since Syslinux
is never compiled with debug enabled by default.

Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
ldlinux: Return immediately after we execute() a command

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 for boot crash of syslinux-4.xx

All syslinux 4.xx versions (tested up to 4.04) seems to contain a bug, that
causes a crash in early phase of syslinux boot from an usb stick.
This is always possible to reproduce, but only on certain hw (atom based
embedded board).
Version 3.86 of syslinux always works with that hw.

When syslinux 4.xx is used to setup bootable usb stick (which works on general
desktop pc), that usb stick does not work with embedded atom based board.
Screen is garbaged, flickering and the system hangs, instead of loading the
image to be booted.

Dissecting syslinux source code reveals, that the problem is within
core/fs/cache.c
function cache_init(), where seems to be an invalid pointer used to store an
initial value - following patch fixes the problem by removing the
offending line, that seems not to be needed anyway.

Signed-off-by: Jan Safrata <jsafrata@centrum.cz>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Merge branch 'master' into elflink

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
core: move disklib into core

Move disklib into core so that it can be used by multidisk support.

Signed-off-by: Andre Ericson <de.ericson@gmail.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
core: initial implementation of fopen with multidisk acess

An initial implementation of fopen. Should work for GPT/MBR.

cache still needs to be modified as syslinux will break after opening
file.

Signed-off-by: Andre Ericson <de.ericson@gmail.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
core: add data structure to hold fs_info for all disks/partition

A new data structure is implemented to hold filesystem information for
all accessed disk/partitions.

Signed-off-by: Andre Ericson <de.ericson@gmail.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
core: modify disk cache to work with multidisk

Disk cache was modified to work with multidisk. Now fopen with
different disks/partitions should be fully working.

Signed-off-by: Andre Ericson <de.ericson@gmail.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>