summaryrefslogtreecommitdiffstats
path: root/src/core/image.c
Commit message (Collapse)AuthorAgeFilesLines
* [pixbuf] Enable PNG format by defaultMichael Brown2016-07-291-24/+0Star
| | | | | | | 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>
* [crypto] Enable both DER and PEM formats by defaultMichael Brown2016-07-291-35/+0Star
| | | | | | | | | | 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>
* [image] Add image_asn1() to extract ASN.1 objects from imageMichael Brown2016-07-291-0/+35
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Skip misleading "format not recognised" error messageMichael Brown2016-04-281-1/+1
| | | | | | | | | | | | Return success (rather than failure) after an image format has been correctly identified. This has no practical effect, since the return value from image_probe() is deliberately never used, but avoids a somewhat surprising and misleading "format not recognised" error message when debugging is enabled. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Provide image_set_uri() to modify an image's URIMichael Brown2016-01-091-10/+28
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Detect image type when image is first registeredMichael Brown2015-08-211-41/+42
| | | | | | | | | | | | | | | | | | | The current usage pattern of image_probe() is a legacy from the time before commit 34b6ecb ("[image] Simplify image management") when loading an image to its executable location in memory was a separate action from actually executing the image. Call image_probe() as soon as an image is registered. This allows "imgstat" to display image type information for all images and allows image-consuming code to assume that image->type is already set correctly. Ignore failures if image_probe() does not recognise the image, since we do expect to handle unrecognised images (initrds, modules, etc). Unrecognised images will be left with a NULL image->type, which image-consuming code can easily check. 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>
* [image] Add image_pixbuf() to create pixel buffer from imageMichael Brown2013-11-271-0/+26
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Allow for non-executable image formatsMichael Brown2013-11-271-0/+2
| | | | 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] Add "--replace" optionMichael Brown2012-07-201-6/+10
| | | | | | | | | Expose image tail-recursion to iPXE scripts via the "--replace" option. This functions similarly to exec() under Unix: the currently-executing script is replaced with the new image (as opposed to running the new image as a subroutine). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Add "--autofree" optionMichael Brown2012-07-201-11/+21
| | | | | | | Allow images to be automatically freed after execution completes (successfully or otherwise). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Avoid potential NULL pointer dereferenceMichael Brown2012-05-081-3/+5
| | | | | | Detected using Valgrind. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Fix use-after-free in debug messagesMichael Brown2012-03-301-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Log image executionsMichael Brown2012-03-271-0/+13
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify image management commands and internal APIMichael Brown2012-03-251-19/+42
| | | | | | | | | | | | | | | | | | | | | | 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] Add concept of trusted imagesMichael Brown2012-03-221-0/+46
| | | | | | | | | | | | | | | | Trusted images may always be executed. Untrusted images may be executed only if the current image trust requirement allows untrusted images. Images can be marked as trusted using image_trust(), and marked as untrusted using image_untrust(). The current image trust requirement can be changed using image_set_trust(). It is possible to make the change permanent, in which case any future attempts to change the image trust requirement will fail. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Eliminate the register_and_xxx_image() functionsMichael Brown2011-10-251-2/+6
| | | | | | | | 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>
* [image] Avoid ending up with multiple selected images on re-registrationMichael Brown2011-03-091-0/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify use of imgdownload()Michael Brown2011-03-091-1/+50
| | | | | | | 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] Generalise "currently-running script" to "currently-running image"Michael Brown2011-03-091-1/+11
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Move the register_and_{select|boot}_image() functions to imgmgmt.cMichael Brown2011-03-091-39/+0Star
| | | | | | | | 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>
* [image] Allow image_set_cmdline() to clear the command lineMichael Brown2011-03-071-4/+8
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify image managementMichael Brown2011-03-071-94/+88Star
| | | | | | | | | | | 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>
* [image] Fix a memory leak in free_image()Piotr Jaroszyński2010-07-111-0/+1
| | | | | | | | | image_set_cmdline() strdup()s cmdline, which free_image() doesn't clean up. Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [refcnt] Add ref_init() wrapper functionMichael Brown2010-06-221-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>
* [build] Rename gPXE to iPXEMichael Brown2010-04-201-4/+4
| | | | | | | | | | | Access to the gpxe.org and etherboot.org domains and associated resources has been revoked by the registrant of the domain. Work around this problem by renaming project from gPXE to iPXE, and updating URLs to match. Also update README, LOG and COPYRIGHTS to remove obsolete information. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-181-0/+2
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* [tables] Redefine methods for accessing linker tablesMichael Brown2009-03-131-7/+1Star
| | | | | | | | | | | | | | | Intel's C compiler (icc) chokes on the zero-length arrays that we currently use as part of the mechanism for accessing linker table entries. Abstract away the zero-length arrays, to make a port to icc easier. Introduce macros such as for_each_table_entry() to simplify the common case of iterating over all entries in a linker table. Represent table names as #defined string constants rather than unquoted literals; this avoids visual confusion between table names and C variable or type names, and also allows us to force a compilation error in the event of incorrect table names.
* [comboot] Fix reference counting on replacement imagesMichael Brown2009-02-171-2/+1Star
| | | | When chaining COMBOOT images, the old images now get freed correctly.
* [comboot] Allow for tail recursion of COMBOOT imagesMichael Brown2009-02-171-3/+27
| | | | | | | | | | | | Multi-level menus via COMBOOT rely on the COMBOOT program being able to exit and invoke a new COMBOOT program (the next menu). This works, but rapidly (within about five iterations) runs out of space in gPXE's internal stack, since each new image is executed in a new function context. Fix by allowing tail recursion between images; an image can now specify a replacement image for itself, and image_exec() will perform the necessary tail recursion.
* [image] Revert "clear LOADED flag" patchMichael Brown2008-07-081-10/+1Star
| | | | | | | | | Clearing the LOADED flag actually prevents users from doing clever things such as loading an image, then loading a patch image, then executing the first image. (image_exec() checks for IMAGE_LOADED, so this sequence of operations will fail if the LOADED flag gets cleared.) This reverts commit 14c080020fb37cb34fe74213393f47bd2ad8b9bc.
* [image] Clear LOADED flag on all other images when loading a new imageMichael Brown2008-07-081-1/+10
| | | | | | Loading an image may overwrite part or all of any previously-loaded images, so we should clear the LOADED flag for all images prior to attempting to load a new image.
* Set current working URI to be that of the executable image whenMichael Brown2007-08-071-3/+12
| | | | | executing any image, not just a script. (This will enable pxelinux to use relative URIs, should it wish to.)
* Allow images to hold references to the originating URI.Michael Brown2007-08-021-0/+78
| | | | Some shuffling around of the image management code; this needs tidying up.
* convert to zallocHolger Lubitz2007-07-061-2/+1Star
|
* Scripts temporarily deregister themselves while executing. ThisMichael Brown2007-06-091-14/+0Star
| | | | | allows us to avoid execution loops without having to hack around the image registration order.
* Add reference counting to register/unregister procedure.Michael Brown2007-06-091-0/+32
|
* Use stdio.h instead of vsprintf.hMichael Brown2007-01-191-1/+1
|
* Rename e{malloc,realloc,free} to u{malloc,realloc,free}, to more obviouslyMichael Brown2007-01-161-1/+0Star
| | | | | reflect the fact that they allocate and deallocate user memory (i.e. things reached through a userptr_t).
* Once image type has been set, do not autoprobe furtherMichael Brown2007-01-141-0/+5
|
* Allow load() and exec() methods to be NULL.Michael Brown2007-01-141-0/+9
|
* Print image physical location in registration message.Michael Brown2007-01-121-1/+3
|
* Let ifmgmt.c take care of calling efree(), since it's the once whichMichael Brown2007-01-121-26/+33
| | | | | | | took out the contract to eventually call efree() when it called fetch(). Maintain the most recently loaded image at the start of the list, so that imgautoselect() will pick it.
* Add debug messageMichael Brown2007-01-121-0/+1
|
* fetch() now knows nothing about struct image; it simply loads a file andMichael Brown2007-01-121-3/+1Star
| | | | returns the allocated buffer.
* Add free_imageMichael Brown2007-01-121-0/+17
|
* Added IMAGE_LOADED flag and find_image()Michael Brown2007-01-121-0/+27
|
* Allow for named images.Michael Brown2007-01-121-3/+5
|
* Provide registration mechanism for loaded images, so that we can e.g.Michael Brown2007-01-121-62/+115
| | | | | | | | refer to them by name from the command line, or build them into a multiboot module list. Use setting image->type to disambiguate between "not my image" and "bad image"; this avoids relying on specific values of the error code.