platform/upstream/syslinux.git
11 years agoCLI: Add Ctrl + V support for printing the Syslinux version
Matt Fleming [Thu, 1 Nov 2012 12:26:22 +0000 (12:26 +0000)]
CLI: Add Ctrl + V support for printing the Syslinux version

The cli code is missing support for printing the version string that
is available in Syslinux 4.06 and earlier.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agowin: Print error message if we fail to install to --directory
Matt Fleming [Thu, 1 Nov 2012 11:30:42 +0000 (11:30 +0000)]
win: Print error message if we fail to install to --directory

Instead of silently returning with no indication of error if we
couldn't install to the --directory argument, print an error message
that tells the user the files are not where they wanted.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agowin: Fix installing to a directory
Matt Fleming [Thu, 1 Nov 2012 11:12:03 +0000 (11:12 +0000)]
win: Fix installing to a directory

commit bda54cb68067 ("installers: Install ldlinux.c32 automatically)"
introduced a bug in the move_file() function. move_file() isn't
deleting the destination path, including the --directory argument,
that ldlinux.sys should be installed to ('new_name'), which means that
the MoveFile() calls fails. What it's actually doing is deleting
ldlinux.sys from the file destination system.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoCLI: Fix command history traversal
Matt Fleming [Thu, 1 Nov 2012 10:56:06 +0000 (10:56 +0000)]
CLI: Fix command history traversal

The up/down keys were broken with respect to traversing through the
command history because it was dereferencing a NULL pointer on the
first iteration.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocom32: Include .init_array section in .ctors in linker script
Matt Fleming [Thu, 1 Nov 2012 09:50:46 +0000 (09:50 +0000)]
com32: Include .init_array section in .ctors in linker script

GCC 4.7 now places pointers to functions with the 'constructor' and
'destructor' function attributes in .init_array and .fini_array
sections, respectively, whereas previously they were in the .ctors and
.dtors sections. This change breaks the ctors/dtors code as it only
expects function to be in the .ctors and .dtors sections, meaning the
ctors and dtors functions are never executed.

While a COM32_INIT() macro exists that places functions in the
.init_array section, no function makes use of it, so there should be
no fallout from this change.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: get_key() requires raw access to user input
Matt Fleming [Wed, 31 Oct 2012 15:55:02 +0000 (15:55 +0000)]
ldlinux: get_key() requires raw access to user input

commit 4503e6260c0 ("ldlinux: Use stdcon instead of rawcon for the
console") broke get_key() because it was no longer possible to read
raw data from stdin. Provide a new function raw_read() that will
return user input a character at a time.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Fix logic if no DEFAULT or UI directive is found
Matt Fleming [Wed, 31 Oct 2012 12:42:25 +0000 (12:42 +0000)]
ldlinux: Fix logic if no DEFAULT or UI directive is found

Somewhere along the way the code that prints,

    No DEFAULT or UI configuration directive found!

was broken, and now no longer prints at all. While we're fixing this
it's a good opportunity to rework the logic to be clearer. Now we only
print the message if a config file was found, since these directives
are obviously missing if there is no config file (a warning will be
printed about the lack of config file anyway).

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoldlinux: Print a warning if no config file is found
Matt Fleming [Wed, 31 Oct 2012 12:49:43 +0000 (12:49 +0000)]
ldlinux: Print a warning if no config file is found

This behaviour is taken from 4.06, where an error message is printed
if no config file is found. A warning is a more user-friendly choice
since Syslinux will still function without a config file.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agopxe: Don't call open_config() from the pxe core
Matt Fleming [Wed, 31 Oct 2012 14:17:49 +0000 (14:17 +0000)]
pxe: Don't call open_config() from the pxe core

Delete some stale comments about ldlinux.c32 requiring ConfigName to
be initialised before it's launched - this is no longer
true. ldlinux.c32 takes care of opening the config files.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agodoc: Document the 'PATH' directive syslinux-5.00-pre9
Matt Fleming [Wed, 31 Oct 2012 11:08:03 +0000 (11:08 +0000)]
doc: Document the 'PATH' directive

The 'PATH' directive allows the user to specify a list of directories
to search when loading modules.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoNEWS: Document the major changes in 5.00
Matt Fleming [Wed, 31 Oct 2012 10:32:42 +0000 (10:32 +0000)]
NEWS: Document the major changes in 5.00

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoMerge branch 'master' into elflink
Matt Fleming [Wed, 24 Oct 2012 13:41:00 +0000 (14:41 +0100)]
Merge branch 'master' into elflink

The following conflict is a result of the fact comapi_chainboot was
only stubbed out on the 'elflink' branch but was properly marked as
obsolete in 'master'.

Conflicts:
core/comboot.inc

11 years agodiag/mbr: Fix typo in README
Matt Fleming [Tue, 23 Oct 2012 15:49:23 +0000 (16:49 +0100)]
diag/mbr: Fix typo in README

Reported-by: Ady <ady-sf@hotmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoMerge branch 'elflink' of git://github.com/aericson/syslinux into elflink
Matt Fleming [Tue, 23 Oct 2012 14:02:50 +0000 (15:02 +0100)]
Merge branch 'elflink' of git://github.com/aericson/syslinux into elflink

Conflicts:
com32/modules/Makefile

11 years agomemdisk: Fix order of sectors/track and bytes/sector syslinux-4.06
Kenneth J. Davis [Mon, 22 Oct 2012 18:20:18 +0000 (19:20 +0100)]
memdisk: Fix order of sectors/track and bytes/sector

Swap order of sectors/track with bytes/sector to match diskette
parameter table order (as pointed to by INT 1Eh).

References: (additional ones available if necessary)
'System BIOS for IBM PC/XT/AT computers and compatibles' by Phoenix
Technologies Ltd. copyright 1987,88,89 3rd printing 1990 ISBN:
0-201-51806-6 pages 61-62
'PC Interrupts' 2nd edition by Ralf Brown & Jim Kyle copyright 1994
1st printing 1993 ISBN: 0-201-62485-0 page 211

Note: this fixes an issue with older FreeDOS kernels that expect this
structure to contain valid values.

Signed-off-by: Kenneth J. Davis <jeremyd@fdos.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoNEWS: Document the VFAT relative path fix
Matt Fleming [Mon, 22 Oct 2012 12:39:24 +0000 (13:39 +0100)]
NEWS: Document the VFAT relative path fix

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoREADME: Clarify the requirements for utils/isohybrid
Matt Fleming [Mon, 22 Oct 2012 12:02:19 +0000 (13:02 +0100)]
README: Clarify the requirements for utils/isohybrid

Be clear that utils/isohybrid requires the UUID library as well as
/usr/include/uuid/uuid.h.

Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoNEWS: Fix some typos
Matt Fleming [Wed, 17 Oct 2012 12:07:07 +0000 (13:07 +0100)]
NEWS: Fix some typos

Reported-by: Ady <ady-sf@hotmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agodoc: minor documentation updates
Vanush "Misha" Paturyan [Wed, 17 Oct 2012 08:54:16 +0000 (09:54 +0100)]
doc: minor documentation updates

syslinux.txt: syslinux binary is in "linux" directory
menu.txt:     menu.c32 and vesamenu.c32 are in com32/menu directory

11 years agoRevert "win: Add -mno-ms-bitfields"
H. Peter Anvin [Mon, 22 Oct 2012 20:44:53 +0000 (13:44 -0700)]
Revert "win: Add -mno-ms-bitfields"

This reverts commit 7d9ee65cc9577eb69782a49a34895ae80820e9ff.

I am concerned that this may cause the Windows ABI header files to be
misinterpreted.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agoPacked definition: workaround for mingw + gcc 4.7
H. Peter Anvin [Mon, 22 Oct 2012 20:42:31 +0000 (13:42 -0700)]
Packed definition: workaround for mingw + gcc 4.7

__attribute__((packed)) does the wrong thing when in ms-struct
mode; this breaks compiling on mingw-w64.  Therefore force gcc struct
mode when we use packed.

This obsoletes checkin

  7d9ee65 win: Add -mno-ms-bitfields

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
11 years agoldlinux: Use stdcon instead of rawcon for the console
Matt Fleming [Fri, 19 Oct 2012 13:41:12 +0000 (14:41 +0100)]
ldlinux: Use stdcon instead of rawcon for the console

Switch to the stdcon input device so things like fgets() work
correctly when reading from stdin.

I noticed this was broken when running dmitest.c32. fgets() was
returning NULL because there was no pending user input instead of
waiting for/buffering the input. Modules are expecting stdin to be a
line-oriented device, not a raw one where each module has to implement
its own line support.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoClean up $(GPLLIB) leak
Matt Fleming [Fri, 19 Oct 2012 09:55:13 +0000 (10:55 +0100)]
Clean up $(GPLLIB) leak

Modules were linking against com32/gpllib/libcom32gpl.c32 even when
NOGPL was set, so remove it from various modules Makefiles and use
$(C_LIBS) in mk/elf.mk which already has the conditional-magic for
$(GPLLIB).

Also, the object files in com32/gpllib/ are not distributed in the
release tarballs, which means that if a user does a 'make netinstall'
they hit the following install error,

install: cannot stat `com32/gpllib/*.c32': No such file or directory

Add a $(INSTALLABLE_MODULES) variable to separate the list of build
and install modules.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocore: Print error message if we don't load ldlinux.c32
Matt Fleming [Fri, 19 Oct 2012 09:52:44 +0000 (10:52 +0100)]
core: Print error message if we don't load ldlinux.c32

If the user forgot to install ldlinux.c32 they're greeted with the
following unhelpful message,

  Boot failed: press a key to retry, or wait for reset...

We should explicitly tell the user that the reason for the boot
failing is that ldlinux.c32 could not be loaded.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocomboot: remove comapi_chainboot syslinux-4.06-pre14
Sebastian Herbszt [Sun, 14 Oct 2012 13:38:58 +0000 (15:38 +0200)]
comboot: remove comapi_chainboot

comapi_chainboot was obsoleted in 3.80.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocomboot: fix documentation
Sebastian Herbszt [Sun, 14 Oct 2012 13:38:25 +0000 (15:38 +0200)]
comboot: fix documentation

comapi_shuffle was obsoleted in 3.80.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoREADME: document the need for /usr/include/uuid/uuid.h
Geert Stappers [Fri, 12 Oct 2012 19:36:50 +0000 (21:36 +0200)]
README: document the need for /usr/include/uuid/uuid.h

utils/isohybrid build depends on /usr/include/uuid/uuid.h The package
name varies between distribution families.

11 years agomenu: Disallow navigation to a disabled entry via *any* key
Matt Fleming [Fri, 12 Oct 2012 11:59:32 +0000 (12:59 +0100)]
menu: Disallow navigation to a disabled entry via *any* key

Generalise the fix from commit c823574f53c1 ("menu: Don't highlight
disabled entries") as it only handled the case where we navigated to a
disabled last entry by pressing Ctrl + N or the DOWN arrow
key. Obviously, we can navigate with other keys such as END, PGDN, etc
so we need to handle all cases.

Reported-by: Ady <ady-sf@hotmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoprdhcp.c32: Turn off DEBUG syslinux-4.06-pre13
Matt Fleming [Thu, 11 Oct 2012 20:18:10 +0000 (21:18 +0100)]
prdhcp.c32: Turn off DEBUG

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoMerge branch 'pxechn-fix-news-for-hpa-2' of git://github.com/geneC/syslinux
Matt Fleming [Thu, 11 Oct 2012 20:16:37 +0000 (21:16 +0100)]
Merge branch 'pxechn-fix-news-for-hpa-2' of git://github.com/geneC/syslinux

Conflicts:
NEWS
com32/modules/Makefile

11 years agowin: Add -mno-ms-bitfields
Shao Miller [Thu, 11 Oct 2012 15:59:37 +0000 (11:59 -0400)]
win: Add -mno-ms-bitfields

Recent MinGW GCCs now have -mms-bitfields on by default, but it
appears to break our intentions with __attribute__((packed)).
See GCC bug 52991,

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991

The undesired behaviour was noticed when the win32 installer
had troubles identifying the media type field of a boot sector.

Signed-off-by: Shao Miller <sha0.miller@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoisohybrid: fix isohybrid.c compile
Frediano Ziglio [Fri, 31 Aug 2012 11:00:16 +0000 (12:00 +0100)]
isohybrid: fix isohybrid.c compile

Make isohybrid.c compile on gcc 4.4 32 bit instead of producing the
following error,

isohybrid.c: In function ‘lendian_64’:
isohybrid.c:437: error: integer constant is too large for ‘long’ type

Cc: Matthew Garrett <mjg@redhat.com>
Cc: Michal Soltys <soltys@ziu.info>
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoext2: add additional check to ext2 loader
Frediano Ziglio [Thu, 2 Aug 2012 08:32:36 +0000 (09:32 +0100)]
ext2: add additional check to ext2 loader

Check if a pointer is NULL due to specifying an invalid inode group
number.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomboot: fix typo in comment
Frediano Ziglio [Thu, 2 Aug 2012 08:31:23 +0000 (09:31 +0100)]
mboot: fix typo in comment

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomake some functions static remove unused NADV define
Frediano Ziglio [Thu, 2 Aug 2012 08:30:04 +0000 (09:30 +0100)]
make some functions static remove unused NADV define

Just some minor cleanup

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomenu: Add MENU GOTO support to the MENU DEFAULT parsing code
Matt Fleming [Tue, 9 Oct 2012 12:45:00 +0000 (13:45 +0100)]
menu: Add MENU GOTO support to the MENU DEFAULT parsing code

Tomas reported that the 'test1' submenu in the following config file
snippet doesn't honour the MENU DEFAULT directive,

    MENU BEGIN test0
       MENU START
       LABEL -
       MENU DEFAULT
       MENU LABEL OptionA
       MENU GOTO test1
    MENU END

    MENU BEGIN test1
       LABEL -
       MENU LABEL OptionA1
       MENU GOTO test0
       LABEL -
       MENU DEFAULT
       MENU LABEL OptionB1
       MENU GOTO test0
    MENU END

The reason is that the menu config code doesn't know how to handle a
default item that is a MENU GOTO directive. A trivial addition to the
code in record() fixes this.

Reported-by: Tomas M <tomas@slax.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agomenu: Don't highlight disabled entries
Matt Fleming [Tue, 9 Oct 2012 12:33:51 +0000 (13:33 +0100)]
menu: Don't highlight disabled entries

There's an off-by-one bug in the menu input handling code which makes
it possible to highlight/select the last entry in a menu even if that
entry is disabled.

It should be noted that you can't actually *do* anything with the
disabled entry, i.e. edit or execute it. Still, allowing it to be
highlighted does look a little strange.

Reported-by: Matt Sephton <matt.sephton@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agocom32: Add ifmemdsk.c32 to Makefile
Matt Fleming [Mon, 8 Oct 2012 14:45:46 +0000 (15:45 +0100)]
com32: Add ifmemdsk.c32 to Makefile

... so that it actually gets built. This should have been added to the
Makefile when ifmemdsk.c was created.

Reported-by: Ady <ady-sf@hotmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoNEWS: Document changes between 4.05 and 4.06 syslinux-4.06-pre12
Matt Fleming [Fri, 13 Jul 2012 14:01:59 +0000 (15:01 +0100)]
NEWS: Document changes between 4.05 and 4.06

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoIn the current Lua.c32 DMI implementation, it is a flat table with dotted names in...
Hung-chi Lihn [Sat, 22 Sep 2012 16:25:49 +0000 (18:25 +0200)]
In the current Lua.c32 DMI implementation, it is a flat table with dotted names in table entries. It also misses a number DMI sub-tables.

This patch, cleans up the DMI table structure using Lua's nested table structure and adds all missing DMI sub-tables. If a DMI sub-table is not supported by the hardware (not filled), then the corresponding sub-table will not be generated. This helps to make the table structure cleaner and reflects the actual DMI information.

Signed-off-by: Hung-chi Lihn <hlihn@google.com>
Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
11 years agoBug fix: Added the missing entry (boot_from_pcmcia) in struct s_characteristics.
Hung-chi Lihn [Sat, 22 Sep 2012 16:24:25 +0000 (18:24 +0200)]
Bug fix: Added the missing entry (boot_from_pcmcia) in struct s_characteristics.

In bios_charac_strings[] of /com32/gpllib/dmi/dmi_bios.c there are actually 29 entries. However, BIOS_CHAR_NB_ELEMENTS in /com32/gplinclude/dmi/dmi_bios.h was defined as 28 and struct s_characteristics in the same file also only had 28 entries. It turns out that there was a missing entry "boot_from_pcmcia" (the 16th entry representing bit 18) in s_characteristics.

Signed-off-by: Hung-chi Lihn <hlihn@google.com>
Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
11 years agoAdded the native syslinux functions config_file(), ipappend_strs(), and reboot()...
Hung-chi Lihn [Sat, 22 Sep 2012 16:23:38 +0000 (18:23 +0200)]
Added the native syslinux functions config_file(), ipappend_strs(), and reboot() to Lua.c32. This allows the Lua script to query the config file name and the ipappend strings (pxelinux only), as well as to perform reboot (warm and cold) to the system.

In Lua.c32, the extension will be used as the following:
  1. syslinux.config_file() will return the config file string.
  2. syslinux.ipappend_strs() will return a table of IPAPPEND strings with numerical indices.
  3. syslinux.reboot() will perform cold reboot, while syslinux.reboot(1) will perform warm reboot.

Signed-off-by: Hung-chi Lihn <hlihn@google.com>
Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
11 years agoThe current Lua.c32 does not enable io.read() due to some missing library functions...
Hung-chi Lihn [Sat, 22 Sep 2012 16:22:55 +0000 (18:22 +0200)]
The current Lua.c32 does not enable io.read() due to some missing library functions. However, this strongly limits the Lua script from getting user inputs and reading files (even in pxelinux via TFTP).

This patch enables io.read() in Lua.c32 with some restrictions:
  1. the io.read("*line") is fully supported.
  2. the io.read("*number") is not supported due to the missing buffering in underlying file I/Os. However, the user can read a line using io.read() and convert the string to numbers using the built in pattern matching and number conversion features.
  3. io.read(bytes) is supported. However, io.read(0) will not be a valid test for EOF due to the missing I/O buffering. io.read() will return nil if EOF is encountered. This offers an alternative way to handle EOF.

Signed-off-by: Hung-chi Lihn <hlihn@google.com>
Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
11 years agoinstallers: Install ldlinux.c32 automatically syslinux-5.00-pre8
Matt Fleming [Fri, 14 Sep 2012 14:22:29 +0000 (15:22 +0100)]
installers: Install ldlinux.c32 automatically

Because ldlinux.c32 is required for Syslinux to function correctly, we
should be installing it automatically much like ldlinux.sys.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agodoc/pxechn.txt: update
Gene Cumm [Sun, 16 Sep 2012 15:19:41 +0000 (11:19 -0400)]
doc/pxechn.txt: update

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
11 years agoextlinux: Handle error case for find_mount()
Matt Fleming [Fri, 14 Sep 2012 13:54:40 +0000 (14:54 +0100)]
extlinux: Handle error case for find_mount()

find_mount() may return NULL, so we'd really better check for that
*before* dereferencing the pointer.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
11 years agoNEWS: Adding 'silent' option from HDT
Erwan Velu [Mon, 10 Sep 2012 19:07:14 +0000 (21:07 +0200)]
NEWS: Adding 'silent' option from HDT

11 years agohdt: Release 0.5.2
Erwan Velu [Mon, 10 Sep 2012 19:03:50 +0000 (21:03 +0200)]
hdt: Release 0.5.2

New release with codename Manon

11 years agohdt: Adding Silent mode
Erwan Velu [Mon, 10 Sep 2012 19:02:02 +0000 (21:02 +0200)]
hdt: Adding Silent mode

By using the "silent" option at the cmdline, HDT tries not displaying
any boring message.

This is particulary interesting with the "display" option.

11 years agohdt: Removing remaining printf()
Erwan Velu [Mon, 10 Sep 2012 18:39:37 +0000 (20:39 +0200)]
hdt: Removing remaining printf()

Using more_printf allow to manage more easily several pages printing.

11 years agoNEWS: Updating for HDT & kontron_wdt
Erwan Velu [Mon, 10 Sep 2012 18:26:59 +0000 (20:26 +0200)]
NEWS: Updating for HDT & kontron_wdt

11 years agokontron_wdt: Fixing makefile
Erwan Velu [Mon, 10 Sep 2012 18:21:33 +0000 (20:21 +0200)]
kontron_wdt: Fixing makefile

Typo.

11 years agokontron_wdt: Enforce timeout value if already set
Erwan Velu [Mon, 10 Sep 2012 15:38:16 +0000 (17:38 +0200)]
kontron_wdt: Enforce timeout value if already set

If the watchdog was already engaged, let's rewrite the timeout to insure
the proper value is set.

11 years agokontron_wdt: Adjusting exit path
Erwan Velu [Mon, 10 Sep 2012 15:35:13 +0000 (17:35 +0200)]
kontron_wdt: Adjusting exit path

If we fail, at least let's boot the expected image

11 years agokontron_wdt: Adding watchdog com32 module
Erwan Velu [Mon, 10 Sep 2012 15:05:03 +0000 (17:05 +0200)]
kontron_wdt: Adding watchdog com32 module

When using a Kontron ETX board, it's possible to initialize and start
the watchdog during syslinux booting.

This allow protecting a boot sequence with a defined timeout.

Bootloader is starting, engage the watchdog and then start a default
entry (typically a Linux image).

If the loaded OS, feed or reinitalize the watchdog, nothing occurs
unless the system will reboot

Conflicts:

com32/modules/Makefile

11 years agodoc/pxechn.txt: Fix old example
Gene Cumm [Thu, 6 Sep 2012 22:27:30 +0000 (18:27 -0400)]
doc/pxechn.txt: Fix old example

Command line options changed.

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
11 years agoMerge remote-tracking branch 'hpa/master'
Erwan Velu [Wed, 5 Sep 2012 19:08:39 +0000 (21:08 +0200)]
Merge remote-tracking branch 'hpa/master'

11 years agomodule: Fixed the upper limit in symbol table walk through
Chandramouli Narayanan [Wed, 5 Sep 2012 06:49:49 +0000 (07:49 +0100)]
module: Fixed the upper limit in symbol table walk through

Number of entries in symbol table should be sized by the table entry
size. Without this, the loading of modules takes forever due to
walking all over the memory.

Signed-off-by: Chandramouli Narayanan <chandramouli.narayanan@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoconsole: Close stdin, stdout, stderr on ldlinux.c32 unload
Matt Fleming [Mon, 3 Sep 2012 13:35:14 +0000 (14:35 +0100)]
console: Close stdin, stdout, stderr on ldlinux.c32 unload

The location of __file_info[] and ansicon_counter are split between
the core and ldlinux.c32. We can end up calling __ansicon_close (from
fp->oop->close) in the process of reloading ldlinux.c32, and while
ansicon_counter is set to its initialised data value of 0 when
reloading ldlinux.c32, the core is never reloaded, and so
__file_info[] retains its pointers.

What this amounts to is that when ldlinux.c32 tries to call
openconsole() after being reloaded, the core tries to close the
ansicon device (the core still has pointers to __ansicon_close)
despite the ansicon code having no knowledge of ever being opened
(because ansicon_counter was reinitialised).

The most logical way to deal with this is to close stdin, stdout and
stderr when unloading ldlinux.c32.

It also turns out that sys/openconsole.o was present in two Makefile
variables which lead to duplication of code, data, etc. We only need
it present in libcom32min.a and not in the core since the core never
handles opening consoles, at least not now that we've deleted
printf_init() which is safe because we always open a console in
ldlinux.c32 anyway.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agodoc/pxechn.txt: word wrap
Gene Cumm [Mon, 3 Sep 2012 18:13:11 +0000 (14:13 -0400)]
doc/pxechn.txt: word wrap

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agodoc/pxechn.txt: Updates for clarity/flow
Gene Cumm [Mon, 3 Sep 2012 17:48:40 +0000 (13:48 -0400)]
doc/pxechn.txt: Updates for clarity/flow

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agodoc/pxechn.txt: Change title for manpage use.
Gene Cumm [Mon, 3 Sep 2012 17:47:48 +0000 (13:47 -0400)]
doc/pxechn.txt: Change title for manpage use.

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
12 years agoldlinux: Use findpath() to lookup filenames syslinux-5.00-pre7
Matt Fleming [Tue, 7 Aug 2012 09:40:12 +0000 (10:40 +0100)]
ldlinux: Use findpath() to lookup filenames

We should use the same method of opening files as the module code when
searching for extensions. In particular, we should search all of PATH.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agorawcon_read: Fix reading high part of input keys
Matt Fleming [Thu, 2 Aug 2012 09:34:17 +0000 (10:34 +0100)]
rawcon_read: Fix reading high part of input keys

commit 8486142cf304 ("elflink: Replace __intcall() with direct
function calls") made the mistake of zero'ing the high part of the
input key on every invocation of __rawcon_read() instead of preserving
it across calls like the old code, which lead to function keys such as
KEY_UP, KEY_DOWN, etc not working.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Return to command prompt after loading COM32
Matt Fleming [Thu, 2 Aug 2012 08:26:54 +0000 (09:26 +0100)]
ldlinux: Return to command prompt after loading COM32

The old COM32 loading code would drop the user at a command prompt
once execution returned from the COM32 amodule. We need to replicate
this because most callers of execute() don't expect it to return.

This bug was noticed when loading a COM32 module from
vesamenu.c32. Once execution returned from the COM32 module the
display became garbled because no code exists to reinitialise the
screen for VGA.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agocom32: Use --as-needed for LDFLAGS
Matt Fleming [Thu, 12 Jul 2012 19:35:14 +0000 (20:35 +0100)]
com32: Use --as-needed for LDFLAGS

This extends commit 4678fd92a21e ("elflink: fix dependency problem in
cmenu/Makefile") and basically reverts commit fb543aa635ff ("com32:
Per-object file LDFLAGS"). By using the --as-needed ld argument we can
specify all the required shared libraries for a directory, even if not
all of the libraries are needed by every .c32 file. --as-needed takes
care of only creating DT_NEEDED entries for the shared libraries that
are actually required to resolve undefined symbols in a given module.

Furthermore, by using $(LIBS) we create a dependency between .c32
files and their shared libraries, which allows multiple make jobs to
run in parallel.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoUse pxe_call() instead of COMBOOT API
Matt Fleming [Thu, 12 Jul 2012 12:34:06 +0000 (13:34 +0100)]
Use pxe_call() instead of COMBOOT API

This involved some other changes, such as passing flags to
unload_pxe() now that we only call it from C code, and hence don't
need to update KeepPXE.

We also needed to move some of the pxe function prototypes to
com32/include/syslinux/pxe_api.h because they are now referenced
outside of the core.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoelflink: Replace __intcall() with direct function calls
Matt Fleming [Tue, 3 Jul 2012 07:50:13 +0000 (08:50 +0100)]
elflink: Replace __intcall() with direct function calls

There's no reason to use the COMBOOT API at all now that we can have
any undefined symbols resolved at runtime - we can just access
functions directly.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agolib/sys/module: Add support for weak symbols
Matt Fleming [Thu, 12 Jul 2012 16:39:53 +0000 (17:39 +0100)]
lib/sys/module: Add support for weak symbols

We need a means of allowing Syslinux derivative-specific functions to
remain unresolved when there is no implementation for them. For
example, unload_pxe() is referenced by common code in com32/lib, but
is only implemented for PXELINUX. By marking unload_pxe() as __weak we
can substitute references with the undefined_symbol() function for
SYSLINUX, EXTLINUX and ISOLINUX. Provided that those references are
never executed everything works fine. However, if code calls actually
calls unload_pxe() from SYSLINUX, EXTLINUX or ISOLINUX an error
message is displayed and execution is halted.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoldlinux: Stop using the internal KT_* image types
Matt Fleming [Wed, 11 Jul 2012 12:12:33 +0000 (13:12 +0100)]
ldlinux: Stop using the internal KT_* image types

The KT_* image types were never meant to be used outside of
com32/menu, so use the external image types from syslinux/boot.h

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agocore/elflink: Delete ADV code that's already in ldlinux
Matt Fleming [Wed, 11 Jul 2012 09:17:49 +0000 (10:17 +0100)]
core/elflink: Delete ADV code that's already in ldlinux

The exact same ADV code is in both com32/elflink/ldlinux and
core/elflink. Since there's no need to have the same code in two place
at once delete the copy from the core since there are no users in
core/.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agoOnly compile dprintf/vdprintf if DEBUG_PORT is defined
H. Peter Anvin [Thu, 19 Jul 2012 15:42:32 +0000 (08:42 -0700)]
Only compile dprintf/vdprintf if DEBUG_PORT is defined

We really, really don't want to accidentally spew output to a debug
port in production, so make it obligatory to define DEBUG_PORT or
DEBUG_STDIO in order for the debugging code to be compiled in.  Since
DEBUG_STDIO just turns the debugging code into stdio references, we
only need to compile the code for the DEBUG_PORT case.

Add a commented-out line to mk/devel.mk to make it easier for users.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Matt Fleming <matt.fleming@intel.com>
12 years agoMerge branch 'master' into elflink
Matt Fleming [Thu, 19 Jul 2012 15:03:19 +0000 (16:03 +0100)]
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

12 years agoldlinux: Return immediately after we execute() a command
Matt Fleming [Fri, 6 Jul 2012 14:36:56 +0000 (15:36 +0100)]
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>
12 years agoCorrect initialization of the cache doubly-linked list syslinux-4.06-pre11
H. Peter Anvin [Thu, 19 Jul 2012 14:29:55 +0000 (07:29 -0700)]
Correct initialization of the cache doubly-linked list

The initialization of the cache doubly-linked list had
head->next->prev instead of head->prev->next; this entry is supposed
to initialize the ->next entry of the last entry in the list (which
points back to the head node.)

For clarity, consistently use "head" to refer to the head node; the
mixing of "head" and "dev->cache_head" needlessly obfuscated the code.

The wild pointer reference caused crashes on some systems.

Reported-by: Jan Safrata <jsafrata@centrum.cz>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agocore: Makefile: Do not enable debug by default
Paulo Alcantara [Thu, 5 Jul 2012 06:54:19 +0000 (03:54 -0300)]
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>
12 years agovdprintf: Remove unused variable
Paulo Alcantara [Thu, 5 Jul 2012 06:39:58 +0000 (03:39 -0300)]
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>
12 years agoelf_module: Remove unused variable
Paulo Alcantara [Thu, 5 Jul 2012 06:36:04 +0000 (03:36 -0300)]
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>
12 years agoFix Makefile install targets
Matt Fleming [Wed, 4 Jul 2012 10:09:54 +0000 (11:09 +0100)]
Fix Makefile install targets

Some Makefiles were still referring to libutil_com.a, even though we
stopped producing that file with commit 74518b8b691c ("elflink: Make
ELF the default object format"). Delete all references to avoid the
following install error,

install: cannot stat `libutil_com.a': No such file or directory

Remove the install target from com32/elflink as we no longer build any
of the test modules, and so don't need to install them.

Also, we need to add ldlinux.c32 to the list of modules that *must* be
installed for all targets, since it is required for Syslinux to
function correctly.

Reported-by: Dag Wieers <dag@wieers.com>
Reported-by: Michael D. Setzer II <mikes@kuentos.guam.net>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agomenu: Supply the command type to execute()
Matt Fleming [Tue, 3 Jul 2012 08:34:03 +0000 (09:34 +0100)]
menu: Supply the command type to execute()

The old execute() was much more forgiving when passing a COM32 module
as KT_NONE, as the old code for loading a kernel could also handle
COM32 modules. This isn't the case with new_linux_kernel(), and COM32
modules really need to take the create_args_and_load() path in
execute().

Without this change loading .c32 files from vesamenu.c32/menu.c32
fails.

Reported-by: Helmut Hullen <Hullen@t-online.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agodprintf: Always include the dprintf implementation in libcom32core.a
Matt Fleming [Mon, 2 Jul 2012 13:02:35 +0000 (14:02 +0100)]
dprintf: Always include the dprintf implementation in libcom32core.a

Whether or not we compile the com32/ code with DEBUG=1 we need to
provide the dprintf() implementation. This was highlighted by commit
72842b681e7b ("SEG(): make SEG() puke on bad pointers if DEBUG is
defined")

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
12 years agolinux.c32: add missing break; syslinux-4.06-pre10
H. Peter Anvin [Fri, 29 Jun 2012 23:23:36 +0000 (16:23 -0700)]
linux.c32: add missing break;

Add missing break; for ENOMEM.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agolinux.c32: allow loading arbitrary setup_data blobs
H. Peter Anvin [Fri, 29 Jun 2012 23:21:13 +0000 (16:21 -0700)]
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>
12 years agosetup_data: if nothing to load and version < 2.09, no harm no foul
H. Peter Anvin [Fri, 29 Jun 2012 22:46:27 +0000 (15:46 -0700)]
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>
12 years agosetup_data: check to make sure kernel version >= 0x0209
H. Peter Anvin [Fri, 29 Jun 2012 22:43:20 +0000 (15:43 -0700)]
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>
12 years agolinux.c32: add support for a device tree blob (dtb)
H. Peter Anvin [Fri, 29 Jun 2012 22:24:02 +0000 (15:24 -0700)]
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>
12 years ago<syslinux/linux.h>: add missing setup_data_init() definition
H. Peter Anvin [Fri, 29 Jun 2012 22:23:19 +0000 (15:23 -0700)]
<syslinux/linux.h>: add missing setup_data_init() definition

Missing prototype.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agoChange fdt-specific loader into a generic setup_data loader
H. Peter Anvin [Fri, 29 Jun 2012 22:16:03 +0000 (15:16 -0700)]
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>
12 years agocom32: Add device tree support
Thierry Reding [Thu, 31 May 2012 15:41:35 +0000 (17:41 +0200)]
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>
12 years agofat: Make mangle behavior similar to the standard one
H. Peter Anvin [Fri, 29 Jun 2012 20:57:42 +0000 (13:57 -0700)]
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>
12 years agowin: Use lower-case private definition of STORAGE_DEVICE_NUMBER
H. Peter Anvin [Fri, 29 Jun 2012 20:18:55 +0000 (13:18 -0700)]
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>
12 years agoSEG(): centralize the bad bailout
H. Peter Anvin [Fri, 29 Jun 2012 16:50:00 +0000 (09:50 -0700)]
SEG(): centralize the bad bailout

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agocom32: mark the invalid SEG() as __unlikely()
H. Peter Anvin [Fri, 29 Jun 2012 16:45:22 +0000 (09:45 -0700)]
com32: mark the invalid SEG() as __unlikely()

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agoSEG(): make SEG() puke on bad pointers if DEBUG is defined
H. Peter Anvin [Fri, 29 Jun 2012 16:40:48 +0000 (09:40 -0700)]
SEG(): make SEG() puke on bad pointers if DEBUG is defined

SEG() and OFFS() should only be passed on lowmem pointers.  When DEBUG
is defined, make SEG() abort if we pass it a non-lowmem pointer.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
12 years agoelflink: fix dependency problem in cmenu/Makefile syslinux-5.00-pre6
H. Peter Anvin [Fri, 29 Jun 2012 14:38:33 +0000 (07:38 -0700)]
elflink: fix dependency problem in cmenu/Makefile

Instead of adding library dependencies implicitly, make them explicit
and use --as-needed to avoid bogus DT_NEEDED entries from being
generated.

The other Makefiles should be adjusted accordingly as well.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Matt Fleming <matt.fleming@intel.com>
12 years agoelflink: Use ConfigName directly, the comboot API doesn't work syslinux-5.00-pre5
H. Peter Anvin [Fri, 29 Jun 2012 04:36:59 +0000 (21:36 -0700)]
elflink: Use ConfigName directly, the comboot API doesn't work

Use the ConfigName buffer directly.  Since this buffer doesn't
necessarily live in lowmem anymore, the comboot API is useless.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoMerge remote-tracking branch 'origin/master' into elflink
H. Peter Anvin [Fri, 29 Jun 2012 04:34:28 +0000 (21:34 -0700)]
Merge remote-tracking branch 'origin/master' into elflink

Conflicts:
core/fs/lib/searchconfig.c

Get the reverse pathname lookup fixes from the master branch.

12 years agoActually keep track of the pathnames for all elements syslinux-4.06-pre9
H. Peter Anvin [Fri, 29 Jun 2012 02:33:16 +0000 (19:33 -0700)]
Actually keep track of the pathnames for all elements

Actually keep track of the pathnames for all elements for on-disk
filesystems.  This makes sure we can always reconstruct the correct
path.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agochdir: collapse /./ and /../ in path for conventional filesystems syslinux-4.06-pre8
H. Peter Anvin [Fri, 29 Jun 2012 00:26:19 +0000 (17:26 -0700)]
chdir: collapse /./ and /../ in path for conventional filesystems

For conventional filesystems (i.e. not PXE), collapse /./ and /../ in
the path when doing chdir.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
12 years agoMakefile: fix misplaced dot
H. Peter Anvin [Wed, 27 Jun 2012 18:03:51 +0000 (11:03 -0700)]
Makefile: fix misplaced dot

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