aboutsummaryrefslogtreecommitdiff
path: root/src/hci
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-05-13 20:27:58 +0100
committerMichael Brown <mcb30@ipxe.org>2023-05-17 14:42:03 +0100
commitc4a8d90387437425faec91bdee42a254944bab76 (patch)
tree325261141009b5dc94acf93f442ae1646afa8468 /src/hci
parent79d85e29aa09c47f1d5a2be9eddd10e61fb22035 (diff)
downloadipxe-c4a8d90387437425faec91bdee42a254944bab76.zip
ipxe-c4a8d90387437425faec91bdee42a254944bab76.tar.gz
ipxe-c4a8d90387437425faec91bdee42a254944bab76.tar.bz2
[image] Generalise concept of selected image
Most image flags are independent values: any combination of flags may be set for any image, and the flags for one image are independent of the flags for any other image. The "selected" flag does not follow this pattern: at most one image may be marked as selected at any time. When invoking a kernel via the UEFI shim, there will be multiple "special" images: the selected kernel itself, the shim image, and potentially a shim-signed GRUB binary to be used as a crutch to assist shim in loading the kernel (since current versions of the UEFI shim are not capable of directly loading a Linux kernel). Remove the "selected" image flag and replace it with a general concept of an image tag with the same semantics: a given tag may be assigned to at most one image, an image may be found by its tag only while the image is currently registered, and a tag will survive unregistration and reregistration of an image (if it has not already been assigned to a new image). For visual consistency, also replace the current image pointer with a current image tag. The image pointer stored within the image tag holds only a weak reference to the image, since the selection of an image should not prevent that image from being freed. (The strong reference to the currently executing image is held locally within the execution scope of image_exec(), and is logically separate from the current image pointer.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/commands/image_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hci/commands/image_cmd.c b/src/hci/commands/image_cmd.c
index 4a7c500..bf97b4d 100644
--- a/src/hci/commands/image_cmd.c
+++ b/src/hci/commands/image_cmd.c
@@ -129,7 +129,7 @@ static int imgsingle_exec ( int argc, char **argv,
&image ) ) != 0 )
goto err_acquire;
} else {
- image = image_find_selected();
+ image = find_image_tag ( &selected_image );
if ( ! image ) {
printf ( "No image selected\n" );
goto err_acquire;