david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

139 Commits

Author SHA1 Message Date
Michael Brown 2782ccec41 [legal] Add support for the Unmodified Binary Distribution Licence
Add the text for the Unmodified Binary Distribution Licence.  This
Licence allows for the distribution of unmodified binaries built from
publicly available source code, without imposing the obligations of
the GNU General Public License upon anyone who chooses to distribute
only the unmodified binaries built from that source code.  See the
licence text for the precise terms and conditions.

Add the licence GPL2_OR_LATER_OR_UBDL to the set of licences which can
be declared using FILE_LICENCE(), and add the corresponding support to
licence.pl.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 12:07:14 +00:00
Michael Brown 5350b65a3c [zbin] Use LZMA compression
LZMA provides significantly better compression (by ~15%) than the
current NRV2B algorithm.

We use a raw LZMA stream (aka LZMA1) to avoid the need for code to
parse the LZMA2 block headers.  We use parameters {lc=2,lp=0,pb=0} to
reduce the stack space required by the decompressor to acceptable
levels (around 8kB).  Using lc=3 or pb=2 would give marginally better
compression, but at the cost of substantially increasing the required
stack space.

The build process now requires the liblzma headers to be present on
the build system, since we do not include a copy of an LZMA compressor
within the iPXE source tree.  The decompressor is written from scratch
(based on XZ Embedded) and is entirely self-contained within the
iPXE source.

The branch-call-jump (BCJ) filter used to improve the compressibility
is specific to iPXE.  We choose not to use liblzma's built-in BCJ
filter since the algorithm is complex and undocumented.  Our BCJ
filter achieves approximately the same results (on typical iPXE
binaries) with a substantially simpler algorithm.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-25 14:06:13 +00:00
Michael Brown 907cffb7c5 [efi] Disallow R_X86_64_32 relocations
UEFI binaries may be relocated to any location within the 64-bit
address space.  We compile as position-independent code with hidden
visibility, which should force all relocation records to be either
PC-relative (in which case no PE relocations are required) or full
64-bit relocations.  There should be no R_X86_64_32 relocation
records, since that would imply an invalid assumption that code could
not be relocated above 4GB.

Remove support for R_X86_64_32 relocation records from util/elf2efi.c,
so that any such records result in a build failure rather than a
potential runtime failure.

Reported-by: Jan Kundrát <jkt@kde.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-12 13:39:25 +00:00
Michael Brown 5de37e124f [efi] Add efifatbin utility
Add utility for constructing EFI fat binaries (dual 32/64-bit
binaries, usable only on Apple EFI systems).

This utility is not part of the standard build process.  To use it:

  make util/efifatbin bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi

and then

  ./util/efifatbin bin-*-efi/ipxe.efi fat-ipxe.efi

Requested-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net>
Tested-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-10 03:12:10 +01:00
Michael Brown ee0c24902a [util] Use PCI length field to obtain length of individual images
Option::ROM currently uses the initialisation length field (single
byte at offset 0x02) to determine the length of a ROM image within a
multi-image ROM file.  For PCI ROM images with a code type other than
0, the initialisation length field may not be present.

Fix by using the PCI header's image length field instead.  Note that
this does not prevent us from correctly handling ISA ROMs, since ISA
ROMs do not support multiple images within a single ROM BAR anyway.

Inspired-by: Swift Geek <swiftgeek@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-26 15:17:56 +01:00
Christian Hesse a8f037a275 [build] Merge util/geniso and util/genliso
Rework geniso and genliso to provide a single merged utility for
generating ISO images.

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-05-14 16:00:58 +01:00
Michael Brown 779d65222e [build] Avoid errors when build directory is mounted via NFS
Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-05-13 16:45:57 +01:00
Christian Hesse 1680d0d14d [build] Fix LABEL name for .liso images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-12-06 17:12:57 +00:00
Christian Hesse 3f9a482b88 [build] Update build system for Syslinux 6.x
Syslinux 6.x places its files into a bios subdirectory, and requires
that a ldlinux.c32 module be included within the ISO image.  Add the
relevant search paths for isolinux.bin, and include the file
ldlinux.c32 within the ISO image if it exists.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-15 11:59:44 +00:00
Michael Brown 7348035231 [libc] Redefine low 8 bits of error code as "platform error code"
The low 8 bits of an iPXE error code are currently defined as the
closest equivalent PXE error code.  Generalise this scheme to
platforms other than PC-BIOS by extending this definition to "closest
equivalent platform error code".  This allows for the possibility of
returning meaningful errors via EFI APIs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 13:34:13 +01:00
Michael Brown e63f6c9241 [efi] Fix building with newer binutils
Newer versions of bfd.h require definitions for the PACKAGE and
PACKAGE_VERSION macros used by autotools.  Work around this by
manually defining these macros before including bfd.h.

Originally-fixed-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net>
Tested-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-14 00:20:04 +00:00
Daniel P. Berrange eb5a2ba596 [zbin] Fix size used for memset in alloc_output_file
The output->buf field is a pointer, not an array, so sizeof() is not
applicable.  We must use the allocated string length instead.

Identified by gcc:

  util/zbin.c: In function ‘alloc_output_file’:
  util/zbin.c:146:37: warning: argument to ‘sizeof’ in ‘memset’ call
    is the same expression as the destination; did you mean to
    dereference it? [-Wsizeof-pointer-memaccess]
  memset ( output->buf, 0xff, sizeof ( output->buf ) );

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-05 15:23:01 +00:00
Michael Brown 09c5109b85 [efi] Ensure EFI binaries comply with Authenticode requirements
Authenticode requires that the size of the raw file must equal the
size of the OptionalHeader.SizeOfHeaders plus the sum of all sections'
SizeOfRawData.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-02-25 17:22:01 +00:00
Michael Brown a27413c82a [util] Fix uninitialised-variable warning in einfo.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-22 08:26:43 -07:00
Michael Brown c7eea31ed8 [util] Fix up checksum in UNDI ROM header, if present
The UNDI ROM header does contain a checksum byte.  Apparently no-one
cares about this, since iPXE has left it as zero for years without
anyone noticing.

Since Option::ROM now understands the UNDI ROM header, we may as well
fix up the checksum byte for the sake of completeness.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 13:22:12 +01:00
Michael Brown 69fa494280 [util] Display UNDI ROM header in disrom.pl
Requested-by: Daniel Wyatt <daniel.wyatt@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 13:19:16 +01:00
Daniel Wyatt 37ac7a666f [util] Allow for CALL NEAR in the option ROM initialisation entry point
Option::ROM currently understands only JMP NEAR and JMP SHORT
instructions in the initialisation entry point.  At least one Broadcom
option ROM has been observed to use a CALL NEAR instruction.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 12:51:47 +01:00
Michael Brown 8cac5c0c92 [util] Update mergerom.pl to handle iPXE ROM header
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 18:05:01 +01:00
Michael Brown 5de45cd3da [romprefix] Report a pessimistic runtime size estimate
PCI3.0 allows us to report a "runtime size" which can be smaller than
the actual ROM size.  On systems that support PMM our runtime size
will be small (~2.5kB), which helps to conserve the limited option ROM
space.  However, there is no guarantee that the PMM allocation will
succeed, and so we need to report the worst-case runtime size in the
PCI header.

Move the "shrunk ROM size" field from the PCI header to a new "iPXE
ROM header", allowing it to be accessed by ROM-manipulation utilities
such as disrom.pl.

Reported-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 17:57:40 +01:00
Michael Brown c3b4860ce3 [legal] Update FSF mailing address in GPL licence texts
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 19:55:45 +01:00
Michael Brown bc93e8ab41 [util] Avoid compiler warning on gcc 4.6
Commit 196751c ("[build] Enable warnings when building utilities")
revealed a previously hidden compiler warning in util/nrv2b.c
regarding an out-of-bounds array subscript in the code

    #if defined(SWD_BEST_OFF)
        if (s->best_pos[2] == 0)
            s->best_pos[2] = key + 1;
    #endif

where best_pos[] is defined by

    #define SWD_BEST_OFF 1

    #if defined(SWD_BEST_OFF)
        unsigned int best_off[ SWD_BEST_OFF ];
        unsigned int best_pos[ SWD_BEST_OFF ];
    #endif

With SWD_BEST_OFF set to 1, it can be proven that all code paths
referring to s->best_off[] and s->best_pos[] will never be executed,
with the exception of the two lines above.  Since these two lines
alone can have no effect on execution, we can safely undefine
SWD_BEST_OFF.

Verified by comparing md5sums of bin/undionly.kpxe before and after
the change.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-03 18:58:43 +01:00
Michael Brown a3cba84bab [util] Update mergerom.pl to handle .mrom images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 15:15:06 +01:00
Michael Brown 9e8d431a0d [romprefix] Add a dummy ROM header to cover the .mrom payload
The header of a .mrom image declares its length to be only a few
kilobytes; the remainder is accessed via a sideband mechanism.  This
makes it difficult to append an additional ROM image, such as an EFI
ROM.

Add a second, dummy ROM header covering the payload portion of the
.mrom image, allowing consumers to locate any appended ROM images in
the usual way.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 15:15:03 +01:00
Michael Brown 12be8bc544 [util] Rewrite catrom.pl to use Option::ROM library
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 11:36:21 +01:00
Michael Brown f2e5f8813e [util] Allow Option::ROM to access multiple ROM images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 11:36:20 +01:00
Marin Hannache 8c42e0c210 [util] Remove obsolete Makefile rule for util/prototester.c
util/prototester.c was removed in commit a6d1815 ("Obsolete for some
time now") back in 2006.

Signed-off-by: Marin Hannache <mareo@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-24 11:45:24 +01:00
Michael Brown 8b0305e285 [efi] Fix compiler warning in elf2efi.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-21 08:05:24 +01:00
Robin Smidsrød eadb6bc3fe [util] Add utility to generate list of supported network cards
niclist.pl recursively scans specified source folders and builds a
list of supported NICs by looking for ISA_ROM and PCI_ROM lines and
outputs the list in text, CSV, JSON, HTML or DokuWiki format.  Sorting
and column selection is possible.

The pci-utils pci.ids file is fetched from SourceForge once a day to
also output the "official" vendor/device names associated with the PCI
device.

Signed-off-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-18 10:38:22 +01:00
Michael Brown 196751ce95 [build] Enable warnings when building utilities
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-10 19:38:54 +01:00
Michael Brown 4740703d9d [console] Ignore unexpected keysyms when generating keyboard maps
I am unable to find any definitive documentation on how Linux keyboard
symbols work.  In the absence of any documentation, I'm going to
assume that unexpected keysyms are harmless and should be ignored.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-27 20:59:47 +01:00
Michael Brown c46acda672 [build] Include UNDI PCI driver within all-drivers build
Commit 9b99d2a ("[build] Avoid generating ROMs with "match-any" vendor
or device IDs") introduced a regression which caused the UNDI PCI
driver to be omitted from the list of all drivers, and thus to be
excluded from the all-drivers build.

Fix by ensuring that the per-driver section of the Makefile is
generated even when there are no ROMs to be built.

Reported-by: Sven Dreyer <sven@dreyer-net.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-11-16 00:22:30 +00:00
Michael Brown 8b092f4c50 [util] Add romcheck.pl
Provide a utility to quickly determine the ROM size and .mrom format
support for attached PCI devices.  For example:

    01:00.0 (1186:4300) supports a 128kB .rom or .mrom

Inspired-by: Wes Frazier <wes.frazier@members.fsf.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-09-19 16:43:08 +01:00
Dominic Cleal 3fc139362c [build] Allow APPEND lines in ipxe.iso to function as expected
Signed-off-by: Dominic Cleal <dcleal@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-05-19 12:03:18 +01:00
Michael Brown 9b99d2af0c [build] Avoid generating ROMs with "match-any" vendor or device IDs
A PCI_ROM() entry containing a vendor or device ID of PCI_ANY_ID
(0xffff) indicates to pci_find_driver() that the entry's vendor or
device ID should be ignored when matching against the device's vendor
or device ID.  It does not represent a PCI ROM that should be built.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-30 16:01:07 +01:00
Michael Brown 0579b8279c [build] Include only one copy of each ROM in "make allroms"
Each PCI ROM currently ends up appearing twice in the $(ROMS) list:
once under its designated name (e.g. "rtl8139.rom"), once under its
PCI IDs (e.g. "bin/10ec8139.rom").

Include only the latter of these in the $(ROMS) list, so that doing
"make allroms" will generate only one copy of each ROM.

Reported-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-30 15:49:00 +01:00
Michael Brown d161ebff94 [build] Generate hybrid ISO images if isohybrid is available
Suggested-by: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-27 22:37:04 +01:00
Michael Brown 48624cf94a [console] Try to avoid problems caused by keycode 86
The "us" keyboard layout contains a mapping for keycode 86 (which
seems not to correspond to any physical key on many US keyboards) to
the ASCII character '<'.  This mapping causes conflicts with the
mapping for keycode 51, which also maps (with shift) to '<'.

Change the keyboard mapping generator to choose the lowest keycode for
each ASCII character as indicating the relevant mapping to use, on the
basis that a lower keycode roughly indicates a "more normal" key.  On
a German keyboard, which has keys for both keycode 51 and keycode 86
present, this causes '<' to be remapped to ';', which is a closer
match to typical user expectations.

Reported-by: Sven Dreyer <sven@dreyer-net.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-16 21:43:56 +00:00
Michael Brown 1febd879e3 [console] Add keymap generator
Inspired by LILO's keytab-lilo.pl, genkeymap.pl uses "loadkeys -b" to
obtain a Linux keyboard map, and generates a file keymap_xx.c in
hci/keymap.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-16 12:02:59 +00:00
Michael Brown ea0fcb9460 [fnrec] Enhance function recording
Enhance the information collected by the function recorder to include
the call site and entry/exit counts.  This allows fnrec.pl to produce
a call tree such as:

    step (from core/getkey.c:46 = 0x17e90) {
      ref_increment (from core/process.c:93 = 0x73ec) { }
      net_step (from core/process.c:96 = 0x73f1) {
        net_poll (from net/netdevice.c:741 = 0xbce6) {
          netdev_poll (from net/netdevice.c:700 = 0xbc58) { }
          netdev_rx_dequeue (from net/netdevice.c:709 = 0xbc65) { }
        }
      }
      ref_decrement (from core/process.c:96 = 0x73f9) { }
    }

Note that inlined functions are reported, confusingly, as extra calls
to the *containing* function.  Minimise this confusion by adding the
attribute "no_instrument_function" to all functions declared as
inline.  (Static functions that have been inlined autonomously by gcc
will still be problematic, but these are far fewer in number.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-09 13:11:27 +00:00
Michael Brown a7fb7a8c6d [util] Update welcome message in ISO images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-17 23:55:53 +01:00
Geoff Lywood b8dd94686b [efi] Fix the 32-bit version of elf2efi64
Currently, if elf2efi.c is compiled using a 32-bit HOST_CC, then the
resulting elf2efi64 binary will generate 32-bit EFI binaries instead
of 64-bit EFI binaries.

The problem is that elf2efi.c uses the MDE_CPU_* definitions to decide
whether to output a 32-bit or 64-bit PE binary.  However, MDE_CPU_*
gets defined in ProcessorBind.h, depending on the compiler's target
architecture.  Overriding them on the command line doesn't work in the
expected way, and you can end up in cases where both MDE_CPU_IA32 and
MDE_CPU_X64 are defined.

Fix by using a separate definition, EFI_TARGET_IA32/EFI_TARGET_X64,
which is specified only on the command line.

Signed-off-by: Geoff Lywood <glywood@vmware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-21 12:41:41 +01:00
Michael Brown 6c0e8c14be [libc] Enable automated extraction of error usage reports
Add preprocessor magic to the error definitions to enable every error
usage to be tracked.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-31 03:11:57 +01:00
Geoff Lywood ceba975b15 [efi] Verify object format support in elf2efi.c
Currently, if you attempt to build 64-bit EFI binaries on a 32-bit
system without a suitable cross-compiling version of libbfd, the iPXE
build will die with a segmentation fault in elf2efi64.

Fix by properly handling the return value from bfd_check_format().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 09:17:37 +01:00
Michael Brown 132c391712 [romprefix] Add .mrom format, allowing loading of large ROMs
Add an infrastructure allowing the prefix to provide an open_payload()
method for obtaining out-of-band access to the whole iPXE image.  Add
a mechanism within this infrastructure that allows raw access to the
expansion ROM BAR by temporarily borrowing an address from a suitable
memory BAR on the same PCI card.

For cards that have a memory BAR that is at least as large as their
expansion ROM BAR, this allows large iPXE ROMs to be supported even on
systems where PMM fails, or where option ROM space pressure makes it
impossible to use PMM shrinking.  The BIOS sees only a stub ROM of
approximately 3kB in size; the remainder (which can be well over 64kB)
is loaded only at the time iPXE is invoked.

As a nice side-effect, an iPXE .mrom image will continue to work even
if its PMM-allocated areas are overwritten between initialisation and
invocation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-25 16:37:06 +01:00
Michael Brown d8c1f2e94f [build] Replace obsolete makerom.pl with quick script using Option::ROM
The only remaining useful function of makerom.pl is to correct the ROM
and PnP checksums; the PCI IDs are set at link time, and padding is
performed using padimg.pl.

Option::ROM already provides a facility for correcting the checksums,
so we may as well just use this instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-25 02:54:12 +01:00
Michael Brown 9068249e24 [prefix] Add .text16.early section
Add a section .text16.early which is always kept inline with the
prefix.  This will allow for some code sharing between the .prefix and
.text16 sections.

Note that the simple solution of just prepending the .prefix section
to the .text16 section will not work, because a bug in Wyse Streaming
Manager server (WLDRM13.BIN) requires us to place a dummy PXENV+ entry
point at the start of .text16.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-20 12:56:28 +01:00
Michael Brown 329686c026 [romprefix] Remove .xrom prefix
The .xrom prefix provides an experimental mechanism for loading ROM
images greater than 64kB in size by mapping the expansion ROM BAR in
at a hopefully-unused address.  This is unreliable, and potentially
dangerous.  In particular, there is no guarantee that any PCI bridges
between the CPU and the device will respond to accesses for the
"unused" memory region that is chosen, and it is possible that the
process of scanning for the "unused" memory region may end up issuing
reads to other PCI devices.  If this ends up trampling on a register
with read side-effects belonging to an unrelated PCI device, this may
cause undefined behaviour.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:48 +01:00
Michael Brown 8406115834 [build] Rename gPXE to iPXE
Access to the gpxe.org and etherboot.org domains and associated
resources has been revoked by the registrant of the domain.  Work
around this problem by renaming project from gPXE to iPXE, and
updating URLs to match.

Also update README, LOG and COPYRIGHTS to remove obsolete information.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:39 +01:00
Piotr Jaroszyński 70537cbe35 [util] Hide an expected error from the 'which' command
Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-04-16 07:55:15 -04:00
Stefan Hajnoczi 6a6f26f74d [fnrec] Add function recorder for debugging
The function recorder is a crash and hang debugging tool.  It logs each
function call into a memory buffer while gPXE runs.  After the machine
is reset, and if the contents of memory have not been overwritten, gPXE
will detect the memory buffer and print out its contents.

This allows developers to see a trace of the last functions called
before a crash or hang.  The util/fnrec.sh script can be used to convert
the function addresses back into symbol names.

To build with fnrec:

    make FNREC=1

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-03-04 11:38:29 -05:00