2 years agopxe_api.h: finish revert of 9acbffd master
Gene Cumm [Sun, 27 Nov 2016 15:51:20 +0000 (10:51 -0500)]
pxe_api.h: finish revert of 9acbffd

9acbffd33b9200ffe37833463b4d4478e824295a caused more issues than it solves.
There appears to be a bigger underlying issue that the __weak argument masks.
Until the underlying issue is solved, we need __weak.

Signed-off-by: Gene Cumm <>
2 years agocore/legacynet/dnsresolv.c: weaken pxe_dns()
Gene Cumm [Sun, 27 Nov 2016 13:54:22 +0000 (08:54 -0500)]
core/legacynet/dnsresolv.c: weaken pxe_dns()

Signed-off-by: Gene Cumm <>
2 years agopartial revert 9acbffd
Gene Cumm [Wed, 20 Jul 2016 10:39:23 +0000 (06:39 -0400)]
partial revert 9acbffd

Weaken 2 declarations.  Seems to be the minimal amount for now.

First exhibited issues with EFI but later also with BIOS beyond *pxelinux.0
when compiled with gcc-5.3.1 and gcc-6.

Signed-off-by: Gene Cumm <>
3 years agounload_pxe(): fix string in dprintf()
H. Peter Anvin [Fri, 17 Jun 2016 01:20:30 +0000 (18:20 -0700)]
unload_pxe(): fix string in dprintf()

Fix a dprintf() message so it matches reality.

Signed-off-by: H. Peter Anvin <>
3 years agomenu: Apply VSHIFT to scrollbar
Bruno Levert [Tue, 14 Jun 2016 10:26:30 +0000 (06:26 -0400)]
menu: Apply VSHIFT to scrollbar

When VSHIFT is used, the scrollbar's position is relative to the old

Signed-off-by: Gene Cumm <>
3 years agoefi/Makefile: remove effective double "//"
Gene Cumm [Tue, 14 Jun 2016 10:17:59 +0000 (06:17 -0400)]
efi/Makefile: remove effective double "//"

During the string substitution, an addtional '/' is added unnecessarily.

Signed-off-by: Gene Cumm <>
3 years agospelling: Auxillary to Auxiliary
Gene Cumm [Wed, 8 Jun 2016 15:54:35 +0000 (11:54 -0400)]
spelling: Auxillary to Auxiliary

Reported-by: Ady <>
Signed-off-by: Gene Cumm <>
3 years agoremoving double l from auxilliary
Geert Stappers [Tue, 7 Jun 2016 10:19:36 +0000 (06:19 -0400)]
removing double l from auxilliary

This patch changes only strings, no program code.

Reported-by: Ady <>
Signed-off-by: Gene Cumm <>
3 years agoextlinux: pull in sys/sysmacros.h for major/minor/makedev
Mike Frysinger [Tue, 19 Apr 2016 10:50:31 +0000 (06:50 -0400)]
extlinux: pull in sys/sysmacros.h for major/minor/makedev

These functions are defined in sys/sysmacros.h, so add the include to
main.c.  This is already handled correctly in mountinfo.c.  Otherwise
we get build failures like:

main.o: In function 'find_device_sysfs':
extlinux/main.c:1131: undefined reference to 'minor'

Signed-off-by: Mike Frysinger <>
Signed-off-by: Gene Cumm <>
3 years agolibupload: Use new TFTP OK status definition
Gene Cumm [Sun, 24 Apr 2016 01:10:41 +0000 (21:10 -0400)]
libupload: Use new TFTP OK status definition

FTBFS: com32/hdt/hdt-dump.c:227:39: error: ‘TFTP_OK’ undeclared
  (first use in this function)

Signed-off-by: Gene Cumm <>
3 years agopxe.c: fix stray line-end garbage
H. Peter Anvin [Wed, 6 Apr 2016 20:05:28 +0000 (13:05 -0700)]
pxe.c: fix stray line-end garbage

The previous commit had some unfortunate line-end garbage; remove.

Signed-off-by: H. Peter Anvin <>
3 years agolibupload: use url_set_ip()
H. Peter Anvin [Wed, 6 Apr 2016 20:02:13 +0000 (13:02 -0700)]
libupload: use url_set_ip()

We already have a core function for setting the IP address of an URL
object based on network lookup or the server default.  Export and use
it instead of open-coding the equivalent logic in upload_tftp.c.

Signed-off-by: H. Peter Anvin <>
3 years agopxe_dns: remove obsolete pxe_dns.c wrapper
H. Peter Anvin [Wed, 6 Apr 2016 19:34:01 +0000 (12:34 -0700)]
pxe_dns: remove obsolete pxe_dns.c wrapper

We used to need a wrapper around the core function dns_resolv() to
implement pxe_dns(), because the former function required its argument
to live in low memory.  This is no longer the case and hasn't been for
a while, so remove this unnecessary level of indirection.

Signed-off-by: H. Peter Anvin <>
3 years agolibupload: don't error out because the tftp functions are unavailable
H. Peter Anvin [Wed, 6 Apr 2016 19:16:21 +0000 (12:16 -0700)]
libupload: don't error out because the tftp functions are unavailable

Provide weak stubs for the case where the tftp functions aren't
available.  This prevents link failures for the case of running on top
of non-network cores.

Signed-off-by: H. Peter Anvin <>
3 years agopxe_api.h: remove __weak from prototypes
H. Peter Anvin [Wed, 6 Apr 2016 19:15:37 +0000 (12:15 -0700)]
pxe_api.h: remove __weak from prototypes

The prototypes themselves are not weak, and declaring them as
such forces the core definitions, which should not be weak, as weak.

Signed-off-by: H. Peter Anvin <>
3 years agolibinstaller: remove signed to unsigned cast in initialization
Pete Batard [Wed, 9 Mar 2016 11:36:13 +0000 (06:36 -0500)]
libinstaller: remove signed to unsigned cast in initialization

Signed-off-by: Pete Batard <>
3 years agolibinstaller: PACKED compatibility for MSVC
Pete Batard [Wed, 9 Mar 2016 11:38:09 +0000 (06:38 -0500)]
libinstaller: PACKED compatibility for MSVC

MSVC requires prefix and suffix attributes for packing structures.

Signed-off-by: Pete Batard <>
3 years agowin/ntfs: remove unused variable and have ntfssect use char API calls
Pete Batard [Wed, 2 Mar 2016 11:45:12 +0000 (06:45 -0500)]
win/ntfs: remove unused variable and have ntfssect use char API calls

The variable 'ok' is never used and generates a warning. Remove it.
Also ntfssect.c is designed to be compiled in non Unicode mode when
using MSVC compilers, so remove all ambiguity about it
(LPCTSTR -> LPCSTR, use of 'A' API calls) so that it doesn't break when
compiled in Unicode mode, which is what Rufus uses with MSVC.

Signed-off-by: Pete Batard <>
3 years error out on NASM 2.11.06
H. Peter Anvin [Tue, 8 Mar 2016 08:20:08 +0000 (00:20 -0800)] error out on NASM 2.11.06

NASM 2.11.06 is known to miscompile Syslinux, so error out on that
NASM version.

Kind of embarrassing for me...

Signed-off-by: H. Peter Anvin <>
3 years agokeytab-lilo: update to support kbd 2.0.3 format
Olivier Brunel [Wed, 2 Mar 2016 22:52:23 +0000 (17:52 -0500)]
keytab-lilo: update to support kbd 2.0.3 format

Since kbd 2.0.3 (commit 6ff47cf2) the format generated by 'loadkeys -m' has
changed slightly, using "unsigned short" instead of "u_short"

Signed-off-by: Olivier Brunel <>
3 years agoMakefile: error out if the core has undefined symbols syslinux-6.04-pre1
H. Peter Anvin [Wed, 2 Mar 2016 05:06:02 +0000 (21:06 -0800)]
Makefile: error out if the core has undefined symbols

--unresolved-symbols=report-all apparently doesn't report the case
where a symbol is requested but never referenced.  Error out if

Signed-off-by: H. Peter Anvin <>
3 years agocore/ http_bake_cookies is not called from assembly
H. Peter Anvin [Wed, 2 Mar 2016 04:34:41 +0000 (20:34 -0800)]
core/ http_bake_cookies is not called from assembly

http_bake_cookies() is never called from assembly code, remove
the declaration.

Signed-off-by: H. Peter Anvin <>
3 years agocore: remove unused stub pm_local_boot()
H. Peter Anvin [Wed, 2 Mar 2016 04:33:03 +0000 (20:33 -0800)]
core: remove unused stub pm_local_boot()

pm_local_boot is never used, remove it.

Signed-off-by: H. Peter Anvin <>
3 years agosyslinux.ld: align the initial heap to 4K rather than 64K
H. Peter Anvin [Wed, 2 Mar 2016 04:14:59 +0000 (20:14 -0800)]
syslinux.ld: align the initial heap to 4K rather than 64K

There is absolutely no reason to align to 64K.  Correct the note about
this being the heap; COM32R modules were Syslinux 4.x specific.

Signed-off-by: H. Peter Anvin <>
3 years agoefi/udp: correct typo of SubnetMask
Gene Cumm [Mon, 29 Feb 2016 15:12:04 +0000 (10:12 -0500)]
efi/udp: correct typo of SubnetMask

Used wrong variable.

Reported-By: Patrick Masotta <>
Signed-off-by: Gene Cumm <>
3 years agocore/i386/syslinux.ld: Remove HIDDEN reference
Gene Cumm [Mon, 22 Feb 2016 11:25:42 +0000 (06:25 -0500)]
core/i386/syslinux.ld: Remove HIDDEN reference

HIDDEN was added to ld in binutils version 2.23 published in August 2012.
This helps preserve backwards compatibility for now.

Signed-off-by: Gene Cumm <>
3 years agogetfssec: update comment explaining next_extent() semantics
H. Peter Anvin [Wed, 10 Feb 2016 21:47:06 +0000 (13:47 -0800)]
getfssec: update comment explaining next_extent() semantics

Update comments which explains next_extent() semantics to be slightly
clearer, and also correct the statement that next_extent can be NULL.

Signed-off-by: H. Peter Anvin <>
3 years agocore/ we don't need the _lma symbols except in one case
H. Peter Anvin [Fri, 12 Feb 2016 04:12:14 +0000 (20:12 -0800)]
core/ we don't need the _lma symbols except in one case

We don't need any of the _lma symbols, except for the one associated
with .pm_code.  Don't export them unconditionally in SECINFO, because
that makes the linker request them as unknown symbols in the dynamic

Signed-off-by: H. Peter Anvin <>
3 years agocore: Clean up the i386-bios build
H. Peter Anvin [Wed, 10 Feb 2016 02:15:50 +0000 (18:15 -0800)]
core: Clean up the i386-bios build

Remove symbols and data structures not used in the i386-bios build,
and clean up the linker script so that most internal symbols are

Signed-off-by: H. Peter Anvin <>
3 years agoMakefile: Remove one remaining instance of EFI_BUILD
H. Peter Anvin [Wed, 10 Feb 2016 02:15:11 +0000 (18:15 -0800)]
Makefile: Remove one remaining instance of EFI_BUILD

Remove one last stray instance of EFI_BUILD.

Signed-off-by: H. Peter Anvin <>
3 years agoMakefile: make the handling of firmware selection a little saner
H. Peter Anvin [Wed, 10 Feb 2016 02:13:20 +0000 (18:13 -0800)]
Makefile: make the handling of firmware selection a little saner

Clean up the handling of firmware selection inside the Makefiles.

Signed-off-by: H. Peter Anvin <>
3 years agogpxe: delete long since obsolete snapshot of gPXE
H. Peter Anvin [Wed, 10 Feb 2016 02:08:47 +0000 (18:08 -0800)]
gpxe: delete long since obsolete snapshot of gPXE

gPXE has been deprecated in favor of iPXE for many, many years now.
It is much better than users get it directly from the iPXE project,
since we should no longer need any special modifications for Syslinux

Signed-off-by: H. Peter Anvin <>
3 years agoDelete unused files
H. Peter Anvin [Wed, 10 Feb 2016 02:05:48 +0000 (18:05 -0800)]
Delete unused files

Remove several files which aren't used at all during the build.

Signed-off-by: H. Peter Anvin <>
3 years agoMerge 'git://'
Gene Cumm [Tue, 19 Jan 2016 11:37:41 +0000 (06:37 -0500)]
Merge 'git://'

FIXME: this circumvents some of the issue but is not the cleanest and may

3 years agocore/xfs: Silence compiler warning
Gene Cumm [Tue, 19 Jan 2016 00:27:18 +0000 (19:27 -0500)]
core/xfs: Silence compiler warning

"may be used uninitialized in this function [-Wuninitialized]" even though logic dictates
it must be OK.

Signed-off-by: Gene Cumm <>
3 years agoMerge 'git://' into master
Gene Cumm [Tue, 19 Jan 2016 11:25:22 +0000 (06:25 -0500)]
Merge 'git://' into master

3 years agobtrfs: Fix logical to physical block address mapping
Paulo Alcantara [Thu, 24 Dec 2015 03:48:13 +0000 (01:48 -0200)]
btrfs: Fix logical to physical block address mapping

The current btrfs support did not handled multiple stripes stored in
chunk items, hence skipping the physical addresses that were needed to
do the mapping.

Besides, the chunk tree may contain DEV_ITEM keys which store
information on all of the underlying block devices, so we must skip them
instead of finishing lookup.

The bug was reproduced with btrfs-progs v4.2.2.

Cc: Gene Cumm <>
Cc: H. Peter Anvin <>
Signed-off-by: Paulo Alcantara <>
v1 -> v2:
 * Do not set ignore_key multiple times. Set it before parsing chunk
v2 -> v3:
 * Replace an unnecessary goto with a continue statement.

3 years agoxfs: Add support for v3 directories
Paulo Alcantara [Tue, 15 Dec 2015 00:39:30 +0000 (22:39 -0200)]
xfs: Add support for v3 directories

Besides supporting newer version of xfs file system, this patch also
does some code refactoring and fix completely broken listing and
searching on v2-3 node directories.

Cc: Gene Cumm <>
Cc: H. Peter Anvin <>
Cc: Raphael S. Carvalho <>
Cc: Ady <>
Signed-off-by: Paulo Alcantara <>
3 years agoPartial Revert: Still use .*.d deps
Gene Cumm [Thu, 10 Dec 2015 19:49:41 +0000 (14:49 -0500)]
Partial Revert: Still use .*.d deps

Previous commit changed the dependency filenames to not have a leading '.'

Signed-off-by: Gene Cumm <>
3 years agoDont bypass compiler driver for Dependency generation options
Khem Raj [Thu, 10 Dec 2015 11:23:32 +0000 (06:23 -0500)]
Dont bypass compiler driver for Dependency generation options

We can let compiler driver pass the right options to preprocessor after
processing -Mxy options, right now its bypassing the gcc driver and
handing them straight to cpp

This also helps in other compilers processing these options correctly
for their preprocessors consumption

Signed-off-by: Khem Raj <>
3 years agocom32: Adding 'exit' entry in chain.c32
Erwan Velu [Tue, 1 Dec 2015 19:53:01 +0000 (20:53 +0100)]
com32: Adding 'exit' entry in chain.c32

This patch is coming after some bad experience with gfxboot.
GFXboot was padding unexpected options on the chain.c32 commande line.
As a result, chain was confused and didn't provided the expected

This patch is a workaround to enforce chain.c32 not considering anything
on the command line after this keyword.


chain.c32 hd0 exit ...garbage...

3 years agocom32: Handle broken modules.alias
Erwan Velu [Tue, 1 Dec 2015 19:47:48 +0000 (20:47 +0100)]
com32: Handle broken modules.alias

When parsing the modules.alias, we shall report it as broken if we
cannot find any valid line in it.

This patch simply count the number of valid lines and report a missing
modules.alias if no valid lines are found.

3 years agoMakefile: Always use -mno-red-zone for EFI
Sylvain Gault [Fri, 27 Nov 2015 21:41:07 +0000 (22:41 +0100)]
Makefile: Always use -mno-red-zone for EFI

This option is mandatory when compiling for EFI as some event handlers
may interupt the running code and use the space just above the reserved
stack space.

Signed-off-by: Sylvain Gault <>
3 years agoMakefile: Pass down the variable EFI_BUILD
Sylvain Gault [Fri, 27 Nov 2015 21:38:26 +0000 (22:38 +0100)]
Makefile: Pass down the variable EFI_BUILD

This variable indicates whether or nor the files are compiled for EFI.
The lack of it lead the Makefiles to forget to add some compilation
options specific to EFI.

Signed-off-by: Sylvain Gault <>
3 years agoextlinux: code cleanup and simplification
Nicolas Cornu via Syslinux [Fri, 13 Nov 2015 19:35:29 +0000 (20:35 +0100)]
extlinux: code cleanup and simplification

Merge btrfs_read_adv and xfs_read_adv into a single generic function
ext_read_adv and split ext_write_adv_offset out of ext_write_adv.

Use those new functions in rewrite_boot_image and btrfs_install_file
where it is actually hardcoded.

Signed-off-by: Nicolas Cornu <>
Signed-off-by: Paulo Alcantara <>
3 years agoextlinux/main.c: space change
Ady [Sun, 15 Nov 2015 14:15:27 +0000 (09:15 -0500)]
extlinux/main.c: space change

Spaces, ASCII 0x20, have been
* moved
* inserted
* deleted

Signed-off-by: Geert Stappers <>
3 years agoextlinux/main.c: Correct comment about btrfs install
Gene Cumm [Sun, 15 Nov 2015 14:14:21 +0000 (09:14 -0500)]
extlinux/main.c: Correct comment about btrfs install

As of commit ID 37eef640 (before 6.03-pre12, before 6.03), it is now in
Boot Area B.

Signed-off-by: Gene Cumm <>
3 years agoextlinux/main.c: comment typo fixes
Ady [Sun, 15 Nov 2015 14:04:09 +0000 (09:04 -0500)]
extlinux/main.c: comment typo fixes

Some typo fixes in extlinux/main.c.
None of them affects code execution.

Signed-off-by: Geert Stappers <>
3 years agolibinstaller: introduce syslxrw library
Paulo Alcantara [Wed, 11 Nov 2015 00:14:30 +0000 (22:14 -0200)]
libinstaller: introduce syslxrw library

Due to size constraints on DOS systems, do not include whole syslxcom
into DOS-based installer for using xpread() and xpwrite() functions,
instead make them part of another separate library and include it only.

Signed-off-by: Paulo Alcantara <>
3 years agomtools: Remove local xpread/xpwrite, use ones from syslxcom
Nicolas Cornu [Tue, 10 Nov 2015 13:51:04 +0000 (14:51 +0100)]
mtools: Remove local xpread/xpwrite, use ones from syslxcom

Signed-off-by: Nicolas Cornu <>
Signed-off-by: Paulo Alcantara <>
3 years agoxfs: rename xfs_is_valid_magicnum to xfs_is_valid_sb
Paulo Alcantara [Sat, 18 Jul 2015 13:26:34 +0000 (10:26 -0300)]
xfs: rename xfs_is_valid_magicnum to xfs_is_valid_sb

xfs_is_valid_magicnum is not actually a generic function that checks for
magic numbers, instead it checks only for superblock's one.

Signed-off-by: Paulo Alcantara <>
Reviewed-by: Gene Cumm <>
3 years agobios: Don't try to guess the sections alignment
Sylvain Gault [Tue, 29 Sep 2015 02:45:09 +0000 (04:45 +0200)]
bios: Don't try to guess the sections alignment

For the compression / decompression to succeed, the sections layout must
be the same between the virtual memory and load memory. The section
alignment was kept in sync by introducing aligment that should be
greater or equal to the actual section alignment.

This patch compute the load memory addresses of the sections so that
the layout is the same as the virtual memory addresses.

Signed-off-by: Sylvain Gault <>
Tested-by: poma <>
Signed-off-by: Paulo Alcantara <>
3 years agobios: Fix alignment change with gcc 5
Sylvain Gault [Tue, 29 Sep 2015 00:38:25 +0000 (02:38 +0200)]
bios: Fix alignment change with gcc 5

The section aligment specified in the ld scripts have to be greater or
equal to those in the .o files generated by gcc.

Signed-off-by: Sylvain Gault <>
Tested-by: poma <>
Signed-off-by: Paulo Alcantara <>
3 years agoldlinux: Fix return pointer to local data
Sylvain Gault [Tue, 13 Oct 2015 04:18:07 +0000 (06:18 +0200)]
ldlinux: Fix return pointer to local data

The command-line parsing used to return a pointer to a local array. The
code used to work by chance, but now, gcc 5 is able to detect it and
return a NULL pointer instead.

The buffer is now marked static. This shouldn't be a problem as only one
command line can be read at a time.

Signed-off-by: Sylvain Gault <>
Tested-by: poma <pomidorabelisima at>
Signed-off-by: Paulo Alcantara <>
3 years agoefi: Disable UseDefaultAddress if possibly deaf
Gene Cumm [Fri, 16 Oct 2015 00:02:29 +0000 (20:02 -0400)]
efi: Disable UseDefaultAddress if possibly deaf

Some machines don't like UseDefaultAddress; fallback to manually
configuring.  HP EFI servers like DL160 Gen9 are affected.

Signed-off-by: Gene Cumm <>
3 years agocore: Fix stack overflow when reloading config
Sylvain Gault [Tue, 13 Oct 2015 03:26:30 +0000 (05:26 +0200)]
core: Fix stack overflow when reloading config

The behavior when running a "CONFIG" command line is to reload
ldlinux.c32 with the new file as argument. This call never return.

In order to avoid stacking up the calls to start_ldlinux, this patch
introduce a setjmp/longjmp to return to the first call to start_ldlinux,
thus freeing all the stack space.

Signed-off-by: Sylvain Gault <>
3 years agoldlinux: fix stack overflow when running COM32 modules
Sylvain Gault [Mon, 12 Oct 2015 03:03:26 +0000 (05:03 +0200)]
ldlinux: fix stack overflow when running COM32 modules

When a COM32 module exits, the functions never return and a new call to
ldlinux_enter_command is made. This could fill the stack and overflow on
some data present in memory.

This patch use setjmp/longjmp to return to the main function and restart
from there when a COM32 module exits.

Signed-off-by: Sylvain Gault <>
3 years agoefi: core_udp_configure()/core_tcp_connect(): Fix error message
Gene Cumm [Mon, 12 Oct 2015 15:32:28 +0000 (11:32 -0400)]
efi: core_udp_configure()/core_tcp_connect(): Fix error message

Wrong translation type used.

Signed-off-by: Gene Cumm <>
3 years agomboot.c32: add ELF64 support for Multiboot1
Alex [Sat, 10 Oct 2015 17:56:20 +0000 (13:56 -0400)]
mboot.c32: add ELF64 support for Multiboot1

mboot.c32 lacks support for loading ELF64 binaries (supported by GRUB2,
for example). This is a trivial patch to add such feature.

[reflow some changes to fit ~80 columns; remove trailing whitespace
Signed-off-by: Gene Cumm <>
3 years agocore/http: Append port number to Host field if needed
Gene Cumm [Sat, 10 Oct 2015 14:00:02 +0000 (10:00 -0400)]
core/http: Append port number to Host field if needed

HTTP/1.1 header Host must contain the port number if not default for the
protocol.  Host isn't a part of HTTP/1.0 but let's implement it right.

Reported-By: Michael DeCandia <>
Signed-off-by: Gene Cumm <>
3 years agocore/pxe: Allow DHCP option 54 Server Identifier
Gene Cumm [Thu, 8 Oct 2015 10:20:58 +0000 (06:20 -0400)]
core/pxe: Allow DHCP option 54 Server Identifier

Apparently some servers don't bother setting siaddr when pointing to
itself for TFTP.  Re-allow 54 but always set IPInfo.serverip from
siaddr/dhcp->sip in packet #3 (PXEReply/proxyDHCP).

Always set from siaddr if good in case parsing after-DHCP options.

Reported-by: Celelibi <>
Signed-off-by: Gene Cumm <>
3 years agochrreplace: Don't skip the first character
Josh Triplett [Mon, 28 Sep 2015 09:56:09 +0000 (05:56 -0400)]
chrreplace: Don't skip the first character

Check if the first character matches the character to replace, rather
than skipping it and starting with the second.

Signed-off-by: Josh Triplett <>
3 years agoextlinux: fix memory leak
Imran Zaman [Sun, 27 Sep 2015 18:19:27 +0000 (14:19 -0400)]
extlinux: fix memory leak

devname is put on heap for all cases to avoid memory
leak, and ease of use in future as well

Signed-off-by: Imran Zaman <>
Reviewed-by: Paulo Alcantara <>
3 years agoAdd gpxe/ to clean-up targets
Gene Cumm [Sun, 27 Sep 2015 18:08:59 +0000 (14:08 -0400)]
Add gpxe/ to clean-up targets

gpxe/ has a lot of binary blobs after a spotless.  Start the cleanup
measures.  do-spotless-gpxe for bios target might be better in another

Signed-off-by: Gene Cumm <>
3 years agocore: readd gPXE/iPXE support for HTTP on pxelinux.0
Gene Cumm [Sun, 27 Sep 2015 10:47:23 +0000 (06:47 -0400)]
core: readd gPXE/iPXE support for HTTP on pxelinux.0

When adding lwIP functionality, the gPXE/iPXE callback was broken.  This
prevented pxelinux.0 from calling gPXE/iPXE for HTTP and FTP URLs.  Re-add
for pxelinux.0 and add code to find file size.

Move to core/legacynet/core.c to access packet_buf and leave a dummy
function for lpxelinux.0.

Signed-off-by: Gene Cumm <>
3 years agocore/fs/lib/loadconfig.c: Add architecture-specific config name to search
Ady [Sun, 20 Sep 2015 19:35:52 +0000 (15:35 -0400)]
core/fs/lib/loadconfig.c: Add architecture-specific config name to search

When multiple architectures are on a single media, all will try to use the
same config, preventing PATH from pointing to an architecture-specific

Signed-off-by: Gene Cumm <>
3 years agocom32/modules: Split build by architecture. Add dir.c32
Gene Cumm [Sun, 20 Sep 2015 12:30:55 +0000 (08:30 -0400)]
com32/modules: Split build by architecture.  Add dir.c32

Certain modules directly make BIOS calls or call library functions that
will not be ported from BIOS (like syslinux_shuffle_boot_rm()).

It appears dir.c32 was long-forgotten for the Makefile

Signed-off-by: Gene Cumm <>
3 years agoefi: Don't unnecessarily rebuild
Sylvain Gault [Wed, 16 Sep 2015 22:43:55 +0000 (18:43 -0400)]
efi: Don't unnecessarily rebuild

OBJ directory creation changed from a .PHONY target to a real target
used through an order-only dependency.

A target depending on another target marked .PHONY is always rebuilt,
thus forcing all the .o files to be rebuilt everytime.

Signed-off-by: Sylvain Gault <>
Reviewed-by: Paulo Alcantara <>
3 years agozlib: use (void(0)) instead of empty #defines
Patrick Masotta [Sun, 13 Sep 2015 12:42:14 +0000 (08:42 -0400)]
zlib: use (void(0)) instead of empty #defines

Originally-By: Patrick Masotta <>
[Use (void(0)) instead of a dummy function -]
Signed-off-by: Gene Cumm <>
3 years agoefi/x86_64: fix trivial compilation warning
Sylvain Gault [Sun, 13 Sep 2015 11:01:01 +0000 (07:01 -0400)]
efi/x86_64: fix trivial compilation warning

Missing */ at the end of a comment.

Signed-off-by: Sylvain Gault <>
Reviewed-by: Paulo Alcantara <>
3 years agopxe/dhcp_option: Don't parse DHCP option 54 Server Identifier
Gene Cumm [Sat, 12 Sep 2015 11:42:37 +0000 (07:42 -0400)]
pxe/dhcp_option: Don't parse DHCP option 54 Server Identifier

Server Identifier is NEVER the next server where Syslinux was loaded from.

BOOTP field siaddr, BOOTP field sname and DHCP option 66 TFTP server name
may contain this information.  For now, just use siaddr.

3 years agoefi: Merge cleanup
Gene Cumm [Thu, 10 Sep 2015 09:55:41 +0000 (05:55 -0400)]
efi: Merge cleanup

Merge git:// branch 'fix/efi/cleanup'

Signed-off-by: Gene Cumm <>
3 years agolibinstaller: Explicit failure if path isn't writable
Erwan Velu [Thu, 3 Sep 2015 13:12:26 +0000 (15:12 +0200)]
libinstaller: Explicit failure if path isn't writable

As per bug #4, we should report a clear failure if the target path is
not writable.

The current code was catching the fact the file was not writable
but it didn't wrote an explicit message and even more confusing, was
trying to process the file descriptor leading to a creepy "Bad file
descriptor" error message.

This patch does return EACCES to avoid process the file description.
It also print an explicit message saying a particular file isn't
writable which generates a fatal error.

A typical output looks like :
[root@host]: extlinux --once=plop /boot
/boot is device /dev/sda
Cannot open file '/boot/ldlinux.sys' in read/write mode !
Fatal error, exiting.

3 years agodoc/menu.txt: further corrections
Gene Cumm [Sun, 6 Sep 2015 12:24:51 +0000 (08:24 -0400)]
doc/menu.txt: further corrections

Signed-off-by: Gene Cumm <>
3 years agodoc/menu.txt: correction, rewording and type corrections.
Ady [Sun, 6 Sep 2015 12:24:08 +0000 (08:24 -0400)]
doc/menu.txt: correction, rewording and type corrections.

Correct the order of the parameters for MENU RESOLUTION.
Update references.

[certain phrases seem clearer in original wording -]
Signed-off-by: Gene Cumm <>
3 years agoefi/x86_64: leave long mode properly
Thomas Letan [Sun, 6 Sep 2015 11:50:39 +0000 (07:50 -0400)]
efi/x86_64: leave long mode properly

Syslinux 6.03 (efi64) fails to boot a 32-bit kernel. The way Syslinux
leaves long mode in kernel_jump assembly routine does not follow AMD64
specifications. More precisely:
1. After setting a new GADT, `cs` has to be refresh by doing a long
jump, but it is not
2. Other segments have to be updated, but they are not
3. Disabling paging has to be done before disabling long mode, but the
implementation does the opposite

In most cases, a computer that tries to execute the kernel_jump routine
reboot (it can also hangs). This patch fixes the kernel_jump routine.

Signed-off-by: Thomas Letan <>
Tested-by: Patrick Masotta <>
Tested-by: Celelibi <>
3 years agolibupload: Reworking tftp support to use core functions
Erwan Velu [Wed, 2 Sep 2015 18:52:30 +0000 (20:52 +0200)]
libupload: Reworking tftp support to use core functions

The libupload was using the pxe_call() directly for doing the tftp
uploading stuff. This was only working with pxelinux.

Since we do have lpxelinux, the libupload should use the core functions
to get rid of thoses direct PXE calls.

This patch does
 - add a tftp_put() function which supports core functions.
 - implement the call from libupload making the code much more simplier

As a result {l}pxelinux can upload data to a tftp server is a similar
way. HDT is getting the benefit of such code.

3 years agotftp: Report server IP address on debug message
Erwan Velu [Wed, 2 Sep 2015 16:26:37 +0000 (18:26 +0200)]
tftp: Report server IP address on debug message

When debugging, it is very useful to get the ip adress of the server
that reponsded to that packet.

3 years agohdt: print tftp error number & message if dump failed
Erwan Velu [Wed, 19 Aug 2015 05:22:19 +0000 (07:22 +0200)]
hdt: print tftp error number & message if dump failed

The current code was making a mistake by searching the -err element in
the array as it was resulting into a negative value.

The current patch does print the error number which could be useful but
also retrieve the proper string to indicate the real error we

3 years agohdt: Removing commas and plus signs from filename
Erwan Velu [Wed, 19 Aug 2015 05:12:10 +0000 (07:12 +0200)]
hdt: Removing commas and plus signs from filename

When uploading the dump file to a tftp server, removing the plus & comma
sign from the filename could make the file easier to manipulate later.

3 years agodebug: Adding -DDEBUG_THREAD
Erwan Velu [Wed, 19 Aug 2015 05:07:25 +0000 (07:07 +0200)]
debug: Adding -DDEBUG_THREAD

When debugging some syslinux code with debugging enabled, the threading
code is so verbose that it completly slow down syslinux but also is so
verbose that any other trace is invisible in the flood.

This commit aims at requesting people to explicitly enable the
threading logs by using -DDEBUG_THREAD.

3 years agogpllib: Updating dmi code
Erwan Velu [Fri, 14 Aug 2015 08:20:33 +0000 (10:20 +0200)]
gpllib: Updating dmi code

This is a simple rebase of the current code against current dmidecode
version. This is pretty lame copy/paste but as we don't have a
libification of dmidecode, that does the job.

This patch does improve mostly the cpu & ram reporting.

3 years agohdt: Avoid false-positive single command detection
Erwan Velu [Fri, 14 Aug 2015 07:22:14 +0000 (09:22 +0200)]
hdt: Avoid false-positive single command detection

Since commit 1697594b61f9a8f9d092996afc0e2c80bbb2a20a, some commands are
said to be "nomodule" like "say".

This patch was adding a check if the nomodule flag was set but didn't
checked that the associated structure did exist leading to false
positive detection.

As a result, the commands were not executed meaning the CLI was unsuable
since ... 3 years.... *shame*

This commit simply avoid considering the nomodule flag if the structure
is not allocated

3 years agohdt: Fixing argv usage to avoid crash
Erwan Velu [Fri, 14 Aug 2015 07:20:08 +0000 (09:20 +0200)]
hdt: Fixing argv usage to avoid crash

argv shall be passed as a pointer to avoid a crash when running
command like "dmi".

Thanks genec for pointing this out.

3 years agocore: dprintf on malloc/free if -DDEBUG_MALLOC
Erwan Velu [Fri, 14 Aug 2015 05:35:21 +0000 (07:35 +0200)]
core: dprintf on malloc/free if -DDEBUG_MALLOC

When dynamic debug is engaged, the output is pretty flooded by
malloc/free messages while you are looking at other traces.

As have a DEBUG_MALLOC option, it seems pretty logical to
enable the malloc/free dprintf() only if this option is engaged.

That patch make the dynamic debug output less floody while letting the
choice to get the malloc/free dprintf() messages.

3 years agoefi: Change status check when draining keyboard
Oliver Wagner [Wed, 2 Sep 2015 18:21:59 +0000 (14:21 -0400)]
efi: Change status check when draining keyboard

PCs without keyboards may hang as they might return a status other than

Signed-off-by: Gene Cumm <>
3 years agocom32: write_sectors() sizing corrections
Robert [Sun, 23 Aug 2015 17:49:33 +0000 (13:49 -0400)]
com32: write_sectors() sizing corrections

Memory allocation and copy length should be SECTOR * size for sectors

Signed-off-by: Robert <>
Signed-off-by: Gene Cumm <>
3 years agoefi: fix warning about unused variable
Sylvain Gault [Tue, 25 Aug 2015 01:31:43 +0000 (03:31 +0200)]
efi: fix warning about unused variable

Signed-off-by: Sylvain Gault <>
3 years agoefi: fix pointer-type mismatch assigment warning
Sylvain Gault [Tue, 25 Aug 2015 01:50:48 +0000 (03:50 +0200)]
efi: fix pointer-type mismatch assigment warning

The assignment looks suspicious but is actually legit since it is
protected by the type check.

Signed-off-by: Sylvain Gault <>
3 years agoefi: fix warnings about argument types
Sylvain Gault [Tue, 25 Aug 2015 01:29:56 +0000 (03:29 +0200)]
efi: fix warnings about argument types

The function efi_get_MAC was given a pointer to array instead of a
simple pointer, generating a warning with gcc.

Signed-off-by: Sylvain Gault <>
3 years agoefi/main: set/check for NULL in efi_create_binding()
Patrick Masotta [Sat, 1 Aug 2015 11:40:16 +0000 (07:40 -0400)]
efi/main: set/check for NULL in efi_create_binding()

If LibLocateHandle() returns success and either 0 handles or we find no
matching handles, treat it the same.

Originally-By: Patrick Masotta <>
Signed-off-by: Gene Cumm <>
3 years agoefi: Hunt for service binding handle if needed
Gene Cumm [Sun, 19 Jul 2015 23:37:30 +0000 (19:37 -0400)]
efi: Hunt for service binding handle if needed

Signed-off-by: Gene Cumm <>
3 years agoefi: add efi_get_MAC()
Gene Cumm [Sun, 19 Jul 2015 18:09:05 +0000 (14:09 -0400)]
efi: add efi_get_MAC()

Extracts a MAC address from a device path

Originally-By: Patrick Masotta <>
[ Respace]
Signed-off-by: Gene Cumm <>
3 years agoefi: rename pxe_handle to image_device_handle
Gene Cumm [Sun, 19 Jul 2015 12:09:10 +0000 (08:09 -0400)]
efi: rename pxe_handle to image_device_handle

Signed-off-by: Gene Cumm <>
3 years agocom32 readconfig: use my_isspace()
Gene Cumm [Sat, 18 Jul 2015 16:10:48 +0000 (12:10 -0400)]
com32 readconfig: use my_isspace()

More consistent.  Also ensures it's properly recast.

Signed-off-by: Gene Cumm <>
3 years agocom32/include/menu.h: Extend my_isspace
Gene Cumm [Sat, 18 Jul 2015 16:06:52 +0000 (12:06 -0400)]
com32/include/menu.h: Extend my_isspace

Add 0x7f as a space character

Signed-off-by: Gene Cumm <>
3 years agocore/serirq: Use memset not memcpy
Gene Cumm [Sat, 18 Jul 2015 12:02:04 +0000 (08:02 -0400)]
core/serirq: Use memset not memcpy

The intention is to nullify not copy the IRQ pointers

Reported-By: Thomas Schmitt <>
Signed-off-by: Gene Cumm <>
3 years agoefi/udp: Don't use AllowPromiscuous
Gene Cumm [Sat, 18 Jul 2015 11:52:43 +0000 (07:52 -0400)]
efi/udp: Don't use AllowPromiscuous

Unnecessary.  On some systems, opens NIC in promiscuous mode or
breaks UseDefaultAddress.

Signed-off-by: Gene Cumm <>
3 years agoefi: Provide feedback on Configure() failures
Gene Cumm [Sat, 18 Jul 2015 11:51:20 +0000 (07:51 -0400)]
efi: Provide feedback on Configure() failures

There are more unsuccessful returns that are ignored.  Restructure to
allow for trapping other values.

Signed-off-by: Gene Cumm <>
3 years agoefi/main.c: don't close handle early
Patrick Masotta [Sat, 27 Jun 2015 02:32:18 +0000 (22:32 -0400)]
efi/main.c: don't close handle early

This clause closes the protocol before creating the child

Signed-off-by: Gene Cumm <>