diff --git a/0001-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled-MMIO-da.patch b/0001-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled-MMIO-da.patch deleted file mode 100644 index fe17577..0000000 --- a/0001-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled-MMIO-da.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 2f06e09673e48f6a91486a8ad38f45c160d537fe Mon Sep 17 00:00:00 2001 -From: "mike.travis@hpe.com" -Date: Wed, 28 Mar 2018 11:42:18 -0500 -Subject: Fix PCIe LER when GRUB2 accesses non-enabled MMIO data from VGA - -A GPU inserted into a PCIe I/O slot disappears during system startup. -The problem centers around GRUB and a specific VGA init function in -efi_uga.c. This causes an LER (link error recorvery) because the MMIO -memory has not been enabled before attempting access. - -The fix is to add the same coding used in other VGA drivers, specifically -to add a check to insure that it is indeed a VGA controller. And then -enable the MMIO address space with the specific bits. - -Signed-off-by: Mike Travis ---- - grub-core/video/efi_uga.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c -index 464ede874..32ef7efbc 100644 ---- a/grub-core/video/efi_uga.c -+++ b/grub-core/video/efi_uga.c -@@ -95,9 +95,18 @@ find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) - { - struct find_framebuf_ctx *ctx = data; - grub_pci_address_t addr; -+ grub_pci_address_t rcaddr; -+ grub_uint32_t subclass; - - addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); -- if (grub_pci_read (addr) >> 24 == 0x3) -+ subclass = (grub_pci_read (addr) >> 16) & 0xffff; -+ if (subclass != GRUB_PCI_CLASS_SUBCLASS_VGA) -+ return 0; -+ -+ /* Enable MEM address spaces */ -+ rcaddr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); -+ grub_pci_write_word (rcaddr, grub_pci_read_word (rcaddr) | GRUB_PCI_COMMAND_MEM_ENABLED); -+ - { - int i; - --- -2.13.6 - diff --git a/0001-Fix-packed-not-aligned-error-on-GCC-8.patch b/0001-Fix-packed-not-aligned-error-on-GCC-8.patch deleted file mode 100644 index 73efa00..0000000 --- a/0001-Fix-packed-not-aligned-error-on-GCC-8.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 721f75ff7de467717658d2de9c20bbb18145790a Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Mon, 26 Mar 2018 16:52:34 +0800 -Subject: Fix packed-not-aligned error on GCC 8 - -When building with GCC 8, there are several errors regarding packed-not-aligned. - -./include/grub/gpt_partition.h:79:1: error: alignment 1 of 'struct grub_gpt_partentry' is less than 8 [-Werror=packed-not-aligned] - -This patch tries to fix the build error by cleaning up the ambiguity of placing -aligned structure in a packed one. In "struct grub_btrfs_time" and "struct -grub_gpt_part_type", the aligned attribute seems to be superfluous, and also -has to be packed, to ensure the structure is bit-to-bit mapped to the format -laid on disk. I think we could blame to copy and paste error here for the -mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as -the name suggests. :) - -Signed-off-by: Michael Chang -Tested-by: Michael Chang ---- - grub-core/fs/btrfs.c | 2 +- - include/grub/efiemu/runtime.h | 2 +- - include/grub/gpt_partition.h | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c -index 4849c1ceb..be195448d 100644 ---- a/grub-core/fs/btrfs.c -+++ b/grub-core/fs/btrfs.c -@@ -175,7 +175,7 @@ struct grub_btrfs_time - { - grub_int64_t sec; - grub_uint32_t nanosec; --} __attribute__ ((aligned (4))); -+} GRUB_PACKED; - - struct grub_btrfs_inode - { -diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h -index 9b6b729f4..36d2dedf4 100644 ---- a/include/grub/efiemu/runtime.h -+++ b/include/grub/efiemu/runtime.h -@@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel - - struct efi_variable - { -- grub_efi_guid_t guid; -+ grub_efi_packed_guid_t guid; - grub_uint32_t namelen; - grub_uint32_t size; - grub_efi_uint32_t attributes; -diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h -index 1b32f6725..9668a68c3 100644 ---- a/include/grub/gpt_partition.h -+++ b/include/grub/gpt_partition.h -@@ -28,7 +28,7 @@ struct grub_gpt_part_type - grub_uint16_t data2; - grub_uint16_t data3; - grub_uint8_t data4[8]; --} __attribute__ ((aligned(8))); -+} GRUB_PACKED; - typedef struct grub_gpt_part_type grub_gpt_part_type_t; - - #define GRUB_GPT_PARTITION_TYPE_EMPTY \ --- -2.13.6 - diff --git a/0001-add-support-for-UEFI-network-protocols.patch b/0001-add-support-for-UEFI-network-protocols.patch index 0e31f3f..7e3344a 100644 --- a/0001-add-support-for-UEFI-network-protocols.patch +++ b/0001-add-support-for-UEFI-network-protocols.patch @@ -23,6 +23,10 @@ V3: * Finish HTTP transaction in one go * Fix bsc#1076132 +V4 + * Add fs_ prefix with upstream commit + ad4bfeec5 Change fs functions to add fs_ prefix + --- grub-core/Makefile.core.def | 18 + grub-core/io/bufio.c | 2 +- @@ -53,30 +57,19 @@ V3: create mode 100644 include/grub/efi/http.h create mode 100644 include/grub/net/efi.h -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index a65c27f7f..e93c77255 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -2167,6 +2167,18 @@ module = { - }; - +Index: grub-2.04~rc1/grub-core/Makefile.core.def +=================================================================== +--- grub-2.04~rc1.orig/grub-core/Makefile.core.def ++++ grub-2.04~rc1/grub-core/Makefile.core.def +@@ -1854,7 +1854,6 @@ module = { module = { -+ name = efi_netfs; -+ common = net/efi/efi_netfs.c; -+ common = net/efi/net.c; -+ common = net/efi/http.c; -+ common = net/efi/pxe.c; -+ common = net/efi/ip4_config.c; -+ common = net/efi/ip6_config.c; -+ common = net/efi/dhcp.c; -+ enable = efi; -+}; -+ -+module = { - name = net; - common = net/net.c; - common = net/dns.c; -@@ -2179,6 +2191,12 @@ module = { + name = linuxefi; + efi = loader/i386/efi/linux.c; +- efi = lib/cmdline.c; + enable = i386_efi; + enable = x86_64_efi; + }; +@@ -2283,6 +2282,12 @@ module = { common = net/ethernet.c; common = net/arp.c; common = net/netbuff.c; @@ -89,11 +82,11 @@ index a65c27f7f..e93c77255 100644 }; module = { -diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c -index 22438277d..d0b0f71b6 100644 ---- a/grub-core/io/bufio.c -+++ b/grub-core/io/bufio.c -@@ -132,7 +132,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len) +Index: grub-2.04~rc1/grub-core/io/bufio.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/io/bufio.c ++++ grub-2.04~rc1/grub-core/io/bufio.c +@@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char return res; /* Need to read some more. */ @@ -102,11 +95,11 @@ index 22438277d..d0b0f71b6 100644 /* Now read between file->offset + res and bufio->buffer_at. */ if (file->offset + res < next_buf) { -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index d467785fc..0ceaa487c 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -672,7 +672,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +Index: grub-2.04~rc1/grub-core/kern/efi/efi.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/kern/efi/efi.c ++++ grub-2.04~rc1/grub-core/kern/efi/efi.c +@@ -722,7 +722,7 @@ grub_efi_print_device_path (grub_efi_dev { grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) dp; @@ -115,7 +108,7 @@ index d467785fc..0ceaa487c 100644 (unsigned) ipv4->local_ip_address[0], (unsigned) ipv4->local_ip_address[1], (unsigned) ipv4->local_ip_address[2], -@@ -685,33 +685,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -735,33 +735,60 @@ grub_efi_print_device_path (grub_efi_dev (unsigned) ipv4->remote_port, (unsigned) ipv4->protocol, (unsigned) ipv4->static_ip_address); @@ -193,7 +186,7 @@ index d467785fc..0ceaa487c 100644 } break; case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE: -@@ -751,6 +778,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) +@@ -801,6 +828,39 @@ grub_efi_print_device_path (grub_efi_dev dump_vendor_path ("Messaging", (grub_efi_vendor_device_path_t *) dp); break; @@ -233,10 +226,10 @@ index d467785fc..0ceaa487c 100644 default: grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); break; -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 82a28fb6e..f189209ba 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c +Index: grub-2.04~rc1/grub-core/net/drivers/efi/efinet.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/net/drivers/efi/efinet.c ++++ grub-2.04~rc1/grub-core/net/drivers/efi/efinet.c @@ -24,6 +24,7 @@ #include #include @@ -245,7 +238,7 @@ index 82a28fb6e..f189209ba 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -481,6 +482,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -481,6 +482,17 @@ grub_efinet_create_dhcp_ack_from_device_ ldp = grub_efi_find_last_device_path (ddp); @@ -263,7 +256,7 @@ index 82a28fb6e..f189209ba 100644 if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)) -@@ -744,6 +756,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -744,6 +756,7 @@ grub_efi_net_config_real (grub_efi_handl if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE || (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE @@ -271,7 +264,7 @@ index 82a28fb6e..f189209ba 100644 && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) continue; dup_dp = grub_efi_duplicate_device_path (dp); -@@ -759,6 +772,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -759,6 +772,15 @@ grub_efi_net_config_real (grub_efi_handl } dup_ldp = grub_efi_find_last_device_path (dup_dp); @@ -287,7 +280,7 @@ index 82a28fb6e..f189209ba 100644 dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; dup_ldp->length = sizeof (*dup_ldp); -@@ -816,6 +838,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, +@@ -816,6 +838,9 @@ grub_efi_net_config_real (grub_efi_handl GRUB_MOD_INIT(efinet) { @@ -305,11 +298,10 @@ index 82a28fb6e..f189209ba 100644 + grub_efi_net_config = NULL; } -diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c -new file mode 100644 -index 000000000..dbef63d8c +Index: grub-2.04~rc1/grub-core/net/efi/dhcp.c +=================================================================== --- /dev/null -+++ b/grub-core/net/efi/dhcp.c ++++ grub-2.04~rc1/grub-core/net/efi/dhcp.c @@ -0,0 +1,397 @@ +#include +#include @@ -708,74 +700,10 @@ index 000000000..dbef63d8c + +grub_command_func_t grub_efi_net_bootp = grub_cmd_efi_bootp; +grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6; -diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c -new file mode 100644 -index 000000000..ef371d885 +Index: grub-2.04~rc1/grub-core/net/efi/http.c +=================================================================== --- /dev/null -+++ b/grub-core/net/efi/efi_netfs.c -@@ -0,0 +1,57 @@ -+#include -+#include -+#define EFI_NET_CMD_PREFIX "net_efi" -+#include -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_command_t cmd_efi_lsroutes; -+static grub_command_t cmd_efi_lscards; -+static grub_command_t cmd_efi_lsaddrs; -+static grub_command_t cmd_efi_addaddr; -+static grub_command_t cmd_efi_bootp; -+static grub_command_t cmd_efi_bootp6; -+ -+static int initialized; -+ -+GRUB_MOD_INIT(efi_netfs) -+{ -+ if (grub_net_open) -+ return; -+ -+ if (grub_efi_net_fs_init ()) -+ { -+ cmd_efi_lsroutes = grub_register_command ("net_efi_ls_routes", grub_efi_net_list_routes, -+ "", N_("list network routes")); -+ cmd_efi_lscards = grub_register_command ("net_efi_ls_cards", grub_efi_net_list_cards, -+ "", N_("list network cards")); -+ cmd_efi_lsaddrs = grub_register_command ("net_efi_ls_addr", grub_efi_net_list_addrs, -+ "", N_("list network addresses")); -+ cmd_efi_addaddr = grub_register_command ("net_efi_add_addr", grub_efi_net_add_addr, -+ N_("SHORTNAME CARD ADDRESS [HWADDRESS]"), -+ N_("Add a network address.")); -+ cmd_efi_bootp = grub_register_command ("net_efi_bootp", grub_efi_net_bootp, -+ N_("[CARD]"), -+ N_("perform a bootp autoconfiguration")); -+ cmd_efi_bootp6 = grub_register_command ("net_efi_bootp6", grub_efi_net_bootp6, -+ N_("[CARD]"), -+ N_("perform a bootp autoconfiguration")); -+ initialized = 1; -+ } -+} -+ -+GRUB_MOD_FINI(efi_netfs) -+{ -+ if (initialized) -+ { -+ grub_unregister_command (cmd_efi_lsroutes); -+ grub_unregister_command (cmd_efi_lscards); -+ grub_unregister_command (cmd_efi_lsaddrs); -+ grub_unregister_command (cmd_efi_addaddr); -+ grub_unregister_command (cmd_efi_bootp); -+ grub_unregister_command (cmd_efi_bootp6); -+ grub_efi_net_fs_fini (); -+ initialized = 0; -+ return; -+ } -+} -diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c -new file mode 100644 -index 000000000..3f61fd2fa ---- /dev/null -+++ b/grub-core/net/efi/http.c ++++ grub-2.04~rc1/grub-core/net/efi/http.c @@ -0,0 +1,419 @@ + +#include @@ -1196,11 +1124,10 @@ index 000000000..3f61fd2fa + .read = grub_efihttp_read, + .close = grub_efihttp_close + }; -diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c -new file mode 100644 -index 000000000..b711a5d94 +Index: grub-2.04~rc1/grub-core/net/efi/ip4_config.c +=================================================================== --- /dev/null -+++ b/grub-core/net/efi/ip4_config.c ++++ grub-2.04~rc1/grub-core/net/efi/ip4_config.c @@ -0,0 +1,398 @@ + +#include @@ -1600,11 +1527,10 @@ index 000000000..b711a5d94 + .set_gateway = grub_efi_ip4_interface_set_gateway, + .set_dns = grub_efi_ip4_interface_set_dns + }; -diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c -new file mode 100644 -index 000000000..017c4d05b +Index: grub-2.04~rc1/grub-core/net/efi/ip6_config.c +=================================================================== --- /dev/null -+++ b/grub-core/net/efi/ip6_config.c ++++ grub-2.04~rc1/grub-core/net/efi/ip6_config.c @@ -0,0 +1,422 @@ +#include +#include @@ -2028,11 +1954,10 @@ index 000000000..017c4d05b + .set_gateway = grub_efi_ip6_interface_set_gateway, + .set_dns = grub_efi_ip6_interface_set_dns + }; -diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -new file mode 100644 -index 000000000..0bac343b4 +Index: grub-2.04~rc1/grub-core/net/efi/net.c +=================================================================== --- /dev/null -+++ b/grub-core/net/efi/net.c ++++ grub-2.04~rc1/grub-core/net/efi/net.c @@ -0,0 +1,1428 @@ +#include +#include @@ -3327,13 +3252,13 @@ index 000000000..0bac343b4 +static struct grub_fs grub_efi_netfs = + { + .name = "efi netfs", -+ .dir = grub_efi_netfs_dir, -+ .open = grub_efi_netfs_open, -+ .read = grub_efi_netfs_read, -+ .close = grub_efi_netfs_close, -+ .label = NULL, -+ .uuid = NULL, -+ .mtime = NULL, ++ .fs_dir = grub_efi_netfs_dir, ++ .fs_open = grub_efi_netfs_open, ++ .fs_read = grub_efi_netfs_read, ++ .fs_close = grub_efi_netfs_close, ++ .fs_label = NULL, ++ .fs_uuid = NULL, ++ .fs_mtime = NULL, + }; + +int @@ -3462,11 +3387,10 @@ index 000000000..0bac343b4 + grub_net_open = NULL; + grub_fs_unregister (&grub_efi_netfs); +} -diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c -new file mode 100644 -index 000000000..4b6b48cb1 +Index: grub-2.04~rc1/grub-core/net/efi/pxe.c +=================================================================== --- /dev/null -+++ b/grub-core/net/efi/pxe.c ++++ grub-2.04~rc1/grub-core/net/efi/pxe.c @@ -0,0 +1,424 @@ + +#include @@ -3892,10 +3816,10 @@ index 000000000..4b6b48cb1 + .close = pxe_close + }; + -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 5cc0d2f3b..02bbe956b 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c +Index: grub-2.04~rc1/grub-core/net/net.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/net/net.c ++++ grub-2.04~rc1/grub-core/net/net.c @@ -32,6 +32,9 @@ #include #include @@ -3906,7 +3830,7 @@ index 5cc0d2f3b..02bbe956b 100644 GRUB_MOD_LICENSE ("GPLv3+"); -@@ -1817,8 +1820,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; +@@ -1817,8 +1820,49 @@ static grub_command_t cmd_addaddr, cmd_d static grub_command_t cmd_lsroutes, cmd_lscards; static grub_command_t cmd_lsaddr, cmd_slaac; @@ -4002,11 +3926,11 @@ index 5cc0d2f3b..02bbe956b 100644 + init_mode = INIT_MODE_NONE; +#endif } -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 99ba068e3..cfedd7895 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -588,6 +588,23 @@ typedef grub_uint16_t grub_efi_ipv6_address_t[8]; +Index: grub-2.04~rc1/include/grub/efi/api.h +=================================================================== +--- grub-2.04~rc1.orig/include/grub/efi/api.h ++++ grub-2.04~rc1/include/grub/efi/api.h +@@ -588,6 +588,23 @@ typedef grub_uint16_t grub_efi_ipv6_addr typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4))); typedef grub_efi_uint64_t grub_efi_physical_address_t; typedef grub_efi_uint64_t grub_efi_virtual_address_t; @@ -4079,7 +4003,7 @@ index 99ba068e3..cfedd7895 100644 struct grub_efi_open_protocol_information_entry { grub_efi_handle_t agent_handle; -@@ -1473,23 +1518,28 @@ typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output +@@ -1473,23 +1518,28 @@ typedef struct grub_efi_simple_text_outp typedef grub_uint8_t grub_efi_pxe_packet_t[1472]; @@ -4251,13 +4175,12 @@ index 99ba068e3..cfedd7895 100644 +typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t; + #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ - || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) - -diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h -new file mode 100644 -index 000000000..fdb88eb81 + || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ + || defined(__riscv) +Index: grub-2.04~rc1/include/grub/efi/dhcp.h +=================================================================== --- /dev/null -+++ b/include/grub/efi/dhcp.h ++++ grub-2.04~rc1/include/grub/efi/dhcp.h @@ -0,0 +1,343 @@ +#ifndef GRUB_EFI_DHCP_HEADER +#define GRUB_EFI_DHCP_HEADER 1 @@ -4602,11 +4525,10 @@ index 000000000..fdb88eb81 +}; + +#endif /* ! GRUB_EFI_DHCP_HEADER */ -diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h -new file mode 100644 -index 000000000..c5e9a89f5 +Index: grub-2.04~rc1/include/grub/efi/http.h +=================================================================== --- /dev/null -+++ b/include/grub/efi/http.h ++++ grub-2.04~rc1/include/grub/efi/http.h @@ -0,0 +1,215 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -4823,11 +4745,10 @@ index 000000000..c5e9a89f5 +typedef struct grub_efi_http grub_efi_http_t; + +#endif /* !GRUB_EFI_HTTP_HEADER */ -diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h -new file mode 100644 -index 000000000..de90d223e +Index: grub-2.04~rc1/include/grub/net/efi.h +=================================================================== --- /dev/null -+++ b/include/grub/net/efi.h ++++ grub-2.04~rc1/include/grub/net/efi.h @@ -0,0 +1,144 @@ +#ifndef GRUB_NET_EFI_HEADER +#define GRUB_NET_EFI_HEADER 1 @@ -4973,88 +4894,3 @@ index 000000000..de90d223e +extern grub_command_func_t grub_efi_net_bootp6; + +#endif /* ! GRUB_NET_EFI_HEADER */ -diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c -index 82073d5cc..ae31271bb 100644 ---- a/util/grub-mknetdir.c -+++ b/util/grub-mknetdir.c -@@ -32,13 +32,15 @@ - - static char *rootdir = NULL, *subdir = NULL; - static char *debug_image = NULL; -+static char efi_netfs = 0; - - enum - { - OPTION_NET_DIRECTORY = 0x301, - OPTION_SUBDIR, - OPTION_DEBUG, -- OPTION_DEBUG_IMAGE -+ OPTION_DEBUG_IMAGE, -+ OPTION_DEBUG_EFI_NETFS - }; - - static struct argp_option options[] = { -@@ -49,6 +51,7 @@ static struct argp_option options[] = { - 0, N_("relative subdirectory on network server"), 2}, - {"debug", OPTION_DEBUG, 0, OPTION_HIDDEN, 0, 2}, - {"debug-image", OPTION_DEBUG_IMAGE, N_("STRING"), OPTION_HIDDEN, 0, 2}, -+ {"debug-efi-netfs", OPTION_DEBUG_EFI_NETFS, 0, OPTION_HIDDEN, 0, 2}, - {0, 0, 0, 0, 0, 0} - }; - -@@ -67,6 +70,9 @@ argp_parser (int key, char *arg, struct argp_state *state) - free (subdir); - subdir = xstrdup (arg); - return 0; -+ case OPTION_DEBUG_EFI_NETFS: -+ efi_netfs = 1; -+ return 0; - /* This is an undocumented feature... */ - case OPTION_DEBUG: - verbosity++; -@@ -82,7 +88,6 @@ argp_parser (int key, char *arg, struct argp_state *state) - } - } - -- - struct argp argp = { - options, argp_parser, NULL, - "\v"N_("Prepares GRUB network boot images at net_directory/subdir " -@@ -92,7 +97,7 @@ struct argp argp = { - - static char *base; - --static const struct -+static struct - { - const char *mkimage_target; - const char *netmodule; -@@ -154,6 +159,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform) - grub_install_push_module (targets[platform].netmodule); - - output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext); -+ - grub_install_make_image_wrap (input_dir, prefix, output, - 0, load_cfg, - targets[platform].mkimage_target, 0); -@@ -190,7 +196,16 @@ main (int argc, char *argv[]) - - grub_install_mkdir_p (base); - -- grub_install_push_module ("tftp"); -+ if (!efi_netfs) -+ { -+ grub_install_push_module ("tftp"); -+ grub_install_push_module ("http"); -+ } -+ else -+ { -+ targets[GRUB_INSTALL_PLATFORM_I386_EFI].netmodule = "efi_netfs"; -+ targets[GRUB_INSTALL_PLATFORM_X86_64_EFI].netmodule = "efi_netfs"; -+ } - - if (!grub_install_source_directory) - { --- -2.13.6 - diff --git a/0001-cpio-Disable-gcc9-Waddress-of-packed-member.patch b/0001-cpio-Disable-gcc9-Waddress-of-packed-member.patch deleted file mode 100644 index 15b5321..0000000 --- a/0001-cpio-Disable-gcc9-Waddress-of-packed-member.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 7ea474c68847757d4c67ffc67f7d714b77c41578 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:02 +0800 -Subject: [PATCH 1/8] cpio: Disable gcc9 -Waddress-of-packed-member - -Disable the -Wadress-of-packaed-member diagnostic for the -grub_cpio_find_file function since the result is found to be false -postive. Any pointers to member of the 'struct head hd' is aligned even -if the structure is packed without paddings. - -[ 59s] In file included from ../grub-core/fs/cpio.c:51: -[ 59s] ../grub-core/fs/cpio_common.c: In function 'grub_cpio_find_file': -[ 59s] ../grub-core/fs/cpio_common.c:58:31: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 58 | data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize)); -[ 59s] | ~~^~~~~~~~~ -[ 59s] ../grub-core/fs/cpio_common.c:60:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 60 | *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime)); -[ 59s] | ~~^~~~~~ -[ 59s] ../grub-core/fs/cpio_common.c:61:28: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 61 | modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode)); -[ 59s] | ~~^~~~~ -[ 59s] ../grub-core/fs/cpio_common.c:62:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 62 | namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize)); -[ 59s] | ~~^~~~~~~~~ -[ 59s] In file included from ../grub-core/fs/cpio_be.c:51: -[ 59s] ../grub-core/fs/cpio_common.c: In function 'grub_cpio_find_file': -[ 59s] ../grub-core/fs/cpio_common.c:58:31: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 58 | data->size = read_number (hd.filesize, ARRAY_SIZE (hd.filesize)); -[ 59s] | ~~^~~~~~~~~ -[ 59s] ../grub-core/fs/cpio_common.c:60:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 60 | *mtime = read_number (hd.mtime, ARRAY_SIZE (hd.mtime)); -[ 59s] | ~~^~~~~~ -[ 59s] ../grub-core/fs/cpio_common.c:61:28: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 61 | modeval = read_number (hd.mode, ARRAY_SIZE (hd.mode)); -[ 59s] | ~~^~~~~ -[ 59s] ../grub-core/fs/cpio_common.c:62:29: error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 62 | namesize = read_number (hd.namesize, ARRAY_SIZE (hd.namesize)); -[ 59s] | ~~^~~~~~~~~ - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - grub-core/fs/cpio_common.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/grub-core/fs/cpio_common.c b/grub-core/fs/cpio_common.c -index ed134d931..4e885d623 100644 ---- a/grub-core/fs/cpio_common.c -+++ b/grub-core/fs/cpio_common.c -@@ -36,6 +36,11 @@ struct grub_archelp_data - grub_off_t size; - }; - -+#if __GNUC__ >= 9 -+#pragma GCC diagnostic push -+#pragma GCC diagnostic ignored "-Waddress-of-packed-member" -+#endif -+ - static grub_err_t - grub_cpio_find_file (struct grub_archelp_data *data, char **name, - grub_int32_t *mtime, grub_uint32_t *mode) -@@ -96,6 +101,10 @@ grub_cpio_find_file (struct grub_archelp_data *data, char **name, - return GRUB_ERR_NONE; - } - -+#if __GNUC__ >= 9 -+#pragma GCC diagnostic pop -+#endif -+ - static char * - grub_cpio_get_link_target (struct grub_archelp_data *data) - { --- -2.16.4 - diff --git a/0001-misc-fix-invalid-character-recongition-in-strto-l.patch b/0001-misc-fix-invalid-character-recongition-in-strto-l.patch deleted file mode 100644 index a54e3d3..0000000 --- a/0001-misc-fix-invalid-character-recongition-in-strto-l.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0155e49166494624e9fb6ef113ed2c16d4accbb3 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Fri, 29 Jul 2016 17:41:27 +0800 -Subject: [PATCH 1/8] misc: fix invalid character recongition in strto*l - -From: Aaron Miller - -Would previously allow digits larger than the base and didn't check that -subtracting the difference from 0-9 to lowercase letters for characters -larger than 9 didn't result in a value lower than 9, which allowed the -parses: ` = 9, _ = 8, ^ = 7, ] = 6, \ = 5, and [ = 4 ---- - grub-core/kern/misc.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c -index d1a54df..3a14d67 100644 ---- a/grub-core/kern/misc.c -+++ b/grub-core/kern/misc.c -@@ -394,9 +394,13 @@ grub_strtoull (const char *str, char **end, int base) - if (digit > 9) - { - digit += '0' - 'a' + 10; -- if (digit >= (unsigned long) base) -+ /* digit <= 9 check is needed to keep chars larger than -+ '9' but less than 'a' from being read as numbers */ -+ if (digit >= (unsigned long) base || digit <= 9) - break; - } -+ if (digit >= (unsigned long) base) -+ break; - - found = 1; - --- -2.6.6 - diff --git a/0001-ofnet-Initialize-structs-in-bootpath-parser.patch b/0001-ofnet-Initialize-structs-in-bootpath-parser.patch deleted file mode 100644 index e815b26..0000000 --- a/0001-ofnet-Initialize-structs-in-bootpath-parser.patch +++ /dev/null @@ -1,36 +0,0 @@ -From ddd47864e98cb32a718075bab4462dc56919ec6c Mon Sep 17 00:00:00 2001 -From: Julian Andres Klode -Date: Mon, 3 Sep 2018 10:09:15 +0200 -Subject: [PATCH] ofnet: Initialize structs in bootpath parser - -Code later on checks if variables inside the struct are -0 to see if they have been set, like if there were addresses -in the bootpath. - -The variables were not initialized however, so the check -might succeed with uninitialized data, and a new interface -with random addresses and the same name is added. This causes -$net_default_mac to point to the random one, so, for example, -using that variable to load per-mac config files fails. - -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1785859 -Signed-off-by: Julian Andres Klode ---- - grub-core/net/drivers/ieee1275/ofnet.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c -=================================================================== ---- grub-2.02.orig/grub-core/net/drivers/ieee1275/ofnet.c -+++ grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c -@@ -153,8 +153,8 @@ grub_ieee1275_parse_bootpath (const char - char *comma_char = 0; - char *equal_char = 0; - grub_size_t field_counter = 0; -- grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; -- grub_net_link_level_address_t hw_addr; -+ grub_net_network_level_address_t client_addr = {}, gateway_addr = {}, subnet_mask = {}; -+ grub_net_link_level_address_t hw_addr = {}; - grub_net_interface_flags_t flags = 0; - struct grub_net_network_level_interface *inter = NULL; - grub_uint32_t vlantag = 0; diff --git a/0001-tpm-Core-TPM-support.patch b/0001-tpm-Core-TPM-support.patch deleted file mode 100644 index 103b6cf..0000000 --- a/0001-tpm-Core-TPM-support.patch +++ /dev/null @@ -1,785 +0,0 @@ -From 866eb2103187d84f2e02c262cfdd1a388acfec15 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Tue, 14 Jul 2015 17:06:35 -0700 -Subject: [PATCH 01/11] Core TPM support - -Add support for performing basic TPM measurements. Right now this only -supports extending PCRs statically and only on UEFI and BIOS systems, but -will measure all modules as they're loaded. ---- - grub-core/Makefile.am | 1 + - grub-core/Makefile.core.def | 3 + - grub-core/kern/dl.c | 3 + - grub-core/kern/efi/tpm.c | 282 +++++++++++++++++++++++++++++++++++++++++++ - grub-core/kern/i386/pc/tpm.c | 132 ++++++++++++++++++++ - grub-core/kern/tpm.c | 19 +++ - include/grub/efi/tpm.h | 153 +++++++++++++++++++++++ - include/grub/tpm.h | 89 ++++++++++++++ - 8 files changed, 682 insertions(+) - create mode 100644 grub-core/kern/efi/tpm.c - create mode 100644 grub-core/kern/i386/pc/tpm.c - create mode 100644 grub-core/kern/tpm.c - create mode 100644 include/grub/efi/tpm.h - create mode 100644 include/grub/tpm.h - -Index: grub-2.02~beta3/grub-core/Makefile.am -=================================================================== ---- grub-2.02~beta3.orig/grub-core/Makefile.am -+++ grub-2.02~beta3/grub-core/Makefile.am -@@ -92,6 +92,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/inc - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/tpm.h - KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h - - if COND_i386_pc -Index: grub-2.02~beta3/grub-core/Makefile.core.def -=================================================================== ---- grub-2.02~beta3.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta3/grub-core/Makefile.core.def -@@ -126,6 +126,7 @@ kernel = { - common = kern/rescue_parser.c; - common = kern/rescue_reader.c; - common = kern/term.c; -+ common = kern/tpm.c; - - noemu = kern/compiler-rt.c; - noemu = kern/mm.c; -@@ -173,6 +174,7 @@ kernel = { - efi = term/efi/console.c; - efi = kern/acpi.c; - efi = kern/efi/acpi.c; -+ efi = kern/efi/tpm.c; - i386_coreboot = kern/i386/pc/acpi.c; - i386_multiboot = kern/i386/pc/acpi.c; - i386_coreboot = kern/acpi.c; -@@ -217,6 +219,7 @@ kernel = { - - i386_pc = kern/i386/pc/init.c; - i386_pc = kern/i386/pc/mmap.c; -+ i386_pc = kern/i386/pc/tpm.c; - i386_pc = term/i386/pc/console.c; - - i386_qemu = bus/pci.c; -Index: grub-2.02~beta3/grub-core/kern/dl.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/kern/dl.c -+++ grub-2.02~beta3/grub-core/kern/dl.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - /* Platforms where modules are in a readonly area of memory. */ - #if defined(GRUB_MACHINE_QEMU) -@@ -729,6 +730,8 @@ grub_dl_load_file (const char *filename) - opens of the same device. */ - grub_file_close (file); - -+ grub_tpm_measure(core, size, GRUB_BINARY_PCR, "grub_module", filename); -+ - mod = grub_dl_load_core (core, size); - grub_free (core); - if (! mod) -Index: grub-2.02~beta3/grub-core/kern/efi/tpm.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta3/grub-core/kern/efi/tpm.c -@@ -0,0 +1,282 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static grub_efi_guid_t tpm_guid = EFI_TPM_GUID; -+static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID; -+ -+static grub_efi_boolean_t grub_tpm_present(grub_efi_tpm_protocol_t *tpm) -+{ -+ grub_efi_status_t status; -+ TCG_EFI_BOOT_SERVICE_CAPABILITY caps; -+ grub_uint32_t flags; -+ grub_efi_physical_address_t eventlog, lastevent; -+ -+ caps.Size = (grub_uint8_t)sizeof(caps); -+ -+ status = efi_call_5(tpm->status_check, tpm, &caps, &flags, &eventlog, -+ &lastevent); -+ -+ if (status != GRUB_EFI_SUCCESS || caps.TPMDeactivatedFlag -+ || !caps.TPMPresentFlag) -+ return 0; -+ -+ return 1; -+} -+ -+static grub_efi_boolean_t grub_tpm2_present(grub_efi_tpm2_protocol_t *tpm) -+{ -+ grub_efi_status_t status; -+ EFI_TCG2_BOOT_SERVICE_CAPABILITY caps; -+ -+ caps.Size = (grub_uint8_t)sizeof(caps); -+ -+ status = efi_call_2(tpm->get_capability, tpm, &caps); -+ -+ if (status != GRUB_EFI_SUCCESS || !caps.TPMPresentFlag) -+ return 0; -+ -+ return 1; -+} -+ -+static grub_efi_boolean_t grub_tpm_handle_find(grub_efi_handle_t *tpm_handle, -+ grub_efi_uint8_t *protocol_version) -+{ -+ grub_efi_handle_t *handles; -+ grub_efi_uintn_t num_handles; -+ -+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &tpm_guid, NULL, -+ &num_handles); -+ if (handles && num_handles > 0) { -+ *tpm_handle = handles[0]; -+ *protocol_version = 1; -+ return 1; -+ } -+ -+ handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &tpm2_guid, NULL, -+ &num_handles); -+ if (handles && num_handles > 0) { -+ *tpm_handle = handles[0]; -+ *protocol_version = 2; -+ return 1; -+ } -+ -+ return 0; -+} -+ -+static grub_err_t -+grub_tpm1_execute(grub_efi_handle_t tpm_handle, -+ PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ grub_efi_status_t status; -+ grub_efi_tpm_protocol_t *tpm; -+ grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn); -+ grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut); -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm_present(tpm)) -+ return 0; -+ -+ /* UEFI TPM protocol takes the raw operand block, no param block header */ -+ status = efi_call_5 (tpm->pass_through_to_tpm, tpm, -+ inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn, -+ outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+static grub_err_t -+grub_tpm2_execute(grub_efi_handle_t tpm_handle, -+ PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ grub_efi_status_t status; -+ grub_efi_tpm2_protocol_t *tpm; -+ grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn); -+ grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut); -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm2_present(tpm)) -+ return 0; -+ -+ /* UEFI TPM protocol takes the raw operand block, no param block header */ -+ status = efi_call_5 (tpm->submit_command, tpm, -+ inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn, -+ outbuf->OPBLength - outhdrsize, outbuf->TPMOperandOut); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+grub_err_t -+grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ grub_efi_handle_t tpm_handle; -+ grub_uint8_t protocol_version; -+ -+ /* It's not a hard failure for there to be no TPM */ -+ if (!grub_tpm_handle_find(&tpm_handle, &protocol_version)) -+ return 0; -+ -+ if (protocol_version == 1) { -+ return grub_tpm1_execute(tpm_handle, inbuf, outbuf); -+ } else { -+ return grub_tpm2_execute(tpm_handle, inbuf, outbuf); -+ } -+} -+ -+typedef struct { -+ grub_uint32_t pcrindex; -+ grub_uint32_t eventtype; -+ grub_uint8_t digest[20]; -+ grub_uint32_t eventsize; -+ grub_uint8_t event[1]; -+} Event; -+ -+ -+static grub_err_t -+grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf, -+ grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ Event *event; -+ grub_efi_status_t status; -+ grub_efi_tpm_protocol_t *tpm; -+ grub_efi_physical_address_t lastevent; -+ grub_uint32_t algorithm; -+ grub_uint32_t eventnum = 0; -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm_present(tpm)) -+ return 0; -+ -+ event = grub_zalloc(sizeof (Event) + grub_strlen(description) + 1); -+ if (!event) -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("cannot allocate TPM event buffer")); -+ -+ event->pcrindex = pcr; -+ event->eventtype = EV_IPL; -+ event->eventsize = grub_strlen(description) + 1; -+ grub_memcpy(event->event, description, event->eventsize); -+ -+ algorithm = TCG_ALG_SHA; -+ status = efi_call_7 (tpm->log_extend_event, tpm, buf, (grub_uint64_t) size, -+ algorithm, event, &eventnum, &lastevent); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+static grub_err_t -+grub_tpm2_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf, -+ grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ EFI_TCG2_EVENT *event; -+ grub_efi_status_t status; -+ grub_efi_tpm2_protocol_t *tpm; -+ -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!grub_tpm2_present(tpm)) -+ return 0; -+ -+ event = grub_zalloc(sizeof (EFI_TCG2_EVENT) + grub_strlen(description) + 1); -+ if (!event) -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("cannot allocate TPM event buffer")); -+ -+ event->Header.HeaderSize = sizeof(EFI_TCG2_EVENT_HEADER); -+ event->Header.HeaderVersion = 1; -+ event->Header.PCRIndex = pcr; -+ event->Header.EventType = EV_IPL; -+ event->Size = sizeof(*event) - sizeof(event->Event) + grub_strlen(description) + 1; -+ grub_memcpy(event->Event, description, grub_strlen(description) + 1); -+ -+ status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, buf, -+ (grub_uint64_t) size, event); -+ -+ switch (status) { -+ case GRUB_EFI_SUCCESS: -+ return 0; -+ case GRUB_EFI_DEVICE_ERROR: -+ return grub_error (GRUB_ERR_IO, N_("Command failed")); -+ case GRUB_EFI_INVALID_PARAMETER: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid parameter")); -+ case GRUB_EFI_BUFFER_TOO_SMALL: -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Output buffer too small")); -+ case GRUB_EFI_NOT_FOUND: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("TPM unavailable")); -+ default: -+ return grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("Unknown TPM error")); -+ } -+} -+ -+grub_err_t -+grub_tpm_log_event(unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ grub_efi_handle_t tpm_handle; -+ grub_efi_uint8_t protocol_version; -+ -+ if (!grub_tpm_handle_find(&tpm_handle, &protocol_version)) -+ return 0; -+ -+ if (protocol_version == 1) { -+ return grub_tpm1_log_event(tpm_handle, buf, size, pcr, description); -+ } else { -+ return grub_tpm2_log_event(tpm_handle, buf, size, pcr, description); -+ } -+} -Index: grub-2.02~beta3/grub-core/kern/i386/pc/tpm.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta3/grub-core/kern/i386/pc/tpm.c -@@ -0,0 +1,132 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define TCPA_MAGIC 0x41504354 -+ -+int tpm_present(void); -+ -+int tpm_present(void) -+{ -+ struct grub_bios_int_registers regs; -+ -+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; -+ regs.eax = 0xbb00; -+ regs.ebx = TCPA_MAGIC; -+ grub_bios_interrupt (0x1a, ®s); -+ -+ if (regs.eax == 0) -+ return 1; -+ -+ return 0; -+} -+ -+grub_err_t -+grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ struct grub_bios_int_registers regs; -+ grub_addr_t inaddr, outaddr; -+ -+ if (!tpm_present()) -+ return 0; -+ -+ inaddr = (grub_addr_t) inbuf; -+ outaddr = (grub_addr_t) outbuf; -+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; -+ regs.eax = 0xbb02; -+ regs.ebx = TCPA_MAGIC; -+ regs.ecx = 0; -+ regs.edx = 0; -+ regs.es = (inaddr & 0xffff0000) >> 4; -+ regs.edi = inaddr & 0xffff; -+ regs.ds = outaddr >> 4; -+ regs.esi = outaddr & 0xf; -+ -+ grub_bios_interrupt (0x1a, ®s); -+ -+ if (regs.eax) -+ return grub_error (GRUB_ERR_IO, N_("TPM error %x\n"), regs.eax); -+ -+ return 0; -+} -+ -+typedef struct { -+ grub_uint32_t pcrindex; -+ grub_uint32_t eventtype; -+ grub_uint8_t digest[20]; -+ grub_uint32_t eventdatasize; -+ grub_uint8_t event[0]; -+} GRUB_PACKED Event; -+ -+typedef struct { -+ grub_uint16_t ipblength; -+ grub_uint16_t reserved; -+ grub_uint32_t hashdataptr; -+ grub_uint32_t hashdatalen; -+ grub_uint32_t pcr; -+ grub_uint32_t reserved2; -+ grub_uint32_t logdataptr; -+ grub_uint32_t logdatalen; -+} GRUB_PACKED EventIncoming; -+ -+typedef struct { -+ grub_uint16_t opblength; -+ grub_uint16_t reserved; -+ grub_uint32_t eventnum; -+ grub_uint8_t hashvalue[20]; -+} GRUB_PACKED EventOutgoing; -+ -+grub_err_t -+grub_tpm_log_event(unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *description) -+{ -+ struct grub_bios_int_registers regs; -+ EventIncoming incoming; -+ EventOutgoing outgoing; -+ Event *event; -+ grub_uint32_t datalength; -+ -+ if (!tpm_present()) -+ return 0; -+ -+ datalength = grub_strlen(description); -+ event = grub_zalloc(datalength + sizeof(Event)); -+ if (!event) -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("cannot allocate TPM event buffer")); -+ -+ event->pcrindex = pcr; -+ event->eventtype = 0x0d; -+ event->eventdatasize = grub_strlen(description); -+ grub_memcpy(event->event, description, datalength); -+ -+ incoming.ipblength = sizeof(incoming); -+ incoming.hashdataptr = (grub_uint32_t)buf; -+ incoming.hashdatalen = size; -+ incoming.pcr = pcr; -+ incoming.logdataptr = (grub_uint32_t)event; -+ incoming.logdatalen = datalength + sizeof(Event); -+ -+ regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; -+ regs.eax = 0xbb01; -+ regs.ebx = TCPA_MAGIC; -+ regs.ecx = 0; -+ regs.edx = 0; -+ regs.es = (((grub_addr_t) &incoming) & 0xffff0000) >> 4; -+ regs.edi = ((grub_addr_t) &incoming) & 0xffff; -+ regs.ds = (((grub_addr_t) &outgoing) & 0xffff0000) >> 4; -+ regs.esi = ((grub_addr_t) &outgoing) & 0xffff; -+ -+ grub_bios_interrupt (0x1a, ®s); -+ -+ grub_free(event); -+ -+ if (regs.eax) -+ return grub_error (GRUB_ERR_IO, N_("TPM error %x\n"), regs.eax); -+ -+ return 0; -+} -Index: grub-2.02~beta3/grub-core/kern/tpm.c -=================================================================== ---- /dev/null -+++ grub-2.02~beta3/grub-core/kern/tpm.c -@@ -0,0 +1,19 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+grub_err_t -+grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, -+ const char *kind, const char *description) -+{ -+ grub_err_t ret; -+ char *desc = grub_xasprintf("%s %s", kind, description); -+ if (!desc) -+ return GRUB_ERR_OUT_OF_MEMORY; -+ ret = grub_tpm_log_event(buf, size, pcr, description); -+ grub_free(desc); -+ return ret; -+} -Index: grub-2.02~beta3/include/grub/efi/tpm.h -=================================================================== ---- /dev/null -+++ grub-2.02~beta3/include/grub/efi/tpm.h -@@ -0,0 +1,153 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_EFI_TPM_HEADER -+#define GRUB_EFI_TPM_HEADER 1 -+ -+#define EFI_TPM_GUID {0xf541796d, 0xa62e, 0x4954, {0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd }}; -+#define EFI_TPM2_GUID {0x607f766c, 0x7455, 0x42be, {0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f }}; -+ -+typedef struct { -+ grub_efi_uint8_t Major; -+ grub_efi_uint8_t Minor; -+ grub_efi_uint8_t RevMajor; -+ grub_efi_uint8_t RevMinor; -+} TCG_VERSION; -+ -+typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY { -+ grub_efi_uint8_t Size; /// Size of this structure. -+ TCG_VERSION StructureVersion; -+ TCG_VERSION ProtocolSpecVersion; -+ grub_efi_uint8_t HashAlgorithmBitmap; /// Hash algorithms . -+ char TPMPresentFlag; /// 00h = TPM not present. -+ char TPMDeactivatedFlag; /// 01h = TPM currently deactivated. -+} TCG_EFI_BOOT_SERVICE_CAPABILITY; -+ -+typedef struct { -+ grub_efi_uint32_t PCRIndex; -+ grub_efi_uint32_t EventType; -+ grub_efi_uint8_t digest[20]; -+ grub_efi_uint32_t EventSize; -+ grub_efi_uint8_t Event[1]; -+} TCG_PCR_EVENT; -+ -+struct grub_efi_tpm_protocol -+{ -+ grub_efi_status_t (*status_check) (struct grub_efi_tpm_protocol *this, -+ TCG_EFI_BOOT_SERVICE_CAPABILITY *ProtocolCapability, -+ grub_efi_uint32_t *TCGFeatureFlags, -+ grub_efi_physical_address_t *EventLogLocation, -+ grub_efi_physical_address_t *EventLogLastEntry); -+ grub_efi_status_t (*hash_all) (struct grub_efi_tpm_protocol *this, -+ grub_efi_uint8_t *HashData, -+ grub_efi_uint64_t HashLen, -+ grub_efi_uint32_t AlgorithmId, -+ grub_efi_uint64_t *HashedDataLen, -+ grub_efi_uint8_t **HashedDataResult); -+ grub_efi_status_t (*log_event) (struct grub_efi_tpm_protocol *this, -+ TCG_PCR_EVENT *TCGLogData, -+ grub_efi_uint32_t *EventNumber, -+ grub_efi_uint32_t Flags); -+ grub_efi_status_t (*pass_through_to_tpm) (struct grub_efi_tpm_protocol *this, -+ grub_efi_uint32_t TpmInputParameterBlockSize, -+ grub_efi_uint8_t *TpmInputParameterBlock, -+ grub_efi_uint32_t TpmOutputParameterBlockSize, -+ grub_efi_uint8_t *TpmOutputParameterBlock); -+ grub_efi_status_t (*log_extend_event) (struct grub_efi_tpm_protocol *this, -+ grub_efi_physical_address_t HashData, -+ grub_efi_uint64_t HashDataLen, -+ grub_efi_uint32_t AlgorithmId, -+ TCG_PCR_EVENT *TCGLogData, -+ grub_efi_uint32_t *EventNumber, -+ grub_efi_physical_address_t *EventLogLastEntry); -+}; -+ -+typedef struct grub_efi_tpm_protocol grub_efi_tpm_protocol_t; -+ -+typedef grub_efi_uint32_t EFI_TCG2_EVENT_LOG_BITMAP; -+typedef grub_efi_uint32_t EFI_TCG2_EVENT_LOG_FORMAT; -+typedef grub_efi_uint32_t EFI_TCG2_EVENT_ALGORITHM_BITMAP; -+ -+typedef struct tdEFI_TCG2_VERSION { -+ grub_efi_uint8_t Major; -+ grub_efi_uint8_t Minor; -+} GRUB_PACKED EFI_TCG2_VERSION; -+ -+typedef struct tdEFI_TCG2_BOOT_SERVICE_CAPABILITY { -+ grub_efi_uint8_t Size; -+ EFI_TCG2_VERSION StructureVersion; -+ EFI_TCG2_VERSION ProtocolVersion; -+ EFI_TCG2_EVENT_ALGORITHM_BITMAP HashAlgorithmBitmap; -+ EFI_TCG2_EVENT_LOG_BITMAP SupportedEventLogs; -+ grub_efi_boolean_t TPMPresentFlag; -+ grub_efi_uint16_t MaxCommandSize; -+ grub_efi_uint16_t MaxResponseSize; -+ grub_efi_uint32_t ManufacturerID; -+ grub_efi_uint32_t NumberOfPcrBanks; -+ EFI_TCG2_EVENT_ALGORITHM_BITMAP ActivePcrBanks; -+} EFI_TCG2_BOOT_SERVICE_CAPABILITY; -+ -+typedef grub_efi_uint32_t TCG_PCRINDEX; -+typedef grub_efi_uint32_t TCG_EVENTTYPE; -+ -+typedef struct tdEFI_TCG2_EVENT_HEADER { -+ grub_efi_uint32_t HeaderSize; -+ grub_efi_uint16_t HeaderVersion; -+ TCG_PCRINDEX PCRIndex; -+ TCG_EVENTTYPE EventType; -+} GRUB_PACKED EFI_TCG2_EVENT_HEADER; -+ -+typedef struct tdEFI_TCG2_EVENT { -+ grub_efi_uint32_t Size; -+ EFI_TCG2_EVENT_HEADER Header; -+ grub_efi_uint8_t Event[1]; -+} GRUB_PACKED EFI_TCG2_EVENT; -+ -+struct grub_efi_tpm2_protocol -+{ -+ grub_efi_status_t (*get_capability) (struct grub_efi_tpm2_protocol *this, -+ EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability); -+ grub_efi_status_t (*get_event_log) (struct grub_efi_tpm2_protocol *this, -+ EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat, -+ grub_efi_physical_address_t *EventLogLocation, -+ grub_efi_physical_address_t *EventLogLastEntry, -+ grub_efi_boolean_t *EventLogTruncated); -+ grub_efi_status_t (*hash_log_extend_event) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint64_t Flags, -+ grub_efi_physical_address_t *DataToHash, -+ grub_efi_uint64_t DataToHashLen, -+ EFI_TCG2_EVENT *EfiTcgEvent); -+ grub_efi_status_t (*submit_command) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t InputParameterBlockSize, -+ grub_efi_uint8_t *InputParameterBlock, -+ grub_efi_uint32_t OutputParameterBlockSize, -+ grub_efi_uint8_t *OutputParameterBlock); -+ grub_efi_status_t (*get_active_pcr_blanks) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t *ActivePcrBanks); -+ grub_efi_status_t (*set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t ActivePcrBanks); -+ grub_efi_status_t (*get_result_of_set_active_pcr_banks) (struct grub_efi_tpm2_protocol *this, -+ grub_efi_uint32_t *OperationPresent, -+ grub_efi_uint32_t *Response); -+}; -+ -+typedef struct grub_efi_tpm2_protocol grub_efi_tpm2_protocol_t; -+ -+#define TCG_ALG_SHA 0x00000004 -+ -+#endif -Index: grub-2.02~beta3/include/grub/tpm.h -=================================================================== ---- /dev/null -+++ grub-2.02~beta3/include/grub/tpm.h -@@ -0,0 +1,89 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2015 Free Software Foundation, Inc. -+ * -+ * GRUB is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation, either version 3 of the License, or -+ * (at your option) any later version. -+ * -+ * GRUB is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with GRUB. If not, see . -+ */ -+ -+#ifndef GRUB_TPM_HEADER -+#define GRUB_TPM_HEADER 1 -+ -+#define SHA1_DIGEST_SIZE 20 -+ -+#define TPM_BASE 0x0 -+#define TPM_SUCCESS TPM_BASE -+#define TPM_AUTHFAIL (TPM_BASE + 0x1) -+#define TPM_BADINDEX (TPM_BASE + 0x2) -+ -+#define GRUB_ASCII_PCR 8 -+#define GRUB_BINARY_PCR 9 -+ -+#define TPM_TAG_RQU_COMMAND 0x00C1 -+#define TPM_ORD_Extend 0x14 -+ -+#define EV_IPL 0x0d -+ -+/* TCG_PassThroughToTPM Input Parameter Block */ -+typedef struct { -+ grub_uint16_t IPBLength; -+ grub_uint16_t Reserved1; -+ grub_uint16_t OPBLength; -+ grub_uint16_t Reserved2; -+ grub_uint8_t TPMOperandIn[1]; -+} GRUB_PACKED PassThroughToTPM_InputParamBlock; -+ -+/* TCG_PassThroughToTPM Output Parameter Block */ -+typedef struct { -+ grub_uint16_t OPBLength; -+ grub_uint16_t Reserved; -+ grub_uint8_t TPMOperandOut[1]; -+} GRUB_PACKED PassThroughToTPM_OutputParamBlock; -+ -+typedef struct { -+ grub_uint16_t tag; -+ grub_uint32_t paramSize; -+ grub_uint32_t ordinal; -+ grub_uint32_t pcrNum; -+ grub_uint8_t inDigest[SHA1_DIGEST_SIZE]; /* The 160 bit value representing the event to be recorded. */ -+} GRUB_PACKED ExtendIncoming; -+ -+/* TPM_Extend Outgoing Operand */ -+typedef struct { -+ grub_uint16_t tag; -+ grub_uint32_t paramSize; -+ grub_uint32_t returnCode; -+ grub_uint8_t outDigest[SHA1_DIGEST_SIZE]; /* The PCR value after execution of the command. */ -+} GRUB_PACKED ExtendOutgoing; -+ -+grub_err_t EXPORT_FUNC(grub_tpm_measure) (unsigned char *buf, grub_size_t size, -+ grub_uint8_t pcr, const char *kind, -+ const char *description); -+#if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) -+grub_err_t grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf); -+grub_err_t grub_tpm_log_event(unsigned char *buf, grub_size_t size, -+ grub_uint8_t pcr, const char *description); -+#else -+static inline grub_err_t grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) { return 0; }; -+static inline grub_err_t grub_tpm_log_event(unsigned char *buf, -+ grub_size_t size, -+ grub_uint8_t pcr, -+ const char *description) -+{ -+ return 0; -+}; -+#endif -+ -+#endif diff --git a/0001-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch b/0001-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch deleted file mode 100644 index 4180f5f..0000000 --- a/0001-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 446794de8da4329ea532cbee4ca877bcafd0e534 Mon Sep 17 00:00:00 2001 -From: "David E. Box" -Date: Fri, 15 Sep 2017 15:37:05 -0700 -Subject: [PATCH] tsc: Change default tsc calibration method to pmtimer on EFI - systems - -On efi systems, make pmtimer based tsc calibration the default over the -pit. This prevents Grub from hanging on Intel SoC systems that power gate -the pit. - -Signed-off-by: David E. Box -Reviewed-by: Daniel Kiper ---- - grub-core/kern/i386/tsc.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: grub-2.02/grub-core/kern/i386/tsc.c -=================================================================== ---- grub-2.02.orig/grub-core/kern/i386/tsc.c -+++ grub-2.02/grub-core/kern/i386/tsc.c -@@ -68,7 +68,7 @@ grub_tsc_init (void) - #ifdef GRUB_MACHINE_XEN - (void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode()); - #elif defined (GRUB_MACHINE_EFI) -- (void) (grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode()); -+ (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode()); - #elif defined (GRUB_MACHINE_COREBOOT) - (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode()); - #else diff --git a/0001-xfs-Accept-filesystem-with-sparse-inodes.patch b/0001-xfs-Accept-filesystem-with-sparse-inodes.patch deleted file mode 100644 index a28b11a..0000000 --- a/0001-xfs-Accept-filesystem-with-sparse-inodes.patch +++ /dev/null @@ -1,57 +0,0 @@ -From cda0a857dd7a27cd5d621747464bfe71e8727fff Mon Sep 17 00:00:00 2001 -From: Daniel Kiper -Date: Tue, 29 May 2018 16:16:02 +0200 -Subject: [PATCH] xfs: Accept filesystem with sparse inodes - -The sparse inode metadata format became a mkfs.xfs default in -xfsprogs-4.16.0, and such filesystems are now rejected by grub as -containing an incompatible feature. - -In essence, this feature allows xfs to allocate inodes into fragmented -freespace. (Without this feature, if xfs could not allocate contiguous -space for 64 new inodes, inode creation would fail.) - -In practice, the disk format change is restricted to the inode btree, -which as far as I can tell is not used by grub. If all you're doing -today is parsing a directory, reading an inode number, and converting -that inode number to a disk location, then ignoring this feature -should be fine, so I've added it to XFS_SB_FEAT_INCOMPAT_SUPPORTED - -I did some brief testing of this patch by hacking up the regression -tests to completely fragment freespace on the test xfs filesystem, and -then write a large-ish number of inodes to consume any existing -contiguous 64-inode chunk. This way any files the grub tests add and -traverse would be in such a fragmented inode allocation. Tests passed, -but I'm not sure how to cleanly integrate that into the test harness. - -Signed-off-by: Eric Sandeen -Reviewed-by: Daniel Kiper -Tested-by: Chris Murphy ---- - grub-core/fs/xfs.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -Index: grub-2.02/grub-core/fs/xfs.c -=================================================================== ---- grub-2.02.orig/grub-core/fs/xfs.c -+++ grub-2.02/grub-core/fs/xfs.c -@@ -79,9 +79,18 @@ GRUB_MOD_LICENSE ("GPLv3+"); - #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ - #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ - --/* We do not currently verify metadata UUID so it is safe to read such filesystem */ -+/* -+ * Directory entries with ftype are explicitly handled by GRUB code. -+ * -+ * We do not currently read the inode btrees, so it is safe to read filesystems -+ * with the XFS_SB_FEAT_INCOMPAT_SPINODES feature. -+ * -+ * We do not currently verify metadata UUID, so it is safe to read filesystems -+ * with the XFS_SB_FEAT_INCOMPAT_META_UUID feature. -+ */ - #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \ - (XFS_SB_FEAT_INCOMPAT_FTYPE | \ -+ XFS_SB_FEAT_INCOMPAT_SPINODES | \ - XFS_SB_FEAT_INCOMPAT_META_UUID) - - struct grub_xfs_sblock diff --git a/0002-Add-Virtual-LAN-support.patch b/0002-Add-Virtual-LAN-support.patch deleted file mode 100644 index 541f2ee..0000000 --- a/0002-Add-Virtual-LAN-support.patch +++ /dev/null @@ -1,360 +0,0 @@ -From d17c80ca8de35f8cb06175965d428bdabbda3c19 Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Mon, 30 Jun 2014 10:37:08 -0300 -Subject: [PATCH 2/2] Add Virtual LAN support. - -This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows -multiple VLANs in a bridged network to share the same physical network link -but maintain isolation: - -http://en.wikipedia.org/wiki/IEEE_802.1Q ---- - ChangeLog | 17 ++++++++++++ - grub-core/net/arp.c | 10 +++++-- - grub-core/net/drivers/ieee1275/ofnet.c | 20 +++++++++++++- - grub-core/net/ethernet.c | 49 ++++++++++++++++++++++++++++++---- - grub-core/net/ip.c | 31 ++++++++++++++------- - include/grub/net.h | 9 +++++++ - include/grub/net/arp.h | 5 ++-- - include/grub/net/ip.h | 3 ++- - 8 files changed, 124 insertions(+), 20 deletions(-) - -Index: grub-2.02~beta3/grub-core/net/arp.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/net/arp.c 2016-02-28 19:23:27.060877621 +0300 -+++ grub-2.02~beta3/grub-core/net/arp.c 2016-02-28 19:23:27.056877621 +0300 -@@ -111,8 +111,8 @@ - } - - grub_err_t --grub_net_arp_receive (struct grub_net_buff *nb, -- struct grub_net_card *card) -+grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card, -+ grub_uint16_t vlantag_vid) - { - struct arppkt *arp_packet = (struct arppkt *) nb->data; - grub_net_network_level_address_t sender_addr, target_addr; -@@ -138,6 +138,12 @@ - - FOR_NET_NETWORK_LEVEL_INTERFACES (inf) - { -+ /* Check vlantag id */ -+ if (inf->card == card && -+ ((inf->vlantag.set && vlantag_vid != inf->vlantag.vid) || -+ (!inf->vlantag.set && vlantag_vid != 0))) -+ continue; -+ - /* Am I the protocol address target? */ - if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 - && arp_packet->op == grub_cpu_to_be16_compile_time (ARP_REQUEST)) -Index: grub-2.02~beta3/grub-core/net/drivers/ieee1275/ofnet.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/net/drivers/ieee1275/ofnet.c 2016-02-28 19:23:27.060877621 +0300 -+++ grub-2.02~beta3/grub-core/net/drivers/ieee1275/ofnet.c 2016-02-28 19:24:47.004878566 +0300 -@@ -147,11 +147,11 @@ - char *comma_char = 0; - char *equal_char = 0; - grub_size_t field_counter = 0; -- - grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask; - grub_net_link_level_address_t hw_addr; - grub_net_interface_flags_t flags = 0; - struct grub_net_network_level_interface *inter = NULL; -+ grub_uint32_t vlantag = 0; - - hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; - -@@ -169,6 +169,18 @@ - *equal_char = 0; - grub_env_set_net_property ((*card)->name, args, equal_char + 1, - grub_strlen(equal_char + 1)); -+ -+ if ((grub_strcmp (args, "vtag") == 0) && -+ (grub_strlen (equal_char + 1) > 4)) -+ { -+ vlantag = grub_strtoul (equal_char + 1, 0, 16) & 0xffff; -+ if (grub_errno == GRUB_ERR_BAD_NUMBER) -+ { -+ vlantag = 0; -+ grub_errno = GRUB_ERR_NONE; -+ } -+ } -+ - *equal_char = '='; - } - else -@@ -207,6 +219,12 @@ - hw_addr.mac, sizeof(hw_addr.mac), 0); - inter = grub_net_add_addr ((*card)->name, *card, &client_addr, &hw_addr, - flags); -+ if (vlantag > 0) -+ { -+ inter->vlantag.set = 1; -+ inter->vlantag.vid = vlantag & 0xfff; -+ } -+ - grub_net_add_ipv4_local (inter, - __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); - } -Index: grub-2.02~beta3/grub-core/net/ethernet.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/net/ethernet.c 2016-02-28 19:23:27.060877621 +0300 -+++ grub-2.02~beta3/grub-core/net/ethernet.c 2016-02-28 19:23:27.056877621 +0300 -@@ -18,6 +18,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -56,10 +57,16 @@ - { - struct etherhdr *eth; - grub_err_t err; -+ grub_uint8_t etherhdr_size; - -- COMPILE_TIME_ASSERT (sizeof (*eth) < GRUB_NET_MAX_LINK_HEADER_SIZE); -+ etherhdr_size = sizeof (*eth); -+ COMPILE_TIME_ASSERT (sizeof (*eth) + 4 < GRUB_NET_MAX_LINK_HEADER_SIZE); - -- err = grub_netbuff_push (nb, sizeof (*eth)); -+ /* Increase ethernet header in case of vlantag */ -+ if (inf->vlantag.set) -+ etherhdr_size += 4; -+ -+ err = grub_netbuff_push (nb, etherhdr_size); - if (err) - return err; - eth = (struct etherhdr *) nb->data; -@@ -76,6 +83,21 @@ - return err; - inf->card->opened = 1; - } -+ -+ /* Check and add a vlan-tag if needed. */ -+ if (inf->vlantag.set) -+ { -+ grub_uint32_t vlantag; -+ vlantag = grub_cpu_to_be32 ((VLANTAG_IDENTIFIER << 16) | inf->vlantag.vid); -+ -+ /* Move eth type to the right */ -+ grub_memcpy ((char *) nb->data + etherhdr_size - 2, -+ (char *) nb->data + etherhdr_size - 6, 2); -+ -+ /* Add the tag in the middle */ -+ grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag, 4); -+ } -+ - return inf->card->driver->send (inf->card, nb); - } - -@@ -90,10 +112,26 @@ - grub_net_link_level_address_t hwaddress; - grub_net_link_level_address_t src_hwaddress; - grub_err_t err; -+ grub_uint8_t etherhdr_size = sizeof (*eth); -+ grub_uint16_t vlantag_vid = 0; -+ -+ /* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */ -+ /* longer than the original one. The vlantag id is extracted and the header */ -+ /* is reseted to the original size. */ -+ if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == -+ grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER)) -+ { -+ vlantag_vid = grub_be_to_cpu16 (grub_get_unaligned16 (nb->data + -+ etherhdr_size)) & 0x1fff; -+ etherhdr_size += 4; -+ /* Move eth type to the original position */ -+ grub_memcpy((char *) nb->data + etherhdr_size - 6, -+ (char *) nb->data + etherhdr_size - 2, 2); -+ } - - eth = (struct etherhdr *) nb->data; - type = grub_be_to_cpu16 (eth->type); -- err = grub_netbuff_pull (nb, sizeof (*eth)); -+ err = grub_netbuff_pull (nb, etherhdr_size); - if (err) - return err; - -@@ -121,13 +159,14 @@ - { - /* ARP packet. */ - case GRUB_NET_ETHERTYPE_ARP: -- grub_net_arp_receive (nb, card); -+ grub_net_arp_receive (nb, card, vlantag_vid); - grub_netbuff_free (nb); - return GRUB_ERR_NONE; - /* IP packet. */ - case GRUB_NET_ETHERTYPE_IP: - case GRUB_NET_ETHERTYPE_IP6: -- return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress); -+ return grub_net_recv_ip_packets (nb, card, &hwaddress, &src_hwaddress, -+ vlantag_vid); - } - grub_netbuff_free (nb); - return GRUB_ERR_NONE; -Index: grub-2.02~beta3/grub-core/net/ip.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/net/ip.c 2016-02-28 19:23:27.060877621 +0300 -+++ grub-2.02~beta3/grub-core/net/ip.c 2016-02-28 19:23:27.056877621 +0300 -@@ -228,12 +228,13 @@ - grub_net_ip_protocol_t proto, - const grub_net_network_level_address_t *source, - const grub_net_network_level_address_t *dest, -+ grub_uint16_t vlantag_vid, - grub_uint8_t ttl) - { - struct grub_net_network_level_interface *inf = NULL; - grub_err_t err; - int multicast = 0; -- -+ - /* DHCP needs special treatment since we don't know IP yet. */ - { - struct udphdr *udph; -@@ -293,6 +294,13 @@ - && grub_net_addr_cmp (&inf->address, dest) == 0 - && grub_net_hwaddr_cmp (&inf->hwaddress, hwaddress) == 0) - break; -+ -+ /* Check vlantag id */ -+ if (inf->card == card && -+ ((inf->vlantag.set && vlantag_vid != inf->vlantag.vid) || -+ (!inf->vlantag.set && vlantag_vid != 0))) -+ continue; -+ - /* Solicited node multicast. */ - if (inf->card == card - && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6 -@@ -381,7 +389,8 @@ - grub_net_recv_ip4_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress) -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t vlantag_vid) - { - struct iphdr *iph = (struct iphdr *) nb->data; - grub_err_t err; -@@ -456,7 +465,7 @@ - dest.ipv4 = iph->dest; - - return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, -- &source, &dest, iph->ttl); -+ &source, &dest, vlantag_vid, iph->ttl); - } - - for (prev = &reassembles, rsm = *prev; rsm; prev = &rsm->next, rsm = *prev) -@@ -592,7 +601,7 @@ - dest.ipv4 = dst; - - return handle_dgram (ret, card, src_hwaddress, -- hwaddress, proto, &source, &dest, -+ hwaddress, proto, &source, &dest, vlantag_vid, - ttl); - } - } -@@ -650,7 +659,8 @@ - grub_net_recv_ip6_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress) -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t vlantag_vid) - { - struct ip6hdr *iph = (struct ip6hdr *) nb->data; - grub_err_t err; -@@ -701,21 +711,24 @@ - grub_memcpy (dest.ipv6, &iph->dest, sizeof (dest.ipv6)); - - return handle_dgram (nb, card, src_hwaddress, hwaddress, iph->protocol, -- &source, &dest, iph->ttl); -+ &source, &dest, vlantag_vid, iph->ttl); - } - - grub_err_t - grub_net_recv_ip_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress) -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t vlantag_vid) - { - struct iphdr *iph = (struct iphdr *) nb->data; - - if ((iph->verhdrlen >> 4) == 4) -- return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress); -+ return grub_net_recv_ip4_packets (nb, card, hwaddress, src_hwaddress, -+ vlantag_vid); - if ((iph->verhdrlen >> 4) == 6) -- return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress); -+ return grub_net_recv_ip6_packets (nb, card, hwaddress, src_hwaddress, -+ vlantag_vid); - grub_dprintf ("net", "Bad IP version: %d\n", (iph->verhdrlen >> 4)); - grub_netbuff_free (nb); - return GRUB_ERR_NONE; -Index: grub-2.02~beta3/include/grub/net.h -=================================================================== ---- grub-2.02~beta3.orig/include/grub/net.h 2016-02-28 19:23:27.060877621 +0300 -+++ grub-2.02~beta3/include/grub/net.h 2016-02-28 19:23:27.056877621 +0300 -@@ -280,6 +280,12 @@ - - extern grub_net_t (*EXPORT_VAR (grub_net_open)) (const char *name); - -+struct grub_net_vlantag -+{ -+ grub_uint8_t set; -+ grub_uint16_t vid; -+}; -+ - struct grub_net_network_level_interface - { - struct grub_net_network_level_interface *next; -@@ -291,6 +297,7 @@ - grub_net_interface_flags_t flags; - struct grub_net_bootp_packet *dhcp_ack; - grub_size_t dhcp_acklen; -+ struct grub_net_vlantag vlantag; - void *data; - }; - -@@ -561,4 +568,6 @@ - #define GRUB_NET_INTERVAL 400 - #define GRUB_NET_INTERVAL_ADDITION 20 - -+#define VLANTAG_IDENTIFIER 0x8100 -+ - #endif /* ! GRUB_NET_HEADER */ -Index: grub-2.02~beta3/include/grub/net/arp.h -=================================================================== ---- grub-2.02~beta3.orig/include/grub/net/arp.h 2016-02-28 19:23:27.060877621 +0300 -+++ grub-2.02~beta3/include/grub/net/arp.h 2016-02-28 19:23:27.056877621 +0300 -@@ -22,10 +22,11 @@ - #include - - extern grub_err_t grub_net_arp_receive (struct grub_net_buff *nb, -- struct grub_net_card *card); -+ struct grub_net_card *card, -+ grub_uint16_t vlantag_vid); - - grub_err_t - grub_net_arp_send_request (struct grub_net_network_level_interface *inf, -- const grub_net_network_level_address_t *proto_addr); -+ const grub_net_network_level_address_t *proto_addr); - - #endif -Index: grub-2.02~beta3/include/grub/net/ip.h -=================================================================== ---- grub-2.02~beta3.orig/include/grub/net/ip.h 2016-02-28 19:23:27.060877621 +0300 -+++ grub-2.02~beta3/include/grub/net/ip.h 2016-02-28 19:23:27.056877621 +0300 -@@ -48,7 +48,8 @@ - grub_net_recv_ip_packets (struct grub_net_buff *nb, - struct grub_net_card *card, - const grub_net_link_level_address_t *hwaddress, -- const grub_net_link_level_address_t *src_hwaddress); -+ const grub_net_link_level_address_t *src_hwaddress, -+ grub_uint16_t vlantag_vid); - - grub_err_t - grub_net_send_ip_packet (struct grub_net_network_level_interface *inf, diff --git a/0002-jfs-Disable-gcc9-Waddress-of-packed-member.patch b/0002-jfs-Disable-gcc9-Waddress-of-packed-member.patch deleted file mode 100644 index ed3a280..0000000 --- a/0002-jfs-Disable-gcc9-Waddress-of-packed-member.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 4f4128defdec0958f7a38736e2c9be2368a5a6da Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:03 +0800 -Subject: [PATCH 2/8] jfs: Disable gcc9 -Waddress-of-packed-member - -Disable the -Wadress-of-packaed-member diagnostic for the -grub_jfs_getent function since the result is found to be false postive. - -The leaf is read into memory as continous chunks in size of 32 bytes and -the pointer to its base is aligned, which also guarentee its member -leaf->namepart is aligned. - -[ 60s] ../grub-core/fs/jfs.c: In function 'grub_jfs_getent': -[ 60s] ../grub-core/fs/jfs.c:557:44: error: taking address of packed member of 'struct grub_jfs_leaf_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 60s] 557 | le_to_cpu16_copy (filename + strpos, leaf->namepart, len < diro->data->namecomponentlen ? len -[ 60s] | ~~~~^~~~~~~~~~ -[ 60s] ../grub-core/fs/jfs.c:570:48: error: taking address of packed member of 'struct grub_jfs_leaf_next_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 60s] 570 | le_to_cpu16_copy (filename + strpos, next_leaf->namepart, len < 15 ? len : 15); -[ 60s] | ~~~~~~~~~^~~~~~~~~~ -[ 60s] cc1: all warnings being treated as errors - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - grub-core/fs/jfs.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c -index 09bc5608d..d5a6d6527 100644 ---- a/grub-core/fs/jfs.c -+++ b/grub-core/fs/jfs.c -@@ -505,6 +505,10 @@ le_to_cpu16_copy (grub_uint16_t *out, grub_uint16_t *in, grub_size_t len) - *out++ = grub_le_to_cpu16 (*in++); - } - -+#if __GNUC__ >= 9 -+#pragma GCC diagnostic push -+#pragma GCC diagnostic ignored "-Waddress-of-packed-member" -+#endif - - /* Read in the next dirent from the directory described by DIRO. */ - static grub_err_t -@@ -582,6 +586,9 @@ grub_jfs_getent (struct grub_jfs_diropen *diro) - return 0; - } - -+#if __GNUC__ >= 9 -+#pragma GCC diagnostic pop -+#endif - - /* Read LEN bytes from the file described by DATA starting with byte - POS. Return the amount of read bytes in READ. */ --- -2.16.4 - diff --git a/0002-tpm-Measure-kernel-initrd.patch b/0002-tpm-Measure-kernel-initrd.patch deleted file mode 100644 index c865b07..0000000 --- a/0002-tpm-Measure-kernel-initrd.patch +++ /dev/null @@ -1,39 +0,0 @@ -From b3afe6ad07192d3f38875e30b57a785ac3b1ea27 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Thu, 16 Jul 2015 15:22:34 -0700 -Subject: [PATCH 02/11] Measure kernel + initrd - -Measure the kernel and initrd when loaded on UEFI systems ---- - grub-core/loader/i386/efi/linux.c | 4 ++++ - 1 file changed, 4 insertions(+) - -Index: grub-2.02~beta3/grub-core/loader/i386/efi/linux.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/loader/i386/efi/linux.c -+++ grub-2.02~beta3/grub-core/loader/i386/efi/linux.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -162,6 +163,7 @@ grub_cmd_initrd (grub_command_t cmd __at - argv[i]); - goto fail; - } -+ grub_tpm_measure (ptr, cursize, GRUB_BINARY_PCR, "grub_linuxefi", "Initrd"); - ptr += cursize; - grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); - ptr += ALIGN_UP_OVERHEAD (cursize, 4); -@@ -217,6 +219,8 @@ grub_cmd_linux (grub_command_t cmd __att - goto fail; - } - -+ grub_tpm_measure (kernel, filelen, GRUB_BINARY_PCR, "grub_linuxefi", "Kernel"); -+ - if (! grub_linuxefi_secure_validate (kernel, filelen)) - { - grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); diff --git a/0003-bootp-New-net_bootp6-command.patch b/0003-bootp-New-net_bootp6-command.patch index 79edd45..35cede2 100644 --- a/0003-bootp-New-net_bootp6-command.patch +++ b/0003-bootp-New-net_bootp6-command.patch @@ -14,10 +14,10 @@ Signed-off-by: Ken Lin include/grub/net.h | 72 ++++ 3 files changed, 1018 insertions(+), 1 deletion(-) -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 189551a..81173b4 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c +Index: grub-2.04~rc1/grub-core/net/bootp.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/net/bootp.c ++++ grub-2.04~rc1/grub-core/net/bootp.c @@ -24,6 +24,98 @@ #include #include @@ -115,10 +115,10 @@ index 189551a..81173b4 100644 + return 1; +} - static void - parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) -@@ -266,6 +358,578 @@ grub_net_configure_by_dhcp_ack (const char *name, - return inter; + struct grub_dhcp_discover_options + { +@@ -563,6 +655,578 @@ out: + return err; } +/* The default netbuff size for sending DHCPv6 packets which should be @@ -693,10 +693,10 @@ index 189551a..81173b4 100644 + return inf; +} + - void - grub_net_process_dhcp (struct grub_net_buff *nb, - struct grub_net_card *card) -@@ -298,6 +962,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb, + /* + * This is called directly from net/ip.c:handle_dgram(), because those + * BOOTP/DHCP packets are a bit special due to their improper +@@ -631,6 +1295,77 @@ grub_net_process_dhcp (struct grub_net_b } } @@ -774,11 +774,11 @@ index 189551a..81173b4 100644 static char hexdigit (grub_uint8_t val) { -@@ -578,7 +1313,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), +@@ -864,7 +1599,174 @@ grub_cmd_bootp (struct grub_command *cmd return err; } --static grub_command_t cmd_getdhcp, cmd_bootp; +-static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp; +static grub_err_t +grub_cmd_bootp6 (struct grub_command *cmd __attribute__ ((unused)), + int argc, char **args) @@ -946,11 +946,11 @@ index 189551a..81173b4 100644 + return err; +} + -+static grub_command_t cmd_getdhcp, cmd_bootp, cmd_bootp6; ++static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp, cmd_bootp6; void grub_bootp_init (void) -@@ -589,6 +1491,9 @@ grub_bootp_init (void) +@@ -878,6 +1780,9 @@ grub_bootp_init (void) cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt, N_("VAR INTERFACE NUMBER DESCRIPTION"), N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value.")); @@ -960,17 +960,17 @@ index 189551a..81173b4 100644 } void -@@ -596,4 +1501,5 @@ grub_bootp_fini (void) - { +@@ -886,4 +1791,5 @@ grub_bootp_fini (void) grub_unregister_command (cmd_getdhcp); grub_unregister_command (cmd_bootp); + grub_unregister_command (cmd_dhcp); + grub_unregister_command (cmd_bootp6); } -diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c -index 8c56baa..2a239b5 100644 ---- a/grub-core/net/ip.c -+++ b/grub-core/net/ip.c -@@ -238,6 +238,45 @@ handle_dgram (struct grub_net_buff *nb, +Index: grub-2.04~rc1/grub-core/net/ip.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/net/ip.c ++++ grub-2.04~rc1/grub-core/net/ip.c +@@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb, { struct udphdr *udph; udph = (struct udphdr *) nb->data; @@ -1016,11 +1016,11 @@ index 8c56baa..2a239b5 100644 if (proto == GRUB_NET_IP_UDP && grub_be_to_cpu16 (udph->dst) == 68) { const struct grub_net_bootp_packet *bootp; -diff --git a/include/grub/net.h b/include/grub/net.h -index ccc169c..38a3973 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -442,6 +442,66 @@ struct grub_net_bootp_packet +Index: grub-2.04~rc1/include/grub/net.h +=================================================================== +--- grub-2.04~rc1.orig/include/grub/net.h ++++ grub-2.04~rc1/include/grub/net.h +@@ -448,6 +448,66 @@ struct grub_net_bootp_packet grub_uint8_t vendor[0]; } GRUB_PACKED; @@ -1087,7 +1087,7 @@ index ccc169c..38a3973 100644 #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 #define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 #define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53 -@@ -468,6 +528,14 @@ grub_net_configure_by_dhcp_ack (const char *name, +@@ -481,6 +541,14 @@ grub_net_configure_by_dhcp_ack (const ch grub_size_t size, int is_def, char **device, char **path); @@ -1102,9 +1102,9 @@ index ccc169c..38a3973 100644 grub_err_t grub_net_add_ipv4_local (struct grub_net_network_level_interface *inf, int mask); -@@ -476,6 +544,10 @@ void +@@ -489,6 +557,10 @@ void grub_net_process_dhcp (struct grub_net_buff *nb, - struct grub_net_card *card); + struct grub_net_network_level_interface *iface); +grub_err_t +grub_net_process_dhcp6 (struct grub_net_buff *nb, @@ -1113,6 +1113,3 @@ index ccc169c..38a3973 100644 int grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a, const grub_net_link_level_address_t *b); --- -2.6.6 - diff --git a/0003-hfs-Fix-gcc9-error-Waddress-of-packed-member.patch b/0003-hfs-Fix-gcc9-error-Waddress-of-packed-member.patch deleted file mode 100644 index 8b5753c..0000000 --- a/0003-hfs-Fix-gcc9-error-Waddress-of-packed-member.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0e49748fad8e036d9875785e57c577214e699941 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:04 +0800 -Subject: [PATCH 3/8] hfs: Fix gcc9 error -Waddress-of-packed-member - -Simply adds the missing packed attribute to 'struct grub_hfs_extent'. - -[ 83s] ../grub-core/fs/hfs.c: In function 'grub_hfs_iterate_records': -[ 83s] ../grub-core/fs/hfs.c:699:9: error: taking address of packed member of 'struct grub_hfs_sblock' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 83s] 699 | ? (&data->sblock.catalog_recs) -[ 83s] | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~ -[ 83s] ../grub-core/fs/hfs.c:700:9: error: taking address of packed member of 'struct grub_hfs_sblock' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 83s] 700 | : (&data->sblock.extent_recs)); -[ 83s] | ~^~~~~~~~~~~~~~~~~~~~~~~~~~ - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - include/grub/hfs.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/grub/hfs.h b/include/grub/hfs.h -index d935f5005..e27993c42 100644 ---- a/include/grub/hfs.h -+++ b/include/grub/hfs.h -@@ -29,7 +29,7 @@ struct grub_hfs_extent - /* The first physical block. */ - grub_uint16_t first_block; - grub_uint16_t count; --}; -+} GRUB_PACKED; - - /* HFS stores extents in groups of 3. */ - typedef struct grub_hfs_extent grub_hfs_datarecord_t[3]; --- -2.16.4 - diff --git a/0003-tpm-Add-BIOS-boot-measurement.patch b/0003-tpm-Add-BIOS-boot-measurement.patch deleted file mode 100644 index 21ce113..0000000 --- a/0003-tpm-Add-BIOS-boot-measurement.patch +++ /dev/null @@ -1,179 +0,0 @@ -From e12373683b894f22c2e35dc3732440a4e9053d61 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Sun, 9 Aug 2015 15:48:51 -0700 -Subject: [PATCH 03/11] Add BIOS boot measurement - -Measure the on-disk grub core on BIOS systems - unlike UEFI, the firmware -can't do this stage for us. ---- - grub-core/boot/i386/pc/boot.S | 30 +++++++++++++++++++++++++- - grub-core/boot/i386/pc/diskboot.S | 44 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 73 insertions(+), 1 deletion(-) - -diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S -index 2bd0b2d..4c63247 100644 ---- a/grub-core/boot/i386/pc/boot.S -+++ b/grub-core/boot/i386/pc/boot.S -@@ -24,11 +24,14 @@ - * defines for the code go here - */ - -+#define TPM 1 -+ - /* Print message string */ - #define MSG(x) movw $x, %si; call LOCAL(message) - #define ERR(x) movw $x, %si; jmp LOCAL(error_message) - - .macro floppy -+#ifndef TPM - part_start: - - LOCAL(probe_values): -@@ -85,6 +88,7 @@ fd_probe_error_string: .asciz "Floppy" - movb MACRO_DOLLAR(79), %ch - - jmp LOCAL(final_init) -+#endif - .endm - - .macro scratch -@@ -255,6 +259,7 @@ real_start: - /* set %si to the disk address packet */ - movw $disk_address_packet, %si - -+#ifndef TPM - /* check if LBA is supported */ - movb $0x41, %ah - movw $0x55aa, %bx -@@ -274,6 +279,7 @@ real_start: - - andw $1, %cx - jz LOCAL(chs_mode) -+#endif - - LOCAL(lba_mode): - xorw %ax, %ax -@@ -317,6 +323,9 @@ LOCAL(lba_mode): - jmp LOCAL(copy_buffer) - - LOCAL(chs_mode): -+#ifdef TPM -+ jmp LOCAL(general_error) -+#else - /* - * Determine the hard disk geometry from the BIOS! - * We do this first, so that LS-120 IDE floppies work correctly. -@@ -428,7 +437,7 @@ setup_sectors: - jc LOCAL(read_error) - - movw %es, %bx -- -+#endif /* TPM */ - LOCAL(copy_buffer): - /* - * We need to save %cx and %si because the startup code in -@@ -451,6 +460,25 @@ LOCAL(copy_buffer): - popw %ds - popa - -+#ifdef TPM -+ pusha -+ -+ movw $0xBB00, %ax /* TCG_StatusCheck */ -+ int $0x1A -+ test %eax, %eax -+ jnz boot /* No TPM or TPM deactivated */ -+ -+ movw $0xBB07, %ax /* TCG_CompactHashLogExtendEvent */ -+ movw $GRUB_BOOT_MACHINE_KERNEL_ADDR, %di -+ xorl %esi, %esi -+ movl $0x41504354, %ebx /* TCPA */ -+ movl $0x200, %ecx /* Measure 512 bytes */ -+ movl $0x8, %edx /* PCR 8 */ -+ int $0x1A -+ -+ popa -+#endif -+boot: - /* boot kernel */ - jmp *(LOCAL(kernel_address)) - -diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S -index 1ee4cf5..3a324ea 100644 ---- a/grub-core/boot/i386/pc/diskboot.S -+++ b/grub-core/boot/i386/pc/diskboot.S -@@ -19,6 +19,8 @@ - #include - #include - -+#define TPM 1 -+ - /* - * defines for the code go here - */ -@@ -58,6 +60,21 @@ _start: - /* this sets up for the first run through "bootloop" */ - movw $LOCAL(firstlist), %di - -+#ifdef TPM -+ /* clear EAX to remove potential garbage */ -+ xorl %eax, %eax -+ /* 8(%di) = number of sectors to read */ -+ movw 8(%di), %ax -+ -+ /* Multiply number of sectors to read with 512 bytes. EAX is 32bit -+ * which is large enough to hold values of up to 4GB. I doubt there -+ * will ever be a core.img larger than that. ;-) */ -+ shll $9, %eax -+ -+ /* write result to bytes_to_measure var */ -+ movl %eax, bytes_to_measure -+#endif -+ - /* save the sector number of the second sector in %ebp */ - movl (%di), %ebp - -@@ -295,6 +312,29 @@ LOCAL(copy_buffer): - /* END OF MAIN LOOP */ - - LOCAL(bootit): -+#ifdef TPM -+ pusha -+ movw $0xBB07, %ax /* TCG_CompactHashLogExtendEvent */ -+ -+ movw $0x0, %bx -+ movw %bx, %es -+ -+ /* We've already measured the first 512 bytes, now measure the rest */ -+ xorl %edi, %edi -+ movw $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200), %di -+ -+ movl $0x41504354, %ebx /* EBX = "TCPA" */ -+ -+ /* %ecx = The length, in bytes, of the buffer to measure */ -+ movl $bytes_to_measure, %esi -+ movl (%esi), %ecx -+ xorl %esi, %esi -+ movl $0x9, %edx /* PCR 9 */ -+ -+ int $0x1A -+ -+ popa -+#endif - /* print a newline */ - MSG(notification_done) - popw %dx /* this makes sure %dl is our "boot" drive */ -@@ -329,6 +369,10 @@ geometry_error_string: .asciz "Geom" - read_error_string: .asciz "Read" - general_error_string: .asciz " Error" - -+#ifdef TPM -+bytes_to_measure: .long 0 -+#endif -+ - /* - * message: write the string pointed to by %si - * --- -1.8.5.6 - diff --git a/0004-hfsplus-Fix-gcc9-error-with-Waddress-of-packed-membe.patch b/0004-hfsplus-Fix-gcc9-error-with-Waddress-of-packed-membe.patch deleted file mode 100644 index cce9e47..0000000 --- a/0004-hfsplus-Fix-gcc9-error-with-Waddress-of-packed-membe.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 621024090b7729c8c698c8ab916d792846d20818 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:05 +0800 -Subject: [PATCH 4/8] hfsplus: Fix gcc9 error with -Waddress-of-packed-member - -The catkey->name could be unaligned since the address of 'void* record' -is calculated as offset in bytes to a malloc buffer. - -The fix is using aligned buffer allocated by grub_malloc for holding -the UTF16 string copied from catkey->name. And use that buffer as -argument for grub_utf16_to_utf8 to convert to UTF8 strings. - -In addition, using a new copy of buffer rather than catkey->name itself -for processing the endianess conversion, we can also get rid of the hunk -restoring byte order of catkey->name to what it was previously. - -[ 59s] ../grub-core/fs/hfsplus.c: In function 'list_nodes': -[ 59s] ../grub-core/fs/hfsplus.c:738:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 738 | *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name, -[ 59s] | ~~~~~~^~~~~~ -[ 59s] ../grub-core/fs/hfsplus.c: In function 'grub_hfsplus_label': -[ 59s] ../grub-core/fs/hfsplus.c:1019:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 59s] 1019 | *grub_utf16_to_utf8 ((grub_uint8_t *) (*label), catkey->name, -[ 59s] | ~~~~~~^~~~~~ - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - grub-core/fs/hfsplus.c | 57 +++++++++++++++++++++++++++++++++++--------------- - 1 file changed, 40 insertions(+), 17 deletions(-) - -diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c -index 73ae95fbc..54786bb1c 100644 ---- a/grub-core/fs/hfsplus.c -+++ b/grub-core/fs/hfsplus.c -@@ -661,6 +661,7 @@ list_nodes (void *record, void *hook_arg) - char *filename; - int i; - struct grub_fshelp_node *node; -+ grub_uint16_t *keyname; - struct grub_hfsplus_catfile *fileinfo; - enum grub_fshelp_filetype type = GRUB_FSHELP_UNKNOWN; - struct list_nodes_ctx *ctx = hook_arg; -@@ -719,32 +720,34 @@ list_nodes (void *record, void *hook_arg) - if (! filename) - return 0; - -+ keyname = grub_malloc (grub_be_to_cpu16 (catkey->namelen) * sizeof (*keyname)); -+ if (!keyname) -+ { -+ grub_free (filename); -+ return 0; -+ } -+ - /* Make sure the byte order of the UTF16 string is correct. */ - for (i = 0; i < grub_be_to_cpu16 (catkey->namelen); i++) - { -- catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]); -+ keyname[i] = grub_be_to_cpu16 (catkey->name[i]); - -- if (catkey->name[i] == '/') -- catkey->name[i] = ':'; -+ if (keyname[i] == '/') -+ keyname[i] = ':'; - - /* If the name is obviously invalid, skip this node. */ -- if (catkey->name[i] == 0) -+ if (keyname[i] == 0) - { -+ grub_free (keyname); - grub_free (filename); - return 0; - } - } - -- *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name, -+ *grub_utf16_to_utf8 ((grub_uint8_t *) filename, keyname, - grub_be_to_cpu16 (catkey->namelen)) = '\0'; - -- /* Restore the byte order to what it was previously. */ -- for (i = 0; i < grub_be_to_cpu16 (catkey->namelen); i++) -- { -- if (catkey->name[i] == ':') -- catkey->name[i] = '/'; -- catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]); -- } -+ grub_free (keyname); - - /* hfs+ is case insensitive. */ - if (! ctx->dir->data->case_sensitive) -@@ -975,6 +978,7 @@ grub_hfsplus_label (grub_device_t device, char **label) - grub_disk_t disk = device->disk; - struct grub_hfsplus_catkey *catkey; - int i, label_len; -+ grub_uint16_t *label_name; - struct grub_hfsplus_key_internal intern; - struct grub_hfsplus_btnode *node = NULL; - grub_disk_addr_t ptr = 0; -@@ -1003,22 +1007,41 @@ grub_hfsplus_label (grub_device_t device, char **label) - grub_hfsplus_btree_recptr (&data->catalog_tree, node, ptr); - - label_len = grub_be_to_cpu16 (catkey->namelen); -+ label_name = grub_malloc (label_len * sizeof (*label_name)); -+ if (!label_name) -+ { -+ grub_free (node); -+ grub_free (data); -+ return grub_errno; -+ } -+ - for (i = 0; i < label_len; i++) - { -- catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]); -+ label_name[i] = grub_be_to_cpu16 (catkey->name[i]); - - /* If the name is obviously invalid, skip this node. */ -- if (catkey->name[i] == 0) -- return 0; -+ if (label_name[i] == 0) -+ { -+ grub_free (label_name); -+ grub_free (node); -+ grub_free (data); -+ return 0; -+ } - } - - *label = grub_malloc (label_len * GRUB_MAX_UTF8_PER_UTF16 + 1); - if (! *label) -- return grub_errno; -+ { -+ grub_free (label_name); -+ grub_free (node); -+ grub_free (data); -+ return grub_errno; -+ } - -- *grub_utf16_to_utf8 ((grub_uint8_t *) (*label), catkey->name, -+ *grub_utf16_to_utf8 ((grub_uint8_t *) (*label), label_name, - label_len) = '\0'; - -+ grub_free (label_name); - grub_free (node); - grub_free (data); - --- -2.16.4 - diff --git a/0004-tpm-Rework-linux-command.patch b/0004-tpm-Rework-linux-command.patch deleted file mode 100644 index e36626e..0000000 --- a/0004-tpm-Rework-linux-command.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 9f12cf163e56d3b5f03c8a5da94dc501032312eb Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Sun, 9 Aug 2015 16:12:39 -0700 -Subject: [PATCH 04/11] Rework linux command - -We want a single buffer that contains the entire kernel image in order to -perform a TPM measurement. Allocate one and copy the entire kernel into it -before pulling out the individual blocks later on. ---- - grub-core/loader/i386/linux.c | 34 +++++++++++++++++++++------------- - 1 file changed, 21 insertions(+), 13 deletions(-) - -Index: grub-2.02~rc1/grub-core/loader/i386/linux.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/loader/i386/linux.c -+++ grub-2.02~rc1/grub-core/loader/i386/linux.c -@@ -680,12 +680,13 @@ grub_cmd_linux (grub_command_t cmd __att - grub_file_t file = 0; - struct linux_kernel_header lh; - grub_uint8_t setup_sects; -- grub_size_t real_size, prot_size, prot_file_size; -+ grub_size_t real_size, prot_size, prot_file_size, kernel_offset; - grub_ssize_t len; - int i; - grub_size_t align, min_align; - int relocatable; - grub_uint64_t preferred_address = GRUB_LINUX_BZIMAGE_ADDR; -+ grub_uint8_t *kernel = NULL; - - grub_dl_ref (my_mod); - -@@ -699,7 +700,15 @@ grub_cmd_linux (grub_command_t cmd __att - if (! file) - goto fail; - -- if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) -+ len = grub_file_size (file); -+ kernel = grub_malloc (len); -+ if (!kernel) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer")); -+ goto fail; -+ } -+ -+ if (grub_file_read (file, kernel, len) != len) - { - if (!grub_errno) - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -707,6 +716,9 @@ grub_cmd_linux (grub_command_t cmd __att - goto fail; - } - -+ grub_memcpy (&lh, kernel, sizeof (lh)); -+ kernel_offset = sizeof (lh); -+ - if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) - { - grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); -@@ -806,13 +818,9 @@ grub_cmd_linux (grub_command_t cmd __att - linux_params.ps_mouse = linux_params.padding10 = 0; - - len = sizeof (linux_params) - sizeof (lh); -- if (grub_file_read (file, (char *) &linux_params + sizeof (lh), len) != len) -- { -- if (!grub_errno) -- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -- argv[0]); -- goto fail; -- } -+ -+ grub_memcpy ((char *)&linux_params + sizeof (lh), kernel + kernel_offset, len); -+ kernel_offset += len; - - linux_params.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; - -@@ -871,7 +879,7 @@ grub_cmd_linux (grub_command_t cmd __att - - /* The other parameters are filled when booting. */ - -- grub_file_seek (file, real_size + GRUB_DISK_SECTOR_SIZE); -+ kernel_offset = real_size + GRUB_DISK_SECTOR_SIZE; - - grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n", - (unsigned) real_size, (unsigned) prot_size); -@@ -1016,9 +1024,7 @@ grub_cmd_linux (grub_command_t cmd __att - - (sizeof (LINUX_IMAGE) - 1)); - - len = prot_file_size; -- if (grub_file_read (file, prot_mode_mem, len) != len && !grub_errno) -- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -- argv[0]); -+ grub_memcpy (prot_mode_mem, kernel + kernel_offset, len); - - if (grub_errno == GRUB_ERR_NONE) - { -@@ -1029,6 +1035,8 @@ grub_cmd_linux (grub_command_t cmd __att - - fail: - -+ grub_free (kernel); -+ - if (file) - grub_file_close (file); - diff --git a/0005-acpi-Fix-gcc9-error-Waddress-of-packed-member.patch b/0005-acpi-Fix-gcc9-error-Waddress-of-packed-member.patch deleted file mode 100644 index 9d3a6ca..0000000 --- a/0005-acpi-Fix-gcc9-error-Waddress-of-packed-member.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0b1bf3932f1b1700d3c8a997e4850fb9a013569d Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:06 +0800 -Subject: [PATCH 5/8] acpi: Fix gcc9 error -Waddress-of-packed-member - -Simply adds the missing packed attribute to 'struct grub_acpi_madt'. - -[ 233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_xsdt_table': -[ 233s] ../../grub-core/commands/lsacpi.c:201:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 233s] 201 | disp_madt_table ((struct grub_acpi_madt *) t); -[ 233s] | ^~~~~~~~~~~~~~ -[ 233s] In file included from ../../grub-core/commands/lsacpi.c:23: -[ 233s] ../../include/grub/acpi.h:50:8: note: defined here -[ 233s] 50 | struct grub_acpi_table_header -[ 233s] | ^~~~~~~~~~~~~~~~~~~~~~ -[ 233s] ../../include/grub/acpi.h:90:8: note: defined here -[ 233s] 90 | struct grub_acpi_madt -[ 233s] | ^~~~~~~~~~~~~~ -[ 233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_rsdt_table': -[ 233s] ../../grub-core/commands/lsacpi.c:225:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 233s] 225 | disp_madt_table ((struct grub_acpi_madt *) t); -[ 233s] | ^~~~~~~~~~~~~~ -[ 233s] In file included from ../../grub-core/commands/lsacpi.c:23: -[ 233s] ../../include/grub/acpi.h:50:8: note: defined here -[ 233s] 50 | struct grub_acpi_table_header -[ 233s] | ^~~~~~~~~~~~~~~~~~~~~~ -[ 233s] ../../include/grub/acpi.h:90:8: note: defined here -[ 233s] 90 | struct grub_acpi_madt -[ 233s] | ^~~~~~~~~~~~~~ - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - include/grub/acpi.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/grub/acpi.h b/include/grub/acpi.h -index 66148f684..84f49487d 100644 ---- a/include/grub/acpi.h -+++ b/include/grub/acpi.h -@@ -93,7 +93,7 @@ struct grub_acpi_madt - grub_uint32_t lapic_addr; - grub_uint32_t flags; - struct grub_acpi_madt_entry_header entries[0]; --}; -+} GRUB_PACKED; - - enum - { --- -2.16.4 - diff --git a/0005-tpm-Rework-linux16-command.patch b/0005-tpm-Rework-linux16-command.patch deleted file mode 100644 index d97a195..0000000 --- a/0005-tpm-Rework-linux16-command.patch +++ /dev/null @@ -1,101 +0,0 @@ -From f8f66cdcb66dba05353887b3be0d715d54efdea8 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Sun, 9 Aug 2015 16:20:58 -0700 -Subject: [PATCH 05/11] Rework linux16 command - -We want a single buffer that contains the entire kernel image in order to -perform a TPM measurement. Allocate one and copy the entire kernel int it -before pulling out the individual blocks later on. ---- - grub-core/loader/i386/pc/linux.c | 34 +++++++++++++++++++++------------- - 1 file changed, 21 insertions(+), 13 deletions(-) - -diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c -index a293b17..1ac9cd1 100644 ---- a/grub-core/loader/i386/pc/linux.c -+++ b/grub-core/loader/i386/pc/linux.c -@@ -123,13 +123,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - grub_file_t file = 0; - struct linux_kernel_header lh; - grub_uint8_t setup_sects; -- grub_size_t real_size; -+ grub_size_t real_size, kernel_offset = 0; - grub_ssize_t len; - int i; - char *grub_linux_prot_chunk; - int grub_linux_is_bzimage; - grub_addr_t grub_linux_prot_target; - grub_err_t err; -+ grub_uint8_t *kernel = NULL; - - grub_dl_ref (my_mod); - -@@ -143,7 +144,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - if (! file) - goto fail; - -- if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) -+ len = grub_file_size (file); -+ kernel = grub_malloc (len); -+ if (!kernel) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer")); -+ goto fail; -+ } -+ -+ if (grub_file_read (file, kernel, len) != len) - { - if (!grub_errno) - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -151,6 +160,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - goto fail; - } - -+ grub_memcpy (&lh, kernel, sizeof (lh)); -+ kernel_offset = sizeof (lh); -+ - if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) - { - grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); -@@ -314,13 +326,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - grub_memmove (grub_linux_real_chunk, &lh, sizeof (lh)); - - len = real_size + GRUB_DISK_SECTOR_SIZE - sizeof (lh); -- if (grub_file_read (file, grub_linux_real_chunk + sizeof (lh), len) != len) -- { -- if (!grub_errno) -- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -- argv[0]); -- goto fail; -- } -+ grub_memcpy (grub_linux_real_chunk + sizeof (lh), kernel + kernel_offset, -+ len); -+ kernel_offset += len; - - if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) - || grub_le_to_cpu16 (lh.version) < 0x0200) -@@ -355,10 +363,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - } - - len = grub_linux16_prot_size; -- if (grub_file_read (file, grub_linux_prot_chunk, grub_linux16_prot_size) -- != (grub_ssize_t) grub_linux16_prot_size && !grub_errno) -- grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -- argv[0]); -+ grub_memcpy (grub_linux_prot_chunk, kernel + kernel_offset, len); -+ kernel_offset += len; - - if (grub_errno == GRUB_ERR_NONE) - { -@@ -368,6 +374,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), - - fail: - -+ grub_free (kernel); -+ - if (file) - grub_file_close (file); - --- -1.8.5.6 - diff --git a/0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch b/0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch index fd0d536..a252ba4 100644 --- a/0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ b/0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch @@ -21,32 +21,23 @@ Signed-off-by: Ken Lin include/grub/net.h | 1 + 2 files changed, 66 insertions(+), 2 deletions(-) -diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c -index 81173b4..04f9f3d 100644 ---- a/grub-core/net/bootp.c -+++ b/grub-core/net/bootp.c -@@ -207,6 +207,11 @@ parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask) - taglength); - break; - -+ case GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER: -+ grub_env_set_net_property (name, "vendor_class_identifier", (const char *) ptr, -+ taglength); -+ break; -+ - case GRUB_NET_BOOTP_EXTENSIONS_PATH: - grub_env_set_net_property (name, "extensionspath", (const char *) ptr, - taglength); -@@ -281,6 +286,66 @@ grub_net_configure_by_dhcp_ack (const char *name, - } - #endif +Index: grub-2.04~rc1/grub-core/net/bootp.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/net/bootp.c ++++ grub-2.04~rc1/grub-core/net/bootp.c +@@ -340,6 +340,53 @@ grub_net_configure_by_dhcp_ack (const ch + if (!inter) + return 0; ++ /* FIXME: Introduce new http flag for better synergy with existing tftp code base */ + if (size > OFFSET_OF (vendor, bp)) + { + char *cidvar; + const char *cid; + -+ parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask); ++ opt = find_dhcp_option (bp, size, GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER, &opt_len); ++ if (opt && opt_len) ++ grub_env_set_net_property (name, "vendor_class_identifier", (const char *) opt, opt_len); + cidvar = grub_xasprintf ("net_%s_%s", name, "vendor_class_identifier"); + cid = grub_env_get (cidvar); + grub_free (cidvar); @@ -55,10 +46,12 @@ index 81173b4..04f9f3d 100644 + { + char *proto, *ip, *pa; + ++ /* FIXME: Provide better URL function that returns in place pointers ++ * so that we don't have to free them. ++ */ + if (!dissect_url (bp->boot_file, &proto, &ip, &pa)) + return inter; + -+ grub_env_set_net_property (name, "boot_file", pa, grub_strlen (pa)); + if (is_def) + { + grub_net_default_server = grub_strdup (ip); @@ -70,61 +63,40 @@ index 81173b4..04f9f3d 100644 + *device = grub_xasprintf ("%s,%s", proto, ip); + grub_print_error (); + } -+ if (path) -+ { -+ *path = grub_strdup (pa); -+ grub_print_error (); -+ if (*path) -+ { -+ char *slash; -+ slash = grub_strrchr (*path, '/'); -+ if (slash) -+ *slash = 0; -+ else -+ **path = 0; -+ } -+ } -+ grub_net_add_ipv4_local (inter, mask); -+ inter->dhcp_ack = grub_malloc (size); -+ if (inter->dhcp_ack) -+ { -+ grub_memcpy (inter->dhcp_ack, bp, size); -+ inter->dhcp_acklen = size; -+ } -+ else -+ grub_errno = GRUB_ERR_NONE; + ++ boot_file = pa; ++ boot_file_len = grub_strlen (pa); ++ ++ /* FIXME: Don't use malloc buffer here */ + grub_free (proto); + grub_free (ip); -+ grub_free (pa); -+ return inter; ++ ++ /* FIXME: NEED TO FREE boot_file */ ++ goto boot_file; + } + } + - if (size > OFFSET_OF (boot_file, bp)) - grub_env_set_net_property (name, "boot_file", bp->boot_file, - sizeof (bp->boot_file)); -@@ -342,8 +407,6 @@ grub_net_configure_by_dhcp_ack (const char *name, - **path = 0; + opt = find_dhcp_option (bp, size, GRUB_NET_DHCP_OVERLOAD, &opt_len); + if (opt && opt_len == 1) + overload = *opt; +@@ -416,6 +463,8 @@ grub_net_configure_by_dhcp_ack (const ch } } -- if (size > OFFSET_OF (vendor, bp)) -- parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask); - grub_net_add_ipv4_local (inter, mask); - - inter->dhcp_ack = grub_malloc (size); -diff --git a/include/grub/net.h b/include/grub/net.h -index 38a3973..e4bf678 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -517,6 +517,7 @@ enum + ++boot_file: ++ + if (boot_file) + { + grub_env_set_net_property (name, "boot_file", boot_file, boot_file_len); +Index: grub-2.04~rc1/include/grub/net.h +=================================================================== +--- grub-2.04~rc1.orig/include/grub/net.h ++++ grub-2.04~rc1/include/grub/net.h +@@ -523,6 +523,7 @@ enum GRUB_NET_BOOTP_DOMAIN = 0x0f, GRUB_NET_BOOTP_ROOT_PATH = 0x11, GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, + GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER = 0x3C, - GRUB_NET_BOOTP_END = 0xff - }; - --- -2.6.6 - + GRUB_NET_DHCP_REQUESTED_IP_ADDRESS = 50, + GRUB_NET_DHCP_OVERLOAD = 52, + GRUB_NET_DHCP_MESSAGE_TYPE = 53, diff --git a/0006-tpm-Measure-kernel-and-initrd-on-BIOS-systems.patch b/0006-tpm-Measure-kernel-and-initrd-on-BIOS-systems.patch deleted file mode 100644 index 9148a83..0000000 --- a/0006-tpm-Measure-kernel-and-initrd-on-BIOS-systems.patch +++ /dev/null @@ -1,84 +0,0 @@ -From f0b411214ccc309f2f126d558e2777469d538ca2 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Sun, 9 Aug 2015 16:28:29 -0700 -Subject: [PATCH 06/11] Measure kernel and initrd on BIOS systems - -Measure the kernel and initrd when loaded on BIOS systems ---- - grub-core/loader/i386/linux.c | 5 +++++ - grub-core/loader/i386/pc/linux.c | 3 +++ - grub-core/loader/linux.c | 2 ++ - 3 files changed, 10 insertions(+) - -Index: grub-2.02~beta3/grub-core/loader/i386/linux.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/loader/i386/linux.c -+++ grub-2.02~beta3/grub-core/loader/i386/linux.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -716,7 +717,10 @@ grub_cmd_linux (grub_command_t cmd __att - goto fail; - } - -+ grub_tpm_measure (kernel, len, GRUB_BINARY_PCR, "grub_linux", "Kernel"); -+ - grub_memcpy (&lh, kernel, sizeof (lh)); -+ - kernel_offset = sizeof (lh); - - if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) -@@ -1025,6 +1029,7 @@ grub_cmd_linux (grub_command_t cmd __att - - len = prot_file_size; - grub_memcpy (prot_mode_mem, kernel + kernel_offset, len); -+ kernel_offset += len; - - if (grub_errno == GRUB_ERR_NONE) - { -Index: grub-2.02~beta3/grub-core/loader/i386/pc/linux.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/loader/i386/pc/linux.c -+++ grub-2.02~beta3/grub-core/loader/i386/pc/linux.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -160,6 +161,8 @@ grub_cmd_linux (grub_command_t cmd __att - goto fail; - } - -+ grub_tpm_measure (kernel, len, GRUB_BINARY_PCR, "grub_linux16", "Kernel"); -+ - grub_memcpy (&lh, kernel, sizeof (lh)); - kernel_offset = sizeof (lh); - -Index: grub-2.02~beta3/grub-core/loader/linux.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/loader/linux.c -+++ grub-2.02~beta3/grub-core/loader/linux.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - - struct newc_head - { -@@ -288,6 +289,7 @@ grub_initrd_load (struct grub_linux_init - grub_initrd_close (initrd_ctx); - return grub_errno; - } -+ grub_tpm_measure (ptr, cursize, GRUB_BINARY_PCR, "grub_initrd", "Initrd"); - ptr += cursize; - } - if (newc) diff --git a/0006-usbtest-Disable-gcc9-Waddress-of-packed-member.patch b/0006-usbtest-Disable-gcc9-Waddress-of-packed-member.patch deleted file mode 100644 index a33cb2f..0000000 --- a/0006-usbtest-Disable-gcc9-Waddress-of-packed-member.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 85e08e174e15c497c4387c16e92243e6ed05feb6 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:07 +0800 -Subject: [PATCH 6/8] usbtest: Disable gcc9 -Waddress-of-packed-member - -Disable the -Wadress-of-packaed-member diagnostic for the -grub_usb_get_string function since the result is false postive. The -descstrp->str is found to be aligned in the buffer allocated for 'struct -grub_usb_desc_str'. - -[ 229s] ../../grub-core/commands/usbtest.c: In function 'grub_usb_get_string': -[ 229s] ../../grub-core/commands/usbtest.c:104:58: error: taking address of packed member of 'struct grub_usb_desc_str' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 229s] 104 | *grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, -[ 229s] | ~~~~~~~~^~~~~ - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - grub-core/commands/usbtest.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/grub-core/commands/usbtest.c b/grub-core/commands/usbtest.c -index 01cdca934..2c6d93fe6 100644 ---- a/grub-core/commands/usbtest.c -+++ b/grub-core/commands/usbtest.c -@@ -63,6 +63,11 @@ static const char *usb_devspeed[] = - "High" - }; - -+#if __GNUC__ >= 9 -+#pragma GCC diagnostic push -+#pragma GCC diagnostic ignored "-Waddress-of-packed-member" -+#endif -+ - static grub_usb_err_t - grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid, - char **string) -@@ -108,6 +113,10 @@ grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid, - return GRUB_USB_ERR_NONE; - } - -+#if __GNUC__ >= 9 -+#pragma GCC diagnostic pop -+#endif -+ - static void - usb_print_str (const char *description, grub_usb_device_t dev, int idx) - { --- -2.16.4 - diff --git a/0007-chainloader-Fix-gcc9-error-Waddress-of-packed-member.patch b/0007-chainloader-Fix-gcc9-error-Waddress-of-packed-member.patch deleted file mode 100644 index cd4596c..0000000 --- a/0007-chainloader-Fix-gcc9-error-Waddress-of-packed-member.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 4868e17507dfebf2894079ad6b4876e612706f30 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:08 +0800 -Subject: [PATCH 7/8] chainloader: Fix gcc9 error -Waddress-of-packed-member - -The address of fp->path_name could be unaligned since seeking into the -device path buffer for a given node could end in byte boundary. - -The fix is using aligned buffer allocated by grub_malloc for receiving -the converted UTF16 string by grub_utf8_to_utf16 and also the processing -after. The resulting string then gets copied to fp->path_name. - -[ 243s] ../../grub-core/loader/efi/chainloader.c: In function 'copy_file_path': -[ 243s] ../../grub-core/loader/efi/chainloader.c:136:32: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 243s] 136 | size = grub_utf8_to_utf16 (fp->path_name, len * GRUB_MAX_UTF16_PER_UTF8, -[ 243s] | ~~^~~~~~~~~~~ -[ 243s] ../../grub-core/loader/efi/chainloader.c:138:12: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 243s] 138 | for (p = fp->path_name; p < fp->path_name + size; p++) -[ 243s] | ^~ - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - grub-core/loader/efi/chainloader.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c -index f706b1ac3..cd92ea3f2 100644 ---- a/grub-core/loader/efi/chainloader.c -+++ b/grub-core/loader/efi/chainloader.c -@@ -110,21 +110,27 @@ static void - copy_file_path (grub_efi_file_path_device_path_t *fp, - const char *str, grub_efi_uint16_t len) - { -- grub_efi_char16_t *p; -+ grub_efi_char16_t *p, *path_name; - grub_efi_uint16_t size; - - fp->header.type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE; - fp->header.subtype = GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE; - -- size = grub_utf8_to_utf16 (fp->path_name, len * GRUB_MAX_UTF16_PER_UTF8, -+ path_name = grub_malloc (len * GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name)); -+ if (!path_name) -+ return; -+ -+ size = grub_utf8_to_utf16 (path_name, len * GRUB_MAX_UTF16_PER_UTF8, - (const grub_uint8_t *) str, len, 0); -- for (p = fp->path_name; p < fp->path_name + size; p++) -+ for (p = path_name; p < path_name + size; p++) - if (*p == '/') - *p = '\\'; - -+ grub_memcpy (fp->path_name, path_name, size * sizeof (*fp->path_name)); - /* File Path is NULL terminated */ - fp->path_name[size++] = '\0'; - fp->header.length = size * sizeof (grub_efi_char16_t) + sizeof (*fp); -+ grub_free (path_name); - } - - static grub_efi_device_path_t * --- -2.16.4 - diff --git a/0007-tpm-Measure-the-kernel-commandline.patch b/0007-tpm-Measure-the-kernel-commandline.patch deleted file mode 100644 index 87e0056..0000000 --- a/0007-tpm-Measure-the-kernel-commandline.patch +++ /dev/null @@ -1,43 +0,0 @@ -From aa88827e5b6ca073d0a67e86c5d6581445de988b Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Sun, 9 Aug 2015 16:32:29 -0700 -Subject: [PATCH 07/11] Measure the kernel commandline - -Measure the kernel commandline to ensure that it hasn't been modified ---- - grub-core/lib/cmdline.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c -index d5e10ee..3791f3a 100644 ---- a/grub-core/lib/cmdline.c -+++ b/grub-core/lib/cmdline.c -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - static unsigned int check_arg (char *c, int *has_space) - { -@@ -67,7 +68,7 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, - { - int i, space; - unsigned int arg_size; -- char *c; -+ char *c, *orig = buf; - - for (i = 0; i < argc; i++) - { -@@ -104,5 +105,8 @@ int grub_create_loader_cmdline (int argc, char *argv[], char *buf, - - *buf = 0; - -+ grub_tpm_measure ((void *)orig, grub_strlen (orig), GRUB_ASCII_PCR, -+ "grub_kernel_cmdline", orig); -+ - return i; - } --- -1.8.5.6 - diff --git a/0008-efi-Fix-gcc9-error-Waddress-of-packed-member.patch b/0008-efi-Fix-gcc9-error-Waddress-of-packed-member.patch deleted file mode 100644 index 1304fb3..0000000 --- a/0008-efi-Fix-gcc9-error-Waddress-of-packed-member.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 4dd4ceec023111a4ccf69f8de6fa0885c6847a35 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 11 Apr 2019 17:14:09 +0800 -Subject: [PATCH 8/8] efi: Fix gcc9 error -Waddress-of-packed-member - -The address of fp->path_name could be unaligned since seeking into the -device path buffer for a given node could end in byte boundary. - -The fix is allocating aligned buffer by grub_malloc for holding the -UTF16 string copied from fp->path_name, and after using that buffer as -argument for grub_utf16_to_utf8 to convert it to UTF8 string. - -[ 255s] ../../grub-core/kern/efi/efi.c: In function 'grub_efi_get_filename': -[ 255s] ../../grub-core/kern/efi/efi.c:410:60: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 255s] 410 | p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len); -[ 255s] | ~~^~~~~~~~~~~ -[ 255s] ../../grub-core/kern/efi/efi.c: In function 'grub_efi_print_device_path': -[ 255s] ../../grub-core/kern/efi/efi.c:900:33: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member] -[ 255s] 900 | *grub_utf16_to_utf8 (buf, fp->path_name, -[ 255s] | ~~^~~~~~~~~~~ - -Signed-off-by: Michael Chang -Reviewed-by: Daniel Kiper ---- - grub-core/kern/efi/efi.c | 27 ++++++++++++++++++++++++--- - 1 file changed, 24 insertions(+), 3 deletions(-) - -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index 84e68cf31..6e1ceb905 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -372,6 +372,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - { - grub_efi_file_path_device_path_t *fp; - grub_efi_uint16_t len; -+ grub_efi_char16_t *dup_name; - - *p++ = '/'; - -@@ -382,7 +383,16 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) - while (len > 0 && fp->path_name[len - 1] == 0) - len--; - -- p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len); -+ dup_name = grub_malloc (len * sizeof (*dup_name)); -+ if (!dup_name) -+ { -+ grub_free (name); -+ return NULL; -+ } -+ p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, -+ grub_memcpy (dup_name, fp->path_name, len * sizeof (*dup_name)), -+ len); -+ grub_free (dup_name); - } - - dp = GRUB_EFI_NEXT_DEVICE_PATH (dp); -@@ -812,9 +822,20 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp) - fp = (grub_efi_file_path_device_path_t *) dp; - buf = grub_malloc ((len - 4) * 2 + 1); - if (buf) -- *grub_utf16_to_utf8 (buf, fp->path_name, -+ { -+ grub_efi_char16_t *dup_name = grub_malloc (len - 4); -+ if (!dup_name) -+ { -+ grub_errno = GRUB_ERR_NONE; -+ grub_printf ("/File((null))"); -+ grub_free (buf); -+ break; -+ } -+ *grub_utf16_to_utf8 (buf, grub_memcpy (dup_name, fp->path_name, len - 4), - (len - 4) / sizeof (grub_efi_char16_t)) -- = '\0'; -+ = '\0'; -+ grub_free (dup_name); -+ } - else - grub_errno = GRUB_ERR_NONE; - grub_printf ("/File(%s)", buf); --- -2.16.4 - diff --git a/0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch index 1818217..f3aebb8 100644 --- a/0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch +++ b/0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch @@ -32,10 +32,10 @@ Signed-off-by: Ken Lin include/grub/efi/api.h | 76 +++++++++++++++++ 2 files changed, 239 insertions(+) -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 2d3b00f..82a28fb 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c +Index: grub-2.04~rc1/grub-core/net/drivers/efi/efinet.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/net/drivers/efi/efinet.c ++++ grub-2.04~rc1/grub-core/net/drivers/efi/efinet.c @@ -30,6 +30,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); /* GUID. */ static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID; @@ -171,7 +171,7 @@ index 2d3b00f..82a28fb 100644 static struct grub_net_buff * grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6) { -@@ -377,6 +498,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -377,6 +498,8 @@ grub_efinet_create_dhcp_ack_from_device_ grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp; struct grub_net_bootp_packet *bp; grub_uint8_t *ptr; @@ -180,7 +180,7 @@ index 2d3b00f..82a28fb 100644 bp = (struct grub_net_bootp_packet *) nb->tail; err = grub_netbuff_put (nb, sizeof (*bp) + 4); -@@ -438,6 +561,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -438,6 +561,25 @@ grub_efinet_create_dhcp_ack_from_device_ *ptr++ = sizeof ("HTTPClient") - 1; grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); @@ -206,7 +206,7 @@ index 2d3b00f..82a28fb 100644 ptr = nb->tail; err = grub_netbuff_put (nb, 1); if (err) -@@ -470,6 +612,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -470,6 +612,8 @@ grub_efinet_create_dhcp_ack_from_device_ struct grub_net_dhcp6_option *opt; struct grub_net_dhcp6_option_iana *iana; struct grub_net_dhcp6_option_iaaddr *iaaddr; @@ -215,7 +215,7 @@ index 2d3b00f..82a28fb 100644 d6p = (struct grub_net_dhcp6_packet *)nb->tail; err = grub_netbuff_put (nb, sizeof(*d6p)); -@@ -533,6 +677,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u +@@ -533,6 +677,25 @@ grub_efinet_create_dhcp_ack_from_device_ opt->len = grub_cpu_to_be16 (uri_len); grub_memcpy (opt->data, uri_dp->uri, uri_len); @@ -241,10 +241,10 @@ index 2d3b00f..82a28fb 100644 *use_ipv6 = 1; } -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index d5a1256..99ba068 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h +Index: grub-2.04~rc1/include/grub/efi/api.h +=================================================================== +--- grub-2.04~rc1.orig/include/grub/efi/api.h ++++ grub-2.04~rc1/include/grub/efi/api.h @@ -334,6 +334,16 @@ { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \ } @@ -333,8 +333,5 @@ index d5a1256..99ba068 100644 +typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t; + #if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ - || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) - --- -2.6.6 - + || defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ + || defined(__riscv) diff --git a/0008-tpm-Measure-commands.patch b/0008-tpm-Measure-commands.patch deleted file mode 100644 index 607b0b3..0000000 --- a/0008-tpm-Measure-commands.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 959e235378adef1477d14d7546c549b7619eb5f1 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Mon, 10 Aug 2015 15:27:12 -0700 -Subject: [PATCH 08/11] Measure commands - -Measure each command executed by grub, which includes script execution. ---- - grub-core/script/execute.c | 25 +++++++++++++++++++++++-- - 1 file changed, 23 insertions(+), 2 deletions(-) - -Index: grub-2.02~beta3/grub-core/script/execute.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/script/execute.c -+++ grub-2.02~beta3/grub-core/script/execute.c -@@ -30,6 +30,7 @@ - #ifdef GRUB_MACHINE_IEEE1275 - #include - #endif -+#include - - /* Max digits for a char is 3 (0xFF is 255), similarly for an int it - is sizeof (int) * 3, and one extra for a possible -ve sign. */ -@@ -936,8 +937,9 @@ grub_script_execute_cmdline (struct grub - grub_err_t ret = 0; - grub_script_function_t func = 0; - char errnobuf[18]; -- char *cmdname; -- int argc; -+ char *cmdname, *cmdstring; -+ int argc, offset = 0, cmdlen = 0; -+ unsigned int i; - char **args; - int invert; - struct grub_script_argv argv = { 0, 0, 0 }; -@@ -946,6 +948,25 @@ grub_script_execute_cmdline (struct grub - if (grub_script_arglist_to_argv (cmdline->arglist, &argv) || ! argv.args[0]) - return grub_errno; - -+ for (i = 0; i < argv.argc; i++) { -+ cmdlen += grub_strlen (argv.args[i]) + 1; -+ } -+ -+ cmdstring = grub_malloc (cmdlen); -+ if (!cmdstring) -+ { -+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, -+ N_("cannot allocate command buffer")); -+ } -+ -+ for (i = 0; i < argv.argc; i++) { -+ offset += grub_snprintf (cmdstring + offset, cmdlen - offset, "%s ", -+ argv.args[i]); -+ } -+ cmdstring[cmdlen-1]= '\0'; -+ grub_tpm_measure ((unsigned char *)cmdstring, cmdlen, GRUB_ASCII_PCR, -+ "grub_cmd", cmdstring); -+ grub_free(cmdstring); - invert = 0; - argc = argv.argc - 1; - args = argv.args + 1; diff --git a/0009-tpm-Measure-multiboot-images-and-modules.patch b/0009-tpm-Measure-multiboot-images-and-modules.patch deleted file mode 100644 index 293fd0d..0000000 --- a/0009-tpm-Measure-multiboot-images-and-modules.patch +++ /dev/null @@ -1,73 +0,0 @@ -From fd82340829d9fce685f80163ddb6ee3399929c3c Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Tue, 1 Sep 2015 16:02:55 -0700 -Subject: [PATCH 09/11] Measure multiboot images and modules - ---- - grub-core/loader/i386/multiboot_mbi.c | 3 +++ - grub-core/loader/multiboot.c | 2 ++ - grub-core/loader/multiboot_mbi2.c | 3 +++ - 3 files changed, 8 insertions(+) - -Index: grub-2.02~rc1/grub-core/loader/i386/multiboot_mbi.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/loader/i386/multiboot_mbi.c -+++ grub-2.02~rc1/grub-core/loader/i386/multiboot_mbi.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #ifdef GRUB_MACHINE_EFI - #include -@@ -173,6 +174,8 @@ grub_multiboot_load (grub_file_t file, c - return grub_errno; - } - -+ grub_tpm_measure((unsigned char*)buffer, len, GRUB_BINARY_PCR, "grub_multiboot", filename); -+ - header = find_header (buffer, len); - - if (header == 0) -Index: grub-2.02~rc1/grub-core/loader/multiboot.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/loader/multiboot.c -+++ grub-2.02~rc1/grub-core/loader/multiboot.c -@@ -42,6 +42,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -424,6 +425,7 @@ grub_cmd_module (grub_command_t cmd __at - } - - grub_file_close (file); -+ grub_tpm_measure (module, size, GRUB_BINARY_PCR, "grub_multiboot", argv[0]); - return GRUB_ERR_NONE; - } - -Index: grub-2.02~rc1/grub-core/loader/multiboot_mbi2.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/loader/multiboot_mbi2.c -+++ grub-2.02~rc1/grub-core/loader/multiboot_mbi2.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #if defined (GRUB_MACHINE_EFI) - #include -@@ -131,6 +132,8 @@ grub_multiboot_load (grub_file_t file, c - - COMPILE_TIME_ASSERT (MULTIBOOT_HEADER_ALIGN % 4 == 0); - -+ grub_tpm_measure ((unsigned char *)mld.buffer, len, GRUB_BINARY_PCR, "grub_multiboot", filename); -+ - header = find_header (mld.buffer, len); - - if (header == 0) diff --git a/0010-tpm-Fix-boot-when-there-s-no-TPM.patch b/0010-tpm-Fix-boot-when-there-s-no-TPM.patch deleted file mode 100644 index d10fd00..0000000 --- a/0010-tpm-Fix-boot-when-there-s-no-TPM.patch +++ /dev/null @@ -1,29 +0,0 @@ -From c9016d2ae0abc5edcb4dcf4b1ce04f138f6e5a67 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Wed, 23 Mar 2016 16:49:42 -0700 -Subject: [PATCH 10/11] Fix boot when there's no TPM - -If the firmware has TPM support but has no TPM, we're jumping to core.img -without popping the registers back onto the stack. Fix that. ---- - grub-core/boot/i386/pc/boot.S | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S -index 4c63247..47a461e 100644 ---- a/grub-core/boot/i386/pc/boot.S -+++ b/grub-core/boot/i386/pc/boot.S -@@ -476,9 +476,9 @@ LOCAL(copy_buffer): - movl $0x8, %edx /* PCR 8 */ - int $0x1A - -+boot: - popa - #endif --boot: - /* boot kernel */ - jmp *(LOCAL(kernel_address)) - --- -1.8.5.6 - diff --git a/0011-tpm-Fix-build-error.patch b/0011-tpm-Fix-build-error.patch deleted file mode 100644 index 41542c9..0000000 --- a/0011-tpm-Fix-build-error.patch +++ /dev/null @@ -1,74 +0,0 @@ -Index: grub-2.02~rc1/grub-core/kern/efi/tpm.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/kern/efi/tpm.c -+++ grub-2.02~rc1/grub-core/kern/efi/tpm.c -@@ -161,21 +161,12 @@ grub_tpm_execute(PassThroughToTPM_InputP - } - } - --typedef struct { -- grub_uint32_t pcrindex; -- grub_uint32_t eventtype; -- grub_uint8_t digest[20]; -- grub_uint32_t eventsize; -- grub_uint8_t event[1]; --} Event; -- -- - static grub_err_t - grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf, - grub_size_t size, grub_uint8_t pcr, - const char *description) - { -- Event *event; -+ TCG_PCR_EVENT *event; - grub_efi_status_t status; - grub_efi_tpm_protocol_t *tpm; - grub_efi_physical_address_t lastevent; -@@ -188,18 +179,18 @@ grub_tpm1_log_event(grub_efi_handle_t tp - if (!grub_tpm_present(tpm)) - return 0; - -- event = grub_zalloc(sizeof (Event) + grub_strlen(description) + 1); -+ event = grub_zalloc(sizeof (TCG_PCR_EVENT) + grub_strlen(description) + 1); - if (!event) - return grub_error (GRUB_ERR_OUT_OF_MEMORY, - N_("cannot allocate TPM event buffer")); - -- event->pcrindex = pcr; -- event->eventtype = EV_IPL; -- event->eventsize = grub_strlen(description) + 1; -- grub_memcpy(event->event, description, event->eventsize); -+ event->PCRIndex = pcr; -+ event->EventType = EV_IPL; -+ event->EventSize = grub_strlen(description) + 1; -+ grub_memcpy(event->Event, description, event->EventSize); - - algorithm = TCG_ALG_SHA; -- status = efi_call_7 (tpm->log_extend_event, tpm, buf, (grub_uint64_t) size, -+ status = efi_call_7 (tpm->log_extend_event, tpm, (grub_efi_physical_address_t)(grub_addr_t) buf, (grub_uint64_t) size, - algorithm, event, &eventnum, &lastevent); - - switch (status) { -@@ -245,7 +236,7 @@ grub_tpm2_log_event(grub_efi_handle_t tp - event->Size = sizeof(*event) - sizeof(event->Event) + grub_strlen(description) + 1; - grub_memcpy(event->Event, description, grub_strlen(description) + 1); - -- status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, buf, -+ status = efi_call_5 (tpm->hash_log_extend_event, tpm, 0, (grub_efi_physical_address_t)(grub_addr_t) buf, - (grub_uint64_t) size, event); - - switch (status) { -Index: grub-2.02~rc1/include/grub/efi/tpm.h -=================================================================== ---- grub-2.02~rc1.orig/include/grub/efi/tpm.h -+++ grub-2.02~rc1/include/grub/efi/tpm.h -@@ -129,7 +129,7 @@ struct grub_efi_tpm2_protocol - grub_efi_boolean_t *EventLogTruncated); - grub_efi_status_t (*hash_log_extend_event) (struct grub_efi_tpm2_protocol *this, - grub_efi_uint64_t Flags, -- grub_efi_physical_address_t *DataToHash, -+ grub_efi_physical_address_t DataToHash, - grub_efi_uint64_t DataToHashLen, - EFI_TCG2_EVENT *EfiTcgEvent); - grub_efi_status_t (*submit_command) (struct grub_efi_tpm2_protocol *this, diff --git a/0012-tpm-Build-tpm-as-module.patch b/0012-tpm-Build-tpm-as-module.patch index d95d9c3..f1007f9 100644 --- a/0012-tpm-Build-tpm-as-module.patch +++ b/0012-tpm-Build-tpm-as-module.patch @@ -1,442 +1,14 @@ From 54b6ba5f27dd9eb9ec2f1a41e7160964ab94451c Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Wed, 23 Nov 2016 16:52:16 +0800 -Subject: [PATCH 11/11] Build tpm as module +Subject: Build tpm as module -Rather than having tpm as permanent kernel feature that gets enabled and active -unconditionally, it's more applicable to have it as external module that can be -installed with --suse-enable-tpm option to grub2-install. +Add --suse-enable-tpm option to grub2-install. -This can provide some enhancement. First the core image size can be nearly the -same when you don't need TPM, as it's controllable option now. Second the TPM -device can be tested upon loading the module instead of on every measurement. -Third is not to potentially break running system by forcing into the TPM after -update, as it's still bleeding edge feature that could have side effect. - ---- - grub-core/Makefile.core.def | 24 +++- - grub-core/boot/i386/pc/boot.S | 1 - - grub-core/kern/efi/tpm.c | 282 ----------------------------------------- - grub-core/kern/i386/pc/tpm.c | 132 -------------------- - grub-core/kern/tpm.c | 11 +- - grub-core/tpm/efi/tpm.c | 283 ++++++++++++++++++++++++++++++++++++++++++ - grub-core/tpm/i386/pc/tpm.c | 144 +++++++++++++++++++++ - include/grub/tpm.h | 23 ++-- - util/grub-install.c | 16 ++- - 9 files changed, 479 insertions(+), 437 deletions(-) - delete mode 100644 grub-core/kern/efi/tpm.c - delete mode 100644 grub-core/kern/i386/pc/tpm.c - create mode 100644 grub-core/tpm/efi/tpm.c - create mode 100644 grub-core/tpm/i386/pc/tpm.c - -Index: grub-2.02~rc1/grub-core/Makefile.core.def +Index: grub-2.04~rc1/util/grub-install.c =================================================================== ---- grub-2.02~rc1.orig/grub-core/Makefile.core.def -+++ grub-2.02~rc1/grub-core/Makefile.core.def -@@ -174,7 +174,6 @@ kernel = { - efi = term/efi/console.c; - efi = kern/acpi.c; - efi = kern/efi/acpi.c; -- efi = kern/efi/tpm.c; - i386_coreboot = kern/i386/pc/acpi.c; - i386_multiboot = kern/i386/pc/acpi.c; - i386_coreboot = kern/acpi.c; -@@ -221,7 +220,6 @@ kernel = { - - i386_pc = kern/i386/pc/init.c; - i386_pc = kern/i386/pc/mmap.c; -- i386_pc = kern/i386/pc/tpm.c; - i386_pc = term/i386/pc/console.c; - - i386_qemu = bus/pci.c; -@@ -395,6 +393,19 @@ image = { - }; - - image = { -+ name = boot_tpm; -+ i386_pc = boot/i386/pc/boot.S; -+ -+ cppflags = '-DTPM=1'; -+ -+ i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; -+ i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; -+ -+ objcopyflags = '-O binary'; -+ enable = i386_pc; -+}; -+ -+image = { - name = cdboot; - - i386_pc = boot/i386/pc/cdboot.S; -@@ -2369,3 +2380,12 @@ module = { - common = loader/i386/xen_file64.c; - extra_dist = loader/i386/xen_fileXX.c; - }; -+ -+module = { -+ name = tpm; -+ i386_pc = kern/i386/pc/tpm.c; -+ efi = kern/efi/tpm.c; -+ -+ enable = i386_pc; -+ enable = efi; -+}; -Index: grub-2.02~rc1/grub-core/boot/i386/pc/boot.S -=================================================================== ---- grub-2.02~rc1.orig/grub-core/boot/i386/pc/boot.S -+++ grub-2.02~rc1/grub-core/boot/i386/pc/boot.S -@@ -24,7 +24,6 @@ - * defines for the code go here - */ - --#define TPM 1 - - /* Print message string */ - #define MSG(x) movw $x, %si; call LOCAL(message) -Index: grub-2.02~rc1/grub-core/kern/efi/tpm.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/kern/efi/tpm.c -+++ grub-2.02~rc1/grub-core/kern/efi/tpm.c -@@ -7,6 +7,8 @@ - #include - #include - -+GRUB_MOD_LICENSE ("GPLv3+"); -+ - static grub_efi_guid_t tpm_guid = EFI_TPM_GUID; - static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID; - -@@ -70,21 +72,14 @@ static grub_efi_boolean_t grub_tpm_handl - } - - static grub_err_t --grub_tpm1_execute(grub_efi_handle_t tpm_handle, -+grub_tpm1_execute(grub_efi_tpm_protocol_t *tpm, - PassThroughToTPM_InputParamBlock *inbuf, - PassThroughToTPM_OutputParamBlock *outbuf) - { - grub_efi_status_t status; -- grub_efi_tpm_protocol_t *tpm; - grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn); - grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut); - -- tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -- GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -- -- if (!grub_tpm_present(tpm)) -- return 0; -- - /* UEFI TPM protocol takes the raw operand block, no param block header */ - status = efi_call_5 (tpm->pass_through_to_tpm, tpm, - inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn, -@@ -107,21 +102,14 @@ grub_tpm1_execute(grub_efi_handle_t tpm_ - } - - static grub_err_t --grub_tpm2_execute(grub_efi_handle_t tpm_handle, -+grub_tpm2_execute(grub_efi_tpm2_protocol_t *tpm, - PassThroughToTPM_InputParamBlock *inbuf, - PassThroughToTPM_OutputParamBlock *outbuf) - { - grub_efi_status_t status; -- grub_efi_tpm2_protocol_t *tpm; - grub_uint32_t inhdrsize = sizeof(*inbuf) - sizeof(inbuf->TPMOperandIn); - grub_uint32_t outhdrsize = sizeof(*outbuf) - sizeof(outbuf->TPMOperandOut); - -- tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -- GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -- -- if (!grub_tpm2_present(tpm)) -- return 0; -- - /* UEFI TPM protocol takes the raw operand block, no param block header */ - status = efi_call_5 (tpm->submit_command, tpm, - inbuf->IPBLength - inhdrsize, inbuf->TPMOperandIn, -@@ -143,42 +131,17 @@ grub_tpm2_execute(grub_efi_handle_t tpm_ - } - } - --grub_err_t --grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -- PassThroughToTPM_OutputParamBlock *outbuf) --{ -- grub_efi_handle_t tpm_handle; -- grub_uint8_t protocol_version; -- -- /* It's not a hard failure for there to be no TPM */ -- if (!grub_tpm_handle_find(&tpm_handle, &protocol_version)) -- return 0; -- -- if (protocol_version == 1) { -- return grub_tpm1_execute(tpm_handle, inbuf, outbuf); -- } else { -- return grub_tpm2_execute(tpm_handle, inbuf, outbuf); -- } --} -- - static grub_err_t --grub_tpm1_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf, -+grub_tpm1_log_event(grub_efi_tpm_protocol_t *tpm, unsigned char *buf, - grub_size_t size, grub_uint8_t pcr, - const char *description) - { - TCG_PCR_EVENT *event; - grub_efi_status_t status; -- grub_efi_tpm_protocol_t *tpm; - grub_efi_physical_address_t lastevent; - grub_uint32_t algorithm; - grub_uint32_t eventnum = 0; - -- tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -- GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -- -- if (!grub_tpm_present(tpm)) -- return 0; -- - event = grub_zalloc(sizeof (TCG_PCR_EVENT) + grub_strlen(description) + 1); - if (!event) - return grub_error (GRUB_ERR_OUT_OF_MEMORY, -@@ -210,19 +173,12 @@ grub_tpm1_log_event(grub_efi_handle_t tp - } - - static grub_err_t --grub_tpm2_log_event(grub_efi_handle_t tpm_handle, unsigned char *buf, -+grub_tpm2_log_event(grub_efi_tpm2_protocol_t *tpm, unsigned char *buf, - grub_size_t size, grub_uint8_t pcr, - const char *description) - { - EFI_TCG2_EVENT *event; - grub_efi_status_t status; -- grub_efi_tpm2_protocol_t *tpm; -- -- tpm = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -- GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -- -- if (!grub_tpm2_present(tpm)) -- return 0; - - event = grub_zalloc(sizeof (EFI_TCG2_EVENT) + grub_strlen(description) + 1); - if (!event) -@@ -255,19 +211,64 @@ grub_tpm2_log_event(grub_efi_handle_t tp - } - } - --grub_err_t -+static grub_efi_tpm_protocol_t *tpm; -+static grub_efi_tpm2_protocol_t *tpm2; -+ -+static grub_err_t -+grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf) -+{ -+ if (tpm) -+ return grub_tpm1_execute(tpm, inbuf, outbuf); -+ else if (tpm2) -+ return grub_tpm2_execute(tpm2, inbuf, outbuf); -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t - grub_tpm_log_event(unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - const char *description) - { -+ if (tpm) -+ return grub_tpm1_log_event(tpm, buf, size, pcr, description); -+ else if (tpm2) -+ return grub_tpm2_log_event(tpm2, buf, size, pcr, description); -+ return GRUB_ERR_NONE; -+} -+ -+static struct grub_tpm grub_efi_tpm = -+{ -+ .log_event = grub_tpm_log_event, -+ .execute = grub_tpm_execute -+}; -+ -+GRUB_MOD_INIT (tpm) -+{ - grub_efi_handle_t tpm_handle; - grub_efi_uint8_t protocol_version; - -- if (!grub_tpm_handle_find(&tpm_handle, &protocol_version)) -- return 0; -+ if (!grub_tpm_handle_find (&tpm_handle, &protocol_version)) -+ return ; - -- if (protocol_version == 1) { -- return grub_tpm1_log_event(tpm_handle, buf, size, pcr, description); -- } else { -- return grub_tpm2_log_event(tpm_handle, buf, size, pcr, description); -- } -+ if (protocol_version == 1) -+ { -+ tpm = grub_efi_open_protocol (tpm_handle, &tpm_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ if (tpm && grub_tpm_present(tpm)) -+ grub_tpm = &grub_efi_tpm; -+ } -+ else -+ { -+ tpm2 = grub_efi_open_protocol (tpm_handle, &tpm2_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ if (tpm2 && grub_tpm2_present(tpm2)) -+ grub_tpm = &grub_efi_tpm; -+ } -+} -+ -+GRUB_MOD_FINI (tpm) -+{ -+ grub_tpm = NULL; -+ tpm = NULL; -+ tpm2 = NULL; - } -Index: grub-2.02~rc1/grub-core/kern/i386/pc/tpm.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/kern/i386/pc/tpm.c -+++ grub-2.02~rc1/grub-core/kern/i386/pc/tpm.c -@@ -4,12 +4,14 @@ - #include - #include - #include -+#include - --#define TCPA_MAGIC 0x41504354 -+GRUB_MOD_LICENSE ("GPLv3+"); - --int tpm_present(void); -+#define TCPA_MAGIC 0x41504354 - --int tpm_present(void) -+static int -+tpm_present(void) - { - struct grub_bios_int_registers regs; - -@@ -24,16 +26,13 @@ int tpm_present(void) - return 0; - } - --grub_err_t -+static grub_err_t - grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, - PassThroughToTPM_OutputParamBlock *outbuf) - { - struct grub_bios_int_registers regs; - grub_addr_t inaddr, outaddr; - -- if (!tpm_present()) -- return 0; -- - inaddr = (grub_addr_t) inbuf; - outaddr = (grub_addr_t) outbuf; - regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; -@@ -80,7 +79,7 @@ typedef struct { - grub_uint8_t hashvalue[20]; - } GRUB_PACKED EventOutgoing; - --grub_err_t -+static grub_err_t - grub_tpm_log_event(unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - const char *description) - { -@@ -90,9 +89,6 @@ grub_tpm_log_event(unsigned char *buf, g - Event *event; - grub_uint32_t datalength; - -- if (!tpm_present()) -- return 0; -- - datalength = grub_strlen(description); - event = grub_zalloc(datalength + sizeof(Event)); - if (!event) -@@ -130,3 +126,19 @@ grub_tpm_log_event(unsigned char *buf, g - - return 0; - } -+static struct grub_tpm grub_pc_tpm = -+{ -+ .log_event = grub_tpm_log_event, -+ .execute = grub_tpm_execute -+}; -+ -+GRUB_MOD_INIT (tpm) -+{ -+ if (tpm_present()) -+ grub_tpm = &grub_pc_tpm; -+} -+ -+GRUB_MOD_FINI (tpm) -+{ -+ grub_tpm = NULL; -+} -Index: grub-2.02~rc1/grub-core/kern/tpm.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/kern/tpm.c -+++ grub-2.02~rc1/grub-core/kern/tpm.c -@@ -5,15 +5,22 @@ - #include - #include - -+grub_tpm_t grub_tpm = NULL; -+ - grub_err_t - grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr, - const char *kind, const char *description) - { - grub_err_t ret; -- char *desc = grub_xasprintf("%s %s", kind, description); -+ char *desc; -+ -+ if (!grub_tpm) -+ return GRUB_ERR_NONE; -+ -+ desc = grub_xasprintf("%s %s", kind, description); - if (!desc) - return GRUB_ERR_OUT_OF_MEMORY; -- ret = grub_tpm_log_event(buf, size, pcr, description); -+ ret = grub_tpm->log_event(buf, size, pcr, desc); - grub_free(desc); - return ret; - } -Index: grub-2.02~rc1/include/grub/tpm.h -=================================================================== ---- grub-2.02~rc1.orig/include/grub/tpm.h -+++ grub-2.02~rc1/include/grub/tpm.h -@@ -69,21 +69,14 @@ typedef struct { - grub_err_t EXPORT_FUNC(grub_tpm_measure) (unsigned char *buf, grub_size_t size, - grub_uint8_t pcr, const char *kind, - const char *description); --#if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) --grub_err_t grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -- PassThroughToTPM_OutputParamBlock *outbuf); --grub_err_t grub_tpm_log_event(unsigned char *buf, grub_size_t size, -- grub_uint8_t pcr, const char *description); --#else --static inline grub_err_t grub_tpm_execute(PassThroughToTPM_InputParamBlock *inbuf, -- PassThroughToTPM_OutputParamBlock *outbuf) { return 0; }; --static inline grub_err_t grub_tpm_log_event(unsigned char *buf, -- grub_size_t size, -- grub_uint8_t pcr, -- const char *description) -+typedef struct grub_tpm - { -- return 0; --}; --#endif -+ grub_err_t (*log_event)(unsigned char *buf, grub_size_t size, -+ grub_uint8_t pcr, const char *description); -+ grub_err_t (*execute)(PassThroughToTPM_InputParamBlock *inbuf, -+ PassThroughToTPM_OutputParamBlock *outbuf); -+} *grub_tpm_t; -+ -+extern grub_tpm_t EXPORT_VAR(grub_tpm); - - #endif -Index: grub-2.02~rc1/util/grub-install.c -=================================================================== ---- grub-2.02~rc1.orig/util/grub-install.c -+++ grub-2.02~rc1/util/grub-install.c +--- grub-2.04~rc1.orig/util/grub-install.c ++++ grub-2.04~rc1/util/grub-install.c @@ -80,6 +80,7 @@ static char *label_color; static char *label_bgcolor; static char *product_version; @@ -472,34 +44,13 @@ Index: grub-2.02~rc1/util/grub-install.c {"debug", OPTION_DEBUG, 0, OPTION_HIDDEN, 0, 2}, {"no-floppy", OPTION_NO_FLOPPY, 0, OPTION_HIDDEN, 0, 2}, -@@ -1322,6 +1329,9 @@ main (int argc, char *argv[]) +@@ -1320,6 +1327,9 @@ main (int argc, char *argv[]) else if (disk_module && disk_module[0]) grub_install_push_module (disk_module); -+ if (suse_enable_tpm && (is_efi || platform == GRUB_INSTALL_PLATFORM_I386_PC)) ++ if (suse_enable_tpm && platform == GRUB_INSTALL_PLATFORM_X86_64_EFI) + grub_install_push_module ("tpm"); + relative_grubdir = grub_make_system_path_relative_to_its_root (grubdir); if (relative_grubdir[0] == '\0') { -@@ -1742,9 +1752,9 @@ main (int argc, char *argv[]) - { - char *boot_img_src = grub_util_path_concat (2, - grub_install_source_directory, -- "boot.img"); -+ suse_enable_tpm ? "boot_tpm.img" : "boot.img"); - char *boot_img = grub_util_path_concat (2, platdir, -- "boot.img"); -+ suse_enable_tpm ? "boot_tpm.img" : "boot.img"); - grub_install_copy_file (boot_img_src, boot_img, 1); - - grub_util_info ("%sgrub-bios-setup %s %s %s %s %s --directory='%s' --device-map='%s' '%s'", -@@ -1762,7 +1772,7 @@ main (int argc, char *argv[]) - - /* Now perform the installation. */ - if (install_bootsector) -- grub_util_bios_setup (platdir, "boot.img", "core.img", -+ grub_util_bios_setup (platdir, suse_enable_tpm ? "boot_tpm.img" : "boot.img", "core.img", - install_drive, force, - fs_probe, allow_floppy, add_rs_codes); - break; diff --git a/0013-tpm-i386-pc-diskboot-img.patch b/0013-tpm-i386-pc-diskboot-img.patch deleted file mode 100644 index 473d1bb..0000000 --- a/0013-tpm-i386-pc-diskboot-img.patch +++ /dev/null @@ -1,148 +0,0 @@ -Index: grub-2.02/grub-core/Makefile.core.def -=================================================================== ---- grub-2.02.orig/grub-core/Makefile.core.def -+++ grub-2.02/grub-core/Makefile.core.def -@@ -451,6 +451,20 @@ image = { - }; - - image = { -+ name = diskboot_tpm; -+ i386_pc = boot/i386/pc/diskboot.S; -+ -+ cppflags = '-DTPM=1'; -+ -+ i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; -+ i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8000'; -+ -+ objcopyflags = '-O binary'; -+ -+ enable = i386_pc; -+}; -+ -+image = { - name = lnxboot; - i386_pc = boot/i386/pc/lnxboot.S; - -Index: grub-2.02/grub-core/boot/i386/pc/diskboot.S -=================================================================== ---- grub-2.02.orig/grub-core/boot/i386/pc/diskboot.S -+++ grub-2.02/grub-core/boot/i386/pc/diskboot.S -@@ -19,8 +19,6 @@ - #include - #include - --#define TPM 1 -- - /* - * defines for the code go here - */ -Index: grub-2.02/include/grub/util/mkimage.h -=================================================================== ---- grub-2.02.orig/include/grub/util/mkimage.h -+++ grub-2.02/include/grub/util/mkimage.h -@@ -71,7 +71,8 @@ struct grub_install_image_target_desc - IMAGE_I386_IEEE1275, - IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH, - IMAGE_FULOONG2F_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC, -- IMAGE_QEMU_MIPS_FLASH, IMAGE_UBOOT, IMAGE_XEN, IMAGE_I386_PC_ELTORITO -+ IMAGE_QEMU_MIPS_FLASH, IMAGE_UBOOT, IMAGE_XEN, IMAGE_I386_PC_ELTORITO, -+ IMAGE_I386_PC_TPM - } id; - enum - { -Index: grub-2.02/util/grub-install.c -=================================================================== ---- grub-2.02.orig/util/grub-install.c -+++ grub-2.02/util/grub-install.c -@@ -1660,6 +1660,16 @@ main (int argc, char *argv[]) - - - case GRUB_INSTALL_PLATFORM_I386_PC: -+ if (suse_enable_tpm) -+ { -+ snprintf (mkimage_target, sizeof (mkimage_target), -+ "%s-%s-tpm", -+ grub_install_get_platform_cpu (platform), -+ grub_install_get_platform_platform (platform)); -+ core_name = "core.img"; -+ break; -+ } -+ /* FALLTHROUGH */ - case GRUB_INSTALL_PLATFORM_MIPSEL_ARC: - case GRUB_INSTALL_PLATFORM_MIPS_ARC: - case GRUB_INSTALL_PLATFORM_ARM_UBOOT: -Index: grub-2.02/util/mkimage.c -=================================================================== ---- grub-2.02.orig/util/mkimage.c -+++ grub-2.02/util/mkimage.c -@@ -165,6 +165,22 @@ static const struct grub_install_image_t - .default_compression = GRUB_COMPRESSION_LZMA - }, - { -+ .dirname = "i386-pc", -+ .names = { "i386-pc-tpm", NULL }, -+ .voidp_sizeof = 4, -+ .bigendian = 0, -+ .id = IMAGE_I386_PC_TPM, -+ .flags = PLATFORM_FLAGS_DECOMPRESSORS, -+ .total_module_size = TARGET_NO_FIELD, -+ .decompressor_compressed_size = GRUB_DECOMPRESSOR_I386_PC_COMPRESSED_SIZE, -+ .decompressor_uncompressed_size = GRUB_DECOMPRESSOR_I386_PC_UNCOMPRESSED_SIZE, -+ .decompressor_uncompressed_addr = TARGET_NO_FIELD, -+ .section_align = 1, -+ .vaddr_offset = 0, -+ .link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR, -+ .default_compression = GRUB_COMPRESSION_LZMA -+ }, -+ { - .dirname = "i386-efi", - .names = { "i386-efi", NULL }, - .voidp_sizeof = 4, -@@ -756,7 +772,8 @@ grub_install_generate_image (const char - - if (image_target->id == IMAGE_I386_PC - || image_target->id == IMAGE_I386_PC_PXE -- || image_target->id == IMAGE_I386_PC_ELTORITO) -+ || image_target->id == IMAGE_I386_PC_ELTORITO -+ || image_target->id == IMAGE_I386_PC_TPM) - comp = GRUB_COMPRESSION_LZMA; - - path_list = grub_util_resolve_dependencies (dir, "moddep.lst", mods); -@@ -980,7 +997,8 @@ grub_install_generate_image (const char - - if ((image_target->id == IMAGE_I386_PC - || image_target->id == IMAGE_I386_PC_PXE -- || image_target->id == IMAGE_I386_PC_ELTORITO) -+ || image_target->id == IMAGE_I386_PC_ELTORITO -+ || image_target->id == IMAGE_I386_PC_TPM) - && decompress_size > GRUB_KERNEL_I386_PC_LINK_ADDR - 0x8200) - grub_util_error ("%s", _("Decompressor is too big")); - -@@ -1023,6 +1041,7 @@ grub_install_generate_image (const char - case IMAGE_I386_PC: - case IMAGE_I386_PC_PXE: - case IMAGE_I386_PC_ELTORITO: -+ case IMAGE_I386_PC_TPM: - if (GRUB_KERNEL_I386_PC_LINK_ADDR + core_size > 0x78000 - || (core_size > (0xffff << GRUB_DISK_SECTOR_BITS)) - || (layout.kernel_size + layout.bss_size -@@ -1061,6 +1080,7 @@ grub_install_generate_image (const char - case IMAGE_I386_PC: - case IMAGE_I386_PC_PXE: - case IMAGE_I386_PC_ELTORITO: -+ case IMAGE_I386_PC_TPM: - { - unsigned num; - char *boot_path, *boot_img; -@@ -1110,7 +1130,10 @@ grub_install_generate_image (const char - free (eltorito_path); - } - -- boot_path = grub_util_get_path (dir, "diskboot.img"); -+ if (image_target->id == IMAGE_I386_PC_TPM) -+ boot_path = grub_util_get_path (dir, "diskboot_tpm.img"); -+ else -+ boot_path = grub_util_get_path (dir, "diskboot.img"); - boot_size = grub_util_get_image_size (boot_path); - if (boot_size != GRUB_DISK_SECTOR_SIZE) - grub_util_error (_("diskboot.img size must be %u bytes"), diff --git a/grub-2.02.tar.xz b/grub-2.02.tar.xz deleted file mode 100644 index 99e42af..0000000 --- a/grub-2.02.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f -size 6113260 diff --git a/grub-2.04.tar.xz b/grub-2.04.tar.xz new file mode 100644 index 0000000..2ac8876 --- /dev/null +++ b/grub-2.04.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d +size 6393864 diff --git a/grub2-Fix-incorrect-netmask-on-ppc64.patch b/grub2-Fix-incorrect-netmask-on-ppc64.patch index 3cf4ba6..009e1fb 100644 --- a/grub2-Fix-incorrect-netmask-on-ppc64.patch +++ b/grub2-Fix-incorrect-netmask-on-ppc64.patch @@ -26,15 +26,16 @@ The count of zero with __builtin_clz can be 22. (clz counts the number of one bi grub-core/net/drivers/ieee1275/ofnet.c | 2 +- 1 file changed, 1 insertion(+), 2 deletions(-) -diff -ur grub-2.02~/grub-core/net/drivers/ieee1275/ofnet.c grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c ---- grub-2.02~/grub-core/net/drivers/ieee1275/ofnet.c 2018-03-26 13:49:55.399558334 +0200 -+++ grub-2.02/grub-core/net/drivers/ieee1275/ofnet.c 2018-03-26 13:51:03.092656921 +0200 -@@ -232,7 +232,7 @@ - } - +Index: grub-2.04~rc1/grub-core/net/drivers/ieee1275/ofnet.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/net/drivers/ieee1275/ofnet.c ++++ grub-2.04~rc1/grub-core/net/drivers/ieee1275/ofnet.c +@@ -220,7 +220,7 @@ grub_ieee1275_parse_bootpath (const char + flags); + inter->vlantag = vlantag; grub_net_add_ipv4_local (inter, - __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4))); + __builtin_clz (~ (subnet_mask.ipv4))); + } - if (gateway_addr.ipv4 != 0) diff --git a/grub2-accept-empty-module.patch b/grub2-accept-empty-module.patch deleted file mode 100644 index 302c9b5..0000000 --- a/grub2-accept-empty-module.patch +++ /dev/null @@ -1,22 +0,0 @@ -Accept empty modules - -For the Xen platform the all_video.mod module is empty. -With old binutils the .symtab section remained (containing -only section symbols), so the check didn't trigger, but starting -with binutils 2.27 not even a .symtab remains. As there are -also no relocations that's no problem (and that is checked -independendly). -Index: grub-2.02~rc1/util/grub-module-verifierXX.c -=================================================================== ---- grub-2.02~rc1.orig/util/grub-module-verifierXX.c -+++ grub-2.02~rc1/util/grub-module-verifierXX.c -@@ -224,7 +224,8 @@ check_symbols (const struct grub_module_ - s = find_section (arch, e, ".moddeps"); - - if (!s) -- grub_util_error ("no symbol table and no .moddeps section"); -+ /*grub_util_error ("no symbol table and no .moddeps section");*/ -+ return; /* An empty module happens for all_video.module for Xen */ - - if (!s->sh_size) - grub_util_error ("no symbol table and empty .moddeps section"); diff --git a/grub2-binutils2.31.patch b/grub2-binutils2.31.patch deleted file mode 100644 index b11267a..0000000 --- a/grub2-binutils2.31.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 842c390469e2c2e10b5aa36700324cd3bde25875 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Sat, 17 Feb 2018 06:47:28 -0800 -Subject: x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32 - -Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a: - -https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a - -x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for -32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as -R_X86_64_PC32. - -Signed-off-by: H.J. Lu -Reviewed-by: Daniel Kiper ---- - grub-core/efiemu/i386/loadcore64.c | 1 + - grub-core/kern/x86_64/dl.c | 1 + - util/grub-mkimagexx.c | 1 + - util/grub-module-verifier.c | 1 + - 4 files changed, 4 insertions(+) - -diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c -index e49d0b6..18facf4 100644 ---- a/grub-core/efiemu/i386/loadcore64.c -+++ b/grub-core/efiemu/i386/loadcore64.c -@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - err = grub_efiemu_write_value (addr, - *addr32 + rel->r_addend - + sym.off -diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c -index 4406906..3a73e6e 100644 ---- a/grub-core/kern/x86_64/dl.c -+++ b/grub-core/kern/x86_64/dl.c -@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - { - grub_int64_t value; - value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value - -diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c -index a2bb054..39d7efb 100644 ---- a/util/grub-mkimagexx.c -+++ b/util/grub-mkimagexx.c -@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, - break; - - case R_X86_64_PC32: -+ case R_X86_64_PLT32: - { - grub_uint32_t *t32 = (grub_uint32_t *) target; - *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32) -diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c -index 9179285..a79271f 100644 ---- a/util/grub-module-verifier.c -+++ b/util/grub-module-verifier.c -@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = { - -1 - }, (int[]){ - R_X86_64_PC32, -+ R_X86_64_PLT32, - -1 - } - }, --- -cgit v1.0-41-gc330 - - diff --git a/grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch b/grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch index 1de5274..e97077d 100644 --- a/grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch +++ b/grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch @@ -21,21 +21,21 @@ Signed-off-by: Jeff Mahoney grub-core/fs/btrfs.c | 529 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 518 insertions(+), 11 deletions(-) -Index: grub-2.02~beta2/grub-core/fs/btrfs.c +Index: grub-2.04~rc1/grub-core/fs/btrfs.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/fs/btrfs.c -+++ grub-2.02~beta2/grub-core/fs/btrfs.c -@@ -29,6 +29,9 @@ - #include - #include +--- grub-2.04~rc1.orig/grub-core/fs/btrfs.c ++++ grub-2.04~rc1/grub-core/fs/btrfs.c +@@ -40,6 +40,9 @@ #include + #include + #include +#include +#include +#include GRUB_MOD_LICENSE ("GPLv3+"); -@@ -64,9 +67,11 @@ struct grub_btrfs_superblock +@@ -78,9 +81,11 @@ struct grub_btrfs_superblock grub_uint64_t generation; grub_uint64_t root_tree; grub_uint64_t chunk_tree; @@ -49,7 +49,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c struct grub_btrfs_device this_device; char label[0x100]; grub_uint8_t dummy4[0x100]; -@@ -105,6 +110,7 @@ struct grub_btrfs_data +@@ -120,6 +125,7 @@ struct grub_btrfs_data grub_uint64_t exttree; grub_size_t extsize; struct grub_btrfs_extent_data *extent; @@ -57,7 +57,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c }; struct grub_btrfs_chunk_item -@@ -171,6 +177,14 @@ struct grub_btrfs_leaf_descriptor +@@ -188,6 +194,14 @@ struct grub_btrfs_leaf_descriptor } *data; }; @@ -72,7 +72,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c struct grub_btrfs_time { grub_int64_t sec; -@@ -215,6 +229,14 @@ struct grub_btrfs_extent_data +@@ -233,6 +247,14 @@ struct grub_btrfs_extent_data #define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100 @@ -87,7 +87,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2, 256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2 }; -@@ -830,6 +852,62 @@ grub_btrfs_read_logical (struct grub_btr +@@ -1153,6 +1175,62 @@ grub_btrfs_read_logical (struct grub_btr return GRUB_ERR_NONE; } @@ -150,7 +150,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c static struct grub_btrfs_data * grub_btrfs_mount (grub_device_t dev) { -@@ -865,6 +943,13 @@ grub_btrfs_mount (grub_device_t dev) +@@ -1188,6 +1266,13 @@ grub_btrfs_mount (grub_device_t dev) data->devices_attached[0].dev = dev; data->devices_attached[0].id = data->sblock.this_device.device_id; @@ -164,7 +164,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c return data; } -@@ -1226,6 +1311,91 @@ get_root (struct grub_btrfs_data *data, +@@ -1654,6 +1739,91 @@ get_root (struct grub_btrfs_data *data, } static grub_err_t @@ -256,7 +256,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c find_path (struct grub_btrfs_data *data, const char *path, struct grub_btrfs_key *key, grub_uint64_t *tree, grub_uint8_t *type) -@@ -1243,14 +1413,26 @@ find_path (struct grub_btrfs_data *data, +@@ -1671,14 +1841,26 @@ find_path (struct grub_btrfs_data *data, char *origpath = NULL; unsigned symlinks_max = 32; @@ -287,7 +287,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c while (1) { while (path[0] == '/') -@@ -1423,9 +1605,21 @@ find_path (struct grub_btrfs_data *data, +@@ -1851,9 +2033,21 @@ find_path (struct grub_btrfs_data *data, path = path_alloc = tmp; if (path[0] == '/') { @@ -312,7 +312,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c } continue; } -@@ -1666,6 +1860,20 @@ grub_btrfs_read (grub_file_t file, char +@@ -2094,6 +2288,20 @@ grub_btrfs_read (grub_file_t file, char data->tree, file->offset, buf, len); } @@ -333,7 +333,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c static grub_err_t grub_btrfs_uuid (grub_device_t device, char **uuid) { -@@ -1677,15 +1885,7 @@ grub_btrfs_uuid (grub_device_t device, c +@@ -2105,15 +2313,7 @@ grub_btrfs_uuid (grub_device_t device, c if (!data) return grub_errno; @@ -350,7 +350,7 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c grub_btrfs_unmount (data); -@@ -1742,6 +1942,242 @@ grub_btrfs_embed (grub_device_t device _ +@@ -2170,6 +2370,242 @@ grub_btrfs_embed (grub_device_t device _ } #endif @@ -592,8 +592,8 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c + static struct grub_fs grub_btrfs_fs = { .name = "btrfs", - .dir = grub_btrfs_dir, -@@ -1757,12 +2193,88 @@ static struct grub_fs grub_btrfs_fs = { + .fs_dir = grub_btrfs_dir, +@@ -2185,12 +2621,88 @@ static struct grub_fs grub_btrfs_fs = { #endif }; @@ -682,10 +682,10 @@ Index: grub-2.02~beta2/grub-core/fs/btrfs.c } + +// vim: si et sw=2: -Index: grub-2.02~beta2/include/grub/btrfs.h +Index: grub-2.04~rc1/include/grub/btrfs.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/btrfs.h -+++ grub-2.02~beta2/include/grub/btrfs.h +--- grub-2.04~rc1.orig/include/grub/btrfs.h ++++ grub-2.04~rc1/include/grub/btrfs.h @@ -29,6 +29,7 @@ enum GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM = 0x84, GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF = 0x90, diff --git a/grub2-btrfs-09-get-default-subvolume.patch b/grub2-btrfs-09-get-default-subvolume.patch index 5d039c2..d15f42a 100644 --- a/grub2-btrfs-09-get-default-subvolume.patch +++ b/grub2-btrfs-09-get-default-subvolume.patch @@ -1,8 +1,8 @@ -Index: grub-2.02/grub-core/fs/btrfs.c +Index: grub-2.04~rc1/grub-core/fs/btrfs.c =================================================================== ---- grub-2.02.orig/grub-core/fs/btrfs.c -+++ grub-2.02/grub-core/fs/btrfs.c -@@ -2446,6 +2446,242 @@ out: +--- grub-2.04~rc1.orig/grub-core/fs/btrfs.c ++++ grub-2.04~rc1/grub-core/fs/btrfs.c +@@ -2867,6 +2867,242 @@ out: return 0; } @@ -244,8 +244,8 @@ Index: grub-2.02/grub-core/fs/btrfs.c + static struct grub_fs grub_btrfs_fs = { .name = "btrfs", - .dir = grub_btrfs_dir, -@@ -2464,6 +2700,7 @@ static struct grub_fs grub_btrfs_fs = { + .fs_dir = grub_btrfs_dir, +@@ -2885,6 +3121,7 @@ static struct grub_fs grub_btrfs_fs = { static grub_command_t cmd_info; static grub_command_t cmd_mount_subvol; static grub_extcmd_t cmd_list_subvols; @@ -253,7 +253,7 @@ Index: grub-2.02/grub-core/fs/btrfs.c static char * subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)), -@@ -2534,6 +2771,11 @@ GRUB_MOD_INIT (btrfs) +@@ -2955,6 +3192,11 @@ GRUB_MOD_INIT (btrfs) "[-p|-n] [-o var] DEVICE", "Print list of BtrFS subvolumes on " "DEVICE.", options); diff --git a/grub2-commands-introduce-read_file-subcommand.patch b/grub2-commands-introduce-read_file-subcommand.patch index a82ebbc..7190920 100644 --- a/grub2-commands-introduce-read_file-subcommand.patch +++ b/grub2-commands-introduce-read_file-subcommand.patch @@ -4,12 +4,18 @@ References: bsc#892852, bsc#891946 Patch-Mainline: not yet Needed to allow s390x-emu to be telecontrolled via LOADPARM. + +v2: Added GRUB_FILE_TYPE_READ_ENVVAR as file type by read_file sub-command +tracked by verifier framework. + --- grub-core/commands/read.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) ---- a/grub-core/commands/read.c -+++ b/grub-core/commands/read.c +Index: grub-2.04~rc1/grub-core/commands/read.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/commands/read.c ++++ grub-2.04~rc1/grub-core/commands/read.c @@ -20,6 +20,7 @@ #include #include @@ -33,7 +39,7 @@ Needed to allow s390x-emu to be telecontrolled via LOADPARM. + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("file name expected")); + if (argc < 2) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable name expected")); -+ file = grub_file_open (args[i++]); ++ file = grub_file_open (args[i++], GRUB_FILE_TYPE_READ_ENVVAR); + if (! file) + return grub_errno; + while ( i < argc ) @@ -68,3 +74,15 @@ Needed to allow s390x-emu to be telecontrolled via LOADPARM. grub_unregister_command (cmd); + grub_unregister_command (cme); } +Index: grub-2.04~rc1/include/grub/file.h +=================================================================== +--- grub-2.04~rc1.orig/include/grub/file.h ++++ grub-2.04~rc1/include/grub/file.h +@@ -122,6 +122,7 @@ enum grub_file_type + GRUB_FILE_TYPE_FS_SEARCH, + GRUB_FILE_TYPE_AUDIO, + GRUB_FILE_TYPE_VBE_DUMP, ++ GRUB_FILE_TYPE_READ_ENVVAR, + + GRUB_FILE_TYPE_LOADENV, + GRUB_FILE_TYPE_SAVEENV, diff --git a/grub2-efi-Free-malloc-regions-on-exit.patch b/grub2-efi-Free-malloc-regions-on-exit.patch deleted file mode 100644 index c0dc400..0000000 --- a/grub2-efi-Free-malloc-regions-on-exit.patch +++ /dev/null @@ -1,186 +0,0 @@ -From 33298c813c36a50ccc881c33c9b6eacfb830c21a Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Subject: [PATCH v7 2/2] efi: Free malloc regions on exit - -When we exit grub, we don't free all the memory that we allocated earlier -for our heap region. This can cause problems with setups where you try -to descend the boot order using "exit" entries, such as PXE -> HD boot -scenarios. - -Signed-off-by: Alexander Graf - ---- - -v2 -> v3: - - - add comment explaining the number of regions - - move nr of regions into a define - - add warning if we exceed the number of freeable regions - - reset region counter to 0 on fini - -v3 -> v4: - - - use dynamic list instead of static array at runtime - - use allocate_pool for list, so we are not bound by heap or random numbers - - remember all allocations, not just the heap - -v4 -> v5: - - - free dynamic list entries on allocation removal - -v5 -> v6: - - - move next ptr to last field - - s/start_addr/address/ - - s/grub_efi_unremember_pages()/grub_efi_drop_alloc()/ - - s/grub_efi_remember_pages()/grub_efi_store_alloc()/ - - move grub_efi_drop_alloc after grub_efi_store_alloc - - s/grub2/GRUB/ - - Make grub_efi_memory_fini comment more verbose - - Drop useless efi_allocated_memory = NULL; line - -v6 -> v7: - - - rewrite grub_efi_drop_alloc() according to Daniel's comments ---- - grub-core/kern/efi/init.c | 1 + - grub-core/kern/efi/mm.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++ - include/grub/efi/efi.h | 1 + - 3 files changed, 81 insertions(+) - -diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c -index 2c31847bf..3dfdf2d22 100644 ---- a/grub-core/kern/efi/init.c -+++ b/grub-core/kern/efi/init.c -@@ -80,4 +80,5 @@ grub_efi_fini (void) - { - grub_efidisk_fini (); - grub_console_fini (); -+ grub_efi_memory_fini (); - } -diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c -index ac2a4c556..6da8c206a 100644 ---- a/grub-core/kern/efi/mm.c -+++ b/grub-core/kern/efi/mm.c -@@ -49,6 +49,69 @@ static grub_efi_uintn_t finish_desc_size; - static grub_efi_uint32_t finish_desc_version; - int grub_efi_is_finished = 0; - -+/* -+ * We need to roll back EFI allocations on exit. Remember allocations that -+ * we'll free on exit. -+ */ -+struct efi_allocation; -+struct efi_allocation { -+ grub_efi_physical_address_t address; -+ grub_efi_uint64_t pages; -+ struct efi_allocation *next; -+}; -+static struct efi_allocation *efi_allocated_memory; -+ -+static void -+grub_efi_store_alloc (grub_efi_physical_address_t address, -+ grub_efi_uintn_t pages) -+{ -+ grub_efi_boot_services_t *b; -+ struct efi_allocation *alloc; -+ grub_efi_status_t status; -+ -+ b = grub_efi_system_table->boot_services; -+ status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, -+ sizeof(*alloc), (void**)&alloc); -+ if (status == GRUB_EFI_SUCCESS) -+ { -+ alloc->next = efi_allocated_memory; -+ alloc->address = address; -+ alloc->pages = pages; -+ efi_allocated_memory = alloc; -+ } -+ else -+ grub_printf ("Could not malloc memory to remember EFI allocation. " -+ "Exiting GRUB won't free all memory.\n"); -+} -+ -+static void -+grub_efi_drop_alloc (grub_efi_physical_address_t address, -+ grub_efi_uintn_t pages) -+{ -+ struct efi_allocation *ea, *eap; -+ grub_efi_boot_services_t *b; -+ -+ b = grub_efi_system_table->boot_services; -+ -+ for (eap = NULL, ea = efi_allocated_memory; ea; eap = ea, ea = ea->next) -+ { -+ if (ea->address != address || ea->pages != pages) -+ continue; -+ -+ /* Remove the current entry from the list */ -+ if (eap) -+ eap->next = ea->next; -+ else -+ efi_allocated_memory = ea->next; -+ -+ /* Then free the memory backing it */ -+ efi_call_1 (b->free_pool, ea); -+ -+ /* And leave, we're done */ -+ break; -+ } -+} -+ - /* Allocate pages below a specified address */ - void * - grub_efi_allocate_pages_max (grub_efi_physical_address_t max, -@@ -79,6 +142,7 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t address, - return 0; - } - -+ grub_efi_store_alloc (address, pages); - return (void *) ((grub_addr_t) address); - } - -@@ -108,6 +172,7 @@ grub_efi_free_pages (grub_efi_physical_address_t address, - - b = grub_efi_system_table->boot_services; - efi_call_2 (b->free_pages, address, pages); -+ grub_efi_drop_alloc (address, pages); - } - - #if defined (__i386__) || defined (__x86_64__) -@@ -422,6 +487,20 @@ add_memory_regions (grub_efi_memory_descriptor_t *memory_map, - grub_fatal ("too little memory"); - } - -+void -+grub_efi_memory_fini (void) -+{ -+ /* -+ * Free all stale allocations. grub_efi_free_pages() will remove -+ * the found entry from the list and it will always find the first -+ * list entry (efi_allocated_memory is the list start). Hence we -+ * remove all entries from the list until none is left altogether. -+ */ -+ while (efi_allocated_memory) -+ grub_efi_free_pages (efi_allocated_memory->address, -+ efi_allocated_memory->pages); -+} -+ - #if 0 - /* Print the memory map. */ - static void -diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h -index 3fa082816..c996913e5 100644 ---- a/include/grub/efi/efi.h -+++ b/include/grub/efi/efi.h -@@ -55,6 +55,7 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, - grub_efi_uintn_t *map_key, - grub_efi_uintn_t *descriptor_size, - grub_efi_uint32_t *descriptor_version); -+void grub_efi_memory_fini (void); - grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle); - void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp); - char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp); --- -2.12.3 - diff --git a/grub2-efi-HP-workaround.patch b/grub2-efi-HP-workaround.patch index 5b53090..932f534 100644 --- a/grub2-efi-HP-workaround.patch +++ b/grub2-efi-HP-workaround.patch @@ -1,7 +1,11 @@ -Index: grub-2.02~beta2/grub-core/kern/efi/init.c + +v2: Add GRUB_FILE_TYPE_CONFIG to grub_file_open, see also upstream commit +ca0a4f689 verifiers: File type for fine-grained signature-verification controlling + +Index: grub-2.04~rc1/grub-core/kern/efi/init.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/efi/init.c -+++ grub-2.02~beta2/grub-core/kern/efi/init.c +--- grub-2.04~rc1.orig/grub-core/kern/efi/init.c ++++ grub-2.04~rc1/grub-core/kern/efi/init.c @@ -25,6 +25,7 @@ #include #include @@ -32,7 +36,7 @@ Index: grub-2.02~beta2/grub-core/kern/efi/init.c + goto quit; + + config = grub_xasprintf ("(%s)%s/grub.cfg", device, path); -+ config_fd = grub_file_open (config); ++ config_fd = grub_file_open (config, GRUB_FILE_TYPE_CONFIG); + + /* everything's fine, so quit the workaround */ + if (config_fd) @@ -53,7 +57,7 @@ Index: grub-2.02~beta2/grub-core/kern/efi/init.c + if (! config_upper) + goto quit; + -+ config_fd = grub_file_open (config_upper); ++ config_fd = grub_file_open (config_upper, GRUB_FILE_TYPE_CONFIG); + + /* if config can be found by the upper case path, return it */ + if (config_fd) @@ -78,7 +82,7 @@ Index: grub-2.02~beta2/grub-core/kern/efi/init.c void grub_machine_get_bootlocation (char **device, char **path) -@@ -69,6 +131,12 @@ grub_machine_get_bootlocation (char **de +@@ -72,6 +134,12 @@ grub_machine_get_bootlocation (char **de p = grub_strrchr (*path, '/'); if (p) *p = '\0'; diff --git a/grub2-efi-Move-grub_reboot-into-kernel.patch b/grub2-efi-Move-grub_reboot-into-kernel.patch deleted file mode 100644 index 11cb458..0000000 --- a/grub2-efi-Move-grub_reboot-into-kernel.patch +++ /dev/null @@ -1,122 +0,0 @@ -From dee74e9bd88aa31e38b1e77dc7845930aa1cd60f Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Subject: [PATCH v7 1/2] efi: Move grub_reboot() into kernel - -The reboot function calls machine_fini() and then reboots the system. -Currently it lives in lib/ which means it gets compiled into the -reboot module which lives on the heap. - -In a following patch, I want to free the heap on machine_fini() -though, so we would free the memory that the code is running in. That -obviously breaks with smarter UEFI implementations. - -So this patch moves it into the core. That way we ensure that all -code running after machine_fini() in the UEFI case is running from -memory that got allocated (and gets deallocated) by the UEFI core. - -Signed-off-by: Alexander Graf - ---- - -v3 -> v4: - - - Move grub_reboot to kern/efi/efi.c ---- - grub-core/Makefile.core.def | 4 ---- - grub-core/kern/efi/efi.c | 9 +++++++++ - grub-core/lib/efi/reboot.c | 33 --------------------------------- - include/grub/misc.h | 3 ++- - 4 files changed, 11 insertions(+), 38 deletions(-) - delete mode 100644 grub-core/lib/efi/reboot.c - -diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def -index a65c27f7f..1cc4ce374 100644 ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -872,10 +872,6 @@ module = { - name = reboot; - i386 = lib/i386/reboot.c; - i386 = lib/i386/reboot_trampoline.S; -- ia64_efi = lib/efi/reboot.c; -- x86_64_efi = lib/efi/reboot.c; -- arm_efi = lib/efi/reboot.c; -- arm64_efi = lib/efi/reboot.c; - powerpc_ieee1275 = lib/ieee1275/reboot.c; - sparc64_ieee1275 = lib/ieee1275/reboot.c; - mips_arc = lib/mips/arc/reboot.c; -diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c -index d467785fc..708581fcb 100644 ---- a/grub-core/kern/efi/efi.c -+++ b/grub-core/kern/efi/efi.c -@@ -155,6 +155,15 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle) - } - - void -+grub_reboot (void) -+{ -+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); -+ efi_call_4 (grub_efi_system_table->runtime_services->reset_system, -+ GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL); -+ for (;;) ; -+} -+ -+void - grub_exit (void) - { - grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); -diff --git a/grub-core/lib/efi/reboot.c b/grub-core/lib/efi/reboot.c -deleted file mode 100644 -index 7de8bcb5d..000000000 ---- a/grub-core/lib/efi/reboot.c -+++ /dev/null -@@ -1,33 +0,0 @@ --/* -- * GRUB -- GRand Unified Bootloader -- * Copyright (C) 2011 Free Software Foundation, Inc. -- * -- * GRUB is free software: you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation, either version 3 of the License, or -- * (at your option) any later version. -- * -- * GRUB is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with GRUB. If not, see . -- */ -- --#include --#include --#include --#include --#include --#include -- --void --grub_reboot (void) --{ -- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); -- efi_call_4 (grub_efi_system_table->runtime_services->reset_system, -- GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL); -- for (;;) ; --} -diff --git a/include/grub/misc.h b/include/grub/misc.h -index 2a9f87cc2..372f009e8 100644 ---- a/include/grub/misc.h -+++ b/include/grub/misc.h -@@ -396,7 +396,8 @@ grub_abs (int x) - } - - /* Reboot the machine. */ --#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS) -+#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS) || \ -+ defined (GRUB_MACHINE_EFI) - void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn)); - #else - void grub_reboot (void) __attribute__ ((noreturn)); --- -2.12.3 - diff --git a/grub2-efi-chainloader-root.patch b/grub2-efi-chainloader-root.patch index 0c588a1..be29084 100644 --- a/grub2-efi-chainloader-root.patch +++ b/grub2-efi-chainloader-root.patch @@ -14,16 +14,16 @@ Signed-off-by: Michael Chang grub-core/loader/efi/chainloader.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c +Index: grub-2.04~rc1/grub-core/loader/efi/chainloader.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/loader/efi/chainloader.c -+++ grub-2.02~beta2/grub-core/loader/efi/chainloader.c -@@ -706,12 +706,16 @@ grub_cmd_chainloader (grub_command_t cmd +--- grub-2.04~rc1.orig/grub-core/loader/efi/chainloader.c ++++ grub-2.04~rc1/grub-core/loader/efi/chainloader.c +@@ -714,12 +714,16 @@ grub_cmd_chainloader (grub_command_t cmd *(--p16) = 0; } + grub_dprintf ("chain", "cmd='%s'\n", filename); - file = grub_file_open (filename); + file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE); if (! file) goto fail; diff --git a/grub2-emu-4-all.patch b/grub2-emu-4-all.patch index 38ff1ee..fcc1c09 100644 --- a/grub2-emu-4-all.patch +++ b/grub2-emu-4-all.patch @@ -5,12 +5,12 @@ grub-core/osdep/unix/emuconsole.c | 5 +++-- 4 files changed, 14 insertions(+), 16 deletions(-) -Index: grub-2.02~rc1/Makefile.util.def +Index: grub-2.04~rc1/Makefile.util.def =================================================================== ---- grub-2.02~rc1.orig/Makefile.util.def -+++ grub-2.02~rc1/Makefile.util.def -@@ -352,7 +352,7 @@ program = { - ldadd = grub-core/gnulib/libgnu.a; +--- grub-2.04~rc1.orig/Makefile.util.def ++++ grub-2.04~rc1/Makefile.util.def +@@ -362,7 +362,7 @@ program = { + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; cppflags = '-DGRUB_SETUP_FUNC=grub_util_bios_setup'; - emu_condition = COND_NOT_s390x; @@ -18,8 +18,8 @@ Index: grub-2.02~rc1/Makefile.util.def }; program = { -@@ -373,7 +373,7 @@ program = { - ldadd = grub-core/gnulib/libgnu.a; +@@ -383,7 +383,7 @@ program = { + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; cppflags = '-DGRUB_SETUP_FUNC=grub_util_sparc_setup'; - emu_condition = COND_NOT_s390x; @@ -27,38 +27,38 @@ Index: grub-2.02~rc1/Makefile.util.def }; program = { -@@ -389,7 +389,7 @@ program = { +@@ -399,7 +399,7 @@ program = { ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - emu_condition = COND_NOT_s390x; + emu_condition = COND_NOT_emu; }; program = { -@@ -420,7 +420,7 @@ program = { +@@ -430,7 +430,7 @@ program = { ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - emu_condition = COND_NOT_s390x; + emu_condition = COND_NOT_emu; }; data = { -@@ -1345,7 +1345,7 @@ program = { +@@ -1361,7 +1361,7 @@ program = { ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - emu_condition = COND_NOT_s390x; + emu_condition = COND_NOT_emu; }; program = { -Index: grub-2.02~rc1/grub-core/Makefile.core.def +Index: grub-2.04~rc1/grub-core/Makefile.core.def =================================================================== ---- grub-2.02~rc1.orig/grub-core/Makefile.core.def -+++ grub-2.02~rc1/grub-core/Makefile.core.def -@@ -1057,7 +1057,7 @@ module = { +--- grub-2.04~rc1.orig/grub-core/Makefile.core.def ++++ grub-2.04~rc1/grub-core/Makefile.core.def +@@ -1139,7 +1139,7 @@ module = { module = { name = videotest; common = commands/videotest.c; @@ -67,7 +67,7 @@ Index: grub-2.02~rc1/grub-core/Makefile.core.def }; module = { -@@ -1470,7 +1470,7 @@ module = { +@@ -1572,7 +1572,7 @@ module = { common = gfxmenu/gui_progress_bar.c; common = gfxmenu/gui_util.c; common = gfxmenu/gui_string_util.c; @@ -76,7 +76,7 @@ Index: grub-2.02~rc1/grub-core/Makefile.core.def }; module = { -@@ -1886,13 +1886,13 @@ module = { +@@ -2008,13 +2008,13 @@ module = { name = gfxterm; common = term/gfxterm.c; enable = videomodules; @@ -92,8 +92,8 @@ Index: grub-2.02~rc1/grub-core/Makefile.core.def }; module = { -@@ -2005,9 +2005,7 @@ module = { - enable = i386_pc; +@@ -2133,9 +2133,7 @@ module = { + enable = i386_xen_pvh; enable = i386_efi; enable = x86_64_efi; - enable = emu; @@ -102,7 +102,7 @@ Index: grub-2.02~rc1/grub-core/Makefile.core.def }; module = { -@@ -2054,7 +2052,7 @@ module = { +@@ -2182,7 +2180,7 @@ module = { module = { name = gfxterm_menu; common = tests/gfxterm_menu.c; @@ -111,8 +111,8 @@ Index: grub-2.02~rc1/grub-core/Makefile.core.def }; module = { -@@ -2205,9 +2203,7 @@ module = { - enable = i386_pc; +@@ -2334,9 +2332,7 @@ module = { + enable = i386_xen_pvh; enable = i386_efi; enable = x86_64_efi; - enable = emu; @@ -121,11 +121,11 @@ Index: grub-2.02~rc1/grub-core/Makefile.core.def }; module = { -Index: grub-2.02~rc1/configure.ac +Index: grub-2.04~rc1/configure.ac =================================================================== ---- grub-2.02~rc1.orig/configure.ac -+++ grub-2.02~rc1/configure.ac -@@ -1884,6 +1884,7 @@ AC_SUBST(BUILD_LIBM) +--- grub-2.04~rc1.orig/configure.ac ++++ grub-2.04~rc1/configure.ac +@@ -1911,6 +1911,7 @@ AC_SUBST(BUILD_LIBM) AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone]) AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) @@ -133,10 +133,10 @@ Index: grub-2.02~rc1/configure.ac AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi]) -Index: grub-2.02~rc1/grub-core/osdep/unix/emuconsole.c +Index: grub-2.04~rc1/grub-core/osdep/unix/emuconsole.c =================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/unix/emuconsole.c -+++ grub-2.02~rc1/grub-core/osdep/unix/emuconsole.c +--- grub-2.04~rc1.orig/grub-core/osdep/unix/emuconsole.c ++++ grub-2.04~rc1/grub-core/osdep/unix/emuconsole.c @@ -50,13 +50,12 @@ static struct termios new_tty; static int console_mode = 0; diff --git a/grub2-fix-build-with-flex-2.6.4.patch b/grub2-fix-build-with-flex-2.6.4.patch deleted file mode 100644 index d7c2d55..0000000 --- a/grub2-fix-build-with-flex-2.6.4.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Andrei Borzenkov - -Fix build with flex 2.6.4+. It no more casts fprintf() call to void, resulting in - -[ 108s] grub_script.yy.c: In function 'yy_fatal_error': -[ 108s] grub_script.yy.c:18:22: error: statement with no effect [-Werror=unused-value] -[ 108s] - -as grub2 defines fprintf as 0. Change it to explicitly define fprintf as (void)0. - -flex commit: https://github.com/westes/flex/commit/a58086a269d3d7367530c1a178644a8e5f1a374f -Index: grub-2.02/grub-core/script/yylex.l -=================================================================== ---- grub-2.02.orig/grub-core/script/yylex.l -+++ grub-2.02/grub-core/script/yylex.l -@@ -91,7 +91,7 @@ typedef size_t yy_size_t; - #define stdin 0 - #define stdout 0 - --#define fprintf(...) 0 -+#define fprintf(...) (void)0 - #define exit(...) grub_fatal("fatal error in lexer") - #endif - diff --git a/grub2-fix-locale-en.mo.gz-not-found-error-message.patch b/grub2-fix-locale-en.mo.gz-not-found-error-message.patch deleted file mode 100644 index df09541..0000000 --- a/grub2-fix-locale-en.mo.gz-not-found-error-message.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e7500166b343874447e6abf385a791998c77f4c4 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Wed, 26 Sep 2012 15:55:44 +0800 -Subject: [PATCH] Silence error messages when translations are unavailable - -From: Colin Watson - -References: bnc#771393 - https://savannah.gnu.org/bugs/?35880 -Patch-Mainline: no - -Signed-off-by: Michael Chang ---- - grub-core/gettext/gettext.c | 8 ++++++++ - 1 files changed, 8 insertions(+), 0 deletions(-) - -Index: grub-2.00/grub-core/gettext/gettext.c -=================================================================== ---- grub-2.00.orig/grub-core/gettext/gettext.c -+++ grub-2.00/grub-core/gettext/gettext.c -@@ -424,9 +424,13 @@ grub_gettext_init_ext (struct grub_gette - grub_free (lang); - } - -- if (locale[0] == 'e' && locale[1] == 'n' -- && (locale[2] == '\0' || locale[2] == '_')) -- grub_errno = err = GRUB_ERR_NONE; -+ /* If no translations are available, fall back to untranslated text. */ -+ if (err == GRUB_ERR_FILE_NOT_FOUND) -+ { -+ grub_errno = GRUB_ERR_NONE; -+ return 0; -+ } -+ - return err; - } - diff --git a/grub2-freetype-pkgconfig.patch b/grub2-freetype-pkgconfig.patch deleted file mode 100644 index 068792a..0000000 --- a/grub2-freetype-pkgconfig.patch +++ /dev/null @@ -1,165 +0,0 @@ -Index: grub-2.02/configure.ac -=================================================================== ---- grub-2.02.orig/configure.ac -+++ grub-2.02/configure.ac -@@ -50,6 +50,10 @@ AC_PREREQ(2.60) - AC_CONFIG_SRCDIR([include/grub/dl.h]) - AC_CONFIG_HEADER([config-util.h]) - -+# Explicitly check for pkg-config early on, since otherwise conditional -+# calls are problematic. -+PKG_PROG_PKG_CONFIG -+ - # Program name transformations - AC_ARG_PROGRAM - grub_TRANSFORM([grub-bios-setup]) -@@ -1493,29 +1497,21 @@ if test x"$enable_grub_mkfont" = xno ; t - grub_mkfont_excuse="explicitly disabled" - fi - --if test x"$grub_mkfont_excuse" = x ; then -- # Check for freetype libraries. -- AC_CHECK_TOOLS([FREETYPE], [freetype-config]) -- if test "x$FREETYPE" = x ; then -- grub_mkfont_excuse=["need freetype2 library"] -- fi --fi -- - unset ac_cv_header_ft2build_h - - if test x"$grub_mkfont_excuse" = x ; then -- # Check for freetype libraries. -- freetype_cflags=`$FREETYPE --cflags` -- freetype_libs=`$FREETYPE --libs` -- SAVED_CPPFLAGS="$CPPFLAGS" -- SAVED_LIBS="$LIBS" -- CPPFLAGS="$CPPFLAGS $freetype_cflags" -- LIBS="$LIBS $freetype_libs" -- AC_CHECK_HEADERS([ft2build.h], [], -- [grub_mkfont_excuse=["need freetype2 headers"]]) -- AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]]) -- CPPFLAGS="$SAVED_CPPFLAGS" -- LIBS="$SAVED_LIBS" -+ PKG_CHECK_MODULES([FREETYPE], [freetype2], [ -+ SAVED_CPPFLAGS="$CPPFLAGS" -+ SAVED_LIBS="$LIBS" -+ CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS" -+ LIBS="$LIBS $FREETYPE_LIBS" -+ AC_CHECK_HEADERS([ft2build.h], [], -+ [grub_mkfont_excuse=["need freetype2 headers"]]) -+ AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], -+ [grub_mkfont_excuse=["freetype2 library unusable"]]) -+ CPPFLAGS="$SAVED_CPPFLAGS" -+ LIBS="$SAVED_LIBS" -+ ], [grub_mkfont_excuse=["need freetype2 library"]]) - fi - - if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then -@@ -1527,8 +1523,6 @@ else - enable_grub_mkfont=no - fi - AC_SUBST([enable_grub_mkfont]) --AC_SUBST([freetype_cflags]) --AC_SUBST([freetype_libs]) - - SAVED_CC="$CC" - SAVED_CPP="$CPP" -@@ -1558,25 +1552,21 @@ AC_SUBST([BUILD_WORDS_BIGENDIAN]) - - if test x"$grub_build_mkfont_excuse" = x ; then - # Check for freetype libraries. -- AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config]) -- if test "x$BUILD_FREETYPE" = x ; then -- grub_build_mkfont_excuse=["need freetype2 library"] -- fi --fi -- --if test x"$grub_build_mkfont_excuse" = x ; then -- # Check for freetype libraries. -- build_freetype_cflags=`$BUILD_FREETYPE --cflags` -- build_freetype_libs=`$BUILD_FREETYPE --libs` -- SAVED_CPPFLAGS_2="$CPPFLAGS" -- SAVED_LIBS="$LIBS" -- CPPFLAGS="$CPPFLAGS $build_freetype_cflags" -- LIBS="$LIBS $build_freetype_libs" -- AC_CHECK_HEADERS([ft2build.h], [], -- [grub_build_mkfont_excuse=["need freetype2 headers"]]) -- AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]]) -- LIBS="$SAVED_LIBS" -- CPPFLAGS="$SAVED_CPPFLAGS_2" -+ SAVED_PKG_CONFIG="$PKG_CONFIG" -+ test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG" -+ PKG_CHECK_MODULES([BUILD_FREETYPE], [freetype2], [ -+ SAVED_CPPFLAGS_2="$CPPFLAGS" -+ SAVED_LIBS="$LIBS" -+ CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS" -+ LIBS="$LIBS $BUILD_FREETYPE_LIBS" -+ AC_CHECK_HEADERS([ft2build.h], [], -+ [grub_build_mkfont_excuse=["need freetype2 headers"]]) -+ AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], -+ [grub_build_mkfont_excuse=["freetype2 library unusable"]]) -+ LIBS="$SAVED_LIBS" -+ CPPFLAGS="$SAVED_CPPFLAGS_2" -+ ], [grub_build_mkfont_excuse=["need freetype2 library"]]) -+ PKG_CONFIG="$SAVED_PKG_CONFIG" - fi - - if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then -@@ -1595,9 +1585,6 @@ if test x"$enable_build_grub_mkfont" = x - fi - fi - --AC_SUBST([build_freetype_cflags]) --AC_SUBST([build_freetype_libs]) -- - CC="$SAVED_CC" - CPP="$SAVED_CPP" - CFLAGS="$SAVED_CFLAGS" -Index: grub-2.02/Makefile.am -=================================================================== ---- grub-2.02.orig/Makefile.am -+++ grub-2.02/Makefile.am -@@ -71,7 +71,7 @@ endif - starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0 - - build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) - CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT) - - garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c -@@ -80,11 +80,11 @@ CLEANFILES += garbage-gen$(BUILD_EXEEXT) - EXTRA_DIST += util/garbage-gen.c - - build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror - CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT) - - build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c -- $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror -+ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror - CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT) - - if COND_STARFIELD -Index: grub-2.02/Makefile.util.def -=================================================================== ---- grub-2.02.orig/Makefile.util.def -+++ grub-2.02/Makefile.util.def -@@ -302,14 +302,14 @@ program = { - common = grub-core/kern/emu/argp_common.c; - common = grub-core/osdep/init.c; - -- cflags = '$(freetype_cflags)'; -+ cflags = '$(FREETYPE_CFLAGS)'; - cppflags = '-DGRUB_MKFONT=1'; - - ldadd = libgrubmods.a; - ldadd = libgrubgcry.a; - ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; -- ldadd = '$(freetype_libs)'; -+ ldadd = '$(FREETYPE_LIBS)'; - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - condition = COND_GRUB_MKFONT; - }; diff --git a/grub2-linux.patch b/grub2-linux.patch index 6463296..446b82b 100644 --- a/grub2-linux.patch +++ b/grub2-linux.patch @@ -1,7 +1,7 @@ -Index: grub-2.02~beta2/util/grub.d/10_linux.in +Index: grub-2.04rc1/util/grub.d/10_linux.in =================================================================== ---- grub-2.02~beta2.orig/util/grub.d/10_linux.in -+++ grub-2.02~beta2/util/grub.d/10_linux.in +--- grub-2.04rc1.orig/util/grub.d/10_linux.in ++++ grub-2.04rc1/util/grub.d/10_linux.in @@ -31,7 +31,7 @@ CLASS="--class gnu-linux --class gnu --c if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS=GNU/Linux @@ -11,7 +11,7 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" fi -@@ -129,7 +129,7 @@ linux_entry () +@@ -141,7 +141,7 @@ linux_entry () message="$(gettext_printf "Loading Linux %s ..." ${version})" sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' @@ -20,10 +20,10 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in EOF if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. -Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in +Index: grub-2.04rc1/util/grub.d/20_linux_xen.in =================================================================== ---- grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in -+++ grub-2.02~beta2/util/grub.d/20_linux_xen.in +--- grub-2.04rc1.orig/util/grub.d/20_linux_xen.in ++++ grub-2.04rc1/util/grub.d/20_linux_xen.in @@ -31,7 +31,7 @@ CLASS="--class gnu-linux --class gnu --c if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS=GNU/Linux @@ -33,12 +33,12 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" fi -@@ -122,7 +122,7 @@ linux_entry () +@@ -134,7 +134,7 @@ linux_entry () fi - multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} + ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' -- module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -+ module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ${args} +- ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} ++ ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ${args} EOF if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. diff --git a/grub2-move-initrd-upper.patch b/grub2-move-initrd-upper.patch deleted file mode 100644 index 36f4ce9..0000000 --- a/grub2-move-initrd-upper.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -pruN grub-2.02.orig/grub-core/loader/arm/linux.c grub-2.02/grub-core/loader/arm/linux.c ---- grub-2.02.orig/grub-core/loader/arm/linux.c 2016-02-22 20:04:35.000000000 +0100 -+++ grub-2.02/grub-core/loader/arm/linux.c 2019-01-28 15:08:48.814415179 +0100 -@@ -50,7 +50,7 @@ typedef void (*kernel_entry_t) (int, uns - #define LINUX_ZIMAGE_MAGIC 0x016f2818 - - #define LINUX_PHYS_OFFSET (0x00008000) --#define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000) -+#define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x03000000) - #define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) - - static grub_size_t -diff -pruN grub-2.02.orig/include/grub/arm/linux.h grub-2.02/include/grub/arm/linux.h ---- grub-2.02.orig/include/grub/arm/linux.h 2017-04-24 11:15:49.000000000 +0200 -+++ grub-2.02/include/grub/arm/linux.h 2019-01-28 15:08:31.122275854 +0100 -@@ -28,7 +28,7 @@ - #if defined GRUB_MACHINE_UBOOT - # include - # define LINUX_ADDRESS (start_of_ram + 0x8000) --# define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000) -+# define LINUX_INITRD_ADDRESS (start_of_ram + 0x03000000) - # define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000) - # define grub_arm_firmware_get_boot_data grub_uboot_get_boot_data - # define grub_arm_firmware_get_machine_type grub_uboot_get_machine_type -@@ -38,7 +38,7 @@ - /* On UEFI platforms - load the images at the lowest available address not - less than *_PHYS_OFFSET from the first available memory location. */ - # define LINUX_PHYS_OFFSET (0x00008000) --# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000) -+# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x03000000) - # define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000) - # define grub_arm_firmware_get_boot_data (grub_addr_t)grub_efi_get_firmware_fdt - static inline grub_uint32_t diff --git a/grub2-msdos-fix-overflow.patch b/grub2-msdos-fix-overflow.patch deleted file mode 100644 index 886150f..0000000 --- a/grub2-msdos-fix-overflow.patch +++ /dev/null @@ -1,46 +0,0 @@ -Index: grub-2.02/grub-core/partmap/msdos.c -=================================================================== ---- grub-2.02.orig/grub-core/partmap/msdos.c -+++ grub-2.02/grub-core/partmap/msdos.c -@@ -175,9 +175,9 @@ grub_partition_msdos_iterate (grub_disk_ - e = mbr.entries + p.index; - - p.start = p.offset -- + (grub_le_to_cpu32 (e->start) -+ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) - << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) - delta; -- p.len = grub_le_to_cpu32 (e->length) -+ p.len = (grub_uint64_t)grub_le_to_cpu32 (e->length) - << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); - p.msdostype = e->type; - -@@ -217,7 +217,7 @@ grub_partition_msdos_iterate (grub_disk_ - if (grub_msdos_partition_is_extended (e->type)) - { - p.offset = ext_offset -- + (grub_le_to_cpu32 (e->start) -+ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) - << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); - if (! ext_offset) - ext_offset = p.offset; -@@ -301,9 +301,9 @@ pc_partition_map_embed (struct grub_disk - - if (!grub_msdos_partition_is_empty (e->type) - && end > offset -- + (grub_le_to_cpu32 (e->start) -+ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) - << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS))) -- end = offset + (grub_le_to_cpu32 (e->start) -+ end = offset + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) - << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); - - /* If this is a GPT partition, this MBR is just a dummy. */ -@@ -319,7 +319,7 @@ pc_partition_map_embed (struct grub_disk - if (grub_msdos_partition_is_extended (e->type)) - { - offset = ext_offset -- + (grub_le_to_cpu32 (e->start) -+ + ((grub_disk_addr_t)grub_le_to_cpu32 (e->start) - << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)); - if (! ext_offset) - ext_offset = offset; diff --git a/grub2-pass-corret-root-for-nfsroot.patch b/grub2-pass-corret-root-for-nfsroot.patch index fd893c6..372a3fb 100644 --- a/grub2-pass-corret-root-for-nfsroot.patch +++ b/grub2-pass-corret-root-for-nfsroot.patch @@ -18,17 +18,18 @@ v2: Filter out autofs and securityfs from /proc/self/mountinfo (bsc#1069094) util/grub-mkconfig.in | 37 ++++++++++++++++++++++++++++++------- 1 files changed, 30 insertions(+), 7 deletions(-) -Index: grub-2.02/util/grub-mkconfig.in +Index: grub-2.04~rc1/util/grub-mkconfig.in =================================================================== ---- grub-2.02.orig/util/grub-mkconfig.in -+++ grub-2.02/util/grub-mkconfig.in -@@ -131,22 +131,47 @@ else +--- grub-2.04~rc1.orig/util/grub-mkconfig.in ++++ grub-2.04~rc1/util/grub-mkconfig.in +@@ -131,23 +131,51 @@ else exit 1 fi -# Device containing our userland. Typically used for root= parameter. -GRUB_DEVICE="`${grub_probe} --target=device /`" -GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true +-GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true +probe_nfsroot_device () { + while read line ; do + part1=`echo $line | sed -e 's! - .*$!!'` @@ -54,23 +55,24 @@ Index: grub-2.02/util/grub-mkconfig.in + +NFSROOT_DEVICE="`awk '($9!="autofs")&&($9!="securityfs")' /proc/self/mountinfo | probe_nfsroot_device`" --# Filesystem for the device containing our userland. Used for stuff like --# choosing Hurd filesystem module. --GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`" + # Filesystem for the device containing our userland. Used for stuff like + # choosing Hurd filesystem module. + GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`" +if [ "x${NFSROOT_DEVICE}" != "x" ]; then + GRUB_DEVICE="" + GRUB_DEVICE_UUID="" ++ GRUB_DEVICE_PARTUUID="" + GRUB_FS="unknown" +else + # Device containing our userland. Typically used for root= parameter. + GRUB_DEVICE="`${grub_probe} --target=device /`" + GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true ++ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true -if [ x"$GRUB_FS" = xunknown ]; then -- GRUB_FS="$(stat -f --printf=%T / || echo unknown)" -+ +- GRUB_FS="$(stat -f -c %T / || echo unknown)" + if [ x"$GRUB_FS" = x ] || [ x"$GRUB_FS" = xunknown ]; then -+ GRUB_FS="$(stat -f --printf=%T / || echo unknown)" ++ GRUB_FS="$(stat -f -c %T / || echo unknown)" + fi fi @@ -78,14 +80,14 @@ Index: grub-2.02/util/grub-mkconfig.in +GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`" +GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true + - if test -f ${sysconfdir}/default/grub ; then - . ${sysconfdir}/default/grub - fi -Index: grub-2.02/util/grub.d/10_linux.in + # Provide a default set of stock linux early initrd images. + # Define here so the list can be modified in the sourced config file. + if [ "x${GRUB_EARLY_INITRD_LINUX_STOCK}" = "x" ]; then +Index: grub-2.04~rc1/util/grub.d/10_linux.in =================================================================== ---- grub-2.02.orig/util/grub.d/10_linux.in -+++ grub-2.02/util/grub.d/10_linux.in -@@ -76,6 +76,12 @@ linux_entry () +--- grub-2.04~rc1.orig/util/grub.d/10_linux.in ++++ grub-2.04~rc1/util/grub.d/10_linux.in +@@ -86,6 +86,12 @@ linux_entry () type="$3" args="$4" @@ -98,7 +100,7 @@ Index: grub-2.02/util/grub.d/10_linux.in if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi -@@ -131,7 +137,7 @@ linux_entry () +@@ -141,7 +147,7 @@ linux_entry () message="$(gettext_printf "Loading Linux %s ..." ${version})" sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' @@ -107,11 +109,11 @@ Index: grub-2.02/util/grub.d/10_linux.in EOF if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. -Index: grub-2.02/util/grub.d/20_linux_xen.in +Index: grub-2.04~rc1/util/grub.d/20_linux_xen.in =================================================================== ---- grub-2.02.orig/util/grub.d/20_linux_xen.in -+++ grub-2.02/util/grub.d/20_linux_xen.in -@@ -91,6 +91,11 @@ linux_entry () +--- grub-2.04~rc1.orig/util/grub.d/20_linux_xen.in ++++ grub-2.04~rc1/util/grub.d/20_linux_xen.in +@@ -101,6 +101,11 @@ linux_entry () type="$4" args="$5" xen_args="$6" @@ -123,12 +125,12 @@ Index: grub-2.02/util/grub.d/20_linux_xen.in if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi -@@ -130,7 +135,7 @@ linux_entry () +@@ -140,7 +145,7 @@ linux_entry () fi - multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} + ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' -- module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ${args} -+ module ${rel_dirname}/${basename} placeholder ${root_device} ${args} +- ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ${args} ++ ${module_loader} ${rel_dirname}/${basename} placeholder ${root_device} ${args} EOF if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. diff --git a/grub2-ppc64-cas-fix-double-free.patch b/grub2-ppc64-cas-fix-double-free.patch index b086a81..5f8146b 100644 --- a/grub2-ppc64-cas-fix-double-free.patch +++ b/grub2-ppc64-cas-fix-double-free.patch @@ -1,8 +1,8 @@ -Index: grub-2.02/grub-core/kern/ieee1275/openfw.c +Index: grub-2.04~rc1/grub-core/kern/ieee1275/openfw.c =================================================================== ---- grub-2.02.orig/grub-core/kern/ieee1275/openfw.c -+++ grub-2.02/grub-core/kern/ieee1275/openfw.c -@@ -592,7 +592,7 @@ grub_ieee1275_canonicalise_devname (cons +--- grub-2.04~rc1.orig/grub-core/kern/ieee1275/openfw.c ++++ grub-2.04~rc1/grub-core/kern/ieee1275/openfw.c +@@ -595,7 +595,7 @@ grub_ieee1275_canonicalise_devname (cons /* Check if it's a CAS reboot. If so, set the script to be executed. */ int @@ -11,7 +11,7 @@ Index: grub-2.02/grub-core/kern/ieee1275/openfw.c { grub_uint32_t ibm_ca_support_reboot; grub_uint32_t ibm_fw_nbr_reboots; -@@ -625,16 +625,37 @@ grub_ieee1275_cas_reboot (char *script) +@@ -628,16 +628,37 @@ grub_ieee1275_cas_reboot (char *script) if (ibm_ca_support_reboot || ibm_fw_nbr_reboots) { @@ -57,7 +57,7 @@ Index: grub-2.02/grub-core/kern/ieee1275/openfw.c grub_ieee1275_set_boot_last_label (""); return -1; -@@ -648,7 +669,8 @@ int grub_ieee1275_set_boot_last_label (c +@@ -651,8 +672,9 @@ int grub_ieee1275_set_boot_last_label (c grub_dprintf("ieee1275", "set boot_last_label (size: %" PRIxGRUB_SIZE ")\n", grub_strlen(text)); if (! grub_ieee1275_finddevice ("/options", &options) && options != (grub_ieee1275_ihandle_t) -1) @@ -67,10 +67,11 @@ Index: grub-2.02/grub-core/kern/ieee1275/openfw.c + grub_strlen (text) + 1, &actual); return 0; } -Index: grub-2.02/grub-core/normal/main.c + +Index: grub-2.04~rc1/grub-core/normal/main.c =================================================================== ---- grub-2.02.orig/grub-core/normal/main.c -+++ grub-2.02/grub-core/normal/main.c +--- grub-2.04~rc1.orig/grub-core/normal/main.c ++++ grub-2.04~rc1/grub-core/normal/main.c @@ -281,10 +281,9 @@ grub_normal_execute (const char *config, #ifdef GRUB_MACHINE_IEEE1275 int boot; @@ -84,11 +85,11 @@ Index: grub-2.02/grub-core/normal/main.c { if (! grub_script_execute_new_scope (script, 0, dummy)) boot = 1; -Index: grub-2.02/include/grub/ieee1275/ieee1275.h +Index: grub-2.04~rc1/include/grub/ieee1275/ieee1275.h =================================================================== ---- grub-2.02.orig/include/grub/ieee1275/ieee1275.h -+++ grub-2.02/include/grub/ieee1275/ieee1275.h -@@ -243,7 +243,7 @@ int EXPORT_FUNC(grub_ieee1275_devalias_n +--- grub-2.04~rc1.orig/include/grub/ieee1275/ieee1275.h ++++ grub-2.04~rc1/include/grub/ieee1275/ieee1275.h +@@ -263,7 +263,7 @@ int EXPORT_FUNC(grub_ieee1275_devalias_n void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias); void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, struct grub_ieee1275_devalias *alias); @@ -96,4 +97,4 @@ Index: grub-2.02/include/grub/ieee1275/ieee1275.h +int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char **script); int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text); - #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));) + char *EXPORT_FUNC(grub_ieee1275_get_boot_dev) (void); diff --git a/grub2-ppc64-cas-reboot-support.patch b/grub2-ppc64-cas-reboot-support.patch index 422dd2a..40063f0 100644 --- a/grub2-ppc64-cas-reboot-support.patch +++ b/grub2-ppc64-cas-reboot-support.patch @@ -24,11 +24,11 @@ parameters include/grub/ieee1275/ieee1275.h | 2 ++ 4 files changed, 90 insertions(+) -Index: grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c +Index: grub-2.04~rc1/grub-core/kern/ieee1275/openfw.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/ieee1275/openfw.c 2016-01-29 23:08:47.560532720 +0300 -+++ grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c 2016-01-29 23:08:47.556532720 +0300 -@@ -590,3 +590,65 @@ +--- grub-2.04~rc1.orig/grub-core/kern/ieee1275/openfw.c ++++ grub-2.04~rc1/grub-core/kern/ieee1275/openfw.c +@@ -593,6 +593,69 @@ grub_ieee1275_canonicalise_devname (cons return NULL; } @@ -94,10 +94,14 @@ Index: grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c + grub_strlen (text), &actual); + return 0; +} -Index: grub-2.02~beta2/grub-core/normal/main.c ++ + char * + grub_ieee1275_get_boot_dev (void) + { +Index: grub-2.04~rc1/grub-core/normal/main.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/normal/main.c 2016-01-29 23:08:47.560532720 +0300 -+++ grub-2.02~beta2/grub-core/normal/main.c 2016-01-29 23:09:59.812533575 +0300 +--- grub-2.04~rc1.orig/grub-core/normal/main.c ++++ grub-2.04~rc1/grub-core/normal/main.c @@ -33,6 +33,9 @@ #include #include @@ -108,7 +112,7 @@ Index: grub-2.02~beta2/grub-core/normal/main.c GRUB_MOD_LICENSE ("GPLv3+"); -@@ -275,6 +278,21 @@ +@@ -275,6 +278,21 @@ grub_normal_execute (const char *config, { menu = read_config_file (config); @@ -130,21 +134,21 @@ Index: grub-2.02~beta2/grub-core/normal/main.c /* Ignore any error. */ grub_errno = GRUB_ERR_NONE; } -Index: grub-2.02~beta2/grub-core/script/execute.c +Index: grub-2.04~rc1/grub-core/script/execute.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/script/execute.c 2016-01-29 23:08:47.560532720 +0300 -+++ grub-2.02~beta2/grub-core/script/execute.c 2016-01-29 23:08:47.560532720 +0300 -@@ -27,6 +27,9 @@ - #include +--- grub-2.04~rc1.orig/grub-core/script/execute.c ++++ grub-2.04~rc1/grub-core/script/execute.c +@@ -28,6 +28,9 @@ #include #include + #include +#ifdef GRUB_MACHINE_IEEE1275 +#include +#endif /* Max digits for a char is 3 (0xFF is 255), similarly for an int it is sizeof (int) * 3, and one extra for a possible -ve sign. */ -@@ -877,6 +880,10 @@ +@@ -878,6 +881,10 @@ grub_script_execute_sourcecode (const ch grub_err_t ret = 0; struct grub_script *parsed_script; @@ -155,16 +159,16 @@ Index: grub-2.02~beta2/grub-core/script/execute.c while (source) { char *line; -Index: grub-2.02~beta2/include/grub/ieee1275/ieee1275.h +Index: grub-2.04~rc1/include/grub/ieee1275/ieee1275.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/ieee1275/ieee1275.h 2016-01-29 23:08:47.560532720 +0300 -+++ grub-2.02~beta2/include/grub/ieee1275/ieee1275.h 2016-01-29 23:08:47.560532720 +0300 -@@ -242,6 +242,8 @@ +--- grub-2.04~rc1.orig/include/grub/ieee1275/ieee1275.h ++++ grub-2.04~rc1/include/grub/ieee1275/ieee1275.h +@@ -263,6 +263,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_n void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias); void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, struct grub_ieee1275_devalias *alias); +int EXPORT_FUNC(grub_ieee1275_cas_reboot) (char *script); +int EXPORT_FUNC(grub_ieee1275_set_boot_last_label) (const char *text); - #define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));) + char *EXPORT_FUNC(grub_ieee1275_get_boot_dev) (void); diff --git a/grub2-ppc64le-disable-video.patch b/grub2-ppc64le-disable-video.patch index 24ddbcb..2380032 100644 --- a/grub2-ppc64le-disable-video.patch +++ b/grub2-ppc64le-disable-video.patch @@ -1,7 +1,7 @@ -Index: grub-2.02~beta2/grub-core/kern/ieee1275/cmain.c +Index: grub-2.04~rc1/grub-core/kern/ieee1275/cmain.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/ieee1275/cmain.c -+++ grub-2.02~beta2/grub-core/kern/ieee1275/cmain.c +--- grub-2.04~rc1.orig/grub-core/kern/ieee1275/cmain.c ++++ grub-2.04~rc1/grub-core/kern/ieee1275/cmain.c @@ -90,7 +90,10 @@ grub_ieee1275_find_options (void) } @@ -14,11 +14,11 @@ Index: grub-2.02~beta2/grub-core/kern/ieee1275/cmain.c /* Old Macs have no key repeat, newer ones have fully working one. The ones inbetween when repeated key generates an escaoe sequence -Index: grub-2.02~beta2/grub-core/video/ieee1275.c +Index: grub-2.04~rc1/grub-core/video/ieee1275.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/video/ieee1275.c -+++ grub-2.02~beta2/grub-core/video/ieee1275.c -@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_vi +--- grub-2.04~rc1.orig/grub-core/video/ieee1275.c ++++ grub-2.04~rc1/grub-core/video/ieee1275.c +@@ -352,9 +352,12 @@ static struct grub_video_adapter grub_vi GRUB_MOD_INIT(ieee1275_fb) { @@ -34,14 +34,14 @@ Index: grub-2.02~beta2/grub-core/video/ieee1275.c } GRUB_MOD_FINI(ieee1275_fb) -Index: grub-2.02~beta2/include/grub/ieee1275/ieee1275.h +Index: grub-2.04~rc1/include/grub/ieee1275/ieee1275.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/ieee1275/ieee1275.h -+++ grub-2.02~beta2/include/grub/ieee1275/ieee1275.h -@@ -145,6 +145,8 @@ enum grub_ieee1275_flag - GRUB_IEEE1275_FLAG_BROKEN_REPEAT, - +--- grub-2.04~rc1.orig/include/grub/ieee1275/ieee1275.h ++++ grub-2.04~rc1/include/grub/ieee1275/ieee1275.h +@@ -148,6 +148,8 @@ enum grub_ieee1275_flag GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN, + + GRUB_IEEE1275_FLAG_RAW_DEVNAMES, + + GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT }; diff --git a/grub2-ppc64le-memory-map.patch b/grub2-ppc64le-memory-map.patch index 5642585..44ac4a7 100644 --- a/grub2-ppc64le-memory-map.patch +++ b/grub2-ppc64le-memory-map.patch @@ -1,7 +1,7 @@ -Index: grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c +Index: grub-2.04~rc1/grub-core/kern/ieee1275/openfw.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/ieee1275/openfw.c -+++ grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c +--- grub-2.04~rc1.orig/grub-core/kern/ieee1275/openfw.c ++++ grub-2.04~rc1/grub-core/kern/ieee1275/openfw.c @@ -302,6 +302,34 @@ grub_ieee1275_map (grub_addr_t phys, gru return args.catch_result; } @@ -45,10 +45,10 @@ Index: grub-2.02~beta2/grub-core/kern/ieee1275/openfw.c return GRUB_ERR_NONE; } -Index: grub-2.02~beta2/include/grub/ieee1275/ieee1275.h +Index: grub-2.04~rc1/include/grub/ieee1275/ieee1275.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/ieee1275/ieee1275.h -+++ grub-2.02~beta2/include/grub/ieee1275/ieee1275.h +--- grub-2.04~rc1.orig/include/grub/ieee1275/ieee1275.h ++++ grub-2.04~rc1/include/grub/ieee1275/ieee1275.h @@ -30,6 +30,12 @@ struct grub_ieee1275_mem_region unsigned int size; }; @@ -62,19 +62,19 @@ Index: grub-2.02~beta2/include/grub/ieee1275/ieee1275.h #define IEEE1275_MAX_PROP_LEN 8192 #define IEEE1275_MAX_PATH_LEN 256 -@@ -214,6 +220,7 @@ int EXPORT_FUNC(grub_ieee1275_millisecon - +@@ -235,6 +241,7 @@ char *EXPORT_FUNC(grub_ieee1275_encode_u + int EXPORT_FUNC(grub_ieee1275_get_block_size) (grub_ieee1275_ihandle_t ihandle); grub_err_t EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size); +void EXPORT_FUNC(grub_releasemap) (void); int EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt, -Index: grub-2.02~beta2/grub-core/kern/ieee1275/init.c +Index: grub-2.04~rc1/grub-core/kern/ieee1275/init.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/ieee1275/init.c -+++ grub-2.02~beta2/grub-core/kern/ieee1275/init.c -@@ -62,6 +62,7 @@ grub_addr_t grub_ieee1275_original_stack +--- grub-2.04~rc1.orig/grub-core/kern/ieee1275/init.c ++++ grub-2.04~rc1/grub-core/kern/ieee1275/init.c +@@ -73,6 +73,7 @@ grub_addr_t grub_ieee1275_original_stack void grub_exit (void) { diff --git a/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch b/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch index 9c2ebe2..e110910 100644 --- a/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch +++ b/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch @@ -21,41 +21,41 @@ Subject: [PATCH 1/3] - Changes made and files added in order to allow s390x create mode 100644 include/grub/s390x/time.h create mode 100644 include/grub/s390x/types.h -Index: grub-2.02~beta2/grub-core/kern/emu/cache_s.S +Index: grub-2.04~rc1/grub-core/kern/emu/cache_s.S =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/emu/cache_s.S -+++ grub-2.02~beta2/grub-core/kern/emu/cache_s.S -@@ -9,6 +9,7 @@ - #elif defined(__powerpc__) +--- grub-2.04~rc1.orig/grub-core/kern/emu/cache_s.S ++++ grub-2.04~rc1/grub-core/kern/emu/cache_s.S +@@ -10,6 +10,7 @@ #include "../powerpc/cache.S" - #elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__) + #elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \ + defined(__mips__) || defined(__riscv) +#elif defined(__s390x__) #else #error "No target cpu type is defined" #endif -Index: grub-2.02~beta2/grub-core/kern/emu/lite.c +Index: grub-2.04~rc1/grub-core/kern/emu/lite.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/emu/lite.c -+++ grub-2.02~beta2/grub-core/kern/emu/lite.c -@@ -24,6 +24,8 @@ - #elif defined(__aarch64__) - #include "../arm64/dl_helper.c" +--- grub-2.04~rc1.orig/grub-core/kern/emu/lite.c ++++ grub-2.04~rc1/grub-core/kern/emu/lite.c +@@ -26,6 +26,8 @@ #include "../arm64/dl.c" + #elif defined(__riscv) + #include "../riscv/dl.c" +#elif defined(__s390x__) +#include "../s390x/dl.c" #else #error "No target cpu type is defined" #endif -Index: grub-2.02~beta2/grub-core/kern/dl.c +Index: grub-2.04~rc1/grub-core/kern/dl.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/dl.c -+++ grub-2.02~beta2/grub-core/kern/dl.c +--- grub-2.04~rc1.orig/grub-core/kern/dl.c ++++ grub-2.04~rc1/grub-core/kern/dl.c @@ -229,7 +229,7 @@ grub_dl_load_segments (grub_dl_t mod, co unsigned i; const Elf_Shdr *s; grub_size_t tsize = 0, talign = 1; --#if !defined (__i386__) && !defined (__x86_64__) -+#if !defined (__i386__) && !defined (__x86_64__) && !defined (__s390x__) +-#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) ++#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && !defined (__s390x__) grub_size_t tramp; grub_size_t got; grub_err_t err; @@ -63,8 +63,8 @@ Index: grub-2.02~beta2/grub-core/kern/dl.c talign = s->sh_addralign; } --#if !defined (__i386__) && !defined (__x86_64__) -+#if !defined (__i386__) && !defined (__x86_64__) && !defined (__s390x__) +-#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) ++#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && !defined (__s390x__) err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got); if (err) return err; @@ -72,15 +72,15 @@ Index: grub-2.02~beta2/grub-core/kern/dl.c mod->segment = seg; } } --#if !defined (__i386__) && !defined (__x86_64__) -+#if !defined (__i386__) && !defined (__x86_64__) && !defined (__s390x__) +-#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) ++#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && !defined (__s390x__) ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN); mod->tramp = ptr; mod->trampptr = ptr; -Index: grub-2.02~beta2/grub-core/kern/s390x/dl.c +Index: grub-2.04~rc1/grub-core/kern/s390x/dl.c =================================================================== --- /dev/null -+++ grub-2.02~beta2/grub-core/kern/s390x/dl.c ++++ grub-2.04~rc1/grub-core/kern/s390x/dl.c @@ -0,0 +1,40 @@ +/* dl.c - arch-dependent part of loadable module support */ +/* @@ -122,10 +122,10 @@ Index: grub-2.02~beta2/grub-core/kern/s390x/dl.c + (void)(seg); + return GRUB_ERR_BUG; +} -Index: grub-2.02~beta2/grub-core/lib/s390x/setjmp.S +Index: grub-2.04~rc1/grub-core/lib/s390x/setjmp.S =================================================================== --- /dev/null -+++ grub-2.02~beta2/grub-core/lib/s390x/setjmp.S ++++ grub-2.04~rc1/grub-core/lib/s390x/setjmp.S @@ -0,0 +1,46 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -173,23 +173,23 @@ Index: grub-2.02~beta2/grub-core/lib/s390x/setjmp.S + lmg %r11,%r15,0(%r2) + lgr %r2,%r3 + br %r14 -Index: grub-2.02~beta2/grub-core/lib/setjmp.S +Index: grub-2.04~rc1/grub-core/lib/setjmp.S =================================================================== ---- grub-2.02~beta2.orig/grub-core/lib/setjmp.S -+++ grub-2.02~beta2/grub-core/lib/setjmp.S -@@ -15,6 +15,8 @@ - #include "./arm/setjmp.S" - #elif defined(__aarch64__) +--- grub-2.04~rc1.orig/grub-core/lib/setjmp.S ++++ grub-2.04~rc1/grub-core/lib/setjmp.S +@@ -17,6 +17,8 @@ #include "./arm64/setjmp.S" + #elif defined(__riscv) + #include "./riscv/setjmp.S" +#elif defined(__s390x__) +#include "./s390x/setjmp.S" #else #error "Unknown target cpu type" #endif -Index: grub-2.02~beta2/include/grub/cache.h +Index: grub-2.04~rc1/include/grub/cache.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/cache.h -+++ grub-2.02~beta2/include/grub/cache.h +--- grub-2.04~rc1.orig/include/grub/cache.h ++++ grub-2.04~rc1/include/grub/cache.h @@ -23,7 +23,7 @@ #include #include @@ -199,10 +199,10 @@ Index: grub-2.02~beta2/include/grub/cache.h static inline void grub_arch_sync_caches (void *address __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) -Index: grub-2.02~beta2/include/grub/s390x/setjmp.h +Index: grub-2.04~rc1/include/grub/s390x/setjmp.h =================================================================== --- /dev/null -+++ grub-2.02~beta2/include/grub/s390x/setjmp.h ++++ grub-2.04~rc1/include/grub/s390x/setjmp.h @@ -0,0 +1,29 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -233,10 +233,10 @@ Index: grub-2.02~beta2/include/grub/s390x/setjmp.h +void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); + +#endif /* ! GRUB_SETJMP_CPU_HEADER */ -Index: grub-2.02~beta2/include/grub/s390x/time.h +Index: grub-2.04~rc1/include/grub/s390x/time.h =================================================================== --- /dev/null -+++ grub-2.02~beta2/include/grub/s390x/time.h ++++ grub-2.04~rc1/include/grub/s390x/time.h @@ -0,0 +1,27 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -265,10 +265,10 @@ Index: grub-2.02~beta2/include/grub/s390x/time.h +} + +#endif /* ! KERNEL_CPU_TIME_HEADER */ -Index: grub-2.02~beta2/include/grub/s390x/types.h +Index: grub-2.04~rc1/include/grub/s390x/types.h =================================================================== --- /dev/null -+++ grub-2.02~beta2/include/grub/s390x/types.h ++++ grub-2.04~rc1/include/grub/s390x/types.h @@ -0,0 +1,32 @@ +/* + * GRUB -- GRand Unified Bootloader diff --git a/grub2-s390x-02-kexec-module-added-to-emu.patch b/grub2-s390x-02-kexec-module-added-to-emu.patch index 0e60963..a23b780 100644 --- a/grub2-s390x-02-kexec-module-added-to-emu.patch +++ b/grub2-s390x-02-kexec-module-added-to-emu.patch @@ -9,14 +9,14 @@ include/grub/emu/misc.h | 3 8 files changed, 204 insertions(+), 4 deletions(-) -Index: grub-2.02~beta2/grub-core/Makefile.core.def +Index: grub-2.04~rc1/grub-core/Makefile.core.def =================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.core.def 2016-01-29 22:59:52.244526390 +0300 -+++ grub-2.02~beta2/grub-core/Makefile.core.def 2016-01-29 22:59:52.240526390 +0300 -@@ -1667,9 +1667,9 @@ - ia64_efi = loader/ia64/efi/linux.c; - arm = loader/arm/linux.c; +--- grub-2.04~rc1.orig/grub-core/Makefile.core.def ++++ grub-2.04~rc1/grub-core/Makefile.core.def +@@ -1786,9 +1786,9 @@ module = { arm64 = loader/arm64/linux.c; + riscv32 = loader/riscv/linux.c; + riscv64 = loader/riscv/linux.c; + emu = loader/emu/linux.c; common = loader/linux.c; common = lib/cmdline.c; @@ -24,10 +24,10 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def }; module = { -Index: grub-2.02~beta2/grub-core/loader/emu/linux.c +Index: grub-2.04~rc1/grub-core/loader/emu/linux.c =================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ grub-2.02~beta2/grub-core/loader/emu/linux.c 2016-01-29 22:59:52.240526390 +0300 +--- /dev/null ++++ grub-2.04~rc1/grub-core/loader/emu/linux.c @@ -0,0 +1,173 @@ +/* + * GRUB -- GRand Unified Bootloader @@ -202,10 +202,10 @@ Index: grub-2.02~beta2/grub-core/loader/emu/linux.c + grub_unregister_command (cmd_linux); + grub_unregister_command (cmd_initrd); +} -Index: grub-2.02~beta2/include/grub/emu/hostfile.h +Index: grub-2.04~rc1/include/grub/emu/hostfile.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/emu/hostfile.h 2016-01-29 22:59:52.244526390 +0300 -+++ grub-2.02~beta2/include/grub/emu/hostfile.h 2016-01-29 22:59:52.240526390 +0300 +--- grub-2.04~rc1.orig/include/grub/emu/hostfile.h ++++ grub-2.04~rc1/include/grub/emu/hostfile.h @@ -22,6 +22,7 @@ #include #include @@ -214,7 +214,7 @@ Index: grub-2.02~beta2/include/grub/emu/hostfile.h #include int -@@ -29,7 +30,7 @@ +@@ -29,7 +30,7 @@ grub_util_is_directory (const char *path int grub_util_is_special_file (const char *path); int @@ -223,10 +223,10 @@ Index: grub-2.02~beta2/include/grub/emu/hostfile.h char * grub_util_path_concat (size_t n, ...); -Index: grub-2.02~beta2/include/grub/emu/exec.h +Index: grub-2.04~rc1/include/grub/emu/exec.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/emu/exec.h 2016-01-29 22:59:52.244526390 +0300 -+++ grub-2.02~beta2/include/grub/emu/exec.h 2016-01-29 22:59:52.240526390 +0300 +--- grub-2.04~rc1.orig/include/grub/emu/exec.h ++++ grub-2.04~rc1/include/grub/emu/exec.h @@ -23,6 +23,8 @@ #include @@ -236,7 +236,7 @@ Index: grub-2.02~beta2/include/grub/emu/exec.h pid_t grub_util_exec_pipe (const char *const *argv, int *fd); pid_t -@@ -32,7 +34,7 @@ +@@ -32,7 +34,7 @@ int grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, const char *stdout_file, const char *stderr_file); int @@ -245,11 +245,11 @@ Index: grub-2.02~beta2/include/grub/emu/exec.h int grub_util_exec_redirect (const char *const *argv, const char *stdin_file, const char *stdout_file); -Index: grub-2.02~beta2/grub-core/Makefile.am +Index: grub-2.04~rc1/grub-core/Makefile.am =================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.am 2016-01-29 22:59:52.244526390 +0300 -+++ grub-2.02~beta2/grub-core/Makefile.am 2016-01-29 22:59:52.240526390 +0300 -@@ -258,6 +258,7 @@ +--- grub-2.04~rc1.orig/grub-core/Makefile.am ++++ grub-2.04~rc1/grub-core/Makefile.am +@@ -303,6 +303,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/inc KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h @@ -257,11 +257,11 @@ Index: grub-2.02~beta2/grub-core/Makefile.am if COND_GRUB_EMU_SDL KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h endif -Index: grub-2.02~beta2/grub-core/kern/emu/main.c +Index: grub-2.04~rc1/grub-core/kern/emu/main.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/emu/main.c 2016-01-29 22:59:52.244526390 +0300 -+++ grub-2.02~beta2/grub-core/kern/emu/main.c 2016-01-29 22:59:52.240526390 +0300 -@@ -106,6 +106,7 @@ +--- grub-2.04~rc1.orig/grub-core/kern/emu/main.c ++++ grub-2.04~rc1/grub-core/kern/emu/main.c +@@ -107,6 +107,7 @@ static struct argp_option options[] = { N_("use GRUB files in the directory DIR [default=%s]"), 0}, {"verbose", 'v', 0, 0, N_("print verbose messages."), 0}, {"hold", 'H', N_("SECS"), OPTION_ARG_OPTIONAL, N_("wait until a debugger will attach"), 0}, @@ -269,7 +269,7 @@ Index: grub-2.02~beta2/grub-core/kern/emu/main.c { 0, 0, 0, 0, 0, 0 } }; -@@ -163,6 +164,9 @@ +@@ -164,6 +165,9 @@ argp_parser (int key, char *arg, struct case 'v': verbosity++; break; @@ -279,11 +279,11 @@ Index: grub-2.02~beta2/grub-core/kern/emu/main.c case ARGP_KEY_ARG: { -Index: grub-2.02~beta2/grub-core/kern/emu/misc.c +Index: grub-2.04~rc1/grub-core/kern/emu/misc.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/emu/misc.c 2016-01-29 22:59:52.244526390 +0300 -+++ grub-2.02~beta2/grub-core/kern/emu/misc.c 2016-01-29 22:59:52.240526390 +0300 -@@ -37,6 +37,7 @@ +--- grub-2.04~rc1.orig/grub-core/kern/emu/misc.c ++++ grub-2.04~rc1/grub-core/kern/emu/misc.c +@@ -39,6 +39,7 @@ #include int verbosity; @@ -291,7 +291,7 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c void grub_util_warn (const char *fmt, ...) -@@ -80,7 +81,7 @@ +@@ -82,7 +83,7 @@ grub_util_error (const char *fmt, ...) vfprintf (stderr, fmt, ap); va_end (ap); fprintf (stderr, ".\n"); @@ -300,7 +300,7 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c } void * -@@ -138,6 +139,9 @@ +@@ -141,6 +142,9 @@ xasprintf (const char *fmt, ...) void grub_exit (void) { @@ -310,7 +310,7 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c exit (1); } #endif -@@ -199,3 +203,15 @@ +@@ -202,3 +206,15 @@ grub_util_load_image (const char *path, fclose (fp); } @@ -326,13 +326,13 @@ Index: grub-2.02~beta2/grub-core/kern/emu/misc.c +{ + return kexecute; +} -Index: grub-2.02~beta2/include/grub/emu/misc.h +Index: grub-2.04~rc1/include/grub/emu/misc.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/emu/misc.h 2016-01-29 22:59:52.244526390 +0300 -+++ grub-2.02~beta2/include/grub/emu/misc.h 2016-01-29 22:59:52.240526390 +0300 -@@ -60,6 +60,9 @@ - void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); - void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2), noreturn)); +--- grub-2.04~rc1.orig/include/grub/emu/misc.h ++++ grub-2.04~rc1/include/grub/emu/misc.h +@@ -56,6 +56,9 @@ void EXPORT_FUNC(grub_util_warn) (const + void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2))); + void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2), noreturn)); +void EXPORT_FUNC(grub_util_set_kexecute) (void); +int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT; diff --git a/grub2-s390x-04-grub2-install.patch b/grub2-s390x-04-grub2-install.patch index 44e85d2..0549122 100644 --- a/grub2-s390x-04-grub2-install.patch +++ b/grub2-s390x-04-grub2-install.patch @@ -71,41 +71,43 @@ V19: util/s390x/zipl2grub.pl.in | 423 +++++++++++++++++++++++++++++++++ 14 files changed, 908 insertions(+), 3 deletions(-) ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -352,6 +352,7 @@ program = { - ldadd = grub-core/gnulib/libgnu.a; +Index: grub-2.04~rc1/Makefile.util.def +=================================================================== +--- grub-2.04~rc1.orig/Makefile.util.def ++++ grub-2.04~rc1/Makefile.util.def +@@ -362,6 +362,7 @@ program = { + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; cppflags = '-DGRUB_SETUP_FUNC=grub_util_bios_setup'; + emu_condition = COND_NOT_s390x; }; program = { -@@ -372,6 +373,7 @@ program = { - ldadd = grub-core/gnulib/libgnu.a; +@@ -382,6 +383,7 @@ program = { + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; cppflags = '-DGRUB_SETUP_FUNC=grub_util_sparc_setup'; + emu_condition = COND_NOT_s390x; }; program = { -@@ -387,6 +389,7 @@ program = { +@@ -397,6 +399,7 @@ program = { ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + emu_condition = COND_NOT_s390x; }; program = { -@@ -417,6 +420,7 @@ program = { +@@ -427,6 +430,7 @@ program = { ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + emu_condition = COND_NOT_s390x; }; data = { -@@ -628,6 +632,7 @@ program = { +@@ -638,6 +642,7 @@ program = { common = grub-core/disk/host.c; common = util/resolve.c; @@ -113,7 +115,7 @@ V19: common = grub-core/kern/emu/argp_common.c; common = grub-core/osdep/init.c; -@@ -697,6 +702,46 @@ script = { +@@ -707,6 +712,46 @@ script = { }; script = { @@ -160,17 +162,19 @@ V19: name = grub-mkconfig_lib; common = util/grub-mkconfig_lib.in; installdir = noinst; -@@ -1308,6 +1353,7 @@ program = { +@@ -1324,6 +1369,7 @@ program = { ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; + ldadd = grub-core/lib/gnulib/libgnu.a; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; + emu_condition = COND_NOT_s390x; }; program = { ---- a/configure.ac -+++ b/configure.ac -@@ -181,9 +181,9 @@ if test x$platform != xemu ; then +Index: grub-2.04~rc1/configure.ac +=================================================================== +--- grub-2.04~rc1.orig/configure.ac ++++ grub-2.04~rc1/configure.ac +@@ -197,9 +197,9 @@ if test x$platform != xemu ; then esac fi @@ -183,19 +187,21 @@ V19: case "$target_os" in windows* | mingw32*) target_os=cygwin ;; -@@ -1908,6 +1908,9 @@ AM_CONDITIONAL([COND_arm_uboot], [test x - AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi]) - AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ]) - AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi]) +@@ -1941,6 +1941,9 @@ AM_CONDITIONAL([COND_riscv32], [test x$t + AM_CONDITIONAL([COND_riscv64], [test x$target_cpu = xriscv64 ]) + AM_CONDITIONAL([COND_riscv32_efi], [test x$target_cpu = xriscv32 -a x$platform = xefi]) + AM_CONDITIONAL([COND_riscv64_efi], [test x$target_cpu = xriscv64 -a x$platform = xefi]) +AM_CONDITIONAL([COND_s390x], [test x$target_cpu = xs390x ]) +AM_CONDITIONAL([COND_NOT_s390x], [test x$target_cpu != xs390x ]) +AM_CONDITIONAL([COND_s390x_emu], [test x$target_cpu = xs390x -a x$platform = xemu]) AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) ---- a/grub-core/Makefile.core.def -+++ b/grub-core/Makefile.core.def -@@ -1057,6 +1057,7 @@ module = { +Index: grub-2.04~rc1/grub-core/Makefile.core.def +=================================================================== +--- grub-2.04~rc1.orig/grub-core/Makefile.core.def ++++ grub-2.04~rc1/grub-core/Makefile.core.def +@@ -1139,6 +1139,7 @@ module = { module = { name = videotest; common = commands/videotest.c; @@ -203,7 +209,7 @@ V19: }; module = { -@@ -1469,6 +1470,7 @@ module = { +@@ -1571,6 +1572,7 @@ module = { common = gfxmenu/gui_progress_bar.c; common = gfxmenu/gui_util.c; common = gfxmenu/gui_string_util.c; @@ -211,7 +217,7 @@ V19: }; module = { -@@ -1884,11 +1886,13 @@ module = { +@@ -2006,11 +2008,13 @@ module = { name = gfxterm; common = term/gfxterm.c; enable = videomodules; @@ -225,7 +231,7 @@ V19: }; module = { -@@ -2003,6 +2007,7 @@ module = { +@@ -2131,6 +2135,7 @@ module = { enable = x86_64_efi; enable = emu; enable = xen; @@ -233,7 +239,7 @@ V19: }; module = { -@@ -2049,6 +2054,7 @@ module = { +@@ -2177,6 +2182,7 @@ module = { module = { name = gfxterm_menu; common = tests/gfxterm_menu.c; @@ -241,7 +247,7 @@ V19: }; module = { -@@ -2201,6 +2207,7 @@ module = { +@@ -2330,6 +2336,7 @@ module = { enable = x86_64_efi; enable = emu; enable = xen; @@ -249,8 +255,10 @@ V19: }; module = { ---- a/grub-core/osdep/basic/no_platform.c -+++ b/grub-core/osdep/basic/no_platform.c +Index: grub-2.04~rc1/grub-core/osdep/basic/no_platform.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/osdep/basic/no_platform.c ++++ grub-2.04~rc1/grub-core/osdep/basic/no_platform.c @@ -44,3 +44,10 @@ grub_install_sgi_setup (const char *inst { grub_util_error ("%s", _("no SGI routines are available for your platform")); @@ -262,9 +270,11 @@ V19: + grub_util_error ("%s", _("no zIPL routines are available for your platform")); +} + ---- a/grub-core/osdep/unix/platform.c -+++ b/grub-core/osdep/unix/platform.c -@@ -233,3 +233,14 @@ grub_install_sgi_setup (const char *inst +Index: grub-2.04~rc1/grub-core/osdep/unix/platform.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/osdep/unix/platform.c ++++ grub-2.04~rc1/grub-core/osdep/unix/platform.c +@@ -239,3 +239,14 @@ grub_install_sgi_setup (const char *inst imgfile, destname, NULL }); grub_util_warn ("%s", _("You will have to set `SystemPartition' and `OSLoader' manually.")); } @@ -279,9 +289,11 @@ V19: + "-z", dest, NULL })) + grub_util_error (_("`%s' failed.\n"), PACKAGE"-zipl-setup"); +} ---- a/grub-core/osdep/windows/platform.c -+++ b/grub-core/osdep/windows/platform.c -@@ -422,3 +422,9 @@ grub_install_sgi_setup (const char *inst +Index: grub-2.04~rc1/grub-core/osdep/windows/platform.c +=================================================================== +--- grub-2.04~rc1.orig/grub-core/osdep/windows/platform.c ++++ grub-2.04~rc1/grub-core/osdep/windows/platform.c +@@ -424,3 +424,9 @@ grub_install_sgi_setup (const char *inst { grub_util_error ("%s", _("no SGI routines are available for your platform")); } @@ -291,17 +303,19 @@ V19: +{ + grub_util_error ("%s", _("no zIPL routines are available for your platform")); +} ---- a/include/grub/util/install.h -+++ b/include/grub/util/install.h -@@ -99,6 +99,7 @@ enum grub_install_plat - GRUB_INSTALL_PLATFORM_I386_XEN, - GRUB_INSTALL_PLATFORM_X86_64_XEN, - GRUB_INSTALL_PLATFORM_ARM64_EFI, +Index: grub-2.04~rc1/include/grub/util/install.h +=================================================================== +--- grub-2.04~rc1.orig/include/grub/util/install.h ++++ grub-2.04~rc1/include/grub/util/install.h +@@ -105,6 +105,7 @@ enum grub_install_plat + GRUB_INSTALL_PLATFORM_ARM_COREBOOT, + GRUB_INSTALL_PLATFORM_RISCV32_EFI, + GRUB_INSTALL_PLATFORM_RISCV64_EFI, + GRUB_INSTALL_PLATFORM_S390X_EMU, GRUB_INSTALL_PLATFORM_MAX }; -@@ -219,6 +220,9 @@ void +@@ -229,6 +230,9 @@ void grub_install_sgi_setup (const char *install_device, const char *imgfile, const char *destname); @@ -311,18 +325,22 @@ V19: int grub_install_compress_gzip (const char *src, const char *dest); int ---- a/util/grub-install-common.c -+++ b/util/grub-install-common.c -@@ -666,6 +666,7 @@ static struct - [GRUB_INSTALL_PLATFORM_ARM_EFI] = { "arm", "efi" }, - [GRUB_INSTALL_PLATFORM_ARM64_EFI] = { "arm64", "efi" }, - [GRUB_INSTALL_PLATFORM_ARM_UBOOT] = { "arm", "uboot" }, +Index: grub-2.04~rc1/util/grub-install-common.c +=================================================================== +--- grub-2.04~rc1.orig/util/grub-install-common.c ++++ grub-2.04~rc1/util/grub-install-common.c +@@ -737,6 +737,7 @@ static struct + [GRUB_INSTALL_PLATFORM_ARM_COREBOOT] = { "arm", "coreboot" }, + [GRUB_INSTALL_PLATFORM_RISCV32_EFI] = { "riscv32", "efi" }, + [GRUB_INSTALL_PLATFORM_RISCV64_EFI] = { "riscv64", "efi" }, + [GRUB_INSTALL_PLATFORM_S390X_EMU] = { "s390x", "emu" }, }; char * ---- a/util/grub-install.c -+++ b/util/grub-install.c +Index: grub-2.04~rc1/util/grub-install.c +=================================================================== +--- grub-2.04~rc1.orig/util/grub-install.c ++++ grub-2.04~rc1/util/grub-install.c @@ -66,6 +66,7 @@ static int force_file_id = 0; static char *disk_module = NULL; static char *efidir = NULL; @@ -369,32 +387,32 @@ V19: #else return NULL; #endif -@@ -495,6 +506,8 @@ have_bootdev (enum grub_install_plat pl) - +@@ -499,6 +510,8 @@ have_bootdev (enum grub_install_plat pl) case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: + case GRUB_INSTALL_PLATFORM_I386_XEN_PVH: + + case GRUB_INSTALL_PLATFORM_S390X_EMU: return 0; /* pacify warning. */ -@@ -907,6 +920,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_ARM_UBOOT: +@@ -914,6 +927,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: + case GRUB_INSTALL_PLATFORM_I386_XEN_PVH: + case GRUB_INSTALL_PLATFORM_S390X_EMU: break; case GRUB_INSTALL_PLATFORM_I386_QEMU: -@@ -952,6 +966,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: +@@ -964,6 +978,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: + case GRUB_INSTALL_PLATFORM_I386_XEN_PVH: + case GRUB_INSTALL_PLATFORM_S390X_EMU: free (install_device); install_device = NULL; break; -@@ -1213,6 +1228,20 @@ main (int argc, char *argv[]) +@@ -1239,6 +1254,20 @@ main (int argc, char *argv[]) } } @@ -415,15 +433,15 @@ V19: grub_install_copy_files (grub_install_source_directory, grubdir, platform); -@@ -1458,6 +1487,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_ARM_UBOOT: +@@ -1488,6 +1517,7 @@ main (int argc, char *argv[]) case GRUB_INSTALL_PLATFORM_I386_XEN: case GRUB_INSTALL_PLATFORM_X86_64_XEN: + case GRUB_INSTALL_PLATFORM_I386_XEN_PVH: + case GRUB_INSTALL_PLATFORM_S390X_EMU: grub_util_warn ("%s", _("no hints available for your platform. Expect reduced performance")); break; /* pacify warning. */ -@@ -1570,6 +1600,10 @@ main (int argc, char *argv[]) +@@ -1605,6 +1635,10 @@ main (int argc, char *argv[]) strcpy (mkimage_target, "sparc64-ieee1275-raw"); core_name = "core.img"; break; @@ -434,7 +452,7 @@ V19: /* pacify warning. */ case GRUB_INSTALL_PLATFORM_MAX: break; -@@ -1585,6 +1619,7 @@ main (int argc, char *argv[]) +@@ -1620,6 +1654,7 @@ main (int argc, char *argv[]) core_name); char *prefix = xasprintf ("%s%s", prefix_drive ? : "", relative_grubdir); @@ -442,7 +460,7 @@ V19: grub_install_make_image_wrap (/* source dir */ grub_install_source_directory, /*prefix */ prefix, /* output */ imgfile, -@@ -1623,6 +1658,10 @@ main (int argc, char *argv[]) +@@ -1658,6 +1693,10 @@ main (int argc, char *argv[]) /* image target */ mkimage_target, 0); } break; @@ -452,8 +470,8 @@ V19: + case GRUB_INSTALL_PLATFORM_ARM_EFI: case GRUB_INSTALL_PLATFORM_ARM64_EFI: - case GRUB_INSTALL_PLATFORM_IA64_EFI: -@@ -1885,6 +1924,10 @@ main (int argc, char *argv[]) + case GRUB_INSTALL_PLATFORM_RISCV32_EFI: +@@ -1934,6 +1973,10 @@ main (int argc, char *argv[]) } break; @@ -464,8 +482,10 @@ V19: case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: +Index: grub-2.04~rc1/util/s390x/dracut-grub2.sh.in +=================================================================== --- /dev/null -+++ b/util/s390x/dracut-grub2.sh.in ++++ grub-2.04~rc1/util/s390x/dracut-grub2.sh.in @@ -0,0 +1,126 @@ +#!/bin/sh +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- @@ -593,8 +613,10 @@ V19: + fi +fi + +Index: grub-2.04~rc1/util/s390x/dracut-module-setup.sh.in +=================================================================== --- /dev/null -+++ b/util/s390x/dracut-module-setup.sh.in ++++ grub-2.04~rc1/util/s390x/dracut-module-setup.sh.in @@ -0,0 +1,19 @@ +#!/bin/bash +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- @@ -615,8 +637,10 @@ V19: + #inst_multiple grub2-emu kexec +} + +Index: grub-2.04~rc1/util/s390x/zipl2grub.conf.in +=================================================================== --- /dev/null -+++ b/util/s390x/zipl2grub.conf.in ++++ grub-2.04~rc1/util/s390x/zipl2grub.conf.in @@ -0,0 +1,26 @@ +## This is the template for '@zipldir@/config' and is subject to +## rpm's %config file handling in case of grub2-s390x-emu package update. @@ -644,8 +668,10 @@ V19: + 1 = grub2 + 2 = skip-grub2 + +Index: grub-2.04~rc1/util/s390x/zipl2grub.pl.in +=================================================================== --- /dev/null -+++ b/util/s390x/zipl2grub.pl.in ++++ grub-2.04~rc1/util/s390x/zipl2grub.pl.in @@ -0,0 +1,423 @@ +#!/usr/bin/perl +use strict; @@ -1070,8 +1096,10 @@ V19: +System( @C); +exit( $miss); + +Index: grub-2.04~rc1/util/s390x/dracut-zipl-refresh.sh.in +=================================================================== --- /dev/null -+++ b/util/s390x/dracut-zipl-refresh.sh.in ++++ grub-2.04~rc1/util/s390x/dracut-zipl-refresh.sh.in @@ -0,0 +1,183 @@ +#!/bin/bash +# ex: ts=8 sw=4 sts=4 et filetype=sh syntax=off diff --git a/grub2-secureboot-add-linuxefi.patch b/grub2-secureboot-add-linuxefi.patch index d1a6eca..2035b3b 100644 --- a/grub2-secureboot-add-linuxefi.patch +++ b/grub2-secureboot-add-linuxefi.patch @@ -6,6 +6,13 @@ References: fate#314485 Patch-Mainline: no Signed-off-by: Michael Chang + +v2: Adjust patch according to new upstream commits +4d4a8c96e verifiers: Add possibility to verify kernel and modules command lines +ca0a4f689 verifiers: File type for fine-grained signature-verification controlling +7d36709d5 i386: make struct linux_kernel_header architecture specific +4bc909bf8 Remove grub_efi_allocate_pages. + --- grub-core/Makefile.core.def | 8 + grub-core/kern/efi/mm.c | 32 ++++ @@ -15,11 +22,11 @@ Signed-off-by: Michael Chang 5 files changed, 415 insertions(+), 0 deletions(-) create mode 100644 grub-core/loader/i386/efi/linux.c -Index: grub-2.02~beta2/grub-core/Makefile.core.def +Index: grub-2.04~rc1/grub-core/Makefile.core.def =================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -1691,6 +1691,14 @@ module = { +--- grub-2.04~rc1.orig/grub-core/Makefile.core.def ++++ grub-2.04~rc1/grub-core/Makefile.core.def +@@ -1850,6 +1850,14 @@ module = { }; module = { @@ -34,13 +41,13 @@ Index: grub-2.02~beta2/grub-core/Makefile.core.def name = chain; efi = loader/efi/chainloader.c; i386_pc = loader/i386/pc/chainloader.c; -Index: grub-2.02~beta2/grub-core/kern/efi/mm.c +Index: grub-2.04~rc1/grub-core/kern/efi/mm.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/efi/mm.c -+++ grub-2.02~beta2/grub-core/kern/efi/mm.c -@@ -49,6 +49,38 @@ static grub_efi_uintn_t finish_desc_size - static grub_efi_uint32_t finish_desc_version; - int grub_efi_is_finished = 0; +--- grub-2.04~rc1.orig/grub-core/kern/efi/mm.c ++++ grub-2.04~rc1/grub-core/kern/efi/mm.c +@@ -113,6 +113,38 @@ grub_efi_drop_alloc (grub_efi_physical_a + } + } +/* Allocate pages below a specified address */ +void * @@ -76,12 +83,12 @@ Index: grub-2.02~beta2/grub-core/kern/efi/mm.c + /* Allocate pages. Return the pointer to the first of allocated pages. */ void * - grub_efi_allocate_pages (grub_efi_physical_address_t address, -Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + grub_efi_allocate_pages_real (grub_efi_physical_address_t address, +Index: grub-2.04~rc1/grub-core/loader/i386/efi/linux.c =================================================================== --- /dev/null -+++ grub-2.02~beta2/grub-core/loader/i386/efi/linux.c -@@ -0,0 +1,371 @@ ++++ grub-2.04~rc1/grub-core/loader/i386/efi/linux.c +@@ -0,0 +1,342 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2012 Free Software Foundation, Inc. @@ -124,32 +131,6 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + +#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12) + -+#define SHIM_LOCK_GUID \ -+ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} } -+ -+struct grub_efi_shim_lock -+{ -+ grub_efi_status_t (*verify) (void *buffer, grub_uint32_t size); -+}; -+typedef struct grub_efi_shim_lock grub_efi_shim_lock_t; -+ -+static grub_efi_boolean_t -+grub_linuxefi_secure_validate (void *data, grub_uint32_t size) -+{ -+ grub_efi_guid_t guid = SHIM_LOCK_GUID; -+ grub_efi_shim_lock_t *shim_lock; -+ -+ shim_lock = grub_efi_locate_protocol(&guid, NULL); -+ -+ if (!shim_lock) -+ return 1; -+ -+ if (shim_lock->verify(data, size) == GRUB_EFI_SUCCESS) -+ return 1; -+ -+ return 0; -+} -+ +typedef void(*handover_func)(void *, grub_efi_system_table_t *, struct linux_kernel_params *); + +static grub_err_t @@ -215,8 +196,8 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + + for (i = 0; i < argc; i++) + { -+ grub_file_filter_disable_compression (); -+ files[i] = grub_file_open (argv[i]); ++ files[i] = grub_file_open (argv[i], GRUB_FILE_TYPE_LINUX_INITRD ++ | GRUB_FILE_TYPE_NO_DECOMPRESS); + if (! files[i]) + goto fail; + nfiles++; @@ -269,9 +250,10 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + int argc, char *argv[]) +{ + grub_file_t file = 0; -+ struct linux_kernel_header lh; ++ struct linux_i386_kernel_header lh; + grub_ssize_t len, start, filelen; + void *kernel; ++ grub_err_t err; + + grub_dl_ref (my_mod); + @@ -281,7 +263,7 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + goto fail; + } + -+ file = grub_file_open (argv[0]); ++ file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL); + if (! file) + goto fail; + @@ -301,13 +283,6 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + goto fail; + } + -+ if (! grub_linuxefi_secure_validate (kernel, filelen)) -+ { -+ grub_error (GRUB_ERR_INVALID_COMMAND, N_("%s has invalid signature"), argv[0]); -+ grub_free (kernel); -+ goto fail; -+ } -+ + grub_file_seek (file, 0); + + grub_free(kernel); @@ -364,9 +339,12 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + } + + grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); -+ grub_create_loader_cmdline (argc, argv, ++ err = grub_create_loader_cmdline (argc, argv, + linux_cmdline + sizeof (LINUX_IMAGE) - 1, -+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1)); ++ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1), ++ GRUB_VERIFY_KERNEL_CMDLINE); ++ if (err) ++ goto fail; + + lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; + @@ -375,7 +353,7 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + start = (lh.setup_sects + 1) * 512; + len = grub_file_size(file) - start; + -+ kernel_mem = grub_efi_allocate_pages(lh.pref_address, ++ kernel_mem = grub_efi_allocate_fixed (lh.pref_address, + BYTES_TO_PAGES(lh.init_size)); + + if (!kernel_mem) @@ -453,29 +431,17 @@ Index: grub-2.02~beta2/grub-core/loader/i386/efi/linux.c + grub_unregister_command (cmd_linux); + grub_unregister_command (cmd_initrd); +} -Index: grub-2.02~beta2/include/grub/efi/efi.h +Index: grub-2.04~rc1/include/grub/efi/efi.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/efi/efi.h -+++ grub-2.02~beta2/include/grub/efi/efi.h -@@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_e - void * - EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address, +--- grub-2.04~rc1.orig/include/grub/efi/efi.h ++++ grub-2.04~rc1/include/grub/efi/efi.h +@@ -47,6 +47,9 @@ EXPORT_FUNC(grub_efi_allocate_fixed) (gr grub_efi_uintn_t pages); + void * + EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages); +void * +EXPORT_FUNC(grub_efi_allocate_pages_max) (grub_efi_physical_address_t max, + grub_efi_uintn_t pages); void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address, grub_efi_uintn_t pages); - int -Index: grub-2.02~beta2/include/grub/i386/linux.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/i386/linux.h -+++ grub-2.02~beta2/include/grub/i386/linux.h -@@ -139,6 +139,7 @@ struct linux_kernel_header - grub_uint64_t setup_data; - grub_uint64_t pref_address; - grub_uint32_t init_size; -+ grub_uint32_t handover_offset; - } GRUB_PACKED; - - /* Boot parameters for Linux based on 2.6.12. This is used by the setup + grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void); diff --git a/grub2-secureboot-chainloader.patch b/grub2-secureboot-chainloader.patch index a6feafa..2d9ef24 100644 --- a/grub2-secureboot-chainloader.patch +++ b/grub2-secureboot-chainloader.patch @@ -21,10 +21,10 @@ Signed-off-by: Michael Chang grub-core/loader/efi/chainloader.c | 538 +++++++++++++++++++++++++++++++++-- 1 files changed, 507 insertions(+), 31 deletions(-) -Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c +Index: grub-2.04~rc1/grub-core/loader/efi/chainloader.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/loader/efi/chainloader.c -+++ grub-2.02~beta2/grub-core/loader/efi/chainloader.c +--- grub-2.04~rc1.orig/grub-core/loader/efi/chainloader.c ++++ grub-2.04~rc1/grub-core/loader/efi/chainloader.c @@ -40,15 +40,31 @@ #include #endif @@ -65,7 +65,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c grub_dl_unref (my_mod); return GRUB_ERR_NONE; -@@ -187,12 +204,460 @@ make_file_path (grub_efi_device_path_t * +@@ -197,12 +214,460 @@ make_file_path (grub_efi_device_path_t * return file_path; } @@ -527,7 +527,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c grub_efi_status_t status; grub_efi_boot_services_t *b; grub_device_t dev = 0; -@@ -200,7 +665,6 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -210,7 +675,6 @@ grub_cmd_chainloader (grub_command_t cmd grub_efi_loaded_image_t *loaded_image; char *filename; void *boot_image = 0; @@ -535,7 +535,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -212,9 +676,36 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -222,9 +686,36 @@ grub_cmd_chainloader (grub_command_t cmd address = 0; image_handle = 0; file_path = 0; @@ -569,10 +569,10 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c + *(--p16) = 0; + } + - file = grub_file_open (filename); + file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE); if (! file) goto fail; -@@ -260,14 +751,14 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -270,14 +761,14 @@ grub_cmd_chainloader (grub_command_t cmd grub_printf ("file path: "); grub_efi_print_device_path (file_path); @@ -590,7 +590,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ANY_PAGES, GRUB_EFI_LOADER_CODE, -@@ -281,7 +772,7 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -291,7 +782,7 @@ grub_cmd_chainloader (grub_command_t cmd } boot_image = (void *) ((grub_addr_t) address); @@ -599,7 +599,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c { if (grub_errno == GRUB_ERR_NONE) grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -@@ -291,7 +782,7 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -301,7 +792,7 @@ grub_cmd_chainloader (grub_command_t cmd } #if defined (__i386__) || defined (__x86_64__) @@ -608,7 +608,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c { struct grub_macho_fat_header *head = boot_image; if (head->magic -@@ -314,20 +805,30 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -324,20 +815,30 @@ grub_cmd_chainloader (grub_command_t cmd > ~grub_cpu_to_le32 (archs[i].size) || grub_cpu_to_le32 (archs[i].offset) + grub_cpu_to_le32 (archs[i].size) @@ -642,7 +642,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c &image_handle); if (status != GRUB_EFI_SUCCESS) { -@@ -350,33 +851,10 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -360,33 +861,10 @@ grub_cmd_chainloader (grub_command_t cmd } loaded_image->device_handle = dev_handle; @@ -678,7 +678,7 @@ Index: grub-2.02~beta2/grub-core/loader/efi/chainloader.c } grub_file_close (file); -@@ -398,6 +876,9 @@ grub_cmd_chainloader (grub_command_t cmd +@@ -408,6 +886,9 @@ grub_cmd_chainloader (grub_command_t cmd if (address) efi_call_2 (b->free_pages, address, pages); diff --git a/grub2-secureboot-install-signed-grub.patch b/grub2-secureboot-install-signed-grub.patch index 09e19c1..1de90a9 100644 --- a/grub2-secureboot-install-signed-grub.patch +++ b/grub2-secureboot-install-signed-grub.patch @@ -17,10 +17,10 @@ Signed-off-by: Michael Chang util/grub-install.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) -Index: grub-2.02/util/grub-install.c +Index: grub-2.04~rc1/util/grub-install.c =================================================================== ---- grub-2.02.orig/util/grub-install.c -+++ grub-2.02/util/grub-install.c +--- grub-2.04~rc1.orig/util/grub-install.c ++++ grub-2.04~rc1/util/grub-install.c @@ -84,6 +84,15 @@ static int suse_enable_tpm = 0; enum @@ -98,7 +98,7 @@ Index: grub-2.02/util/grub-install.c case ARGP_KEY_HELP_POST_DOC: return xasprintf (text, program_name, GRUB_BOOT_DIR_NAME "/" GRUB_DIR_NAME); default: -@@ -1596,13 +1636,34 @@ main (int argc, char *argv[]) +@@ -1627,13 +1667,34 @@ main (int argc, char *argv[]) char mkimage_target[200]; const char *core_name = NULL; @@ -106,7 +106,6 @@ Index: grub-2.02/util/grub-install.c switch (platform) { -- case GRUB_INSTALL_PLATFORM_I386_EFI: + case GRUB_INSTALL_PLATFORM_ARM64_EFI: + + if (signed_grub_mode > SIGNED_GRUB_INHIBIT) @@ -128,14 +127,14 @@ Index: grub-2.02/util/grub-install.c + fprintf (stderr, _("Use signed file in %s for installation.\n"), signed_imgfile); + + /* fallthrough. */ + case GRUB_INSTALL_PLATFORM_I386_EFI: case GRUB_INSTALL_PLATFORM_X86_64_EFI: -+ case GRUB_INSTALL_PLATFORM_I386_EFI: case GRUB_INSTALL_PLATFORM_ARM_EFI: - case GRUB_INSTALL_PLATFORM_ARM64_EFI: + case GRUB_INSTALL_PLATFORM_RISCV32_EFI: + case GRUB_INSTALL_PLATFORM_RISCV64_EFI: case GRUB_INSTALL_PLATFORM_IA64_EFI: - core_name = "core.efi"; - snprintf (mkimage_target, sizeof (mkimage_target), -@@ -1678,13 +1739,75 @@ main (int argc, char *argv[]) +@@ -1703,13 +1764,75 @@ main (int argc, char *argv[]) core_name); char *prefix = xasprintf ("%s%s", prefix_drive ? : "", relative_grubdir); @@ -167,7 +166,7 @@ Index: grub-2.02/util/grub-install.c + else if (prefix_drive) + { + char *uuid = NULL; -+ if (grub_fs->uuid && grub_fs->uuid (grub_dev, &uuid)) ++ if (grub_fs->fs_uuid && grub_fs->fs_uuid (grub_dev, &uuid)) + { + grub_print_error (); + grub_errno = 0; @@ -212,7 +211,7 @@ Index: grub-2.02/util/grub-install.c /* Backward-compatibility kludges. */ switch (platform) { -@@ -1950,6 +2073,13 @@ main (int argc, char *argv[]) +@@ -1985,6 +2108,13 @@ main (int argc, char *argv[]) char *dst = grub_util_path_concat (2, efidir, efi_file); grub_install_copy_file (imgfile, dst, 1); free (dst); diff --git a/grub2-secureboot-no-insmod-on-sb.patch b/grub2-secureboot-no-insmod-on-sb.patch index 79d5a02..68fec61 100644 --- a/grub2-secureboot-no-insmod-on-sb.patch +++ b/grub2-secureboot-no-insmod-on-sb.patch @@ -13,10 +13,10 @@ Signed-off-by: Michael Chang include/grub/efi/efi.h | 1 + 3 files changed, 46 insertions(+) -Index: grub-2.02~beta2/grub-core/kern/dl.c +Index: grub-2.04~rc1/grub-core/kern/dl.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/dl.c -+++ grub-2.02~beta2/grub-core/kern/dl.c +--- grub-2.04~rc1.orig/grub-core/kern/dl.c ++++ grub-2.04~rc1/grub-core/kern/dl.c @@ -38,6 +38,10 @@ #define GRUB_MODULES_MACHINE_READONLY #endif @@ -28,7 +28,7 @@ Index: grub-2.02~beta2/grub-core/kern/dl.c #pragma GCC diagnostic ignored "-Wcast-align" -@@ -682,6 +686,19 @@ grub_dl_load_file (const char *filename) +@@ -688,6 +692,19 @@ grub_dl_load_file (const char *filename) grub_boot_time ("Loading module %s", filename); @@ -45,14 +45,14 @@ Index: grub-2.02~beta2/grub-core/kern/dl.c + } +#endif + - file = grub_file_open (filename); + file = grub_file_open (filename, GRUB_FILE_TYPE_GRUB_MODULE); if (! file) return 0; -Index: grub-2.02~beta2/grub-core/kern/efi/efi.c +Index: grub-2.04~rc1/grub-core/kern/efi/efi.c =================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/efi/efi.c -+++ grub-2.02~beta2/grub-core/kern/efi/efi.c -@@ -259,6 +259,34 @@ grub_efi_get_variable (const char *var, +--- grub-2.04~rc1.orig/grub-core/kern/efi/efi.c ++++ grub-2.04~rc1/grub-core/kern/efi/efi.c +@@ -273,6 +273,34 @@ grub_efi_get_variable (const char *var, return NULL; } @@ -87,11 +87,11 @@ Index: grub-2.02~beta2/grub-core/kern/efi/efi.c #pragma GCC diagnostic ignored "-Wcast-align" /* Search the mods section from the PE32/PE32+ image. This code uses -Index: grub-2.02~beta2/include/grub/efi/efi.h +Index: grub-2.04~rc1/include/grub/efi/efi.h =================================================================== ---- grub-2.02~beta2.orig/include/grub/efi/efi.h -+++ grub-2.02~beta2/include/grub/efi/efi.h -@@ -72,6 +72,7 @@ EXPORT_FUNC (grub_efi_set_variable) (con +--- grub-2.04~rc1.orig/include/grub/efi/efi.h ++++ grub-2.04~rc1/include/grub/efi/efi.h +@@ -85,6 +85,7 @@ EXPORT_FUNC (grub_efi_set_variable) (con const grub_efi_guid_t *guid, void *data, grub_size_t datasize); diff --git a/grub2-secureboot-provide-linuxefi-config.patch b/grub2-secureboot-provide-linuxefi-config.patch index 3628b26..458d22e 100644 --- a/grub2-secureboot-provide-linuxefi-config.patch +++ b/grub2-secureboot-provide-linuxefi-config.patch @@ -25,11 +25,11 @@ has shim exported protocols available. util/grub.d/10_linux.in | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) -Index: grub-2.02~beta2/util/grub-mkconfig.in +Index: grub-2.04~rc1/util/grub-mkconfig.in =================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig.in -+++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -254,7 +254,8 @@ export GRUB_DEFAULT \ +--- grub-2.04~rc1.orig/util/grub-mkconfig.in ++++ grub-2.04~rc1/util/grub-mkconfig.in +@@ -271,7 +271,8 @@ export GRUB_DEFAULT \ GRUB_BADRAM \ GRUB_OS_PROBER_SKIP_LIST \ GRUB_DISABLE_SUBMENU \ @@ -39,11 +39,11 @@ Index: grub-2.02~beta2/util/grub-mkconfig.in if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" -Index: grub-2.02~beta2/util/grub.d/10_linux.in +Index: grub-2.04~rc1/util/grub.d/10_linux.in =================================================================== ---- grub-2.02~beta2.orig/util/grub.d/10_linux.in -+++ grub-2.02~beta2/util/grub.d/10_linux.in -@@ -133,7 +133,7 @@ linux_entry () +--- grub-2.04~rc1.orig/util/grub.d/10_linux.in ++++ grub-2.04~rc1/util/grub.d/10_linux.in +@@ -145,7 +145,7 @@ linux_entry () printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" fi message="$(gettext_printf "Loading Linux %s ..." ${version})" @@ -52,12 +52,12 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' linuxefi ${rel_dirname}/${basename} ${root_device} ${args} -@@ -147,7 +147,7 @@ EOF - if test -n "${initrd}" ; then - # TRANSLATORS: ramdisk isn't identifier. Should be translated. - message="$(gettext_printf "Loading initial ramdisk ...")" +@@ -163,7 +163,7 @@ EOF + for i in ${initrd}; do + initrd_path="${initrd_path} ${rel_dirname}/${i}" + done - if [ -d /sys/firmware/efi ]; then + if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' - initrdefi ${rel_dirname}/${initrd} + initrdefi $(echo $initrd_path) diff --git a/grub2-secureboot-use-linuxefi-on-uefi.patch b/grub2-secureboot-use-linuxefi-on-uefi.patch index 23c28a6..c417786 100644 --- a/grub2-secureboot-use-linuxefi-on-uefi.patch +++ b/grub2-secureboot-use-linuxefi-on-uefi.patch @@ -11,11 +11,11 @@ Signed-off-by: Michael Chang util/grub.d/10_linux.in | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) -Index: grub-2.02~beta2/util/grub.d/10_linux.in +Index: grub-2.04~rc1/util/grub.d/10_linux.in =================================================================== ---- grub-2.02~beta2.orig/util/grub.d/10_linux.in -+++ grub-2.02~beta2/util/grub.d/10_linux.in -@@ -133,17 +133,31 @@ linux_entry () +--- grub-2.04~rc1.orig/util/grub.d/10_linux.in ++++ grub-2.04~rc1/util/grub.d/10_linux.in +@@ -145,10 +145,17 @@ linux_entry () printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" fi message="$(gettext_printf "Loading Linux %s ..." ${version})" @@ -34,16 +34,20 @@ Index: grub-2.02~beta2/util/grub.d/10_linux.in if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. message="$(gettext_printf "Loading initial ramdisk ...")" +@@ -156,10 +163,17 @@ EOF + for i in ${initrd}; do + initrd_path="${initrd_path} ${rel_dirname}/${i}" + done - sed "s/^/$submenu_indentation/" << EOF + if [ -d /sys/firmware/efi ]; then + sed "s/^/$submenu_indentation/" << EOF + echo '$(echo "$message" | grub_quote)' -+ initrdefi ${rel_dirname}/${initrd} ++ initrdefi $(echo $initrd_path) +EOF + else + sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' - initrd ${rel_dirname}/${initrd} + initrd $(echo $initrd_path) EOF + fi fi diff --git a/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch b/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch index 7f0febd..4d35d12 100644 --- a/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch +++ b/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch @@ -1,8 +1,11 @@ -Index: grub-2.02/util/setup.c + +V2: Add fs_ prefix to fs functions by upstream commit ad4bfee + +Index: grub-2.04/util/setup.c =================================================================== ---- grub-2.02.orig/util/setup.c -+++ grub-2.02/util/setup.c -@@ -511,8 +511,42 @@ SETUP (const char *dir, +--- grub-2.04.orig/util/setup.c ++++ grub-2.04/util/setup.c +@@ -526,8 +526,42 @@ SETUP (const char *dir, err = grub_util_ldm_embed (dest_dev->disk, &nsec, maxsec, GRUB_EMBED_PCBIOS, §ors); else if (ctx.dest_partmap) @@ -19,14 +22,14 @@ Index: grub-2.02/util/setup.c + grub_fs_t root_fs; + + root_fs = grub_fs_probe (root_dev); -+ if (root_fs && root_fs->embed) ++ if (root_fs && root_fs->fs_embed) + { + grub_disk_addr_t *fs_sectors; + unsigned int fs_nsec; + + fs_sectors = NULL; + fs_nsec = core_sectors; -+ err = root_fs->embed (root_dev, &fs_nsec, maxsec, ++ err = root_fs->fs_embed (root_dev, &fs_nsec, maxsec, + GRUB_EMBED_PCBIOS, &fs_sectors); + if (!err && fs_nsec >= core_sectors) + { @@ -45,9 +48,9 @@ Index: grub-2.02/util/setup.c +#endif + } else - err = fs->embed (dest_dev, &nsec, maxsec, - GRUB_EMBED_PCBIOS, §ors); -@@ -594,7 +628,7 @@ SETUP (const char *dir, + err = fs->fs_embed (dest_dev, &nsec, maxsec, + GRUB_EMBED_PCBIOS, §ors); +@@ -639,7 +673,7 @@ SETUP (const char *dir, /* Write the core image onto the disk. */ for (i = 0; i < nsec; i++) @@ -55,4 +58,4 @@ Index: grub-2.02/util/setup.c + grub_disk_write (core_dev->disk, sectors[i], 0, GRUB_DISK_SECTOR_SIZE, core_img + i * GRUB_DISK_SECTOR_SIZE); - + #endif diff --git a/grub2.changes b/grub2.changes index 3e78162..917c2c7 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,86 @@ +------------------------------------------------------------------- +Thu Oct 17 06:34:52 UTC 2019 - Michael Chang + +- Version bump to 2.04 + * removed + - translations-20170427.tar.xz + * grub2.spec + - Make signed grub-tpm.efi specific to x86_64-efi build, the platform + currently shipped with tpm module from upstream codebase + - Add shim_lock to signed grub.efi in x86_64-efi build + - x86_64: linuxefi now depends on linux, both will verify kernel via + shim_lock + - Remove translation tarball and po file hacks as it's been included in + upstream tarball + * rediff + - grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch + - grub2-commands-introduce-read_file-subcommand.patch + - grub2-secureboot-add-linuxefi.patch + - 0001-add-support-for-UEFI-network-protocols.patch + - grub2-efi-HP-workaround.patch + - grub2-secureboot-install-signed-grub.patch + - grub2-linux.patch + - use-grub2-as-a-package-name.patch + - grub2-pass-corret-root-for-nfsroot.patch + - grub2-secureboot-use-linuxefi-on-uefi.patch + - grub2-secureboot-no-insmod-on-sb.patch + - grub2-secureboot-provide-linuxefi-config.patch + - grub2-secureboot-chainloader.patch + - grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch + - grub2-s390x-02-kexec-module-added-to-emu.patch + - grub2-s390x-04-grub2-install.patch + - grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch + - grub2-efi-chainloader-root.patch + - grub2-ppc64le-disable-video.patch + - grub2-ppc64-cas-reboot-support.patch + - grub2-Fix-incorrect-netmask-on-ppc64.patch + - 0003-bootp-New-net_bootp6-command.patch + - 0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch + - 0012-tpm-Build-tpm-as-module.patch + - grub2-emu-4-all.patch + - grub2-btrfs-09-get-default-subvolume.patch + - grub2-ppc64le-memory-map.patch + - grub2-ppc64-cas-fix-double-free.patch + - 0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch + * drop upstream patches + - grub2-fix-locale-en.mo.gz-not-found-error-message.patch + - grub2-fix-build-with-flex-2.6.4.patch + - grub2-accept-empty-module.patch + - 0001-Fix-packed-not-aligned-error-on-GCC-8.patch + - 0001-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled-MMIO-da.patch + - unix-exec-avoid-atexit-handlers-when-child-exits.patch + - 0001-xfs-Accept-filesystem-with-sparse-inodes.patch + - grub2-binutils2.31.patch + - grub2-msdos-fix-overflow.patch + - 0001-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch + - grub2-efi-Move-grub_reboot-into-kernel.patch + - grub2-efi-Free-malloc-regions-on-exit.patch + - grub2-move-initrd-upper.patch + - 0002-Add-Virtual-LAN-support.patch + - 0001-ofnet-Initialize-structs-in-bootpath-parser.patch + - 0001-misc-fix-invalid-character-recongition-in-strto-l.patch + - 0001-tpm-Core-TPM-support.patch + - 0002-tpm-Measure-kernel-initrd.patch + - 0003-tpm-Add-BIOS-boot-measurement.patch + - 0004-tpm-Rework-linux-command.patch + - 0005-tpm-Rework-linux16-command.patch + - 0006-tpm-Measure-kernel-and-initrd-on-BIOS-systems.patch + - 0007-tpm-Measure-the-kernel-commandline.patch + - 0008-tpm-Measure-commands.patch + - 0009-tpm-Measure-multiboot-images-and-modules.patch + - 0010-tpm-Fix-boot-when-there-s-no-TPM.patch + - 0011-tpm-Fix-build-error.patch + - 0013-tpm-i386-pc-diskboot-img.patch + - grub2-freetype-pkgconfig.patch + - 0001-cpio-Disable-gcc9-Waddress-of-packed-member.patch + - 0002-jfs-Disable-gcc9-Waddress-of-packed-member.patch + - 0003-hfs-Fix-gcc9-error-Waddress-of-packed-member.patch + - 0004-hfsplus-Fix-gcc9-error-with-Waddress-of-packed-membe.patch + - 0005-acpi-Fix-gcc9-error-Waddress-of-packed-member.patch + - 0006-usbtest-Disable-gcc9-Waddress-of-packed-member.patch + - 0007-chainloader-Fix-gcc9-error-Waddress-of-packed-member.patch + - 0008-efi-Fix-gcc9-error-Waddress-of-packed-member.patch + ------------------------------------------------------------------- Tue Oct 15 13:29:14 UTC 2019 - rw@suse.com @@ -39,7 +122,7 @@ Mon Jun 17 09:45:49 UTC 2019 - mchang@suse.com ------------------------------------------------------------------- Fri Jun 14 06:13:58 UTC 2019 - mchang@suse.com -- Avoid high resolution when trying to keep current mode (bsc#1133842) +- Avoid high resolution when trying to keep current mode (bsc#1133842) * grub2-video-limit-the-resolution-for-fixed-bimap-font.patch - Make GRUB_SAVEDEFAULT working with btrfs (bsc#1128592) * grub2-grubenv-in-btrfs-header.patch diff --git a/grub2.spec b/grub2.spec index f0bd007..c13a4aa 100644 --- a/grub2.spec +++ b/grub2.spec @@ -142,19 +142,16 @@ BuildRequires: update-bootloader-rpm-macros %define only_x86_64 %{nil} %endif -Version: 2.02 +Version: 2.04 Release: 0 Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later Group: System/Boot Url: http://www.gnu.org/software/grub/ -%define rev 20120622 -Source0: grub-%{version}.tar.xz +Source0: https://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz Source1: 90_persistent Source2: grub.default Source4: grub2.rpmlintrc -# rsync -Lrtvz translationproject.org::tp/latest/grub/ po -Source5: translations-20170427.tar.xz Source6: grub2-once Source7: 20_memtest86+ Source8: README.ibm3215 @@ -176,11 +173,9 @@ Patch6: grub2-iterate-and-hook-for-extended-partition.patch Patch8: grub2-ppc-terminfo.patch Patch9: grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch Patch10: grub2-fix-error-terminal-gfxterm-isn-t-found.patch -Patch11: grub2-fix-build-with-flex-2.6.4.patch Patch12: grub2-fix-menu-in-xen-host-server.patch Patch15: not-display-menu-when-boot-once.patch Patch17: grub2-pass-corret-root-for-nfsroot.patch -Patch18: grub2-fix-locale-en.mo.gz-not-found-error-message.patch Patch19: grub2-efi-HP-workaround.patch Patch21: grub2-secureboot-add-linuxefi.patch Patch22: grub2-secureboot-use-linuxefi-on-uefi.patch @@ -208,7 +203,6 @@ Patch65: grub2-mkconfig-aarch64.patch Patch70: grub2-default-distributor.patch Patch71: grub2-menu-unrestricted.patch Patch72: grub2-mkconfig-arm.patch -Patch74: grub2-accept-empty-module.patch Patch75: grub2-s390x-06-loadparm.patch Patch76: grub2-s390x-07-add-image-param-for-zipl-setup.patch Patch77: grub2-s390x-08-workaround-part-to-disk.patch @@ -220,15 +214,8 @@ Patch82: grub2-diskfilter-support-pv-without-metadatacopies.patch Patch83: grub2-efi-uga-64bit-fb.patch Patch84: grub2-s390x-09-improve-zipl-setup.patch Patch85: grub2-getroot-scan-disk-pv.patch -Patch86: 0001-Fix-packed-not-aligned-error-on-GCC-8.patch -Patch87: 0001-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled-MMIO-da.patch -Patch88: unix-exec-avoid-atexit-handlers-when-child-exits.patch -Patch89: 0001-xfs-Accept-filesystem-with-sparse-inodes.patch -Patch90: grub2-binutils2.31.patch -Patch91: grub2-msdos-fix-overflow.patch Patch92: grub2-util-30_os-prober-multiple-initrd.patch Patch93: grub2-getroot-support-nvdimm.patch -Patch94: 0001-tsc-Change-default-tsc-calibration-method-to-pmtimer.patch # Btrfs snapshot booting related patches Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch Patch102: grub2-btrfs-02-export-subvolume-envvars.patch @@ -249,30 +236,22 @@ Patch124: grub2-efi-xen-removable.patch # Hidden menu entry and hotkey "t" for text console Patch140: grub2-Add-hidden-menu-entries.patch Patch141: grub2-SUSE-Add-the-t-hotkey.patch -# EFI free memory on exit fix (bsc#980739) -Patch150: grub2-efi-Move-grub_reboot-into-kernel.patch -Patch151: grub2-efi-Free-malloc-regions-on-exit.patch # Linux root device related patches Patch163: grub2-zipl-setup-fix-btrfs-multipledev.patch Patch164: grub2-suse-remove-linux-root-param.patch -# ARM patches - boo#1123350 -Patch180: grub2-move-initrd-upper.patch # PPC64 LE support Patch205: grub2-ppc64le-disable-video.patch Patch207: grub2-ppc64le-memory-map.patch # PPC -Patch210: 0002-Add-Virtual-LAN-support.patch Patch211: grub2-ppc64-cas-reboot-support.patch Patch212: grub2-install-remove-useless-check-PReP-partition-is-empty.patch Patch213: grub2-Fix-incorrect-netmask-on-ppc64.patch Patch215: grub2-ppc64-cas-new-scope.patch -Patch216: 0001-ofnet-Initialize-structs-in-bootpath-parser.patch Patch218: grub2-ppc64-cas-fix-double-free.patch Patch233: grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch Patch234: fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-new-glibc.patch Patch236: grub2-efi_gop-avoid-low-resolution.patch # Support HTTP Boot IPv4 and IPv6 (fate#320129) -Patch280: 0001-misc-fix-invalid-character-recongition-in-strto-l.patch Patch281: 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch Patch282: 0003-bootp-New-net_bootp6-command.patch Patch283: 0004-efinet-UEFI-IPv6-PXE-support.patch @@ -283,19 +262,7 @@ Patch287: 0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch # Fix GOP BLT support (FATE#322332) Patch311: grub2-efi-gop-add-blt.patch # TPM Support (FATE#315831) -Patch400: 0001-tpm-Core-TPM-support.patch -Patch401: 0002-tpm-Measure-kernel-initrd.patch -Patch402: 0003-tpm-Add-BIOS-boot-measurement.patch -Patch403: 0004-tpm-Rework-linux-command.patch -Patch404: 0005-tpm-Rework-linux16-command.patch -Patch405: 0006-tpm-Measure-kernel-and-initrd-on-BIOS-systems.patch -Patch406: 0007-tpm-Measure-the-kernel-commandline.patch -Patch407: 0008-tpm-Measure-commands.patch -Patch408: 0009-tpm-Measure-multiboot-images-and-modules.patch -Patch409: 0010-tpm-Fix-boot-when-there-s-no-TPM.patch -Patch410: 0011-tpm-Fix-build-error.patch Patch411: 0012-tpm-Build-tpm-as-module.patch -Patch412: 0013-tpm-i386-pc-diskboot-img.patch # UEFI HTTP and related network protocol support (FATE#320130) Patch420: 0001-add-support-for-UEFI-network-protocols.patch Patch421: 0002-AUDIT-0-http-boot-tracker-bug.patch @@ -305,22 +272,11 @@ Patch430: grub2-mkconfig-default-entry-correction.patch Patch431: grub2-s390x-10-keep-network-at-kexec.patch # Support for UEFI Secure Boot on AArch64 (FATE#326541) Patch450: grub2-secureboot-install-signed-grub.patch -# Use pkg-config to find Freetype2 -Patch500: grub2-freetype-pkgconfig.patch Patch501: grub2-btrfs-help-on-snapper-rollback.patch # Improved hiDPI device support (FATE#326680) Patch510: grub2-video-limit-the-resolution-for-fixed-bimap-font.patch # Support long menuentries (FATE#325760) Patch511: grub2-gfxmenu-support-scrolling-menu-entry-s-text.patch -# Fix GCC 9 build failure (bsc#1121208) -Patch520: 0001-cpio-Disable-gcc9-Waddress-of-packed-member.patch -Patch521: 0002-jfs-Disable-gcc9-Waddress-of-packed-member.patch -Patch522: 0003-hfs-Fix-gcc9-error-Waddress-of-packed-member.patch -Patch523: 0004-hfsplus-Fix-gcc9-error-with-Waddress-of-packed-membe.patch -Patch524: 0005-acpi-Fix-gcc9-error-Waddress-of-packed-member.patch -Patch525: 0006-usbtest-Disable-gcc9-Waddress-of-packed-member.patch -Patch526: 0007-chainloader-Fix-gcc9-error-Waddress-of-packed-member.patch -Patch527: 0008-efi-Fix-gcc9-error-Waddress-of-packed-member.patch Requires: gettext-runtime %if 0%{?suse_version} >= 1140 @@ -487,8 +443,7 @@ swap partition while in resuming %prep # We create (if we build for efi) two copies of the sources in the Builddir -%setup -q -n grub-%{version} -a 5 -(cd po && ls *.po | cut -d. -f1 | xargs) >po/LINGUAS +%setup -q -n grub-%{version} %patch1 -p1 %patch2 -p1 %patch3 -p1 @@ -497,11 +452,9 @@ swap partition while in resuming %patch8 -p1 %patch9 -p1 %patch10 -p1 -%patch11 -p1 %patch12 -p1 %patch15 -p1 %patch17 -p1 -%patch18 -p1 %patch19 -p1 %patch21 -p1 %patch22 -p1 @@ -529,7 +482,6 @@ swap partition while in resuming %patch70 -p1 %patch71 -p1 %patch72 -p1 -%patch74 -p1 %patch75 -p1 %patch76 -p1 %patch77 -p1 @@ -541,15 +493,8 @@ swap partition while in resuming %patch83 -p1 %patch84 -p1 %patch85 -p1 -%patch86 -p1 -%patch87 -p1 -%patch88 -p1 -%patch89 -p1 -%patch90 -p1 -%patch91 -p1 %patch92 -p1 %patch93 -p1 -%patch94 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1 @@ -567,24 +512,18 @@ swap partition while in resuming %patch124 -p1 %patch140 -p1 %patch141 -p1 -%patch150 -p1 -%patch151 -p1 %patch163 -p1 %patch164 -p1 -%patch180 -p1 %patch205 -p1 %patch207 -p1 -%patch210 -p1 %patch211 -p1 %patch212 -p1 %patch213 -p1 %patch215 -p1 -%patch216 -p1 %patch218 -p1 %patch233 -p1 %patch234 -p1 %patch236 -p1 -%patch280 -p1 %patch281 -p1 %patch282 -p1 %patch283 -p1 @@ -593,36 +532,15 @@ swap partition while in resuming %patch286 -p1 %patch287 -p1 %patch311 -p1 -%patch400 -p1 -%patch401 -p1 -%patch402 -p1 -%patch403 -p1 -%patch404 -p1 -%patch405 -p1 -%patch406 -p1 -%patch407 -p1 -%patch408 -p1 -%patch409 -p1 -%patch410 -p1 %patch411 -p1 -%patch412 -p1 %patch420 -p1 %patch421 -p1 %patch430 -p1 %patch431 -p1 %patch450 -p1 -%patch500 -p1 %patch501 -p1 %patch510 -p1 %patch511 -p1 -%patch520 -p1 -%patch521 -p1 -%patch522 -p1 -%patch523 -p1 -%patch524 -p1 -%patch525 -p1 -%patch526 -p1 -%patch527 -p1 %build # collect evidence to debug spurious build failure on SLE15 @@ -636,14 +554,6 @@ ulimit -a # This simplifies patch handling without need to use git to create patch # that renames file mv docs/grub.texi docs/grub2.texi -# This avoids attempt to rebuild potfiles which fails because necessary -# sources are not included in tarball -mv po/grub.pot po/%{name}.pot - -# Generate po/LINGUAS for message catalogs ... -./linguas.sh -# ... and make sure new catalogs are actually created -rm -f po/stamp-po cp %{SOURCE8} . mkdir build @@ -736,7 +646,7 @@ PXE_MODULES="efinet tftp http" CRYPTO_MODULES="luks gcry_rijndael gcry_sha1 gcry_sha256" %ifarch x86_64 -CD_MODULES="${CD_MODULES} linuxefi" +CD_MODULES="${CD_MODULES} shim_lock linuxefi" %else CD_MODULES="${CD_MODULES} linux" %endif @@ -744,8 +654,10 @@ CD_MODULES="${CD_MODULES} linux" GRUB_MODULES="${CD_MODULES} ${FS_MODULES} ${PXE_MODULES} ${CRYPTO_MODULES} mdraid09 mdraid1x lvm serial" ./grub-mkimage -O %{grubefiarch} -o grub.efi --prefix= \ -d grub-core ${GRUB_MODULES} +%ifarch x86_64 ./grub-mkimage -O %{grubefiarch} -o grub-tpm.efi --prefix= \ -d grub-core ${GRUB_MODULES} tpm +%endif %ifarch x86_64 aarch64 %if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110 @@ -824,7 +736,10 @@ cd .. %ifarch %{efi} cd build-efi %make_install -install -m 644 grub.efi grub-tpm.efi %{buildroot}/%{_datadir}/%{name}/%{grubefiarch}/. +install -m 644 grub.efi %{buildroot}/%{_datadir}/%{name}/%{grubefiarch}/. +%ifarch x86_64 +install -m 644 grub-tpm.efi %{buildroot}/%{_datadir}/%{name}/%{grubefiarch}/. +%endif # Create grub.efi link to system efi directory # This is for tools like kiwi not fiddling with the path @@ -845,7 +760,10 @@ EoM %ifarch x86_64 aarch64 %if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110 -export BRP_PESIGN_FILES="%{_datadir}/%{name}/%{grubefiarch}/grub.efi %{_datadir}/%{name}/%{grubefiarch}/grub-tpm.efi" +export BRP_PESIGN_FILES="%{_datadir}/%{name}/%{grubefiarch}/grub.efi" +%ifarch x86_64 +BRP_PESIGN_FILES="${BRP_PESIGN_FILES} %{_datadir}/%{name}/%{grubefiarch}/grub-tpm.efi" +%endif install -m 444 grub.der %{buildroot}/%{sysefidir}/ %endif %endif @@ -1252,7 +1170,9 @@ fi %defattr(-,root,root,-) %dir %{_datadir}/%{name}/%{grubefiarch} %{_datadir}/%{name}/%{grubefiarch}/grub.efi +%ifarch x86_64 %{_datadir}/%{name}/%{grubefiarch}/grub-tpm.efi +%endif %{_datadir}/%{name}/%{grubefiarch}/*.img %{_datadir}/%{name}/%{grubefiarch}/*.lst %{_datadir}/%{name}/%{grubefiarch}/*.mod diff --git a/translations-20170427.tar.xz b/translations-20170427.tar.xz deleted file mode 100644 index ea0bb13..0000000 --- a/translations-20170427.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2793b20ede25e0d3a63ab5939a4fca6786d40d09946711350f8bf3cf9639f079 -size 585860 diff --git a/unix-exec-avoid-atexit-handlers-when-child-exits.patch b/unix-exec-avoid-atexit-handlers-when-child-exits.patch deleted file mode 100644 index 3a5fcfb..0000000 --- a/unix-exec-avoid-atexit-handlers-when-child-exits.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Patrick Steinhardt -Date: Mon, 28 Aug 2017 20:57:19 +0200 -Subject: unix exec: avoid atexit handlers when child exits -Git-commit: e75cf4a58b5eaf482804e5e1b2cc7d4399df350e -Patch-mainline: Yes, but not released yet -References: bsc#1086670 - -The `grub_util_exec_redirect_all` helper function can be used to -spawn an executable and redirect its output to some files. After calling -`fork()`, the parent will wait for the child to terminate with -`waitpid()` while the child prepares its file descriptors, environment -and finally calls `execvp()`. If something in the children's setup -fails, it will stop by calling `exit(127)`. - -Calling `exit()` will cause any function registered via `atexit()` to be -executed, which is usually the wrong thing to do in a child. And -actually, one can easily observe faulty behaviour on musl-based systems -without modprobe(8) installed: executing `grub-install --help` will call -`grub_util_exec_redirect_all` with "modprobe", which obviously fails if -modprobe(8) is not installed. Due to the child now exiting and invoking -the `atexit()` handlers, it will clean up some data structures of the -parent and cause it to be deadlocked in the `waitpid()` syscall. - -The issue can easily be fixed by calling `_exit(127)` instead, which is -especially designed to be called when the atexit-handlers should not be -executed. - -Signed-off-by: Patrick Steinhardt ---- - grub-core/osdep/unix/exec.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/grub-core/osdep/unix/exec.c -+++ b/grub-core/osdep/unix/exec.c -@@ -99,7 +99,7 @@ grub_util_exec_redirect_all (const char - { - fd = open (stdin_file, O_RDONLY); - if (fd < 0) -- exit (127); -+ _exit (127); - dup2 (fd, STDIN_FILENO); - close (fd); - } -@@ -108,7 +108,7 @@ grub_util_exec_redirect_all (const char - { - fd = open (stdout_file, O_WRONLY | O_CREAT, 0700); - if (fd < 0) -- exit (127); -+ _exit (127); - dup2 (fd, STDOUT_FILENO); - close (fd); - } -@@ -117,7 +117,7 @@ grub_util_exec_redirect_all (const char - { - fd = open (stderr_file, O_WRONLY | O_CREAT, 0700); - if (fd < 0) -- exit (127); -+ _exit (127); - dup2 (fd, STDERR_FILENO); - close (fd); - } -@@ -126,7 +126,7 @@ grub_util_exec_redirect_all (const char - setenv ("LC_ALL", "C", 1); - - execvp ((char *) argv[0], (char **) argv); -- exit (127); -+ _exit (127); - } - waitpid (pid, &status, 0); - if (!WIFEXITED (status)) diff --git a/use-grub2-as-a-package-name.patch b/use-grub2-as-a-package-name.patch index a8281a8..9639a42 100644 --- a/use-grub2-as-a-package-name.patch +++ b/use-grub2-as-a-package-name.patch @@ -12,16 +12,16 @@ Signed-off-by: Jiri Slaby configure.ac | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) -Index: grub-2.02/configure.ac +Index: grub-2.04/configure.ac =================================================================== ---- grub-2.02.orig/configure.ac -+++ grub-2.02/configure.ac +--- grub-2.04.orig/configure.ac ++++ grub-2.04/configure.ac @@ -31,7 +31,7 @@ dnl (such as BUILD_CC, BUILD_CFLAGS, etc dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are dnl used for the target type. See INSTALL for full list of variables. --AC_INIT([GRUB],[2.02],[bug-grub@gnu.org]) -+AC_INIT([GRUB2],[2.02],[bug-grub@gnu.org]) +-AC_INIT([GRUB],[2.04],[bug-grub@gnu.org]) ++AC_INIT([GRUB2],[2.04],[bug-grub@gnu.org]) AC_CONFIG_AUX_DIR([build-aux])