[build] Avoid spurious unused-but-set-variable warnings in gcc 4.6
The __table_entries() construction seems to trigger a false positive
warning in gcc 4.6 relating to variables which are set but never
used. Add __attribute__((unused)) to inhibit this warning.
Reported-by: Ralph Giles <giles@thaumas.net>
Tested-by: Ralph Giles <giles@thaumas.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
The keymap files, though autogenerated, are checked in to version
control and should be considered as source files. They should never
be automatically rebuilt.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
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>
[efi] Mark SNP devices as children of EFI PCI device
Re-open the EFI_PCI_IO_PROTOCOL specifying an Attributes value of
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. This causes the SNP devices to
be marked as children of the EFI PCI device (as shown in the "devtree"
command).
On at least one IBM blade system, this is required in order to have
the relevant drivers automatically attach to the SNP controller at
device creation time.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[romprefix] Use correct size for PMM allocation of image source block
iPXE allocates its first PMM block using the image source length,
which is rounded up to the nearest 16-byte paragraph. It then copies
in data of a length calculated from the ROM size, which is
theoretically less than or equal to the image source length, but is
rounded up to the nearest 512-byte sector. This can result in copying
beyond the end of the allocated PMM block, which can corrupt the PMM
data structures (and other essentially arbitrary areas of memory).
Fix by rounding up the image source length to the nearest 512-byte
sector before using it as the PMM allocation length.
Reported-by: Alex Williamson <alex.williamson@redhat.com>
Reported-by: Jarrod Johnson <jarrod.b.johnson@gmail.com>
Reported-by: Itay Gazit <itayg@mellanox.co.il>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
In a virtual environment such as qemu, we can legitimately receive
packets less than 64 bytes in length, such as ARP replies. These are
currently discarded, causing most IPv4 communication to fail.
Fix by ignoring the RFDShort bit when receiving packets.
Reported-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[bios] Use INT 16,11 instead of INT 16,01 to check for keystrokes
INT 16,01 will discard some extended keystrokes on some BIOSes, making
it impossible for iPXE to detect keypresses such as F12. Fix by using
INT 16,11 instead.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
A script that downloads a new image using imgdownload() with the
action register_and_replace_image() can now be freed immediately
before the replacement image is executed. This functionality is not
yet exposed via an iPXE command.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[image] Move the register_and_{select|boot}_image() functions to imgmgmt.c
These functions are used only as the "action" parameters to
imgdownload() or imgfetch(), and so belong in imgmgmt.c rather than
image.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[prefix] Allow iPXE's own command line to be executed as a script
Some prefixes (e.g. .lkrn) allow a command line to be passed in to
iPXE. At present, this command line is ignored.
If a command line is provided, treat it as an embedded script (without
an explicit "#!ipxe" magic marker). This allows for patterns of
invocation such as
title iPXE
kernel /boot/ipxe.lkrn dhcp && \
sanboot iscsi:10.0.4.1::::iqn.2010-04.org.ipxe.dolphin:storage
Here GRUB is instructed to load ipxe.lkrn with an embedded script
equivalent to
#!ipxe
dhcp
sanboot iscsi:10.0.4.1::::iqn.2010-04.org.ipxe.dolphin:storage
This can be used to effectively vary the embedded script without
having to rebuild ipxe.lkrn.
Originally-implemented-by: Dave Hansen <dave@sr71.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
The "prompt" command exposes the prompt() function, allowing a script
to prompt the user for a keypress and take action depending on the
result. For example
#!ipxe
prompt -k 0x197e -t 2000 Press F12 to boot from network... || exit
autoboot
Signed-off-by: Michael Brown <mcb30@ipxe.org>
The function keys F5-F12 all conform to the same ANSI pattern as the
other "special" keys that we currently recognise. Add these key
definitions, and shrink the representation of the ANSI sequences in
bios_console.c to compensate.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Refactor the {load,exec} image operations as {probe,exec}. This makes
the probe mechanism cleaner, eliminates some forward declarations,
avoids holding magic state in image->priv, eliminates the possibility
of screwing up between the "load" and "exec" stages, and makes the
documentation simpler since the concept of "loading" (as distinct from
"executing") no longer needs to be explained.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
When chainloading rtl8139.pxe from an old Etherboot rtl8139.zrom, iPXE
can end up misreading the first word of the MAC address from the
EEPROM as being all zeroes. This is presumably because Etherboot has
left the serial EEPROM in an unexpected state.
Fix by using the chip select line to reset the SPI device before we
start accessing it.
Reported-by: Mandar U Jog <mandarjog@gmail.com>
Tested-by: Mandar U Jog <mandarjog@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[parseopt] Refer to online documentation for command help
The online documentation (e.g. http://ipxe.org/cmd/ifopen), though not
yet complete, is far more comprehensive than could be provided within
the iPXE binary. Save around 200 bytes (compressed) by removing the
command descriptions from the interactive help, and instead referring
users directly to the web page describing the relevant command.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
The default initiator IQN is "iqn.2000-09.org.etherboot:UNKNOWN".
This is problematic for two reasons:
a) the etherboot.org domain (and hence the associated IQN namespace)
is not under the control of the iPXE project, and
b) some targets (correctly) refuse to allow concurrent connections
from different initiators using the same initiator IQN.
Solve both problems by changing the default initiator IQN to be
iqn.2010-04.org.ipxe:<hostname> if a hostname is set, or
iqn.2010-04.org.ipxe:<uuid> if no hostname is set.
Explicit initiator IQNs set via DHCP option 203 are not affected by
this change.
Unfortunately, this change is likely to break some existing
configurations, where ACL rules have been put in place referring to
the old default initiator IQN. Users may need to update ACLs, or
force the use of the old IQN using an iPXE script line such as
set initiator-iqn iqn.2000-09.org.etherboot:UNKNOWN
or a dhcpd.conf option such as
option iscsi-initiator-iqn "iqn.2000-09.org.etherboot:UNKNOWN"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[settings] Make fetch_string_setting_copy() easier to use
Most callers of functions in the fetch_setting() family treat any
errors as meaning "non-existent setting". In the case of
fetch_string_setting_copy(), an existent setting can still result in
an error due to memory allocation failure.
Allow the caller to distinguish between a non-existent setting and an
error in allocating memory for the copy, by returning success (and a
NULL buffer pointer) for a non-existent setting.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[settings] Avoid fetch_string_setting_copy() leaving an uninitialised pointer
For consistency with other functions in the fetch_setting() family,
ensure that fetch_string_setting_copy() always initialises the pointer
to the fetched setting even if fetching fails.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[bofm] Allow garbage collection of BOFM code in non-BOFM builds
Most builds will not have BOFM enabled. In these builds, allow all
BOFM code (including BOFM-only code within the individual drivers) to
be garbage-collected at link time in order to save space in the final
binary.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Testing BOFM involves gaining access to an IBM blade chassis, which is
often not practical. Provide a facility for testing BOFM
functionality outside of a real IBM blade context.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[autoboot] Allow a SAN boot as a fallback if a filename boot returns
Currently, if both a filename and root-path are present, iPXE will
hook the SAN device but will only attempt to boot from the filename.
Change this behaviour so that both are attempted. Users who want to
avoid booting from the SAN as a fallback can do so via the existing
"skip-san-boot" setting.
This allows for seamless deployment to a SAN target using Windows
Deployment Services (and similar products). A user simply has to
define the root-path option in DHCP and then use WDS to deploy the
system. No further configuration should be required.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
If the NBP returns, then always print a trailing newline, since some
NBPs (e.g. wdsnbp.com) leave the cursor in a random position halfway
across the screen.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[image] Allow download job to complete before acting upon image
Allow the monojob controlling the download to complete before calling
register_image() and friends. This allows the trailing "ok" from
monojob.c to be printed before the image starts executing (and
possibly printing output of its own).
Signed-off-by: Michael Brown <mcb30@ipxe.org>