aboutsummaryrefslogtreecommitdiff
path: root/src/config/config.c
AgeCommit message (Collapse)AuthorFilesLines
37 hours[usb] Add "usbscan" command for iterating over USB devicesMichael Brown1-0/+3
Implement a "usbscan" command as a direct analogy of the existing "pciscan" command, allowing scripts to iterate over all detected USB devices. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2024-08-29[image] Add the "imgdecrypt" commandMichael Brown1-0/+3
Add the "imgdecrypt" command that can be used to decrypt a detached encrypted data image using a cipher key obtained from a separate CMS envelope image. For example: # Create non-detached encrypted CMS messages # openssl cms -encrypt -binary -aes-256-gcm -recip client.crt \ -in vmlinuz -outform DER -out vmlinuz.cms openssl cms -encrypt -binary -aes-256-gcm -recip client.crt \ -in initrd.img -outform DER -out initrd.img.cms # Detach data from envelopes (using iPXE's contrib/crypto/cmsdetach) # cmsdetach vmlinuz.cms -d vmlinuz.dat -e vmlinuz.env cmsdetach initrd.img.cms -d initrd.img.dat -e initrd.img.env and then within iPXE: #!ipxe imgfetch http://192.168.0.1/vmlinuz.dat imgfetch http://192.168.0.1/initrd.img.dat imgdecrypt vmlinuz.dat http://192.168.0.1/vmlinuz.env imgdecrypt initrd.img.dat http://192.168.0.1/initrd.img.env boot vmlinuz Signed-off-by: Michael Brown <mcb30@ipxe.org>
2024-06-20[form] Add support for dynamically created interactive formsMichael Brown1-0/+3
Add support for presenting a dynamic user interface as an interactive form, alongside the existing support for presenting a dynamic user interface as a menu. An interactive form may be used to allow a user to input (or edit) values for multiple settings on a single screen, as a user-friendly alternative to prompting for setting values via the "read" command. In the present implementation, all input fields must fit on a single screen (with no scrolling), and the only supported widget type is an editable text box. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2024-06-20[dynui] Generalise the concept of a menu to a dynamic user interfaceMichael Brown1-1/+1
We currently have an abstract model of a dynamic menu as a list of items, each of which has a name, a description, and assorted metadata such as a shortcut key. The "menu" and "item" commands construct representations in this abstract model, and the "choose" command then presents the items as a single-choice menu, with the selected item's name used as the output value. This same abstraction may be used to model a dynamic form as a list of editable items, each of which has a corresponding setting name, an optional description label, and assorted metadata such as a shortcut key. By defining a "form" command as an alias for the "menu" command, we could construct and present forms using commands such as: #!ipxe form Login to ${url} item username Username or email address item --secret password Password present or #!ipxe form Configure IPv4 networking for ${netX/ifname} item netX/ip IPv4 address item netX/netmask Subnet mask item netX/gateway Gateway address item netX/dns DNS server address present Reusing the same abstract model for both menus and forms allows us to minimise the increase in code size, since the implementation of the "form" and "item" commands is essentially zero-cost. Rename everything within the abstract data model from "menu" to "dynamic user interface" to reflect this generalisation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2024-03-15[ucode] Add support for updating x86 microcodeMichael Brown1-0/+3
Intel and AMD distribute microcode updates, which are typically applied by the BIOS and/or the booted operating system. BIOS updates can be difficult to obtain and cumbersome to apply, and are often neglected. Operating system updates may be subject to strict change control processes, particularly for production workloads. There is therefore value in being able to update the microcode at boot time using a freshly downloaded microcode update file, particularly in scenarios where the physical hardware and the installed operating system are controlled by different parties (such as in a public cloud infrastructure). Add support for parsing Intel and AMD microcode update images, and for applying the updates to all CPUs in the system. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-06-09[efi] Provide read-only access to EFI variables via settings mechanismMichael Brown1-0/+3
EFI variables do not map neatly to the iPXE settings mechanism, since the EFI variable identifier includes a namespace GUID that cannot cleanly be supplied as part of a setting name. Creating a new EFI variable requires the variable's attributes to be specified, which does not fit within iPXE's settings concept. However, EFI variable names are generally unique even without the namespace GUID, and EFI does provide a mechanism to iterate over all existent variables. We can therefore provide read-only access to EFI variables by comparing only the names and ignoring the namespace GUIDs. Provide an "efi" settings block that implements this mechanism using a syntax such as: echo Platform language is ${efi/PlatformLang:string} show efi/SecureBoot:int8 Settings are returned as raw binary values by default since an EFI variable may contain boolean flags, integer values, ASCII strings, UCS-2 strings, EFI device paths, X.509 certificates, or any other arbitrary blob of data. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-05-22[efi] Add "shim" commandMichael Brown1-0/+3
Allow a shim to be used to facilitate booting a kernel using a script such as: kernel /images/vmlinuz console=ttyS0,115200n8 initrd /images/initrd.img shim /images/shimx64.efi boot Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-12[image] Support archive image formats independently of "imgextract" commandMichael Brown1-3/+6
Support for the zlib and gzip archive image formats is currently included only if the IMAGE_ARCHIVE_CMD is used to enable the "imgextract" command. The ability to transparently execute a single-member archive image without using the "imgextract" command renders this unintuitive: a user wanting to gain the ability to boot a gzip-compressed kernel image would expect to have to enable IMAGE_GZIP rather than IMAGE_ARCHIVE_CMD. Reverse the inclusion logic, so that archive image formats must now be enabled explicitly (via IMAGE_GZIP and/or IMAGE_ZLIB), with the archive image management commands dragged in as needed if any archive image formats are enabled. The archive image management commands may be explicitly disabled via IMAGE_ARCHIVE_CMD if necessary. This matches the behaviour of IBMGMT_CMD and similar options, where the relevant commands are included only when something else already drags in the underlying feature. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-08[image] Add "imgextract" command for extracting archive imagesMichael Brown1-0/+3
Add the concept of extracting an image from an archive (which could be a single-file archive such as a gzip-compressed file), along with an "imgextract" command to expose this functionality to scripts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-01-22[image] Add the "imgmem" commandMichael Brown1-0/+3
Provide the "imgmem" command to create an image from an existing block of memory, for debugging purposes only. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-08-01[shell] Enable "shell" command even when BANNER_TIMEOUT is zeroMichael Brown1-0/+3
Setting BANNER_TIMEOUT to zero removes the only symbol reference to shell.o, causing the "shell" command to become unavailable. Add SHELL_CMD in config/general.h (enabled by default) which will explicitly drag in shell.o regardless of the value of BANNER_TIMEOUT. Reported-by: Julian Brost <julian@0x4a42.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-05-23[acpi] Expose ACPI tables via settings mechanismMichael Brown1-0/+3
Allow values to be read from ACPI tables using the syntax ${acpi/<signature>.<index>.0.<offset>.<length>} where <signature> is the ACPI table signature as a 32-bit hexadecimal number (e.g. 0x41504093 for the 'APIC' signature on the MADT), <index> is the index into the array of tables matching this signature, <offset> is the byte offset within the table, and <length> is the field length in bytes. Numeric values are returned in reverse byte order, since ACPI numeric values are usually little-endian. For example: ${acpi/0x41504943.0.0.0.0} - entire MADT table in raw hex ${acpi/0x41504943.0.0.0x0a.6:string} - MADT table OEM ID ${acpi/0x41504943.0.0.0x24.4:uint32} - local APIC address Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-08-31[cmdline] Add certificate management commandsMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-29[pixbuf] Enable PNG format by defaultMichael Brown1-6/+0
Enable IMAGE_PNG (but not IMAGE_PNM) by default, and drag in the relevant objects only when image_pixbuf() is present in the binary. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-29[crypto] Enable both DER and PEM formats by defaultMichael Brown1-6/+0
Enable both IMAGE_DER and IMAGE_PEM by default, and drag in the relevant objects only when image_asn1() is present in the binary. This allows "imgverify" to transparently use either DER or PEM signature files. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-29[crypto] Add PEM image formatMichael Brown1-0/+3
Add PEM-encoded ASN.1 as an image format. We accept as PEM any image containing a line starting with a "-----BEGIN" boundary marker. We allow for PEM files containing multiple ASN.1 objects, such as a certificate chain produced by concatenating individual certificate files. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-29[crypto] Add DER image formatMichael Brown1-0/+3
Add DER-encoded ASN.1 as an image format. There is no fixed signature for DER files. We treat an image as DER if it comprises a single valid SEQUENCE object covering the entire length of the image. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-06-13[cmdline] Add "ntp" commandMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-10-16[build] Generalise CONSOLE_VESAFB to CONSOLE_FRAMEBUFFERMichael Brown1-9/+0
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-08-17[http] Rewrite HTTP core to support content encodingsMichael Brown1-0/+3
Rewrite the HTTP core to allow for the addition of arbitrary content encoding mechanisms, such as PeerDist and gzip. The core now exposes http_open() which can be used to create requests with an explicitly selected HTTP method, an optional requested content range, and an optional request body. A simple wrapper provides the preexisting behaviour of creating either a GET request or an application/x-www-form-urlencoded POST request (if the URI includes parameters). The HTTP SAN interface is now implemented using the generic block device translator. Individual blocks are requested using http_open() to create a range request. Server connections are now managed via a connection pool; this allows for multiple requests to the same server (e.g. for SAN blocks) to be completely unaware of each other. Repeated HTTPS connections to the same server can reuse a pooled connection, avoiding the per-connection overhead of establishing a TLS session (which can take several seconds if using a client certificate). Support for HTTP SAN booting and for the Basic and Digest authentication schemes is now optional and can be controlled via the SANBOOT_PROTO_HTTP, HTTP_AUTH_BASIC, and HTTP_AUTH_DIGEST build configuration options in config/general.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-06-29[serial] Use new UART abstraction in serial console driverMichael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-05-19[int13con] Add basic ability to log to a local disk via INT 13Michael Brown1-0/+3
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-04-24[vram] Add "vram" built-in setting to dump video RAMMichael Brown1-0/+3
The "vram" setting returns the (Base64-encoded) contents of video RAM, and can be used to capture a screenshot. For example: after running memtest.0 and encountering an error, the output can be captured and sent to a remote server for later diagnosis: #!ipxe chain -a http://server/memtest.0 && goto ok || goto bad :bad params param errno ${errno} param vram ${vram} chain -a http://server/report.php##params :ok Inspired-by: Christian Nilsson <nikize@gmail.com> Originally-implemented-by: Christian Nilsson <nikize@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-05[build] Fix the REQUIRE_SYMBOL mechanismMichael Brown1-0/+2
At some point in the past few years, binutils became more aggressive at removing unused symbols. To function as a symbol requirement, a relocation record must now be in a section marked with @progbits and must not be in a section which gets discarded during the link (either via --gc-sections or via /DISCARD/). Update REQUIRE_SYMBOL() to generate relocation records meeting these criteria. To minimise the impact upon the final binary size, we use existing symbols (specified via the REQUIRING_SYMBOL() macro) as the relocation targets where possible. We use R_386_NONE or R_X86_64_NONE relocation types to prevent any actual unwanted relocation taking place. Where no suitable symbol exists for REQUIRING_SYMBOL() (such as in config.c), the macro PROVIDE_REQUIRING_SYMBOL() can be used to generate a one-byte-long symbol to act as the relocation target. If there are versions of binutils for which this approach fails, then the fallback will probably involve killing off REQUEST_SYMBOL(), redefining REQUIRE_SYMBOL() to use the current definition of REQUEST_SYMBOL(), and postprocessing the linked ELF file with something along the lines of "nm -u | wc -l" to check that there are no undefined symbols remaining. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-04[build] Remove obsolete and unused portions of config.cMichael Brown1-28/+0
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02[legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown1-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>
2015-02-26[legal] Include full licence text for all GPL2_OR_LATER filesMichael Brown1-2/+12
Add the standard warranty disclaimer and Free Software Foundation address paragraphs to the licence text where these are not currently present. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-04-27[cmdline] Add "profstat" command to display profiling statisticsMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-03-02[cmdline] Add the "ipstat" commandMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-01-12[png] Add support for PNG imagesMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-28[vesafb] Add VESA frame buffer consoleMichael Brown1-0/+3
The VESA frame buffer console uses the VESA BIOS extensions (VBE) to enumerate video modes, selects an appropriate mode, and then hands off to the generic frame buffer code. The font is extracted from the VGA BIOS, avoiding the need to provide an external font file. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-28[cmdline] Add "console" command to configure consoleMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-11-27[pnm] Add support for PNM imagesMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-10-21[cmdline] Add "ping" commandMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-25[cmdline] Add "nstat" commandMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-09-03[ipv6] Replace IPv6 stackMichael Brown1-0/+3
Replace the existing partially-implemented IPv6 stack with a fresh implementation. This implementation is not yet complete. The IPv6 transmit and receive datapaths are functional (including fragment reassembly and parsing of arbitrary extension headers). NDP neighbour solicitations and advertisements are supported. ICMPv6 echo is supported. At present, only link-local addresses may be used, and there is no way to specify an IPv6 address as part of a URI (either directly or via a DNS lookup). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-19[cmdline] Add "params" and "param" commands to manage form parameter listsMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-12[settings] Expose memory map via settings mechanismMichael Brown1-0/+3
Allow memory map entries to be read using the syntax ${memmap/<region>.<properties>.<scale>} where <region> is the index of the memory region, <properties> is a bitmask where bit 0 represents the start address and bit 1 represents the length (allowing the end address to be encoded by having both bits 0 and 1 set), and <scale> is the number of bits by which to shift the result. This allows for several values of interest to be encoded. For example: ${memmap/<region>.1.0:hexraw} # 64-bit start address of <region> ${memmap/<region>.2.0:hexraw} # 64-bit length of <region>, in bytes ${memmap/<region>.3.0:hexraw} # 64-bit end address of <region> ${memmap/<region>.2.10:int32} # Length of <region>, in kB ${memmap/<region>.2.20:int32} # Length of <region>, in MB The numeric encoding is slightly more sophisticated than described here, allowing a single encoding to cover multiple regions. (See the source code for details.) The primary use case for this feature is to provide the total system memory size (in MB) via the "memsize" predefined setting. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-07[settings] Expose CPUID instruction via settings mechanismMichael Brown1-0/+3
Allow CPUID values to be read using the syntax ${cpuid/<register>.<function>} For example, ${cpuid/2.0x80000001} will give the value of %ecx after calling CPUID with %eax=0x80000001. Values for <register> are encoded as %eax=0, %ebx=1, %ecx=2, %edx=3. The numeric encoding is more sophisticated than described above, allowing for settings such as the CPU model (obtained by calling CPUID with %eax=0x80000002-0x80000004 inclusive and concatenating the values returned in %eax:%ebx:%ecx:%edx). See the source code for details. The "cpuvendor" and "cpumodel" settings provide easy access to these more complex CPUID settings. This functionality is intended to complement the "cpuid" command, which allows for testing individual CPUID feature bits. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-08-05[cmdline] Add "pciscan" command to allow iteration over PCI devicesMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15[nfs] Add support for NFS protocolMarin Hannache1-0/+3
Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-15[cmdline] Add "poweroff" commandMarin Hannache1-0/+3
Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-13[settings] Expose PCI configuration space via settings mechanismMichael Brown1-0/+3
Allow values to be read from PCI configuration space using the syntax ${pci/<busdevfn>.<offset>.<length>} where <busdevfn> is the bus:dev.fn address of the PCI device (expressed as a single integer, as returned by ${net0/busloc}), <offset> is the offset within PCI configuration space, and <length> is the length within PCI configuration space. Values are returned in reverse byte order, since PCI configuration space is little-endian by definition. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-07-13[settings] Add config/settings.hMichael Brown1-1/+6
Move VMWARE_SETTINGS build configuration option from config/sideband.h to a new config/settings.h. Existing instances of config/local/sideband.h will not be affected, since config.c still #includes config/sideband.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10[console] Add support for the bochs/qemu debug port consoleMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10[cmdline] Add standalone "nslookup" commandPatrick Plenefisch1-0/+3
Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-05[sdi] Add support for SDI imagesMichael Brown1-0/+3
Add support (disabled by default) for booting .sdi images as used by Windows XP Embedded. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09[cmdline] Add "sync" commandMichael Brown1-0/+3
Add "sync" command (loosely based on the Unix "sync"), which will wait for any pending operations to complete. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-07[cmdline] Add "cpuid" commandMichael Brown1-0/+3
Allow x86 CPU feature flags (such as support for 64-bit mode) to be checked using the "cpuid" command. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-04-24[image] Remove non-working image loadersMarin Hannache1-9/+0
The WinCE, a.out and FreeBSD loaders are designed to be #included by core/loader.c, which no longer exists. These old loaders are not usable anymore and cause compilation failures when enabled in config/general.h. Signed-off-by: Marin Hannache <mareo@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>