summaryrefslogtreecommitdiffstats
path: root/src/usr/autoboot.c
Commit message (Collapse)AuthorAgeFilesLines
* [block] Allow use of a non-default EFI SAN boot filenameMichael Brown2017-04-121-6/+44
| | | | | | | | | | | | | | | | | | | | | | | Some older operating systems (e.g. RHEL6) use a non-default filename on the root disk and rely on setting an EFI variable to point to the bootloader. This does not work when performing a SAN boot on a machine where the EFI variable is not present. Fix by allowing a non-default filename to be specified via the "sanboot --filename" option or the "san-filename" setting. For example: sanboot --filename \efi\redhat\grub.efi \ iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6 or option ipxe.san-filename code 188 = string; option ipxe.san-filename "\\efi\\redhat\\grub.efi"; option root-path "iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6"; Originally-implemented-by: Vishvananda Ishaya Abrams <vish.ishaya@oracle.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Describe all SAN devices via ACPI tablesMichael Brown2017-03-281-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Describe all SAN devices via ACPI tables such as the iBFT. For tables that can describe only a single device (i.e. the aBFT and sBFT), one table is installed per device. For multi-device tables (i.e. the iBFT), all devices are described in a single table. An underlying SAN device connection may be closed at the time that we need to construct an ACPI table. We therefore introduce the concept of an "ACPI descriptor" which enables the SAN boot code to maintain an opaque pointer to the underlying object, and an "ACPI model" which can build tables from a list of such descriptors. This separates the lifecycles of ACPI descriptions from the lifecycles of the block device interfaces, and allows for construction of the ACPI tables even if the block device interface has been closed. For a multipath SAN device, iPXE will wait until sufficient information is available to describe all devices but will not wait for all paths to connect successfully. For example: with a multipath iSCSI boot iPXE will wait until at least one path has become available and name resolution has completed on all other paths. We do this since the iBFT has to include IP addresses rather than DNS names. We will commence booting without waiting for the inactive paths to either become available or close; this avoids unnecessary boot delays. Note that the Linux kernel will refuse to accept an iBFT with more than two NIC or target structures. We therefore describe only the NICs that are actually required in order to reach the described targets. Any iBFT with at most two targets is therefore guaranteed to describe at most two NICs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Add basic multipath supportMichael Brown2017-03-261-6/+8
| | | | | | | | | | | Add basic support for multipath block devices. The "sanboot" and "sanhook" commands now accept a list of SAN URIs. We open all URIs concurrently. The first connection to become available for issuing block device commands is marked as the active path and used for all subsequent commands; all other connections are then closed. Whenever the active path fails, we reopen all URIs and repeat the process. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [int13] Allow drive to be hooked using the natural drive numberMichael Brown2016-03-221-4/+6
| | | | | | | Interpret the maximum drive number (0xff for hard disks, 0x7f for floppy disks) as meaning "use natural drive number". Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Fix incorrect boolean logicMichael Brown2016-01-191-2/+2
| | | | | | | | | | Commit 53d2d9e ("[uri] Generalise tftp_uri() to pxe_uri()") introduced a regression in which an NFS root path would no longer be treated as an unsupported root path, causing a boot with an NFS root path to fail with a "Could not open SAN device" error. Reported-by: David Evans <dave.evans55@googlemail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Generalise tftp_uri() to pxe_uri()Michael Brown2015-09-021-57/+32Star
| | | | | | | | | | | | | | | | | | 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>
* [autoboot] Display image information as part of the default control flowMichael Brown2015-08-211-0/+1
| | | | | | | | | | When booting without an embedded script, display the imgstat() information immediately before executing the downloaded image. This allows potentially useful diagnostic information (such as the detected image type) to be observed by the user without needing to enter the iPXE shell and manually download the image. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [test] Allow self-tests to report exit status when running under LinuxMichael Brown2015-08-211-7/+11
| | | | | | | | | Allow the return status from an embedded image to propagate out to the eventual return status from main(). When running under Linux, this allows the pass/fail result of unit tests to be observable without having to visually inspect the console output. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Match against parent devices when matching by bus type and locationMichael Brown2015-03-171-2/+7
| | | | | | | | | | | | | | | | | When using iPXE as an option ROM for a PCI USB controller (e.g. via qemu's "-device nec-usb-xhci,romfile=..." syntax), the ROM prefix will set the PCI bus:dev.fn address of the USB controller as the PCI autoboot device. This will cause iPXE to fail to boot from any detected USB network devices, since they will not match the autoboot bus type (or location). Fix by allowing the autoboot bus type and location to match against the network device or any of its parent devices. This allows the match to succeed for USB network devices attached to the selected PCI USB controller. Reported-by: Dan Ellis <Dan.Ellis@displaylink.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+5
| | | | | | | | | | These files cannot be automatically relicensed by util/relicense.pl since they either contain unusual but trivial contributions (such as the addition of __nonnull function attributes), or contain lines dating back to the initial git revision (and so require manual knowledge of the code's origin). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Allow product tag line to be customised via config/branding.hMichael Brown2015-02-111-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Allow product URI to be customised via config/branding.hMichael Brown2015-02-111-2/+1Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Use PRODUCT_SHORT_NAME for end-user visible stringsMichael Brown2015-02-111-3/+5
| | | | | | | | | | | Use PRODUCT_SHORT_NAME instead of a hardcoded "iPXE" for strings which are typically shown in the user interface. Note that this only allows for customisation of the user interface. Where the "iPXE" string serves a technical purpose (such as in the HTTP User-Agent), the string cannot be customised. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Move branding information to config/branding.hMichael Brown2015-02-111-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Allow tftp_uri() to construct a URI with a custom portMichael Brown2015-02-061-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Allow autoboot device to be identified by link-layer addressMichael Brown2014-07-081-9/+59
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Expose build timestamp, build name, and product namesMichael Brown2014-06-241-2/+2
| | | | | | | | Expose the build timestamp (measured in seconds since the Epoch) and the build name (e.g. "rtl8139.rom" or "ipxe.efi"), and provide the product name and product short name in a single centralised location. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Add "--timeout" parameter to image downloading commandsMichael Brown2014-03-101-1/+1
| | | | | | | | | | | | | | | | | | iPXE will detect timeout failures in several situations: network link-up, DHCP, TCP connection attempts, unacknowledged TCP data, etc. This does not cover all possible circumstances. For example, if a connection to a web server is successfully established and the web server acknowledges the HTTP request but never sends any data in response, then no timeout will be triggered. There is no timeout defined within the HTTP specifications, and the underlying TCP connection will not generate a timeout since it has no way to know that the HTTP layer is expecting to receive data from the server. Add a "--timeout" parameter to "imgfetch", "chain", etc. If no progress is made (i.e. no data is downloaded) within the timeout period, then the download will be aborted. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Enable infrastructure to specify an autoboot device locationAlex Williamson2014-03-031-17/+26
| | | | | | | | | | | | | | | | | | iPXE will currently attempt to boot from every network device for which it has a driver. Where a system has more than one network device supported by iPXE, this renders BIOS IPL lists ineffective. Allow an autoboot device location to be specified. If such a location is specified, then only devices matching that location will be used as part of the automatic boot sequence. If no such location is specified, then all devices will be used. Note that this does not affect the "autoboot" command, which will continue to use all devices. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Refactor URI parsing and formattingMichael Brown2014-02-271-11/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | Add support for parsing of URIs containing literal IPv6 addresses (e.g. "http://[fe80::69ff:fe50:5845%25net0]/boot.ipxe"). Duplicate URIs by directly copying the relevant fields, rather than by formatting and reparsing a URI string. This relaxes the requirements on the URI formatting code and allows it to focus on generating human-readable URIs (e.g. by not escaping ':' characters within literal IPv6 addresses). As a side-effect, this allows relative URIs containing parameter lists (e.g. "../boot.php##params") to function as expected. Add validity check for FTP paths to ensure that only printable characters are accepted (since FTP is a human-readable line-based protocol with no support for character escaping). Construct TFTP next-server+filename URIs directly, rather than parsing a constructed "tftp://..." string, Add self-tests for URI functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Force settings into alphabetical order within sectionsMichael Brown2013-12-051-3/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Explicitly separate the concept of a completed fetched settingMichael Brown2013-12-051-21/+24
| | | | | | | | | | The fetch_setting() family of functions may currently modify the definition of the specified setting (e.g. to add missing type information). Clean up this interface by requiring callers to provide an explicit buffer to contain the completed definition of the fetched setting, if required. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Use ifconf() to configure network deviceMichael Brown2013-11-051-3/+2Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Fix shell banner timeoutMichael Brown2013-11-051-1/+3
| | | | | | | | | | | Commit 5e1fa5c ("[parseopt] Add parse_timeout()") introduced a regression causing the shell banner timeout value (calculated in milliseconds) to be treated as a timer tick count, resulting in a timeout of approximately two minutes rather than the intended two seconds. Reported-by: Christian Hesse <list@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Use next-server from filename's settings blockMichael Brown2013-06-241-14/+25
| | | | | | | | | | | Locate the settings block containing the filename, and search only that settings block for the next-server address. This avoids problems caused by misconfigured DHCP servers which provide a next-server address (often defaulting to the DHCP server's own IP address) even when not providing a filename. Originally-implemented-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Split main control flow out of main() into a new function ipxe()Michael Brown2013-03-131-0/+95
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Update FSF mailing address in GPL licence textsMichael Brown2012-07-201-1/+2
| | | | | Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Automatically free autobooted imagesMichael Brown2012-07-201-0/+1
| | | | | | | Simplify the process of booting by ensuring that old images are not left registered after an unsuccessful autoboot attempt. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify image management commands and internal APIMichael Brown2012-03-251-3/+6
| | | | | | | | | | | | | | | | | | | | | | Remove the name, cmdline, and action parameters from imgdownload() and imgdownload_string(). These functions now simply download and return an image. Add the function imgacquire(), which will interpret a "name or URI string" parameter and return either an existing image or a newly downloaded image. Use imgacquire() to merge similar image-management commands that currently differ only by whether they take the name of an existing image or the URI of a new image to download. For example, "chain" and "imgexec" can now be merged. Extend imgstat and imgfree commands to take an optional list of images. Remove the arbitrary restriction on the length of image names. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Eliminate the register_and_xxx_image() functionsMichael Brown2011-10-251-1/+1
| | | | | | | | All users of imgdownload() require registration of the image, so make registration an integral part of imgdownload() itself and simplify the "action" parameter to be one of image_select(), image_exec() et al. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [sanboot] Add "sanhook" and "sanunhook" commandsMichael Brown2011-04-241-43/+56
| | | | | | | Expose the multiple-SAN-drive capability of the iPXE core via the iPXE command line by adding commands to hook and unhook additional drives. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Match terminology in online documentationMichael Brown2011-03-231-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Impose a fixed order on settingsMichael Brown2011-03-231-2/+2
| | | | | | | Improve the appearance of the "config" user interface by ensuring that settings appear in some kind of logical order. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify use of imgdownload()Michael Brown2011-03-091-12/+1Star
| | | | | | | Allow imgdownload() to be called without first having to allocate (and so keep track of) an image. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify image managementMichael Brown2011-03-071-1/+1
| | | | | | | | | | | 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>
* [autoboot] Allow a SAN boot as a fallback if a filename boot returnsMichael Brown2011-03-021-6/+23
| | | | | | | | | | | | | | | 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>
* [autoboot] Tidy up output following NBP executionMichael Brown2011-03-021-1/+7
| | | | | | | | 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>
* [autoboot] Use a custom error number for "nothing to boot"Michael Brown2011-02-281-1/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Add an iPXE error URI to the "nothing to boot" messageMichael Brown2011-02-281-1/+1
| | | | | | | Change the message "No filename or root path specified" to include an iPXE error URI. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Cope properly with empty DHCP filenamesMichael Brown2011-02-011-3/+3
| | | | | | | This (hopefully) fixes a regression introduced in commit e088892 ("[autoboot] Connect SAN disk during a filename boot, if applicable"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Avoid using uri_dup() for constructed TFTP URIMichael Brown2011-02-011-6/+6
| | | | | | | uri_dup() chokes on duplicating a URI with a path that does not begin with a slash. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Allow setting expansions in filename and root-pathMichael Brown2011-01-281-10/+32
| | | | | | | | | | Allow the DHCP filename and root-path to contain settings expansions, such as http://boot.ipxe.org/demo/boot.php?mac=${mac:hexhyp} Originally-implemented-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Connect SAN disk during a filename boot, if applicableMichael Brown2011-01-271-130/+185
| | | | | | | | | | | | | | | | | | | For performing installations direct to a SAN target, it can be very useful to hook a SAN disk and then proceed to perform a filename boot. For example, the user may wish to hook the (empty) SAN installation disk and then boot into the OS installer via TFTP. This provides an alternative mechanism to using "keep-san" and relying on the BIOS to fall through to boot from the installation media, which is unreliable on many BIOSes. When a root-path is specified in addition to a boot filename, attempt to hook the root-path as a SAN disk before booting from the specified filename. Since the root-path may be used for non-SAN purposes (e.g. an NFS root mount point), ignore the root-path if it contains a URI scheme that we do not support. Originally-implemented-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [init] Remove concept of "shutdown exit flags"Michael Brown2011-01-271-4/+0Star
| | | | | | | | Remove the concept of shutdown exit flags, and replace it with a counter used to keep track of exposed interfaces that require devices to remain active. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Merge "netboot" command into "autoboot"Michael Brown2010-11-221-18/+19
| | | | | | | | | | Allow "autoboot" to accept an optional list of network devices, and remove the "netboot" command. This saves around 130 bytes. The "netboot" command has existed for approximately 48 hours, so its removal should not cause backwards compatibility issues for anyone. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Use generic option-parsing libraryMichael Brown2010-11-211-3/+5
| | | | | | Total saving: 32 bytes. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Add "netboot" commandMichael Brown2010-11-201-1/+1
| | | | | Originally-implemented-by: michael-dev@fami-braun.de Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Introduce "skip-san-boot" optionDave Hansen2010-10-221-4/+17
| | | | | | | | | | | | | For some install-to-SAN scenarios, the OS needs to be able to reboot to reread the partition table. On this second boot attempt, the SAN disk will not be empty and so iPXE will attempt to boot from it, rather than falling back to the OS' installation media. Work around this problem by introducing the "skip-san-boot" option, similar in spirit to "keep-san". Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [autoboot] Improve visibility of error messagesMichael Brown2010-10-221-27/+34
| | | | | | | Improve the visibility of error messages by removing the redundant final printing of the URL being booted. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Replace gPXE block-device API with an iPXE asynchronous interfaceMichael Brown2010-09-141-8/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The block device interface used in gPXE predates the invention of even the old gPXE data-transfer interface, let alone the current iPXE generic asynchronous interface mechanism. Bring this old code up to date, with the following benefits: o Block device commands can be cancelled by the requestor. The INT 13 layer uses this to provide a global timeout on all INT 13 calls, with the result that an unexpected passive failure mode (such as an iSCSI target ACKing the request but never sending a response) will lead to a timeout that gets reported back to the INT 13 user, rather than simply freezing the system. o INT 13,00 (reset drive) is now able to reset the underlying block device. INT 13 users, such as DOS, that use INT 13,00 as a method for error recovery now have a chance of recovering. o All block device commands are tagged, with a numerical tag that will show up in debugging output and in packet captures; this will allow easier interpretation of bug reports that include both sources of information. o The extremely ugly hacks used to generate the boot firmware tables have been eradicated and replaced with a generic acpi_describe() method (exploiting the ability of iPXE interfaces to pass through methods to an underlying interface). The ACPI tables are now built in a shared data block within .bss16, rather than each requiring dedicated space in .data16. o The architecture-independent concept of a SAN device has been exposed to the iPXE core through the sanboot API, which provides calls to hook, unhook, boot, and describe SAN devices. This allows for much more flexible usage patterns (such as hooking an empty SAN device and then running an OS installer via TFTP). Signed-off-by: Michael Brown <mcb30@ipxe.org>