Signed-off-by: Michael Brown <mcb30@ipxe.org>
* booting fails for any reason, offer a second chance
* to enter the shell for diagnostics.
*/
- if ( have_images() ) {
- for_each_image ( image ) {
- image_exec ( image );
- break;
- }
+ if ( ( image = first_image() ) != NULL ) {
+ image_exec ( image );
} else {
autoboot();
}
return ( ! list_empty ( &images ) );
}
+/**
+ * Retrieve first image
+ *
+ * @ret image Image, or NULL
+ */
+static inline struct image * first_image ( void ) {
+ return list_first_entry ( &images, struct image, list );
+}
+
extern struct image * alloc_image ( void );
extern void image_set_uri ( struct image *image, struct uri *uri );
extern int image_set_cmdline ( struct image *image, const char *cmdline );