]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: Xen: Use a new fdf include for the PVH ELF header
authorSebastien Boeuf <sebastien.boeuf@intel.com>
Wed, 2 Mar 2022 13:31:31 +0000 (21:31 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 4 Mar 2022 02:41:57 +0000 (02:41 +0000)
Instead of having the PVH ELF header part of the fdf file directly, we
move it to a dedicated include file. This is the first step in
automating the generation of the header.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
OvmfPkg/OvmfXen.fdf
OvmfPkg/XenElfHeader.fdf.inc [new file with mode: 0644]

index a6acf3b835aab2abcdae99d6ae8baaec8af512cc..2e67db5d329cc00024322b97aaa0eebdfcc3fa5b 100644 (file)
@@ -31,61 +31,8 @@ NumBlocks     = $(FW_BLOCKS)
 !if $(FD_SIZE_IN_KB) == 4096\r
 0x00000000|0x00040000\r
 !endif\r
-DATA = {\r
-  #\r
-  # This hex array have been generated by OvmfPkg/OvmfXenElfHeaderGenerator.c\r
-  # and copied manually.\r
-  #\r
-  # ELF file header\r
-  0x7f, 0x45, 0x4c, 0x46, # e_ident[0..3]: Magic number\r
-  0x01, # File class: 32-bit objects\r
-  0x01, # Data encoding: 2's complement, little endian\r
-  0x01, # File version\r
-  0x03, # OS ABI identification: Object uses GNU ELF extensions\r
-  0x00, # ABI version\r
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  # e_ident[EI_PAD...]\r
-  0x02, 0x00, # e_type = Executable file\r
-  0x03, 0x00, # e_machine = Intel 80386\r
-  0x01, 0x00, 0x00, 0x00, # e_version\r
-  0xd0, 0xff, 0x2f, 0x00, # e_entry: Entry point virtual address\r
-  0x34, 0x00, 0x00, 0x00, # e_phoff: Program header table file offset\r
-  0x00, 0x00, 0x00, 0x00, # e_shoff: Section header table file offset\r
-  0x00, 0x00, 0x00, 0x00, # e_flags: Processor-specific flags\r
-  0x34, 0x00, #    e_ehsize: ELF header size\r
-  0x20, 0x00, # e_phentsize: Program header table entry size\r
-  0x02, 0x00, #     e_phnum: Program header table entry count\r
-  0x00, 0x00, # e_shentsize: Section header table entry size\r
-  0x00, 0x00, #     e_shnum: Section header table entry count\r
-  0x00, 0x00, # e_shstrndx\r
-\r
-  # ELF Program segment headers\r
-  # - Load segment\r
-  0x01, 0x00, 0x00, 0x00, # p_type = Loadable program segment\r
-  0x00, 0x00, 0x00, 0x00, # p_offset\r
-  0x00, 0x00, 0x10, 0x00, # p_vaddr: Segment virtual address\r
-  0x00, 0x00, 0x10, 0x00, # p_paddr: Segment physical address\r
-  0x00, 0x00, 0x20, 0x00, # p_filesz: Segment size in file\r
-  0x00, 0x00, 0x20, 0x00, # p_memsz: Segment size in memory\r
-  0x07, 0x00, 0x00, 0x00, # p_flags = Segment is executable | writable | readable\r
-  0x00, 0x00, 0x00, 0x00, # p_align\r
-  # - ELFNOTE segment\r
-  0x04, 0x00, 0x00, 0x00, # p_type = PT_NOTE\r
-  0x74, 0x00, 0x00, 0x00, # p_offset = point to XEN_ELFNOTE_PHYS32_ENTRY below\r
-  0x74, 0x00, 0x10, 0x00,\r
-  0x74, 0x00, 0x10, 0x00,\r
-  0x14, 0x00, 0x00, 0x00,\r
-  0x14, 0x00, 0x00, 0x00,\r
-  0x04, 0x00, 0x00, 0x00, # p_flags = Segment is readable\r
-  0x00, 0x00, 0x00, 0x00,\r
-\r
-  # XEN_ELFNOTE_PHYS32_ENTRY\r
-  0x04, 0x00, 0x00, 0x00, # name size\r
-  0x04, 0x00, 0x00, 0x00, # desc size\r
-  0x12, 0x00, 0x00, 0x00, # type = XEN_ELFNOTE_PHYS32_ENTRY\r
-  0x58, 0x65, 0x6e, 0x00, # name = "Xen"\r
-  0xd0, 0xff, 0x2f, 0x00, # desc: PVH entry point\r
-  0x00\r
-}\r
+\r
+!include XenElfHeader.fdf.inc\r
 \r
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)\r
 0x0000e000|0x00001000\r
diff --git a/OvmfPkg/XenElfHeader.fdf.inc b/OvmfPkg/XenElfHeader.fdf.inc
new file mode 100644 (file)
index 0000000..dbc1305
--- /dev/null
@@ -0,0 +1,64 @@
+## @file\r
+#  FDF include file that defines a PVH ELF header.\r
+#\r
+#  Copyright (c) 2022, Intel Corporation. All rights reserved.\r
+#\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+DATA = {\r
+  #\r
+  # This hex array have been generated by OvmfPkg/OvmfXenElfHeaderGenerator.c\r
+  # and copied manually.\r
+  #\r
+  # ELF file header\r
+  0x7f, 0x45, 0x4c, 0x46, # e_ident[0..3]: Magic number\r
+  0x01, # File class: 32-bit objects\r
+  0x01, # Data encoding: 2's complement, little endian\r
+  0x01, # File version\r
+  0x03, # OS ABI identification: Object uses GNU ELF extensions\r
+  0x00, # ABI version\r
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  # e_ident[EI_PAD...]\r
+  0x02, 0x00, # e_type = Executable file\r
+  0x03, 0x00, # e_machine = Intel 80386\r
+  0x01, 0x00, 0x00, 0x00, # e_version\r
+  0xd0, 0xff, 0x2f, 0x00, # e_entry: Entry point virtual address\r
+  0x34, 0x00, 0x00, 0x00, # e_phoff: Program header table file offset\r
+  0x00, 0x00, 0x00, 0x00, # e_shoff: Section header table file offset\r
+  0x00, 0x00, 0x00, 0x00, # e_flags: Processor-specific flags\r
+  0x34, 0x00, #    e_ehsize: ELF header size\r
+  0x20, 0x00, # e_phentsize: Program header table entry size\r
+  0x02, 0x00, #     e_phnum: Program header table entry count\r
+  0x00, 0x00, # e_shentsize: Section header table entry size\r
+  0x00, 0x00, #     e_shnum: Section header table entry count\r
+  0x00, 0x00, # e_shstrndx\r
+\r
+  # ELF Program segment headers\r
+  # - Load segment\r
+  0x01, 0x00, 0x00, 0x00, # p_type = Loadable program segment\r
+  0x00, 0x00, 0x00, 0x00, # p_offset\r
+  0x00, 0x00, 0x10, 0x00, # p_vaddr: Segment virtual address\r
+  0x00, 0x00, 0x10, 0x00, # p_paddr: Segment physical address\r
+  0x00, 0x00, 0x20, 0x00, # p_filesz: Segment size in file\r
+  0x00, 0x00, 0x20, 0x00, # p_memsz: Segment size in memory\r
+  0x07, 0x00, 0x00, 0x00, # p_flags = Segment is executable | writable | readable\r
+  0x00, 0x00, 0x00, 0x00, # p_align\r
+  # - ELFNOTE segment\r
+  0x04, 0x00, 0x00, 0x00, # p_type = PT_NOTE\r
+  0x74, 0x00, 0x00, 0x00, # p_offset = point to XEN_ELFNOTE_PHYS32_ENTRY below\r
+  0x74, 0x00, 0x10, 0x00,\r
+  0x74, 0x00, 0x10, 0x00,\r
+  0x14, 0x00, 0x00, 0x00,\r
+  0x14, 0x00, 0x00, 0x00,\r
+  0x04, 0x00, 0x00, 0x00, # p_flags = Segment is readable\r
+  0x00, 0x00, 0x00, 0x00,\r
+\r
+  # XEN_ELFNOTE_PHYS32_ENTRY\r
+  0x04, 0x00, 0x00, 0x00, # name size\r
+  0x04, 0x00, 0x00, 0x00, # desc size\r
+  0x12, 0x00, 0x00, 0x00, # type = XEN_ELFNOTE_PHYS32_ENTRY\r
+  0x58, 0x65, 0x6e, 0x00, # name = "Xen"\r
+  0xd0, 0xff, 0x2f, 0x00, # desc: PVH entry point\r
+  0x00\r
+}\r