H. Peter Anvin [Fri, 31 May 2013 15:05:57 +0000 (08:05 -0700)]
serial: Clean up and abstract handling of serial ports
The special handling of serial ports 0-3 meaning "look in a BIOS
table" is at least officially BIOS-specific, so create an inline
function and move it to bios.h.
While we are at it, make the function look slightly less like
converted assembly.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
H. Peter Anvin [Fri, 31 May 2013 14:52:55 +0000 (07:52 -0700)]
font: load data as a single block
The only reason for a loop is to interleave data, which we don't need
anymore; instead the data is stored in packed form.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Matt Fleming [Wed, 29 May 2013 14:01:12 +0000 (15:01 +0100)]
serial: fix SERIAL directive for ports > 0
There is a bug in the SERIAL directive parsing code that means that
using a port other than the first (SERIAL 0) results in a non-working
serial console. We need to use the serial port number from the config
file to offset the BIOS I/O port base address, otherwise we always
lookup the I/O port address for the first serial port instead of the one
the user specified.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Wed, 29 May 2013 12:56:02 +0000 (13:56 +0100)]
font: increment pointer to fontbuf by font height
Instead of always assuming that the font height is 32 bytes, use
hdr.height to increment our fontbuf pointer. hdr.height is the size of
the chunks we read from the .psf file.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 25 Apr 2013 14:14:18 +0000 (15:14 +0100)]
linux: Clear up error message
Passing opt.device to perror() in do_open_file() results in confusing
error messages, as Jack reports,
Last night, I was trying to install syslinux (5.01) to a SD card of
mine, writing to a subdirectory to keep the layout neat:
syslinux-5.01/linux# ./syslinux -i -d /boot /dev/mmcblk0p1
/dev/mmcblk0p1: No such file or directory
The message is coming from do_open_file() in syslinux.c: the call to
open() fails because the containing directory isn't present, and then it
calls perror(opt.device).
We should instead be passing 'name' to perror() so that we know _which_
file doesn't exist.
Reported-by: Jack Kelly <jack@jackkelly.name>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 25 Apr 2013 12:17:06 +0000 (13:17 +0100)]
load_linux: update errno before returning
syslinux_boot_linux() only returns control to the caller when something
has gone wrong, under normal circumstances a kernel is booted.
Update errno accordingly in the error paths, so the user no longer sees
inaccurate errno values which result in the following kinds of messages,
"Booting kernel failed: Bad file descriptor"
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Josh Triplett [Wed, 27 Mar 2013 21:50:37 +0000 (14:50 -0700)]
Fix support for Linux kernel images with no protected mode code
Some kernel images use the Linux kernel boot protocol and header
structure, but do not actually have any protected-mode code. For
instance, grub's 1024-byte lnxboot.img consists of 1024 real-mode bytes
and 0 protected-mode bytes; you can concatenate it with a full grub
core.img to produce a self-contained bootable kernel, but you can also
use it standalone as the kernel with the core.img loaded as an initrd.
syslinux 4 supports this, but it no longer works with syslinux 5: the
memmap functions do not correctly handle a request to work with a 0-byte
region. With lnxboot.img, this would cause syslinux to bail because it
thinks it has no space at the 1M load location but cannot relocate
lnxboot.img. (In bailing, it gives the confusing error message "Bad
file descriptor", not because that error actually occurred when
attempting to boot the kernel, but because errno has that value on entry
to syslinux_boot_linux and nothing clears or sets it.)
Fix the regression by handling the corner case of no protected-mode code
explicitly.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Burt Triplett <burt@pbjtriplett.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
H. Peter Anvin [Thu, 28 Mar 2013 21:14:20 +0000 (14:14 -0700)]
pxe: disentangle the legacy and lwip stacks without #ifdef
Disentangle the dependencies via the legacy and the lwip stacks. Now
there are no more #ifdefs (except for a single one in pxelinux.asm)
and the only difference between the pxelinux and lpxelinux archives
are which files are included.
To make this happen:
1. Replace the private part of the socket structure with a union.
2. Move the list of URL methods into a stack-dependent file.
Reported-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Matt Fleming [Wed, 20 Mar 2013 15:22:40 +0000 (15:22 +0000)]
pxe: Fix compiler warnings and real bug
commit
00a6f13139 ("Partially revert "pxe: Pass absolute path to
pxe_chdir()"") introduced a bug by comparing the function 'url_type'
with URL_SUFFIX. This resulted in the following warning,
fs/pxe/pxe.c: In function ‘pxe_chdir’:
fs/pxe/pxe.c:460:18: warning: comparison between pointer and integer [enabled by default]
fs/pxe/pxe.c:458:19: warning: unused variable ‘path_type’ [-Wunused-variable]
fs/pxe/pxe.c: In function ‘pxe_chdir’:
fs/pxe/pxe.c:460:18: warning: comparison between pointer and integer [enabled by default]
fs/pxe/pxe.c:458:19: warning: unused variable ‘path_type’ [-Wunused-variable]
which unfortunately went unnoticed.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Fri, 15 Mar 2013 16:32:52 +0000 (16:32 +0000)]
ldlinux: Fixup lwip merge botch
The lwip merge changed the code for copying cmdline arguments from,
strcpy(q, p);
to this,
do {
*q++ = ch = *p++;
} while (ch);
which means 'p' no longer points at 'args'. Use 'args' explicitly for
the case where we need to apply a filename extension, otherwise users
end up seeing errors like,
Failed to load COM32 file .c32
Reported-by: Mattias Schlenker <ms@mattiasschlenker.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Mon, 11 Mar 2013 13:57:56 +0000 (13:57 +0000)]
Partially revert "pxe: Pass absolute path to pxe_chdir()"
This partially reverts commit
b208ba467f678ed8e73f8d11fc0609634120cb83.
It isn't correct to always pass URL_OLD_TFTP to chdir(), since the
path prefix option may contain a full url, e.g. http://
Specialise the one case where we need to build a ::-style TFTP path
inside of get_prefix() to maintain backwards compatability, since from
Syslinux 5.00 onwards we may move out of the root directory ("::")
while searching for ldlinux.c32.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 28 Feb 2013 15:07:19 +0000 (15:07 +0000)]
readconfig: Don't display "(null)" labels when hitting TAB
It is entirely legitimate for a menu entry to have a NULL label or
displayname. Since these entries are not used for execution, skip
displaying them in print_labels() when hitting the TAB key.
Reported-by: Bernd Blaauw <bblaauw@home.nl>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 28 Feb 2013 17:44:54 +0000 (17:44 +0000)]
ldlinux: Always update ConfigName when opening a config file
With the introduction of commit
aa7dd29db684 ("ldlinux: Pass config
filename as argv[1] to ldlinux.c32") we stopped using ConfigName to
store the filename of the config file we intend to open in execute()
since it interfered with the filesystem-specific open_config()
implementations. But a side-effect of this change is that
syslinux_config_file() no longer works if we explicitly pass a
filename to parse_config_file().
The logical place to keep ConfigName in sync is in parse_config_file()
since it's expected that all the filesystem-specific open_config()
functions will fill out ConfigName for us. In the case where the
filename is supplied by the caller, we need to fill it out ourselves.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Wed, 6 Mar 2013 17:10:32 +0000 (17:10 +0000)]
Merge branch 'lwip-merge' into elflink
Matt Fleming [Tue, 26 Feb 2013 16:24:56 +0000 (16:24 +0000)]
net: Return of the legacy network stack
While it's nice having the shiny new lwIP stack, there is definitely
merit in being able to choose between two different network stacks. We
want to keep the legacy network stack around as it is known to handle
funky BIOS implementations and provides a good reference point when
bugs are suspected in the lwIP code.
Users now have a choice of .0 files. pxelinux.0 uses the legacy
network stack, while lpxelinux.0 uses lwIP.
Note that not every protocol is converted to using this new API. The
http, ftp and tcp code is still inherently tied to the netconn API,
and is only available with lpxelinux.0 and the lwIP stack. It's
unlikely that this code will ever be fixed up to work with the legacy
network stack.
Network stack operations are abstracted behind the net_core_*
interface, and each network stack has private data fields contained
within a struct net_private.
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Tue, 26 Feb 2013 14:25:00 +0000 (14:25 +0000)]
shuffle: syslinux_dump_movelist() only takes 1 argument
Fix up the following compiler error that is triggered with -DDEBUG=2,
syslinux/shuffle.c:135:2: error: too many arguments to function ‘syslinux_dump_movelist’
In file included from syslinux/shuffle.c:44:0:
../include/syslinux/movebits.h:87:6: note: declared here
syslinux/shuffle.c:155:5: warning: passing argument 1 of ‘syslinux_dump_movelist’ from incompatible pointer type [enabled by default]
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Tue, 19 Feb 2013 12:18:19 +0000 (12:18 +0000)]
lwip: Fix use-after-free memory corruption
Set *sem to NULL after free() otherwise calling sys_sem_set_invalid()
will cause us to write into a memory location that has potentially
either been reused for another allocation or contains freelist
metadata.
This manifested as malloc() corruption, because we
sys_sem_set_invalid() was overwriting malloc metadata used for
maintaining the freelist.
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Mon, 18 Feb 2013 20:25:27 +0000 (20:25 +0000)]
pxe: Handle closing file with NULL ->inode
It's possible that pxe_close_file() will be called with a NULL
file->inode from searchdir() if pxe_searchdir() fails to lookup a
file.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Mon, 25 Feb 2013 15:25:16 +0000 (15:25 +0000)]
Merge branch 'lwip' into elflink
Welcome to Syslinux 5.10.
Conflicts:
NEWS
com32/lib/Makefile
com32/lib/sys/open.c
com32/lib/syslinux/ipappend.c
com32/modules/Makefile
com32/modules/prdhcp.c
core/Makefile
core/cmdline.inc
core/com32.inc
core/comboot.inc
core/configinit.inc
core/fs/chdir.c
core/fs/fs.c
core/fs/pxe/dnsresolv.c
core/fs/pxe/pxe.c
core/fs/pxe/pxe.h
core/idle.c
core/include/ctype.h
core/init.inc
core/mem/init.c
core/parseconfig.inc
core/runkernel.inc
core/syslinux.ld
core/ui.inc
doc/comboot.txt
version
Matt Fleming [Fri, 22 Feb 2013 15:13:38 +0000 (15:13 +0000)]
com32: Add com32_cmdline() which returns argv[1..argc-1]
cmd.c32 needs an equivalent of __com32.cs_cmdline now that the COMBOOT
code is dead. Introducing com32_cmdline(), which returns a string
consisting of module arguments from argv[1] to argv[argc-1], separated
by spaces.
Reported-by: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 21 Feb 2013 14:24:57 +0000 (14:24 +0000)]
ldlinux: Don't discard cmdline arguments when executing labels
Don't throw away additional cmdline arguments when executing a
label. Append them instead. Gene Cumm reports,
When using the CLI and calling a LABEL "mylabel", specifying
"mylabel options" does not pass "options" through to the kernel's
command line.
Reported-by: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 17 Jan 2013 14:33:25 +0000 (14:33 +0000)]
mem: Add magic field to detect memory corruption
Very little checking is performed on the validity of freelist
metadata. Add a magic field to struct arena_header which can be used
to detect memory corruption or whether a user tries to free something
that isn't a malloc pointer.
This feature can be enabled with -DDEBUG_MALLOC. Turn it on for
development in mk/devel.mk.
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Tue, 19 Feb 2013 21:09:55 +0000 (21:09 +0000)]
pxe: Pass absolute path to pxe_chdir()
We may have moved out of the root directory when calling get_prefix()
and so need a way to create an absolute path.
Historically, in versions prior to 5.xx we would call
pxe_open_config() while we were still in the root directory ("::"),
and so, we could construct a relative path to the config file.
However, because we need to load ldlinux.c32 before opening the config
file, which may involve us changing directory, we need a way of
constructing an absolute path to the config file in get_prefix().
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Tue, 19 Feb 2013 21:11:55 +0000 (21:11 +0000)]
ldlinux: Pass config filename as argv[1] to ldlinux.c32
Instead of hijacking ConfigName use a more standard method of passing
a config name to ldlinux.c32's main() function, via argc and argv.
This allows us to actually call open_config() the first time
ldlinux.c32 is executed even if the file system has already modified
ConfigName. For example, pxelinux_configfile() parses the DHCP 209
option and fills out ConfigName before ldlinux.c32 is launched, but
because the PXE code needs to do things with the path to the config
file (such as parsing the DHCP 210 option), we need to leave the
config mangling to open_config() and not try and lookup ConfigName
from ldlinux.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Michal Soltys [Thu, 14 Feb 2013 15:51:47 +0000 (16:51 +0100)]
com32/chain: fix potential problem with 'fs' option
It's possible, that fs_lba available through syslinux_derivative_info()
could be 0. So match the candidates including disk, instead of only
partitions.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:47 +0000 (16:51 +0100)]
com32/chain: sizeof style change (trivial)
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: (utility) use enum for BPB types
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: (partiter) add cebr_siz for completness
Might be useful at some and/or when partiter becomes a non-chain
specific code.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: (partiter) dos_next_ebr() fixup
Make sure that *lba is set to 0, if start_lba in the record is 0. Not an
issue in any of the code using partiter currently, as that implies
either broken layout or a hole. Still useful for consistency with index
== -1 or when relax flag is set.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: use single value for partiter related options (flags)
Also use enum instead of #defines for flags.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: partiter: rename start_lba
disk.c also uses start_lba and it can mean few different things
depending on context (disk relative, BEBR relative, current EBR
relative).
partiter's main offset is always a disk relative value. To make it more
distinct and avoid suggestion the value is simply a copy of the one from
disk_dos_part_entry, we rename it to more fitting abs_lba.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: manglepe_fixchs() correction
We have to be more careful, when in-entry start/length values are 0 (one
or both). Firstly they are relative to the disk or the [B]EBR (while CHS
are absolute). Secondly, length 0 would imply the end CHS being lower
than the start CHS.
Under normal circumstances, partiter would complain about corrupt layout
(unless relax flag is set) and value 0 in any of those fields generally
imply a hole, so the adjustments were harmless - nontheless they made
everything look silly and not really correct.
Adjusted approach is:
- for start entry - if the os entry is 0 /and/ the beginning is 0 -
reset to 0, otherwise calculate chs
- for end entry - as above /or/ length is 0 - reset to 0, otherwise
calculate chs
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: index -1 partiter adjustment
Currently, the only situation when index could be set to -1 was empty
logical partition (with stepall flag active). To keep things consistent
(and with index0 already providing "full" info), adjust the partiter to
also set -1 on empty main partition.
This change also allows simple index check to see whether we're are at
the empty partition or not, without digging into disk_dos_part_entry
data and retesting ostype field. We rely on it now in manglepe_hide().
Also some retab! changes in partiter.h and one variable rename.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: rely more on addr_t, replace ADDR*
Whenever the computation imply use of that type, even if it's just
uint32_t.
Add dosmax (using 40:13) and dosmin (0x500) instead of separate ADDR*
and dosmem (in do_boot()).
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: remove common.h
Only 2 defines there related to preliminary options.c's and chain.c's
hecks (real checks come later during mapping to real memory). So move
them to options.h and remove common.h.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: recognize exFAT
The usual stuff - hidden sectors (now 64bit at different offset),
drive offest, "BPB" type.
Formally (?) region from 0x0B to 0x3F should be 0, but ... it's
tempting to fill "old" values there. Might be worth adding a switch to
handle such behavior.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: implement handling of non-standard hybrid GPT+MBR layouts
We also take a bit relaxed approach - so we check for presence of 0xEE
at any place, then attempt to read GPT header only if prefmbr is not
set.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: implement relax flag
This flag tones down sanity checks during partition iteration.
This is useful in situations such as:
- inconsistent layouts, but with some partition still in sane bootable state
- usb sticks/disks moved between different PCs might return different
size, which might cause problems if the partitions span the whole disk
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: warning/error/help/doc tidying
Trivial change that tidies a bit warning / error reporting through
fatal()/error()/warn(). Also small doc/help updates.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:46 +0000 (16:51 +0100)]
com32/chain: use disk_guid for part_guid for 0th partition
Initial position of each itarator is whole disk, so this actually
matches.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: cleaner variable names
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: mangle and related updates
Comments, output and minor adjustments.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: add pi_errored() in partiter
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: remove unused ebr_start
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: partiter - more precise comments / output
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: remove redundant rawindex
'index0' provides the same "raw" info, complementing standard 'index'.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: partiter - simplifications and updates
The code uses more abstractions than it's really worth or necessary, so
these patches simplify the code a bit. Partially suggested by Shao as
well.
Additionally, there're some added comments and more consistent naming
used.
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: shuffle code before partiter simplifications
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: change stepall into flags
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: use anonymous and unnamed aggregates
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: comments, minor adjustment
- add some comments to clarify c{nul,add,max} modes
- use enums instead of defines
- remove unnecessary integer casts
- avoid casts and uninline guid_is0()
- minor handover comment/flow changes
- clean up some old comment-outs
- add -fno-strict-aliasing as it's not picked anymore by default for
elf.mk
Signed-off-by: Michal Soltys <soltys@ziu.info>
Michal Soltys [Thu, 14 Feb 2013 15:51:45 +0000 (16:51 +0100)]
com32/chain: update licenses and #ifndef stanzas
Licenses:
chain.[ch] Makefile: GPLv2+
the rest: MIT
Defines:
Avoid prefixing with _
Signed-off-by: Michal Soltys <soltys@ziu.info>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Acked-by: Shao Miller <sha0.miller@gmail.com>
Matt Fleming [Wed, 13 Feb 2013 12:34:52 +0000 (12:34 +0000)]
pxe: chdir to Path Prefix (DHCP Option 210) to open config
This is an addition to commit
282fe9da42e ("elflink: Use
CurrentDirName for initial PATH if valid") which tried to fix the case
when booting PXELINUX with DHCP options 209 and 210. Unfortunately,
it's not useful to play games with PATH and we really do need to chdir
to the Path Prefix before opening the config file because the config
file may be specified with a path relative to the Path Prefix.
Just do the chdir() and be done with it.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Sebastian Herbszt [Sun, 10 Feb 2013 18:30:51 +0000 (19:30 +0100)]
poweroff COM32 module
This module is able to power off a system via APM.
It replaces the poweroff COMBOOT module.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Frediano Ziglio [Fri, 8 Feb 2013 12:58:36 +0000 (12:58 +0000)]
4k_sector: Support sectors >512
If EBIOS is detected for this drive it tries to read sector size and
use it. If error or no EBIOS 512 is assumed.
Buffer to read sector size is always allocated into the stack.
CHS informations are not readed as not needed and save space not
restoring %dl for drive number.
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Frediano Ziglio [Fri, 8 Feb 2013 12:58:35 +0000 (12:58 +0000)]
4k_sector: Reduce size reducing a message
Easy way to reduce code but actually I found the message is
readable at the same way as previous.
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Frediano Ziglio [Fri, 8 Feb 2013 12:58:34 +0000 (12:58 +0000)]
4k_sector: Save some bytes adding a function to set bx before read_sector
Mostly of the time bx was set as phdr before calling read_sector
so add a specific function to set %bx and call read_sector
gaining 2 bytes
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Frediano Ziglio [Fri, 8 Feb 2013 12:58:33 +0000 (12:58 +0000)]
4k_sector: Recover 3 bytes avoid a call
after read_sector %edx:%eax are unused or incremented so increment
always at end gaining 3 bytes
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 7 Feb 2013 18:56:05 +0000 (18:56 +0000)]
version: Welcome to the 5.02 release cycle
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 7 Feb 2013 17:56:24 +0000 (17:56 +0000)]
elflink: Use CurrentDirName for initial PATH if valid
commit
c250a42263c8 ("elflink: Set PATH to the directory containing
ldlinux.c32") made the mistake of thinking that CurrentDirName doesn't
contain useful data for PXELINUX, it may do. If a user specifies a
Path Prefix (DHCP option 210) we enter load_env32() with that path as
the current working directory. If that path is thrown away instead of
being used for PATH we may fail to load a config file as specified
with Configuration File Option (DHCP option 209).
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 7 Feb 2013 12:59:35 +0000 (12:59 +0000)]
run_command: Use load_kernel() which understands labels
load_kernel() understands how to handle labels from config files
whereas create_args_and_load() assumes that the cmdline is a COM32
file. Callers of syslinux_run_command() may want to pass labels, so
use a function that allows that.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 7 Feb 2013 11:28:58 +0000 (11:28 +0000)]
ldlinux: Append BOOT_IMAGE= to kernel cmdline
Some users rely on the syntax of the kernel cmdline from 4.xx and this
is currently different in 5.xx. Fix things to match the 4.xx syntax.
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
H. Peter Anvin [Mon, 4 Feb 2013 19:38:07 +0000 (11:38 -0800)]
load_linux: bail if no place for the real mode portion is found
Bail in the case of no space for the real mode code. This can happen
mostly for zImage kernels when the conventional memory ceiling is too
low.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
H. Peter Anvin [Mon, 4 Feb 2013 19:35:39 +0000 (11:35 -0800)]
load_linux: additional cleanups and corner case fixing
Handle the case with a zero-length passed in initramfs for ancient
protocols, since we bothered handling it correctly for newer
protocols.
Move the setting of the command line pointer to the place where the
command line is actually placed, for clarity.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
H. Peter Anvin [Mon, 4 Feb 2013 19:23:20 +0000 (11:23 -0800)]
load_linux: the command line pointer depends on real_mode_base
The command line pointer depends on real_mode_base, so we can't set it
up until we know where the real mode code will actually land.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
H. Peter Anvin [Mon, 4 Feb 2013 19:07:11 +0000 (11:07 -0800)]
load_linux: boot protocol < 2.00 could still have a command line
The command line existed before the 2.00 boot protocol, it was the
initrd which was the new addition to that version. Therefore, allow
the command line to be set even for the ancient kernels.
This is necessary to specify a command line for memtest86+.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Matt Fleming [Fri, 25 Jan 2013 14:32:38 +0000 (14:32 +0000)]
ldlinux: Correct the attribute bit for foreground bright
The foreground bright bit number is bit 3.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Fri, 25 Jan 2013 14:30:33 +0000 (14:30 +0000)]
ldlinux: Convert all UsingVGA uses with display_mask_vga()
Introduce display_mask_vga() which does the necessary converting of
UsingVGA into a mask to be AND'd with DisplayMask.
Also, apply TextAttribute when clearing the screen after we've seen a
form feed.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Fri, 25 Jan 2013 11:12:52 +0000 (11:12 +0000)]
elflink: Set PATH to the directory containing ldlinux.c32
On ISOLINUX and PXELINUX, CurrentDirName doesn't contain anything
useful when we enter load_env32(). commit
10bb72d1528b ("PATH: Use
installation directory for 'PATH'") didn't handle the case where we
don't have an installation path, or don't find ldlinux.c32 there. If
we find ldlinux.c32 in one of 'search_directories' use that directory
as the PATH string.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 24 Jan 2013 17:39:33 +0000 (17:39 +0000)]
NEWS: Add entries for 5.01
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 24 Jan 2013 17:23:45 +0000 (17:23 +0000)]
Merge branch 'doc-elflink-for-mfleming' of git://github.com/geneC/syslinux into elflink
Pull AsciiDoc-based documentation from Gene Cumm,
* 'doc-elflink-for-mfleming' of git://github.com/geneC/syslinux:
txt/Makefile: make directories
txt/: Remove COMBOOT as of 5.00; spelling; add PATH
NEWS: add txt/
Makefile: add txt/
txt/: Add new AsciiDoc formatted documentation
Matt Fleming [Thu, 24 Jan 2013 17:22:57 +0000 (17:22 +0000)]
Merge branch 'for-upstream' of git://git.zytor.com/users/pcacjr/syslinux into elflink
Pull XFS changes from Paulo Alcantara,
"feel free to pull my for-upstream branch on zytor. it contains the
cache for directory blocks on XFS, ldlinux.c32 installation support
for XFS and one trivial fix for shortform-directory lookup."
* 'for-upstream' of git://git.zytor.com/users/pcacjr/syslinux:
extlinux: Also install ldlinux.c32 file on XFS
xfs: Flush cache of directory blocks once done with readdir()
xfs: Remove unnecessary free()'s
xfs: Fix bug when listing shortform directory entries
xfs: Add cache for directory blocks
xfs: Make xfs_dir2_entry_name_cmp() inline
xfs: Avoid useless malloc()'s and free()'s
xfs: Make it more verbose on debug
xfs: Improve error and debug printing
xfs: Do some refactoring
Matt Fleming [Thu, 24 Jan 2013 16:47:44 +0000 (16:47 +0000)]
ldlinux: Fix serial output and delete eprintf()
Tagging __syslinux_get_serial_info() with __constructor is pretty
useless when the global variables it uses, such as SerialPort, etc,
are assigned *after* the constructor has run. This constructor made
sense when config parsing was done by the core, but parsing is now
performed by ldlinux. We need to explicitly invoke the function to
initialise __syslinux_serial_console_info once we've parsed any config
files.
eprintf.c was introduced in commit
086d698c642f ("ldlinux: Add
eprintf() to print to VGA and serial") because printf() output wasn't
appearing on the serial console. It turns out that the above
__constructor confusion was the real bug.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 24 Jan 2013 13:24:41 +0000 (13:24 +0000)]
ldlinux: Don't update UsingVGA when we just want the value
There was a bug introduced when this code was copied from the old 4.x
assembly implementation, we don't need to update UsingVGA everytime we
read a character, we only need its value when comparing it against the
DisplayMask.
This bug caused every other character to be displayed when only
writing to the text console, as well as other nasties such as making
syslinux_force_text_mode() think it's in VGA mode even when it's in
text mode.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 24 Jan 2013 11:52:32 +0000 (11:52 +0000)]
ldlinux: Dynamically allocate cmdline buffer to avoid overflow
Also, because we no longer pass the allocated buffer to __intcall()
and friends we can use malloc() instead of lmalloc(), leaving precious
low memory for other users.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 24 Jan 2013 11:07:08 +0000 (11:07 +0000)]
ldlinux: Clear screen on ASCII 12 (form feed) in DISPLAY file
The ansi code won't handle \f the way we want, so we need to
explicitly clear the screen and reset the cursor position, like the
old 4.x code.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Wed, 23 Jan 2013 14:46:08 +0000 (14:46 +0000)]
module: Replace cur_module with module_current()
It's easy for cur_module and prev_module to get out of sync with
reality (the actual module that is running), so add module_current()
which returns the module at the head of the module_list, i.e. the
module that was loaded most recently. Better still, by using the list
we don't have to do any kind of stacking of module pointers ourselves.
This fixes a bug where cur_module contained a stale pointer (the
module had actually been unloaded) but the pointer value had since
been reallocated for a new module in spawn_load(), meaning that the
following check,
if (!strcmp(cur_module->name, module->name))
was always going to be true, even though *no* module was actually
loaded at this point as we were reloading ldlinux.c32 from
start_ldlinux(). This could have been fixed with a NULL-assignment
after module_unload(), but using the modules_head list to detect the
current module is much cleaner.
Note that the core module loaded in load_env32() is always on the
list, therefore module_current() will always return a valid pointer.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Wed, 23 Jan 2013 13:24:36 +0000 (13:24 +0000)]
hdt: Move ~162K byte data object from the stack to the bss
A struct s_hardware is far too large to be placed onto the stack and
was causing us run past the end of the allocated stack and overwrite
the diskcache, which resulted in apparent file system corruption.
Move this hefty object into the bss.
Cc: Erwan Velu <erwanaliasr1@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Wed, 23 Jan 2013 13:40:24 +0000 (13:40 +0000)]
module: Check for NULL ctors and dtors
Don't dereference a NULL ctor/dtor as that can cause us to crash.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 17 Jan 2013 14:50:29 +0000 (14:50 +0000)]
module: Check the return value of malloc()
Instead of blindly writing through a possible-NULL pointer, check the
return value of malloc().
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Thu, 17 Jan 2013 13:15:56 +0000 (13:15 +0000)]
init: Leave mem_init() to fs_init()
Remove the superfluous call from init().
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Matt Fleming [Wed, 23 Jan 2013 10:55:14 +0000 (10:55 +0000)]
realloc: Set the HEAP when splitting a block
Failure to do so means we may put a free block in some random location
because ARENA_HEAP_GET() can return something invalid when used to
find the correct free list in __free_block().
This bug manifested as running out of available free memory.
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Paulo Alcantara [Tue, 22 Jan 2013 19:12:51 +0000 (17:12 -0200)]
extlinux: Also install ldlinux.c32 file on XFS
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
Gene Cumm [Thu, 17 Jan 2013 04:49:32 +0000 (23:49 -0500)]
txt/Makefile: make directories
Gene Cumm [Tue, 15 Jan 2013 02:38:02 +0000 (21:38 -0500)]
txt/: Remove COMBOOT as of 5.00; spelling; add PATH
Also changing markup for AsciiDoc
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
Gene Cumm [Fri, 7 Dec 2012 04:43:57 +0000 (23:43 -0500)]
NEWS: add txt/
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
Gene Cumm [Fri, 7 Dec 2012 04:43:41 +0000 (23:43 -0500)]
Makefile: add txt/
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>