/** Image will be automatically unregistered after execution */
#define IMAGE_AUTO_UNREGISTER 0x0008
+/** Image will be hidden from enumeration */
+#define IMAGE_HIDDEN 0x0010
+
/** An executable image type */
struct image_type {
/** Name of this image type */
#define for_each_image_safe( image, tmp ) \
list_for_each_entry_safe ( (image), (tmp), &images, list )
-/**
- * Test for existence of images
- *
- * @ret existence Some images exist
- */
-static inline int have_images ( void ) {
- return ( ! list_empty ( &images ) );
-}
-
/**
* Retrieve first image
*
len = 0;
for_each_image ( image ) {
+ /* Skip hidden images */
+ if ( image->flags & IMAGE_HIDDEN )
+ continue;
+
/* Pad to alignment boundary */
pad_len = ( ( -reader->pos ) & ( INITRD_ALIGN - 1 ) );
if ( pad_len ) {
/* Construct directory entries for image-backed files */
index = file->pos;
for_each_image ( image ) {
- if ( index-- == 0 ) {
- efi_file_image ( &entry, image );
- efirc = efi_file_info ( &entry, len, data );
- if ( efirc == 0 )
- file->pos++;
- return efirc;
- }
+
+ /* Skip hidden images */
+ if ( image->flags & IMAGE_HIDDEN )
+ continue;
+
+ /* Skip preceding images */
+ if ( index-- )
+ continue;
+
+ /* Construct directory entry */
+ efi_file_image ( &entry, image );
+ efirc = efi_file_info ( &entry, len, data );
+ if ( efirc == 0 )
+ file->pos++;
+ return efirc;
}
/* No more entries */
EFI_DISK_IO_PROTOCOL *diskio;
void *interface;
} diskio;
+ struct image *image;
EFI_STATUS efirc;
int rc;
goto err_initrd_claim;
/* Install Linux initrd fixed device path file if non-empty */
- if ( have_images() &&
- ( ( rc = efi_file_path_install ( &efi_file_initrd ) ) != 0 ) ) {
- goto err_initrd_install;
+ for_each_image ( image ) {
+ if ( image->flags & IMAGE_HIDDEN )
+ continue;
+ if ( ( rc = efi_file_path_install ( &efi_file_initrd ) ) != 0 )
+ goto err_initrd_install;
+ break;
}
return 0;
printf ( " [SELECTED]" );
if ( image->flags & IMAGE_AUTO_UNREGISTER )
printf ( " [AUTOFREE]" );
+ if ( image->flags & IMAGE_HIDDEN )
+ printf ( " [HIDDEN]" );
if ( image->cmdline )
printf ( " \"%s\"", image->cmdline );
printf ( "\n" );