diff options
Diffstat (limited to 'main/grub/0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch')
-rw-r--r-- | main/grub/0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/main/grub/0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch b/main/grub/0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch new file mode 100644 index 0000000000..eff71cf901 --- /dev/null +++ b/main/grub/0017-xen-Use-elfnote-defines-instead-of-plain-numbers.patch @@ -0,0 +1,86 @@ +From 688cab35a913ba61f39439f6071381bc3201fcda Mon Sep 17 00:00:00 2001 +From: Juergen Gross <jgross@suse.com> +Date: Fri, 7 Dec 2018 13:11:45 +0100 +Subject: [PATCH 17/20] xen: Use elfnote defines instead of plain numbers + +In order to avoid using plain integers for the ELF notes use the +available Xen include instead. + +Signed-off-by: Juergen Gross <jgross@suse.com> +Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> +Tested-by: Hans van Kranenburg <hans@knorrie.org> +(cherry picked from commit 9bce25213a44553c71527776f65fabc3b729c2f3) +--- + util/grub-mkimagexx.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c +index e63f148e4..e7b8cf161 100644 +--- a/util/grub-mkimagexx.c ++++ b/util/grub-mkimagexx.c +@@ -48,6 +48,8 @@ + #include <grub/util/install.h> + #include <grub/util/mkimage.h> + ++#include <xen/elfnote.h> ++ + #pragma GCC diagnostic ignored "-Wcast-align" + + /* These structures are defined according to the CHRP binding to IEEE1275, +@@ -312,7 +314,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + note_ptr = (Elf_Nhdr *) ptr; + note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); + note_ptr->n_descsz = grub_host_to_target32 (sizeof (PACKAGE_NAME)); +- note_ptr->n_type = grub_host_to_target32 (6); ++ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_GUEST_OS); + ptr += sizeof (Elf_Nhdr); + memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); + ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); +@@ -323,7 +325,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + note_ptr = (Elf_Nhdr *) ptr; + note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); + note_ptr->n_descsz = grub_host_to_target32 (sizeof ("generic")); +- note_ptr->n_type = grub_host_to_target32 (8); ++ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_LOADER); + ptr += sizeof (Elf_Nhdr); + memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); + ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); +@@ -334,7 +336,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + note_ptr = (Elf_Nhdr *) ptr; + note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); + note_ptr->n_descsz = grub_host_to_target32 (sizeof ("xen-3.0")); +- note_ptr->n_type = grub_host_to_target32 (5); ++ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_XEN_VERSION); + ptr += sizeof (Elf_Nhdr); + memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); + ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); +@@ -345,7 +347,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + note_ptr = (Elf_Nhdr *) ptr; + note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); + note_ptr->n_descsz = grub_host_to_target32 (image_target->voidp_sizeof); +- note_ptr->n_type = grub_host_to_target32 (1); ++ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_ENTRY); + ptr += sizeof (Elf_Nhdr); + memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); + ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); +@@ -356,7 +358,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + note_ptr = (Elf_Nhdr *) ptr; + note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); + note_ptr->n_descsz = grub_host_to_target32 (image_target->voidp_sizeof); +- note_ptr->n_type = grub_host_to_target32 (3); ++ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_VIRT_BASE); + ptr += sizeof (Elf_Nhdr); + memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); + ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); +@@ -369,7 +371,7 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc + note_ptr = (Elf_Nhdr *) ptr; + note_ptr->n_namesz = grub_host_to_target32 (sizeof (GRUB_XEN_NOTE_NAME)); + note_ptr->n_descsz = grub_host_to_target32 (sizeof ("yes,bimodal")); +- note_ptr->n_type = grub_host_to_target32 (9); ++ note_ptr->n_type = grub_host_to_target32 (XEN_ELFNOTE_PAE_MODE); + ptr += sizeof (Elf_Nhdr); + memcpy (ptr, GRUB_XEN_NOTE_NAME, sizeof (GRUB_XEN_NOTE_NAME)); + ptr += ALIGN_UP (sizeof (GRUB_XEN_NOTE_NAME), 4); +-- +2.21.0 + |