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

1103 Commits

Author SHA1 Message Date
Michael Brown 7c395b0e21 [build] Use -no-pie on newer versions of gcc
Some distributions patch gcc to generate position independent
executables by default.  We currently include a workaround to check
for this and to add -fno-PIE -nopie to CFLAGS if required.

Newer patched versions of gcc require -fno-PIE -no-pie instead.  Check
for both variants.

Reported-by: Nathan Rennie-Waldock <nathan.renniewaldock@gmail.com>
Originally-fixed-by: Markos Chandras <mchandras@suse.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-06-14 12:33:16 +01:00
Michael Brown aeb6203811 [dhcp] Automatically generate vendor class identifier string
The vendor class identifier strings in DHCP_ARCH_VENDOR_CLASS_ID are
out of sync with the (correct) client architecture values in
DHCP_ARCH_CLIENT_ARCHITECTURE.

Fix by removing all definitions of DHCP_ARCH_VENDOR_CLASS_ID, and
instead generating the vendor class identifier string automatically
based on DHCP_ARCH_CLIENT_ARCHITECTURE and DHCP_ARCH_CLIENT_NDI.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-04 15:07:05 +01:00
Michael Brown 3d9f094022 [dhcp] Allow for variable encapsulation of architecture-specific options
DHCPv4 and DHCPv6 share some values in common for the architecture-
specific options (such as the client system architecture type), but
use different encapsulations: DHCPv4 has a single byte for the option
length while DHCPv6 has a 16-bit field for the option length.

Move the containing DHCP_OPTION() and related wrappers from the
individual dhcp_arch.h files to dhcp.c, thus allowing for the
architecture-specific values to be reused in dhcpv6.c.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-04 13:15:05 +01:00
Michael Brown 5e5450c2d0 [comboot] Support COMBOOT in 64-bit builds
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-04-15 15:31:36 +01:00
Michael Brown 311a5732c8 [gdb] Add support for x86_64
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-22 08:44:32 +00:00
Michael Brown dbc9e591a5 [test] Move i386-specific tests to arch/i386/tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-17 14:32:00 +00:00
Michael Brown 9bab13a772 [hyperv] Use generic set_bit() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-03-16 22:33:41 +00:00
Michael Brown 31b5c2e753 [librm] Provide an abstraction wrapper for prot_call
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18 23:23:38 +00:00
Michael Brown 196f0f2551 [librm] Convert prot_call() to a real-mode near call
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-18 17:12:16 +00:00
Michael Brown 9dc340d735 [librm] Discard argument as part of return from prot_call()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 23:16:49 +00:00
Michael Brown f468f12b1e [bios] Add bin-x86_64-pcbios build platform
Move most arch/i386 files to arch/x86, and adjust the contents of the
Makefiles and the include/bits/*.h headers to reflect the new
locations.

This patch makes no substantive code changes, as can be seen using a
rename-aware diff (e.g. "git show -M5").

This patch does not make the pcbios platform functional for x86_64; it
merely allows it to compile without errors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 43515f9f1a [bios] Move isolinux definitions to Makefile.pcbios
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 1a457e933a [bios] Allow librm to be compiled for x86_64
This commit does not make librm functional for x86_64; it merely
allows it to compile without errors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 8819a34c0e [bios] Allow memmap.c to be compiled for x86_64
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 7691e5eedb [bios] Allow bios_console.c to be compiled for x86_64
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 4d224c95d4 [bios] Allow bzimage.c to be compiled for x86_64
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 9c58ba2cd7 [bios] Allow rtc_entropy.c to be compiled for x86_64
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 44e05b0ffc [bios] Allow relocate.c to be compiled for x86_64
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 9f79f5f1a5 [bios] Use size_t when casting _text16_memsz and _data16_memsz
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown 15fadab533 [bios] Use intptr_t when casting .text16 function pointers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 19:32:32 +00:00
Michael Brown b9c4c2676b [libc] Split rmsetjmp() and rmlongjmp() into a separate rmsetjmp.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-16 16:06:25 +00:00
Michael Brown 7ecfe7159f [prefix] Pad .text16 and .data16 segment sizes at build time
Commit c64747d ("[librm] Speed up real-to-protected mode transition
under KVM") rounded down the .text16 segment address calculated in
alloc_basemem() to a multiple of 64 bytes in order to speed up mode
transitions under KVM.

This creates a potential discrepancy between alloc_basemem() and
free_basemem(), meaning that free_basemem() may free less memory than
was allocated by alloc_basemem().

Fix by padding the calculated sizes of both .text16 and .data16 to a
multiple of 64 bytes at build time.

Debugged-by: Yossef Efraim <yossefe@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-12 14:04:51 +00:00
Michael Brown 6de378aae8 [pxe] Clarify comments regarding shrinking of cached DHCP packet
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-02-11 19:14:00 +00:00
Michael Brown 83c8f2e8e3 [i386] Add check_bios_interrupts() debug function
Provide a debug function check_bios_interrupts() to look for changes
to the interrupt vector table.  This can be useful when investigating
the behaviour (including crashes) of external PXE NBPs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-12 08:27:59 +00:00
Michael Brown 7d48affec2 [pxe] Add debug message to display real-mode segment addresses
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-11 16:22:16 +00:00
Michael Brown 07e14bfb8a [pxe] Colourise debug output
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-11 16:20:05 +00:00
Michael Brown 173c48a57e [romprefix] Report an optimistic runtime size estimate
Commit 5de45cd ("[romprefix] Report a pessimistic runtime size
estimate") set the PCI3.0 "runtime size" field equal to the worst-case
runtime size, on the basis that there is no guarantee that PMM
allocation will succeed and hence no guarantee that we will be able to
shrink the ROM image.

On a PCI3.0 system where PMM allocation would succeed, this can cause
the BIOS to unnecessarily refuse to initialise the iPXE ROM due to a
perceived shortage of option ROM space.

Fix by reporting the best-case runtime size via the PCI header, and
checking that we have sufficient runtime space (if applicable).  This
allows iPXE ROMs to initialise on PCI3.0 systems that might otherwise
fail due to a shortage of option ROM space.

This may cause iPXE ROMs to fail to initialise on PCI3.0 systems where
PMM is broken.  (Pre-PCI3.0 systems are unaffected since there must
already have been sufficient option ROM space available for the
initialisation entry point to be called.)

On balance, it seems preferable to avoid breaking "good" systems
(PCI3.0 with working PMM) at the cost of potentially breaking "bad"
systems (PCI3.0 with broken PMM).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-06 00:30:23 +00:00
Michael Brown dd485992dc [vmware] Expose GuestRPC mechanism in 64-bit builds
The GuestRPC mechanism (used for VMWARE_SETTINGS and CONSOLE_VMWARE)
does not use any real-mode code and so can be exposed in both 64-bit
and 32-bit builds.

Reported-by: Matthew Helton <mwhelton@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-01-05 17:20:36 +00:00
Michael Brown 0f67f2edb7 [bios] Add support for injecting keypresses
When USB network card drivers are used, the BIOS' legacy USB
capability is necessarily disabled since there is no way to share the
host controller between the BIOS and iPXE.

Commit 3726722 ("[usb] Add basic support for USB keyboards") added
support allowing a USB keyboard to be used within iPXE.  However,
external code such as a PXE NBP has no way to utilise this support,
and so a USB keyboard cannot be used to control a PXE NBP loaded from
a USB network card.

Add support for injecting keypresses from any iPXE console into the
BIOS keyboard buffer.  This allows external code such as a PXE NBP to
function with a USB keyboard even after the BIOS' legacy USB
capability has been disabled.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-23 11:47:17 +00:00
Michael Brown 7f65a08f3e [efi] Add %.usb target for building EFI-bootable USB (or other) disk images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-12-07 13:08:22 +00:00
Michael Brown 309c58824f [comboot] Reset console before starting COMBOOT executable
iPXE does not call shutdown() before invoking a COMBOOT executable,
since the executable is allowed to make API calls back into iPXE.  If
a background picture is used, then the console will not be restored to
text mode before invoking the COMBOOT executable.  This can cause
undefined behaviour.

Fix by adding an explicit call to console_reset() immediately before
invoking a COMBOOT or COM32 executable, analogous to the call made to
console_reset() immediately before invokving a PXE NBP.

Debugged-by: Andrew Widdersheim <awiddersheim@inetu.net>
Tested-by: Andrew Widdersheim <awiddersheim@inetu.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-11-17 14:20:35 +00:00
Michael Brown 4b7443d132 [build] Generalise CONSOLE_VESAFB to CONSOLE_FRAMEBUFFER
The name "vesafb" is intrinsically specific to a BIOS environment.
Generalise the build configuration option CONSOLE_VESAFB to
CONSOLE_FRAMEBUFFER, in preparation for adding EFI framebuffer
support.

Existing configurations using CONSOLE_VESAFB will continue to work.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-10-16 16:38:39 +01:00
Michael Brown 79afe60b09 [fbcon] Move margin calculations to fbcon.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-10-14 22:16:45 +01:00
Michael Brown bc69777a40 [fbcon] Allow character height to be selected at runtime
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-10-14 22:16:40 +01:00
Michael Brown 1852803e46 [pxe] Notify BIOS via INT 1a,564e for each new network device
Use INT 1a,564e to notify the BIOS of each network device that we
detect.  This provides an opportunity for the BIOS to implement
platform policy such as changing the MAC address by issuing a call to
PXENV_UNDI_SET_STATION_ADDRESS.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-15 13:43:35 +01:00
Michael Brown 3b586c8e29 [pxe] Invoke INT 1a,564e when PXE stack is activated
Invoke INT 1a,564e whenever a PXE stack is activated, passing the
address of the PXENV+ structure in %es:%bx.  This is designed to allow
a BIOS to be notified when a PXE stack has been installed, providing
an opportunity for start-of-day commands such as setting the MAC
address according to a policy chosen by the BIOS.

PXE defines INT 1a,5650 as a means of locating the PXENV+ structure:
this call returns %ax=0x564e and the address of the PXENV+ structure
in %es:%bx.  We choose INT 1a,564e as a fairly natural notification
call, using the parameters as would be returned by INT 1a,5650.

The full calling convention (documented as per section 3.1 of the PXE
specification) is:

  INT 1a,564e - PXE installation notification
  Enter:
    %ax = 0x564e
    %es = 16-bit segment address of the PXENV+ structure
    %bx = 16-bit offset of the PXENV+ structure
  Exit:
    %edx may be trashed (as is the case for INT 1a,5650)
    All other register contents must be preserved
    CF is cleared
    IF is preserved
    All other flags are undefined

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-15 13:33:44 +01:00
Michael Brown 53d2d9e3c3 [uri] Generalise tftp_uri() to pxe_uri()
Merge the functionality of parse_next_server_and_filename() and
tftp_uri() into a single pxe_uri(), which takes a server address
(IPv4/IPv6/none) and a filename, and produces a URI using the rule:

 - if the filename is a hierarchical absolute URI (i.e. includes a
   scheme such as "http://" or "tftp://") then use that URI and ignore
   the server address,

 - otherwise, if the server address is recognised (according to
   sa_family) then construct a TFTP URI based on the server address,
   port, and filename

 - otherwise fail.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-02 13:38:53 +01:00
Michael Brown f6e1da5cbf [build] Search for ldlinux.c32 separately from isolinux.bin
Some distributions (observed with Ubuntu 15.04) place ldlinux.c32 in a
separate directory from isolinux.bin.  Search for these files
separately, and allow an alternative location of ldlinux.c32 to be
provided via LDLINUX_C32=... on the make command line.

Reported-by: Adrian Koshka <adriankoshcha@teknik.io>
Tested-by: Adrian Koshka <adriankoshcha@teknik.io>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-09-01 21:04:44 +01:00
Michael Brown 2ef04f092c [pxe] Construct all fake DHCP packets before starting PXE NBP
Commit edf74df ("[pxe] Always reconstruct packet for
PXENV_GET_CACHED_INFO") fixed the problems caused by returning stale
DHCP packets (e.g. from an earlier boot attempt using a different
network device), but broke interoperability with NBPs such as WDS
which may overwrite our cached (fake) DHCP packets and expect the
modified packets to be returned by a subsequent call to
PXENV_GET_CACHED_INFO.

Fix by constructing the fake DHCP packets immediately before
transferring control to a PXE NBP.  Calls to PXENV_GET_CACHED_INFO
will now never modify the cached packets.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-29 16:58:12 +01:00
Michael Brown fb4ce72e64 [pxe] Warn about PXE NBPs that may be EFI executables
A relatively common user mistake is to attempt to boot an EFI
executable (such as grub.efi) using a BIOS version of iPXE.

Unfortunately there are no signature checks that we can use to
unambiguously identify a PXE NBP, since a PXE NBP is just raw machine
code.  We therefore have to accept anything sufficiently small to fit
into base memory as a valid PXE NBP.

We can detect that a file might be an EFI executable by checking for
the initial "MZ" signature bytes.  This does not necessarily preclude
the file from also being a PXE NBP (since it would be possible to
create a hybrid binary which acts as both an EFI executable and a PXE
NBP, similar to the way in which wimboot and the Linux kernel are
hybrid binaries which act as both an EFI executable and a bzImage).

If the initial "MZ" signature bytes are present, then attempt to warn
the user by setting the image type to "PXE-NBP (may be EFI?)".  We
can't (sensibly) prevent the user from accidentally running an EFI
executable as a PXE NBP, but we can at least make it easier for the
user to identify their mistake.

Inspired-by: Robin Smidsrød <robin@smidsrod.no>
Inspired-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-21 15:13:19 +01:00
Daniel Pieczko abd36b9f96 [prefix] Use correct register for KEEP_IT_REAL physical address conversion
Signed-off-by: Daniel Pieczko <dpieczko@solarflare.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-08-14 16:18:54 +01:00
Michael Brown 9aa55f811a [comboot] Avoid dragging in serial console support unconditionally
When the ability for iPXE to handle multiple serial ports was added,
the choice was made that the singular serial port referred to by
COMBOOT calls should mean the port used for the serial console.  This
unintentionally caused IMAGE_COMBOOT to also enable CONSOLE_SERIAL.

Fix by providing a weak-symbol version of the serial console which
will be used if serial console support was not explicitly enabled.

Reported-by: Torgeir Wulfsberg <Torgeir.Wulfsberg@kongsberg.com>
Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-31 10:58:05 +01:00
Michael Brown ae7f22eb28 [elf] Reject ELFBoot images requiring virtual addressing
We do not set up any kind of virtual addressing before invoking an
ELFBoot image.  Reject if the image's program headers indicate that
virtual addresses are not equal to physical addresses.

This avoids problems when loading some RHEL5 kernels, which seem to
include ELFBoot headers using virtual addressing.  With this change,
these kernels are no longer detected as ELFBoot, and so may be
(correctly) detected as bzImage instead.

Reported-by: Torgeir.Wulfsberg@kongsberg.com
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-29 14:17:09 +01:00
Christian Nilsson f903ddaac0 [bios] Add ANSI blink attribute
Expose the high bit of the VGA text attribute byte via the ANSI SGR
parameters 5 ("blink on") and 25 ("blink off").

Note that some video cards (and virtual machines) may display a high
intensity background colour instead of blinking text.

Signed-off-by: Christian Nilsson <nikize@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-07-22 16:46:02 +01:00
Wissam Shoukair d8a618e80f [comboot] Implement INT22,0x000c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-29 12:42:51 +01:00
Michael Brown 2a696ab963 [serial] Use new UART abstraction in serial console driver
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-29 11:04:10 +01:00
Michael Brown edf74df4ab [pxe] Always reconstruct packet for PXENV_GET_CACHED_INFO
Avoid accidentally returning stale packets (e.g. for a previously
attempted network device) by always constructing a fresh DHCP packet.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-29 10:18:39 +01:00
Michael Brown 36817ea260 [mromprefix] Report a dummy size at offset 0x02 of .mrom payload
The size of the .mrom payload (the second PCI ROM image) is defined in
its PCI header.  The code type for the .mrom payload image is
deliberately set to an invalid value (0xff) to ensure that no BIOS
tries to parse anything in the image other than the PCI header.

Since the code type is not set to 0x00 ("Intel x86, PC-AT
compatible"), bytes 0x02-0x17 should not be interpreted by the BIOS as
being in the standard ISA expansion ROM format.  In particular, the
byte at offset 0x02 does not represent the length of the ROM image (in
512-byte blocks).

However, some Dell BIOSes seem to erroneously use the byte at offset
0x02 to determine the length of the .mrom payload when walking the
list of PCI ROM images.  Since this byte is currently set to zero,
this can lead to the BIOS getting stuck in an infinite loop during
POST.  (This problem may not arise if the .mrom payload is the final
image in the ROM, since the BIOS will then have no reason to attempt
to locate the next image.)

One possible workaround would be to put the real payload size in this
byte, but doing so would constrain the .mrom payload size to 128kB
(see commit 8049a52 ("[mromprefix] Allow for .mrom images larger than
128kB") for more details).

Another possible workaround would be to put the real payload size as a
word in bytes 0x02-0x03 (as is done for EFI ROMs).  This would not
constrain the .mrom payload size, but a payload size which happened to
be exactly 128kB would result in a zero value in the byte at offset
0x02 and so could still result in infinite loops on BIOSes with this
bug.

We choose to place a fixed value of 0x01 in the byte at offset 0x02.
This should at least prevent the BIOS from getting stuck in an
infinite loop.  (The BIOS may walk into the middle of the .mrom
payload, where it will almost certainly not find a valid {0x55,0xaa}
signature or a valid PCIR header, and will therefore hopefully abort
processing.)

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-25 10:33:46 +01:00
Michael Brown e46154fbb4 [pci] Use flat real mode to call INT 1a,b101
Some HP BIOSes (observed with an HP ProLiant m710p Server Cartridge)
have a bug in the implementation of INT 1a,b101: they blithely assume
that real-mode code is able to read from anywhere in the 32-bit memory
space.

This problem affects the call to INT 1a,b101 made from within
pcibios_num_bus() (which uses REAL_CODE() and hence executes in
genuine real mode) but does not affect the call made from within
romprefix.S (since with a PMM BIOS, that call executes in flat real
mode anyway).

Work around the problem by explicitly calling flatten_real_mode()
before invoking INT 1a,b101.  This is a rarely-used code path, and so
the extra overhead of emulating instructions in some VM configurations
(see commit 6d4deee ("[librm] Use genuine real mode to accelerate
operation in virtual machines") for more details) is negligible.

Reported-by: Wissam Shoukair <wissams@mellanox.com>
Debugged-by: Wissam Shoukair <wissams@mellanox.com>
Debugged-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-23 20:51:19 +01:00
Michael Brown 3ec8b67818 [int13con] Add basic ability to log to a local disk via INT 13
Several popular public cloud providers do not provide any sensible
mechanism for obtaining debug output from an OS which is failing to
boot.  For example, Amazon EC2 provides the "Get System Log" facility,
which occasionally deigns to report a random subset of the characters
emitted via the VM's serial port, but usually returns only a blank
screen.  (Amazingly, this is still superior to the debugging
facilities provided by Azure.)

Work around these shortcomings by adding a console type which sends
output to a magically detected raw disk partition, and including such
a partition within any iPXE .usb-format image.

To use this facility:

 - build an iPXE .usb image with CONSOLE_INT13 enabled

 - boot the cloud VM from this image

 - after the boot fails, attach the VM's boot disk to a second VM

 - from this second VM, use "less -f -R /dev/sdb3" (or similar) to
   view the iPXE output.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-19 12:58:03 +01:00