aboutsummaryrefslogtreecommitdiff
path: root/src/image
AgeCommit message (Collapse)AuthorFilesLines
2015-03-02[legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown1-1/+1
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>
2015-03-02[legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown5-5/+25
Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-19[efi] Provide dummy device path in efi_image_probe()Michael Brown1-1/+6
Some UEFI platforms will fail the call to LoadImage() with EFI_INVALID_PARAMETER if we do not provide a device path (even though we are providing a non-NULL SourceBuffer). Fix by providing an empty device path for the call to LoadImage() in efi_image_probe(). The call to LoadImage() in efi_image_exec() already constructs and provides a device path (based on the most recently opened SNP device), and so does not require this fix. Reported-by: NICOLAS CATTIE <nicolas.cattie@mpsa.com> Tested-by: NICOLAS CATTIE <nicolas.cattie@mpsa.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-29[efi] Wrap any images loaded by our wrapped imageMichael Brown1-1/+1
Propagate our modified EFI system table to any images loaded by the image that we wrap, thereby allowing us to observe boot services calls made by all subsequent EFI images. Also show details of intercepted ExitBootServices() calls. When wrapping is used, exiting boot services will almost certainly fail, but this at least allows us to see when it happens. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-06[efi] Move abstract device path and handle functions to efi_utils.cMichael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-05[efi] Open device path protocol only at point of useMichael Brown1-1/+1
Some EFI 1.10 systems (observed on an Apple iMac) do not allow us to open the device path protocol with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER and so we cannot maintain a safe, long-lived pointer to the device path. Work around this by instead opening the device path protocol with an attribute of EFI_OPEN_PROTOCOL_GET_PROTOCOL whenever we need to use it. Debugged-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-05[efi] Provide centralised definitions of commonly-used GUIDsMichael Brown1-4/+0
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-31[efi] Avoid unnecessarily passing pointers to EFI_HANDLEsMichael Brown1-2/+2
efi_file_install() and efi_download_install() are both used to install onto existing handles. There is therefore no need to allow for each of their calls to InstallMultipleProtocolInterfaces() to create a new handle. By passing the handle directly (rather than a pointer to the handle), we avoid potential confusion (and erroneous debug message colours). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-30[efi] Fill in loaded image's DeviceHandle if firmware fails to do soMichael Brown1-0/+7
Some EFI 1.10 implementations (observed with a mid-2011 iMac) seem to fail to fill in the DeviceHandle for our loaded images. It is plausible that these implementations fill in the DeviceHandle only if loading the image from a device path (rather than directly from a memory buffer). Work around this problem by filling in DeviceHandle if the firmware leaves it empty. We cannot sensibly fill in FilePath, because we have no way of knowing whether or not the firmware will treat this as a pointer to be freed when the image returns. Reported-by: Curtis Larsen <larsen@dixie.edu> Tested-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-30[efi] Unload started images only on failureMichael Brown1-9/+17
If the StartImage() call returns with no error, then the image must have been started and returned successfully. It either unloaded itself, or it intended to remain loaded (e.g. it was a driver). We therefore do not unload successful images. If there was an error, we attempt to unload the image. This may not work. In particular, there is no way to tell whether an error returned from StartImage() was due to being unable to start the image (in which case we probably should call UnloadImage()), or due to the image itself returning an error (in which case we probably should not call UnloadImage()). We therefore ignore any failures from the UnloadImage() call itself. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-07-16[efi] Allow for interception of boot services calls by loaded imageMichael Brown1-0/+4
When building with DEBUG=efi_wrap, print details of calls made by the loaded image to selected boot services functions. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-14[efi] Disable SNP devices when running iPXE as the applicationMichael Brown1-0/+4
Some UEFI builds will set up a timer to continuously poll any SNP devices. This can drain packets from the network device's receive queue before iPXE gets a chance to process them. Use netdev_rx_[un]freeze() to explicitly indicate when we expect our network devices to be driven via the external SNP API (as we do with the UNDI API on the standard BIOS build), and disable the SNP API except when receive queue processing is frozen. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-12[png] Add support for PNG imagesMichael Brown1-0/+1007
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-27[pnm] Add support for PNM imagesMichael Brown1-0/+415
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-07[cmdline] Generate command option help text automaticallyMichael Brown1-1/+1
Generate the command option help text automatically from the list of defined options. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-01[parseopt] Add parse_timeout()Michael Brown1-2/+2
Parsing a timeout value (specified in milliseconds) into an internal timeout value measured in timer ticks is a common operation. Provide a parse_timeout() value to carry out this conversion automatically. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-25[script] Allow commands following a script labelMichael Brown1-43/+53
Allow commands to be placed on the same line as a label. This allows for improved legibility of loop constructions by incorporating the loop check condition into the same line as the loop label. For example, to iterate over network devices using the forthcoming "inc" command: set idx:int16 0 :loop isset ${net${idx}/mac} || goto loop_done echo net${idx} is a ${net${idx}/chip} with MAC ${net${idx}/mac} inc idx && goto loop :loop_done Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-25[script] Allow initial whitespace on lines containing labelsMichael Brown1-4/+29
Initial whitespace is already accepted on lines containing commands, since it gets ignored by the system() call. Minimise surprise and allow for neater indentation of scripts by also allowing whitespace on lines containing labels. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15[script] Avoid trying to read final character of a zero-length stringMichael Brown1-2/+2
Detected using Valgrind. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15[script] Allow for backslash continuation of script linesMichael Brown1-13/+41
Allow long script lines to be broken up using backslash continuation. For example: choose --default linux --timeout 3000 os \ && goto boot_${os} || goto cancelled Requested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19[efi] Add sample platform-generated error disambiguationsMichael Brown1-3/+19
Add disambiguated errors for LoadImage() and StartImage(), primarily to demonstrate how to use __einfo_uniqify() and __einfo_platformify() in the context of EFI platform errors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19[efi] Perform meaningful error code conversionsMichael Brown1-8/+11
Exploit the redefinition of iPXE error codes to include a "platform error code" to allow for meaningful conversion of EFI_STATUS values to iPXE errors and vice versa. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-19[efi] Fix minor typos in efi_image.cMichael Brown1-3/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-13[efi] Expose downloaded images via EFI_SIMPLE_FILE_SYSTEM_PROTOCOLMichael Brown1-92/+139
Expose iPXE's images as a UEFI file system, allowing the booted image to access all images downloaded by iPXE. This functionality is complementary to the custom iPXE download protocol. The iPXE download protocol allows a booted image to utilise iPXE to download arbitrary URIs, but requires the booted image to specifically support the custom iPXE download protocol. The new functionality limits the booted image to accessing only files that were already downloaded by iPXE (e.g. as part of a script), but can work with any generic UEFI image (e.g. the UEFI shell). Both protocols are provided simultaneously, and are attached to the SNP device handle. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20[legal] Update FSF mailing address in GPL licence textsMichael Brown4-4/+8
Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-23[script] Avoid using stack-allocated memory in process_line()Michael Brown1-14/+15
Script lines can be arbitrarily long; allocate on the heap rather than on the stack. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-19[multiboot] Place multiboot modules low in memoryMichael Brown1-3/+15
Solaris assumes that there is enough space above the Multiboot modules to use as a decompression and scratch area. This assumption is invalid when using iPXE, which places the Multiboot modules near the top of (32-bit) memory. Fix by copying the modules to an area of memory immediately following the loaded kernel. Debugged-by: Michael Brown <mcb30@ipxe.org> Debugged-by: Scott McWhirter <scottm@joyent.com> Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-09[elf] Avoid attempting to load 64-bit ELF binariesMichael Brown1-1/+10
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-03-29[parseopt] Allow "prompt" command to accept character literals for --keyMichael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-02-15[efi] Add iPXE download protocolJarrod Johnson1-2/+124
iPXE exposes some extended capabilities via the PXE FILE API to allow NBPs such as pxelinux to use protocols other than TFTP. Provide an equivalent interface as a UEFI protocol so that EFI binaries may also take advantage of iPXE's extended capabilities. This can be used with a patched version of elilo, for example: http://comments.gmane.org/gmane.comp.boot-loaders.elilo.general/147 Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-08-08[script] Accept labels on lines terminated with CRLFMichael Brown1-1/+7
CRLF line terminators are allowed in scripts; the carriage return is simply interpreted as trailing whitespace and so is ignored. This fails on lines containing script labels, since the label-finding code checks for a line containing only the ":" marker and the label itself (without any trailing whitespace). Fix by allowing a label to be terminated by either a NUL or a whitespace character. Reported-by: Bovey Christian <Christian.Bovey@chuv.ch> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-29[efi] Ensure that all drivers are shut down before the OS bootsMichael Brown1-30/+0
Reported-by: Itay Gazit <itayg@mellanox.co.il> Suggested-by: Michael R Turner <mikeyt@us.ibm.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-09[script] Allow scripts to be replacedMichael Brown1-2/+6
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>
2011-03-09[image] Generalise "currently-running script" to "currently-running image"Michael Brown1-22/+12
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07[prefix] Allow iPXE's own command line to be executed as a scriptMichael Brown2-1/+2
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>
2011-03-07[script] Add "prompt" commandMichael Brown1-0/+67
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>
2011-03-07[script] Add an iPXE error URI to the "not in a script" messageMichael Brown1-2/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-03-07[image] Simplify image managementMichael Brown4-38/+24
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>
2011-03-04[parseopt] Refer to online documentation for command helpMichael Brown1-2/+1
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>
2011-01-27[init] Remove concept of "shutdown exit flags"Michael Brown1-1/+1
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>
2010-11-29[script] Remove "Aborting on <line>" messageMichael Brown1-3/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-29[cmdline] Match user expectations for &&, ||, goto, and exitMichael Brown1-7/+6
The && and || operators should be left-associative, since that is how they are treated in most other languages (including C and Unix shell). For example, in the command: dhcp net0 && goto dhcp_ok || echo No DHCP on net0 if the "dhcp net0" fails then the "echo" should be executed. After an "exit" or a successful "goto", further commands on the same line should never be executed. For example: goto somewhere && echo This should never be printed exit 0 && echo This should never be printed exit 1 && echo This should never be printed An "exit" should cause the current shell or script to terminate and return the specified exit status to its caller. For example: chain test.ipxe && echo Success || echo Failure [in test.ipxe] #!ipxe exit 0 should echo "Success". Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22[script] Allow "exit" to exit a scriptMichael Brown1-14/+21
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22[script] Implement "goto" in iPXE scriptsMichael Brown1-25/+189
Allow script labels to be defined using the syntax :<labelname> (nothing else allowed on the line, including whitespace). Labels are ignored during script execution, but can be used as the target of the "goto" command. For example: #!ipxe goto machine_${net0/ip} || goto machine_default # Linux kernel boot :machine_10.0.0.101 :machine_10.0.0.102 set filename http://my.boot.server/vmlinuz goto done # Default configuration :machine_default set filename pxelinux.0 goto done # Boot selected configuration :done chain ${filename} Originally-implemented-by: Shao Miller <shao.miller@yrdsb.edu.on.ca> Originally-implemented-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-16[ioapi] Move get_memmap() to the I/O API groupPiotr Jaroszyński1-1/+1
pcbios specific get_memmap() is used by the b44 driver making all-drivers builds fail on other platforms. Move it to the I/O API group and provide a dummy implementation on EFI. Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-23[refcnt] Add ref_no_free handlerJoshua Oreman1-11/+1
Since more reference-counted structures than embedded images might want to mark themselves unfreeable, expose a dummy ref_no_free(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22[refcnt] Add ref_init() wrapper functionMichael Brown1-1/+1
Standardise on using ref_init() to initialise an embedded reference count, to match the coding style used by other embedded objects. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-02[efi] Add the "snpnet" driverGeoff Lywood1-3/+34
Add a new network driver that consumes the EFI Simple Network Protocol. Also add a bus driver that can find the Simple Network Protocol that iPXE was loaded from; the resulting behavior is similar to the "undionly" driver for BIOS systems. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-31[libc] Enable automated extraction of error usage reportsMichael Brown1-11/+14
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-22[script] Accept "#!gpxe" as well as "#!ipxe" as a script magic markerMichael Brown1-4/+9
Signed-off-by: Michael Brown <mcb30@ipxe.org>