Skip to contentSkip to conversation

doc: Reference configure.ac instead of configure.in

PATCH New Hans Ulrich Niedermann 1 participant 3 messages May 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: Reference configure.ac instead of configure.in

Change the textual reference in the INSTALL file to configure.in to refer to configure.ac instead.

The grub configure.in has been renamed to configure.ac in 2003.

INSTALL +1 -1
index e490d22d3..7eb0bd1cc 100644
@@ -88,7 +88,7 @@ be considered for the next release.  If at some point `config.cache'
 contains results you don't want to keep, you may remove or edit it.
 
 The file `configure.ac' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.in' if you want to change
+called `autoconf'.  You only need `configure.ac' if you want to change
 it or regenerate `configure' using a newer version of `autoconf'.
 
 
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 mb2 loader: Fix header size, alignment for Multiboot 2

Change the old Multiboot 1 header size both in the explanatory comment and in the for loop condition actually looking for a Multiboot 2 header to the actual Multiboot 2 header size.

This also fixes the old Multiboot 1 alignment copied over in the comment to reflect the Multiboot 2 specification.

grub-core/loader/multiboot_mbi2.c +4 -3
index a5f9a94a2..026109e69 100644
@@ -90,10 +90,11 @@ static struct multiboot_header *
 find_header (grub_properly_aligned_t *buffer, grub_ssize_t len)
 {
   struct multiboot_header *header;
-  /* Look for the multiboot header in the buffer.  The header should
-     be at least 12 bytes and aligned on a 4-byte boundary.  */
+  /* Look for the Multiboot 2 header magic in the buffer.  The
+     complete MB2 header should be at least 16+8=24 bytes (header
+     magic plus terminator tag) and aligned on an 8-byte boundary. */
   for (header = (struct multiboot_header *) buffer;
-       ((char *) header <= (char *) buffer + len - 12);
+       ((char *) header <= (char *) buffer + len - 24);
        header = (struct multiboot_header *) ((grub_uint32_t *) header + MULTIBOOT_HEADER_ALIGN / 4))
     {
       if (header->magic == MULTIBOOT2_HEADER_MAGIC
Signature · 1 line
2.26.2
#2 lore raw

RFC PATCH 1/1 mb2 loader: Use the same iteration code for MB2 as for MB1

In reply to Hans Ulrich Niedermann

This avoids the divisions by 4 to compensate for using an array of 32bit values instead of bytes in MB2 find_header(), just like the MB1 find_header() does it.

Also uses the same principle for iterating through the MB2 header tags.

Why not use the same code for iterating over memory locations in the Multiboot 2 loader as we do in the Multiboot 1 loader?

grub-core/loader/multiboot_mbi2.c +2 -2
index 026109e69..38ddea088 100644
@@ -95,7 +95,7 @@ find_header (grub_properly_aligned_t *buffer, grub_ssize_t len)
      magic plus terminator tag) and aligned on an 8-byte boundary. */
   for (header = (struct multiboot_header *) buffer;
        ((char *) header <= (char *) buffer + len - 24);
-       header = (struct multiboot_header *) ((grub_uint32_t *) header + MULTIBOOT_HEADER_ALIGN / 4))
+       header = (struct multiboot_header *) ((char *) header + MULTIBOOT_HEADER_ALIGN))
     {
       if (header->magic == MULTIBOOT2_HEADER_MAGIC
 	  && !(header->magic + header->architecture
@@ -152,7 +152,7 @@ grub_multiboot2_load (grub_file_t file, const char *filename)
 
   for (tag = (struct multiboot_header_tag *) (header + 1);
        tag->type != MULTIBOOT_TAG_TYPE_END;
-       tag = (struct multiboot_header_tag *) ((grub_uint32_t *) tag + ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN) / 4))
+       tag = (struct multiboot_header_tag *) ((char *) tag + ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN)))
     switch (tag->type)
       {
       case MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST:
Signature · 1 line
2.26.2