Skip to contentSkip to conversation

Split 3: boot script support

PATCH In review Bean 2 participants 4 messages Apr 11, 2009 – May 16, 2009

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 Split 3: boot script support

Hi,

This patch allows grub-mkimage to embed a boot script in core.img, which would be executed by the rescue parser before switching to normal mode.

Signature · 1 line
Bean
include/grub/kernel.h +1 -0
index adaee58..6b17ea8 100644
@@ -31,6 +31,7 @@ struct grub_module_header
   {
     OBJ_TYPE_ELF,
     OBJ_TYPE_MEMDISK,
+    OBJ_TYPE_CONFIG
   }  grub_module_header_types;
 
   /* The size of object (including this header).  */
kern/main.c +19 -0
index 494f176..9215d55 100644
@@ -74,6 +74,24 @@ grub_load_modules (void)
   grub_module_iterate (hook);
 }
 
+static void
+grub_load_config (void)
+{
+  auto int hook (struct grub_module_header *);
+  int hook (struct grub_module_header *header)
+    {
+      /* Not an ELF module, skip.  */
+      if (header->type != OBJ_TYPE_CONFIG)
+	return 0;
+
+      grub_parser_execute ((char *) header +
+			   sizeof (struct grub_module_header));
+      return 1;
+    }
+
+  grub_module_iterate (hook);
+}
+
 /* Write hook for the environment variables of root. Remove surrounding
    parentheses, if any.  */
 static char *
@@ -153,6 +171,7 @@ grub_main (void)
   grub_register_rescue_parser ();
   grub_register_rescue_reader ();
 
+  grub_load_config ();
   grub_load_normal_mode ();
   grub_reader_loop (0);
 }
util/i386/pc/grub-mkimage.c +38 -4

99 lines not on this page · raw message

#1 lore raw

Hello, I find this useful. It permits e.g. to have root by uuid.

Quoted 1 line

/* Not an ELF module, skip. */

This comment is out of sync

Quoted 14 lines · Bean

Hi,

This patch allows grub-mkimage to embed a boot script in core.img, which would be executed by the rescue parser before switching to normal mode.

------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
author
#2 lore raw

Hi,

Since the script split patch has been committed, this one should be quite trivial. I'd commit it in a few days if there is no objection.

Quoted 34 lines · phcoder

Hello, I find this useful. It permits e.g. to have root by uuid.

Quoted 1 line

/* Not an ELF module, skip.  */

This comment is out of sync

Quoted 9 lines · Bean

Hi,

This patch allows grub-mkimage to embed a boot script in core.img, which would be executed by the rescue parser before switching to normal mode.

Quoted 6 lines

------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

--

Regards
Vladimir 'phcoder' Serbinenko

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 1 line
Bean
author
#3 lore raw

Hi,

Committed.

Quoted 46 lines · Bean

Hi,

Since the script split patch has been committed, this one should be quite trivial. I'd commit it in a few days if there is no objection.

Quoted 25 lines · phcoder

Hello, I find this useful. It permits e.g. to have root by uuid.

Quoted 1 line

/* Not an ELF module, skip.  */

This comment is out of sync

Quoted 9 lines · Bean

Hi,

This patch allows grub-mkimage to embed a boot script in core.img, which would be executed by the rescue parser before switching to normal mode.

Quoted 6 lines

------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

--

Quoted 9 lines

Regards
Vladimir 'phcoder' Serbinenko

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

--
Bean

Signature · 1 line
Bean