From cc490a048e42cd58fd7c87e468e7b47820238e6719b5e7649c96c8e010cc7f45 Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Thu, 18 Feb 2010 14:10:48 +0000 Subject: [PATCH] Accepting request 32673 from devel:openSUSE:Factory Copy from devel:openSUSE:Factory/grub2 based on submit request 32673 from user a_jaeger OBS-URL: https://build.opensuse.org/request/show/32673 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=1 --- ...lid-character-recongition-in-strto-l.patch | 37 - 0002-Add-Virtual-LAN-support.patch | 360 ---- ...racketed-ipv6-addrs-and-port-numbers.patch | 250 --- 0003-bootp-New-net_bootp6-command.patch | 1118 ---------- 0004-efinet-UEFI-IPv6-PXE-support.patch | 127 -- 0005-grub.texi-Add-net_bootp6-doument.patch | 51 - ...essing-DHCPACK-packet-from-HTTP-Boot.patch | 130 -- ...etting-network-from-UEFI-device-path.patch | 389 ---- ...etting-DNS-server-from-UEFI-protocol.patch | 340 --- 20_memtest86+ | 59 - 80_suse_btrfs_snapshot | 10 - PATCH_POLICY | 6 - README.ibm3215 | 59 - README.openSUSE | 48 + SLES-UEFI-CA-Certificate.crt | 39 - ...-for-partition-lookup-with-new-glibc.patch | 17 - grub-1.95-grubdir.patch | 17 + grub-1.97.2.tar.gz | 3 + grub-2.02~rc1.tar.xz | 3 - grub.default | 41 +- grub2-Add-hidden-menu-entries.patch | 232 -- ...INE_LINUX_RECOVERY-for-recovery-mode.patch | 46 - grub2-SUSE-Add-the-t-hotkey.patch | 68 - grub2-accept-empty-module.patch | 22 - ...-add-ability-to-boot-from-subvolumes.patch | 696 ------ grub2-btrfs-02-export-subvolume-envvars.patch | 21 - grub2-btrfs-03-follow_default.patch | 187 -- grub2-btrfs-04-grub2-install.patch | 160 -- grub2-btrfs-05-grub2-mkconfig.patch | 136 -- grub2-btrfs-06-subvol-mount.patch | 512 ----- grub2-btrfs-07-subvol-fallback.patch | 46 - ...rkaround-snapshot-menu-default-entry.patch | 58 - grub2-btrfs-workaround-grub2-once.patch | 475 ----- ...mands-introduce-read_file-subcommand.patch | 70 - grub2-default-distributor.patch | 200 -- grub2-dlsym-v4.patch | 30 + grub2-editenv-add-warning-message.patch | 36 - grub2-efi-Free-malloc-regions-on-exit.patch | 88 - grub2-efi-HP-workaround.patch | 93 - grub2-efi-chainload-harder.patch | 103 - grub2-efi-chainloader-root.patch | 39 - ...-efi-disable-video-cirrus-and-bochus.patch | 35 - grub2-efi-gop-add-blt.patch | 59 - grub2-efi-xen-chainload.patch | 166 -- grub2-efi-xen-cmdline.patch | 27 - grub2-efi_gop-avoid-low-resolution.patch | 39 - grub2-emu-4-all.patch | 170 -- ...x-error-terminal-gfxterm-isn-t-found.patch | 33 - ...ale-en.mo.gz-not-found-error-message.patch | 37 - grub2-fix-menu-in-xen-host-server.patch | 130 -- ...ix-multi-device-root-kernel-argument.patch | 44 - ...oot-treat-mdadm-ddf-as-simple-device.patch | 68 - ...rate-and-hook-for-extended-partition.patch | 48 - grub2-linguas.sh-no-rsync.patch | 21 - grub2-linux.patch | 51 +- grub2-menu-unrestricted.patch | 23 - grub2-mkconfig-aarch64.patch | 14 - grub2-mkconfig-arm.patch | 12 - grub2-once | 291 --- grub2-once.service | 16 - grub2-pass-corret-root-for-nfsroot.patch | 131 -- grub2-ppc-terminfo.patch | 151 -- grub2-ppc64-cas-reboot-support.patch | 170 -- grub2-ppc64le-disable-video.patch | 49 - grub2-ppc64le-memory-map.patch | 84 - ...-files-added-in-order-to-allow-s390x.patch | 304 --- ...2-s390x-02-kexec-module-added-to-emu.patch | 342 --- grub2-s390x-03-output-7-bit-ascii.patch | 530 ----- grub2-s390x-04-grub2-install.patch | 1066 ---------- grub2-s390x-05-grub2-mkconfig.patch | 147 -- grub2-s390x-06-loadparm.patch | 47 - ...0x-07-add-image-param-for-zipl-setup.patch | 41 - grub2-s390x-08-workaround-part-to-disk.patch | 15 - grub2-secureboot-add-linuxefi.patch | 481 ----- grub2-secureboot-chainloader.patch | 690 ------ grub2-secureboot-no-insmod-on-sb.patch | 101 - ...2-secureboot-provide-linuxefi-config.patch | 63 - ...ot-use-linuxefi-on-uefi-in-os-prober.patch | 54 - grub2-secureboot-use-linuxefi-on-uefi.patch | 51 - ...up-try-fs-embed-if-mbr-gap-too-small.patch | 58 - grub2-snapper-plugin.sh | 281 --- grub2-suse-remove-linux-root-param.patch | 83 - grub2-systemd-sleep.sh | 216 -- ...Unifont-for-starfield-theme-terminal.patch | 15 - grub2-use-rpmsort-for-version-sorting.patch | 12 - ...tead-of-udevadm-for-partition-lookup.patch | 32 - ...-vbe-blacklist-preferred-1440x900x32.patch | 20 - grub2-xen-linux16.patch | 31 - grub2-xen-pv-firmware.cfg | 136 -- grub2-zipl-setup-fix-btrfs-multipledev.patch | 15 - grub2.changes | 1884 ----------------- grub2.rpmlintrc | 9 - grub2.spec | 1157 +--------- info-dir-entry.patch | 29 - not-display-menu-when-boot-once.patch | 31 - openSUSE-UEFI-CA-Certificate.crt | 26 - ready | 0 rename-grub-info-file-to-grub2.patch | 40 - translations-20140921.tar.xz | 3 - use-grub2-as-a-package-name.patch | 27 - 100 files changed, 209 insertions(+), 16119 deletions(-) delete mode 100644 0001-misc-fix-invalid-character-recongition-in-strto-l.patch delete mode 100644 0002-Add-Virtual-LAN-support.patch delete mode 100644 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch delete mode 100644 0003-bootp-New-net_bootp6-command.patch delete mode 100644 0004-efinet-UEFI-IPv6-PXE-support.patch delete mode 100644 0005-grub.texi-Add-net_bootp6-doument.patch delete mode 100644 0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch delete mode 100644 0007-efinet-Setting-network-from-UEFI-device-path.patch delete mode 100644 0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch delete mode 100644 20_memtest86+ delete mode 100644 80_suse_btrfs_snapshot delete mode 100644 PATCH_POLICY delete mode 100644 README.ibm3215 create mode 100644 README.openSUSE delete mode 100644 SLES-UEFI-CA-Certificate.crt delete mode 100644 fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-new-glibc.patch create mode 100644 grub-1.95-grubdir.patch create mode 100644 grub-1.97.2.tar.gz delete mode 100644 grub-2.02~rc1.tar.xz delete mode 100644 grub2-Add-hidden-menu-entries.patch delete mode 100644 grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch delete mode 100644 grub2-SUSE-Add-the-t-hotkey.patch delete mode 100644 grub2-accept-empty-module.patch delete mode 100644 grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch delete mode 100644 grub2-btrfs-02-export-subvolume-envvars.patch delete mode 100644 grub2-btrfs-03-follow_default.patch delete mode 100644 grub2-btrfs-04-grub2-install.patch delete mode 100644 grub2-btrfs-05-grub2-mkconfig.patch delete mode 100644 grub2-btrfs-06-subvol-mount.patch delete mode 100644 grub2-btrfs-07-subvol-fallback.patch delete mode 100644 grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch delete mode 100644 grub2-btrfs-workaround-grub2-once.patch delete mode 100644 grub2-commands-introduce-read_file-subcommand.patch delete mode 100644 grub2-default-distributor.patch create mode 100644 grub2-dlsym-v4.patch delete mode 100644 grub2-editenv-add-warning-message.patch delete mode 100644 grub2-efi-Free-malloc-regions-on-exit.patch delete mode 100644 grub2-efi-HP-workaround.patch delete mode 100644 grub2-efi-chainload-harder.patch delete mode 100644 grub2-efi-chainloader-root.patch delete mode 100644 grub2-efi-disable-video-cirrus-and-bochus.patch delete mode 100644 grub2-efi-gop-add-blt.patch delete mode 100644 grub2-efi-xen-chainload.patch delete mode 100644 grub2-efi-xen-cmdline.patch delete mode 100644 grub2-efi_gop-avoid-low-resolution.patch delete mode 100644 grub2-emu-4-all.patch delete mode 100644 grub2-fix-error-terminal-gfxterm-isn-t-found.patch delete mode 100644 grub2-fix-locale-en.mo.gz-not-found-error-message.patch delete mode 100644 grub2-fix-menu-in-xen-host-server.patch delete mode 100644 grub2-fix-multi-device-root-kernel-argument.patch delete mode 100644 grub2-getroot-treat-mdadm-ddf-as-simple-device.patch delete mode 100644 grub2-iterate-and-hook-for-extended-partition.patch delete mode 100644 grub2-linguas.sh-no-rsync.patch delete mode 100644 grub2-menu-unrestricted.patch delete mode 100644 grub2-mkconfig-aarch64.patch delete mode 100644 grub2-mkconfig-arm.patch delete mode 100644 grub2-once delete mode 100644 grub2-once.service delete mode 100644 grub2-pass-corret-root-for-nfsroot.patch delete mode 100644 grub2-ppc-terminfo.patch delete mode 100644 grub2-ppc64-cas-reboot-support.patch delete mode 100644 grub2-ppc64le-disable-video.patch delete mode 100644 grub2-ppc64le-memory-map.patch delete mode 100644 grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch delete mode 100644 grub2-s390x-02-kexec-module-added-to-emu.patch delete mode 100644 grub2-s390x-03-output-7-bit-ascii.patch delete mode 100644 grub2-s390x-04-grub2-install.patch delete mode 100644 grub2-s390x-05-grub2-mkconfig.patch delete mode 100644 grub2-s390x-06-loadparm.patch delete mode 100644 grub2-s390x-07-add-image-param-for-zipl-setup.patch delete mode 100644 grub2-s390x-08-workaround-part-to-disk.patch delete mode 100644 grub2-secureboot-add-linuxefi.patch delete mode 100644 grub2-secureboot-chainloader.patch delete mode 100644 grub2-secureboot-no-insmod-on-sb.patch delete mode 100644 grub2-secureboot-provide-linuxefi-config.patch delete mode 100644 grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch delete mode 100644 grub2-secureboot-use-linuxefi-on-uefi.patch delete mode 100644 grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch delete mode 100644 grub2-snapper-plugin.sh delete mode 100644 grub2-suse-remove-linux-root-param.patch delete mode 100644 grub2-systemd-sleep.sh delete mode 100644 grub2-use-Unifont-for-starfield-theme-terminal.patch delete mode 100644 grub2-use-rpmsort-for-version-sorting.patch delete mode 100644 grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch delete mode 100644 grub2-vbe-blacklist-preferred-1440x900x32.patch delete mode 100644 grub2-xen-linux16.patch delete mode 100644 grub2-xen-pv-firmware.cfg delete mode 100644 grub2-zipl-setup-fix-btrfs-multipledev.patch delete mode 100644 grub2.rpmlintrc delete mode 100644 info-dir-entry.patch delete mode 100644 not-display-menu-when-boot-once.patch delete mode 100644 openSUSE-UEFI-CA-Certificate.crt create mode 100644 ready delete mode 100644 rename-grub-info-file-to-grub2.patch delete mode 100644 translations-20140921.tar.xz delete mode 100644 use-grub2-as-a-package-name.patch 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/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-net-read-bracketed-ipv6-addrs-and-port-numbers.patch b/0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch deleted file mode 100644 index 35b1aa4..0000000 --- a/0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch +++ /dev/null @@ -1,250 +0,0 @@ -From 4a00be0176a459fa6e199f2709eabbe8dc0d7979 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Fri, 29 Jul 2016 17:41:38 +0800 -Subject: [PATCH 2/8] net: read bracketed ipv6 addrs and port numbers - -From: Aaron Miller - -Allow specifying port numbers for http and tftp paths, and allow ipv6 addresses -to be recognized with brackets around them, which is required to specify a port -number ---- - grub-core/net/http.c | 21 ++++++++++--- - grub-core/net/net.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++--- - grub-core/net/tftp.c | 6 +++- - include/grub/net.h | 1 + - 4 files changed, 104 insertions(+), 10 deletions(-) - -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index 5aa4ad3..f182d7b 100644 ---- a/grub-core/net/http.c -+++ b/grub-core/net/http.c -@@ -312,12 +312,14 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - int i; - struct grub_net_buff *nb; - grub_err_t err; -+ char* server = file->device->net->server; -+ int port = file->device->net->port; - - nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE - + sizeof ("GET ") - 1 - + grub_strlen (data->filename) - + sizeof (" HTTP/1.1\r\nHost: ") - 1 -- + grub_strlen (file->device->net->server) -+ + grub_strlen (server) + sizeof (":XXXXXXXXXX") - + sizeof ("\r\nUser-Agent: " PACKAGE_STRING - "\r\n") - 1 - + sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX" -@@ -356,7 +358,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - sizeof (" HTTP/1.1\r\nHost: ") - 1); - - ptr = nb->tail; -- err = grub_netbuff_put (nb, grub_strlen (file->device->net->server)); -+ err = grub_netbuff_put (nb, grub_strlen (server)); - if (err) - { - grub_netbuff_free (nb); -@@ -365,6 +367,15 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - grub_memcpy (ptr, file->device->net->server, - grub_strlen (file->device->net->server)); - -+ if (port) -+ { -+ ptr = nb->tail; -+ grub_snprintf ((char *) ptr, -+ sizeof (":XXXXXXXXXX"), -+ ":%d", -+ port); -+ } -+ - ptr = nb->tail; - err = grub_netbuff_put (nb, - sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n") -@@ -390,8 +401,10 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) - grub_netbuff_put (nb, 2); - grub_memcpy (ptr, "\r\n", 2); - -- data->sock = grub_net_tcp_open (file->device->net->server, -- HTTP_PORT, http_receive, -+ grub_dprintf ("http", "opening path %s on host %s TCP port %d\n", -+ data->filename, server, port ? port : HTTP_PORT); -+ data->sock = grub_net_tcp_open (server, -+ port ? port : HTTP_PORT, http_receive, - http_err, http_err, - file); - if (!data->sock) -diff --git a/grub-core/net/net.c b/grub-core/net/net.c -index 10773fc..5cc0d2f 100644 ---- a/grub-core/net/net.c -+++ b/grub-core/net/net.c -@@ -437,6 +437,12 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) - grub_uint16_t newip[8]; - const char *ptr = val; - int word, quaddot = -1; -+ int bracketed = 0; -+ -+ if (ptr[0] == '[') { -+ bracketed = 1; -+ ptr++; -+ } - - if (ptr[0] == ':' && ptr[1] != ':') - return 0; -@@ -475,6 +481,9 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest) - grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0])); - } - grub_memcpy (ip, newip, 16); -+ if (bracketed && *ptr == ']') { -+ ptr++; -+ } - if (rest) - *rest = ptr; - return 1; -@@ -1260,8 +1269,10 @@ grub_net_open_real (const char *name) - { - grub_net_app_level_t proto; - const char *protname, *server; -+ char *host; - grub_size_t protnamelen; - int try; -+ int port = 0; - - if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0) - { -@@ -1299,6 +1310,72 @@ grub_net_open_real (const char *name) - return NULL; - } - -+ char* port_start; -+ /* ipv6 or port specified? */ -+ if ((port_start = grub_strchr (server, ':'))) -+ { -+ char* ipv6_begin; -+ if((ipv6_begin = grub_strchr (server, '['))) -+ { -+ char* ipv6_end = grub_strchr (server, ']'); -+ if(!ipv6_end) -+ { -+ grub_error (GRUB_ERR_NET_BAD_ADDRESS, -+ N_("mismatched [ in address")); -+ return NULL; -+ } -+ /* port number after bracketed ipv6 addr */ -+ if(ipv6_end[1] == ':') -+ { -+ port = grub_strtoul (ipv6_end + 2, NULL, 10); -+ if(port > 65535) -+ { -+ grub_error (GRUB_ERR_NET_BAD_ADDRESS, -+ N_("bad port number")); -+ return NULL; -+ } -+ } -+ host = grub_strndup (ipv6_begin, (ipv6_end - ipv6_begin) + 1); -+ } -+ else -+ { -+ if (grub_strchr (port_start + 1, ':')) -+ { -+ int iplen = grub_strlen (server); -+ /* bracket bare ipv6 addrs */ -+ host = grub_malloc (iplen + 3); -+ if(!host) -+ { -+ return NULL; -+ } -+ host[0] = '['; -+ grub_memcpy (host + 1, server, iplen); -+ host[iplen + 1] = ']'; -+ host[iplen + 2] = '\0'; -+ } -+ else -+ { -+ /* hostname:port or ipv4:port */ -+ port = grub_strtol (port_start + 1, NULL, 10); -+ if(port > 65535) -+ { -+ grub_error (GRUB_ERR_NET_BAD_ADDRESS, -+ N_("bad port number")); -+ return NULL; -+ } -+ host = grub_strndup (server, port_start - server); -+ } -+ } -+ } -+ else -+ { -+ host = grub_strdup (server); -+ } -+ if (!host) -+ { -+ return NULL; -+ } -+ - for (try = 0; try < 2; try++) - { - FOR_NET_APP_LEVEL (proto) -@@ -1308,14 +1385,13 @@ grub_net_open_real (const char *name) - { - grub_net_t ret = grub_zalloc (sizeof (*ret)); - if (!ret) -- return NULL; -- ret->protocol = proto; -- ret->server = grub_strdup (server); -- if (!ret->server) - { -- grub_free (ret); -+ grub_free (host); - return NULL; - } -+ ret->protocol = proto; -+ ret->port = port; -+ ret->server = host; - ret->fs = &grub_net_fs; - return ret; - } -diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c -index 7d90bf6..a0817a0 100644 ---- a/grub-core/net/tftp.c -+++ b/grub-core/net/tftp.c -@@ -314,6 +314,7 @@ tftp_open (struct grub_file *file, const char *filename) - grub_err_t err; - grub_uint8_t *nbd; - grub_net_network_level_address_t addr; -+ int port = file->device->net->port; - - data = grub_zalloc (sizeof (*data)); - if (!data) -@@ -382,13 +383,16 @@ tftp_open (struct grub_file *file, const char *filename) - err = grub_net_resolve_address (file->device->net->server, &addr); - if (err) - { -+ grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n", -+ (unsigned long long)data->file_size, -+ (unsigned long long)data->block_size); - destroy_pq (data); - grub_free (data); - return err; - } - - data->sock = grub_net_udp_open (addr, -- TFTP_SERVER_PORT, tftp_receive, -+ port ? port : TFTP_SERVER_PORT, tftp_receive, - file); - if (!data->sock) - { -diff --git a/include/grub/net.h b/include/grub/net.h -index 2192fa1..ccc169c 100644 ---- a/include/grub/net.h -+++ b/include/grub/net.h -@@ -270,6 +270,7 @@ typedef struct grub_net - { - char *server; - char *name; -+ int port; - grub_net_app_level_t protocol; - grub_net_packets_t packs; - grub_off_t offset; --- -2.6.6 - diff --git a/0003-bootp-New-net_bootp6-command.patch b/0003-bootp-New-net_bootp6-command.patch deleted file mode 100644 index 79edd45..0000000 --- a/0003-bootp-New-net_bootp6-command.patch +++ /dev/null @@ -1,1118 +0,0 @@ -From f6c8c7985fd88fc89cd49227c9e74feaf58cfdd6 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Sun, 10 Jul 2016 23:46:06 +0800 -Subject: [PATCH 3/8] bootp: New net_bootp6 command - -Implement new net_bootp6 command for IPv6 network auto configuration via the -DHCPv6 protocol (RFC3315). - -Signed-off-by: Michael Chang -Signed-off-by: Ken Lin ---- - grub-core/net/bootp.c | 908 +++++++++++++++++++++++++++++++++++++++++++++++++- - grub-core/net/ip.c | 39 +++ - 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 -@@ -24,6 +24,98 @@ - #include - #include - #include -+#include -+#include -+ -+static int -+dissect_url (const char *url, char **proto, char **host, char **path) -+{ -+ const char *p, *ps; -+ grub_size_t l; -+ -+ *proto = *host = *path = NULL; -+ ps = p = url; -+ -+ while ((p = grub_strchr (p, ':'))) -+ { -+ if (grub_strlen (p) < sizeof ("://") - 1) -+ break; -+ if (grub_memcmp (p, "://", sizeof ("://") - 1) == 0) -+ { -+ l = p - ps; -+ *proto = grub_malloc (l + 1); -+ if (!*proto) -+ { -+ grub_print_error (); -+ return 0; -+ } -+ -+ grub_memcpy (*proto, ps, l); -+ (*proto)[l] = '\0'; -+ p += sizeof ("://") - 1; -+ break; -+ } -+ ++p; -+ } -+ -+ if (!*proto) -+ { -+ grub_dprintf ("bootp", "url: %s is not valid, protocol not found\n", url); -+ return 0; -+ } -+ -+ ps = p; -+ p = grub_strchr (p, '/'); -+ -+ if (!p) -+ { -+ grub_dprintf ("bootp", "url: %s is not valid, host/path not found\n", url); -+ grub_free (*proto); -+ *proto = NULL; -+ return 0; -+ } -+ -+ l = p - ps; -+ -+ if (l > 2 && ps[0] == '[' && ps[l - 1] == ']') -+ { -+ *host = grub_malloc (l - 1); -+ if (!*host) -+ { -+ grub_print_error (); -+ grub_free (*proto); -+ *proto = NULL; -+ return 0; -+ } -+ grub_memcpy (*host, ps + 1, l - 2); -+ (*host)[l - 2] = 0; -+ } -+ else -+ { -+ *host = grub_malloc (l + 1); -+ if (!*host) -+ { -+ grub_print_error (); -+ grub_free (*proto); -+ *proto = NULL; -+ return 0; -+ } -+ grub_memcpy (*host, ps, l); -+ (*host)[l] = 0; -+ } -+ -+ *path = grub_strdup (p); -+ if (!*path) -+ { -+ grub_print_error (); -+ grub_free (*host); -+ grub_free (*proto); -+ *host = NULL; -+ *proto = NULL; -+ return 0; -+ } -+ 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; - } - -+/* The default netbuff size for sending DHCPv6 packets which should be -+ large enough to hold the information */ -+#define GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE 512 -+ -+struct grub_dhcp6_options -+{ -+ grub_uint8_t *client_duid; -+ grub_uint16_t client_duid_len; -+ grub_uint8_t *server_duid; -+ grub_uint16_t server_duid_len; -+ grub_uint32_t iaid; -+ grub_uint32_t t1; -+ grub_uint32_t t2; -+ grub_net_network_level_address_t *ia_addr; -+ grub_uint32_t preferred_lifetime; -+ grub_uint32_t valid_lifetime; -+ grub_net_network_level_address_t *dns_server_addrs; -+ grub_uint16_t num_dns_server; -+ char *boot_file_proto; -+ char *boot_file_server_ip; -+ char *boot_file_path; -+}; -+ -+typedef struct grub_dhcp6_options *grub_dhcp6_options_t; -+ -+struct grub_dhcp6_session -+{ -+ struct grub_dhcp6_session *next; -+ struct grub_dhcp6_session **prev; -+ grub_uint32_t iaid; -+ grub_uint32_t transaction_id:24; -+ grub_uint64_t start_time; -+ struct grub_net_dhcp6_option_duid_ll duid; -+ struct grub_net_network_level_interface *iface; -+ -+ /* The associated dhcpv6 options */ -+ grub_dhcp6_options_t adv; -+ grub_dhcp6_options_t reply; -+}; -+ -+typedef struct grub_dhcp6_session *grub_dhcp6_session_t; -+ -+typedef void (*dhcp6_option_hook_fn) (const struct grub_net_dhcp6_option *opt, void *data); -+ -+static void -+foreach_dhcp6_option (const struct grub_net_dhcp6_option *opt, grub_size_t size, -+ dhcp6_option_hook_fn hook, void *hook_data); -+ -+static void -+parse_dhcp6_iaaddr (const struct grub_net_dhcp6_option *opt, void *data) -+{ -+ grub_dhcp6_options_t dhcp6 = (grub_dhcp6_options_t )data; -+ -+ grub_uint16_t code = grub_be_to_cpu16 (opt->code); -+ grub_uint16_t len = grub_be_to_cpu16 (opt->len); -+ -+ if (code == GRUB_NET_DHCP6_OPTION_IAADDR) -+ { -+ const struct grub_net_dhcp6_option_iaaddr *iaaddr; -+ iaaddr = (const struct grub_net_dhcp6_option_iaaddr *)opt->data; -+ -+ if (len < sizeof (*iaaddr)) -+ { -+ grub_dprintf ("bootp", "DHCPv6: code %u with insufficient length %u\n", code, len); -+ return; -+ } -+ if (!dhcp6->ia_addr) -+ { -+ dhcp6->ia_addr = grub_malloc (sizeof(*dhcp6->ia_addr)); -+ dhcp6->ia_addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ dhcp6->ia_addr->ipv6[0] = grub_get_unaligned64 (iaaddr->addr); -+ dhcp6->ia_addr->ipv6[1] = grub_get_unaligned64 (iaaddr->addr + 8); -+ dhcp6->preferred_lifetime = grub_be_to_cpu32 (iaaddr->preferred_lifetime); -+ dhcp6->valid_lifetime = grub_be_to_cpu32 (iaaddr->valid_lifetime); -+ } -+ } -+} -+ -+static void -+parse_dhcp6_option (const struct grub_net_dhcp6_option *opt, void *data) -+{ -+ grub_dhcp6_options_t dhcp6 = (grub_dhcp6_options_t)data; -+ grub_uint16_t code = grub_be_to_cpu16 (opt->code); -+ grub_uint16_t len = grub_be_to_cpu16 (opt->len); -+ -+ switch (code) -+ { -+ case GRUB_NET_DHCP6_OPTION_CLIENTID: -+ -+ if (dhcp6->client_duid || !len) -+ { -+ grub_dprintf ("bootp", "Skipped DHCPv6 CLIENTID with length %u\n", len); -+ break; -+ } -+ dhcp6->client_duid = grub_malloc (len); -+ grub_memcpy (dhcp6->client_duid, opt->data, len); -+ dhcp6->client_duid_len = len; -+ break; -+ -+ case GRUB_NET_DHCP6_OPTION_SERVERID: -+ -+ if (dhcp6->server_duid || !len) -+ { -+ grub_dprintf ("bootp", "Skipped DHCPv6 SERVERID with length %u\n", len); -+ break; -+ } -+ dhcp6->server_duid = grub_malloc (len); -+ grub_memcpy (dhcp6->server_duid, opt->data, len); -+ dhcp6->server_duid_len = len; -+ break; -+ -+ case GRUB_NET_DHCP6_OPTION_IA_NA: -+ { -+ const struct grub_net_dhcp6_option_iana *ia_na; -+ grub_uint16_t data_len; -+ -+ if (dhcp6->iaid || len < sizeof (*ia_na)) -+ { -+ grub_dprintf ("bootp", "Skipped DHCPv6 IA_NA with length %u\n", len); -+ break; -+ } -+ ia_na = (const struct grub_net_dhcp6_option_iana *)opt->data; -+ dhcp6->iaid = grub_be_to_cpu32 (ia_na->iaid); -+ dhcp6->t1 = grub_be_to_cpu32 (ia_na->t1); -+ dhcp6->t2 = grub_be_to_cpu32 (ia_na->t2); -+ -+ data_len = len - sizeof (*ia_na); -+ if (data_len) -+ foreach_dhcp6_option ((const struct grub_net_dhcp6_option *)ia_na->data, data_len, parse_dhcp6_iaaddr, dhcp6); -+ } -+ break; -+ -+ case GRUB_NET_DHCP6_OPTION_DNS_SERVERS: -+ { -+ const grub_uint8_t *po; -+ grub_uint16_t ln; -+ grub_net_network_level_address_t *la; -+ -+ if (!len || len & 0xf) -+ { -+ grub_dprintf ("bootp", "Skip invalid length DHCPv6 DNS_SERVERS \n"); -+ break; -+ } -+ dhcp6->num_dns_server = ln = len >> 4; -+ dhcp6->dns_server_addrs = la = grub_zalloc (ln * sizeof (*la)); -+ -+ for (po = opt->data; ln > 0; po += 0x10, la++, ln--) -+ { -+ la->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ la->ipv6[0] = grub_get_unaligned64 (po); -+ la->ipv6[1] = grub_get_unaligned64 (po + 8); -+ la->option = DNS_OPTION_PREFER_IPV6; -+ } -+ } -+ break; -+ -+ case GRUB_NET_DHCP6_OPTION_BOOTFILE_URL: -+ dissect_url ((const char *)opt->data, -+ &dhcp6->boot_file_proto, -+ &dhcp6->boot_file_server_ip, -+ &dhcp6->boot_file_path); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+static void -+foreach_dhcp6_option (const struct grub_net_dhcp6_option *opt, grub_size_t size, dhcp6_option_hook_fn hook, void *hook_data) -+{ -+ while (size) -+ { -+ grub_uint16_t code, len; -+ -+ if (size < sizeof (*opt)) -+ { -+ grub_dprintf ("bootp", "DHCPv6: Options stopped with remaining size %" PRIxGRUB_SIZE "\n", size); -+ break; -+ } -+ size -= sizeof (*opt); -+ len = grub_be_to_cpu16 (opt->len); -+ code = grub_be_to_cpu16 (opt->code); -+ if (size < len) -+ { -+ grub_dprintf ("bootp", "DHCPv6: Options stopped at out of bound length %u for option %u\n", len, code); -+ break; -+ } -+ if (!len) -+ { -+ grub_dprintf ("bootp", "DHCPv6: Options stopped at zero length option %u\n", code); -+ break; -+ } -+ else -+ { -+ if (hook) -+ hook (opt, hook_data); -+ size -= len; -+ opt = (const struct grub_net_dhcp6_option *)((grub_uint8_t *)opt + len + sizeof (*opt)); -+ } -+ } -+} -+ -+static grub_dhcp6_options_t -+grub_dhcp6_options_get (const struct grub_net_dhcp6_packet *v6h, -+ grub_size_t size) -+{ -+ grub_dhcp6_options_t options; -+ -+ if (size < sizeof (*v6h)) -+ { -+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("DHCPv6 packet size too small")); -+ return NULL; -+ } -+ -+ options = grub_zalloc (sizeof(*options)); -+ if (!options) -+ return NULL; -+ -+ foreach_dhcp6_option ((const struct grub_net_dhcp6_option *)v6h->dhcp_options, -+ size - sizeof (*v6h), parse_dhcp6_option, options); -+ -+ return options; -+} -+ -+static void -+grub_dhcp6_options_free (grub_dhcp6_options_t options) -+{ -+ if (options->client_duid) -+ grub_free (options->client_duid); -+ if (options->server_duid) -+ grub_free (options->server_duid); -+ if (options->ia_addr) -+ grub_free (options->ia_addr); -+ if (options->dns_server_addrs) -+ grub_free (options->dns_server_addrs); -+ if (options->boot_file_proto) -+ grub_free (options->boot_file_proto); -+ if (options->boot_file_server_ip) -+ grub_free (options->boot_file_server_ip); -+ if (options->boot_file_path) -+ grub_free (options->boot_file_path); -+ -+ grub_free (options); -+} -+ -+static grub_dhcp6_session_t grub_dhcp6_sessions; -+#define FOR_DHCP6_SESSIONS(var) FOR_LIST_ELEMENTS (var, grub_dhcp6_sessions) -+ -+static void -+grub_net_configure_by_dhcp6_info (const char *name, -+ struct grub_net_card *card, -+ grub_dhcp6_options_t dhcp6, -+ int is_def, -+ int flags, -+ struct grub_net_network_level_interface **ret_inf) -+{ -+ grub_net_network_level_netaddress_t netaddr; -+ struct grub_net_network_level_interface *inf; -+ -+ if (dhcp6->ia_addr) -+ { -+ inf = grub_net_add_addr (name, card, dhcp6->ia_addr, &card->default_address, flags); -+ -+ netaddr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ netaddr.ipv6.base[0] = dhcp6->ia_addr->ipv6[0]; -+ netaddr.ipv6.base[1] = 0; -+ netaddr.ipv6.masksize = 64; -+ grub_net_add_route (name, netaddr, inf); -+ -+ if (ret_inf) -+ *ret_inf = inf; -+ } -+ -+ if (dhcp6->dns_server_addrs) -+ { -+ grub_uint16_t i; -+ -+ for (i = 0; i < dhcp6->num_dns_server; ++i) -+ grub_net_add_dns_server (dhcp6->dns_server_addrs + i); -+ } -+ -+ if (dhcp6->boot_file_path) -+ grub_env_set_net_property (name, "boot_file", dhcp6->boot_file_path, -+ grub_strlen (dhcp6->boot_file_path)); -+ -+ if (is_def && dhcp6->boot_file_server_ip) -+ { -+ grub_net_default_server = grub_strdup (dhcp6->boot_file_server_ip); -+ grub_env_set ("net_default_interface", name); -+ grub_env_export ("net_default_interface"); -+ } -+} -+ -+static void -+grub_dhcp6_session_add (struct grub_net_network_level_interface *iface, -+ grub_uint32_t iaid) -+{ -+ grub_dhcp6_session_t se; -+ struct grub_datetime date; -+ grub_err_t err; -+ grub_int32_t t = 0; -+ -+ se = grub_malloc (sizeof (*se)); -+ -+ err = grub_get_datetime (&date); -+ if (err || !grub_datetime2unixtime (&date, &t)) -+ { -+ grub_errno = GRUB_ERR_NONE; -+ t = 0; -+ } -+ -+ se->iface = iface; -+ se->iaid = iaid; -+ se->transaction_id = t; -+ se->start_time = grub_get_time_ms (); -+ se->duid.type = grub_cpu_to_be16_compile_time (3) ; -+ se->duid.hw_type = grub_cpu_to_be16_compile_time (1); -+ grub_memcpy (&se->duid.hwaddr, &iface->hwaddress.mac, sizeof (se->duid.hwaddr)); -+ se->adv = NULL; -+ se->reply = NULL; -+ grub_list_push (GRUB_AS_LIST_P (&grub_dhcp6_sessions), GRUB_AS_LIST (se)); -+} -+ -+static void -+grub_dhcp6_session_remove (grub_dhcp6_session_t se) -+{ -+ grub_list_remove (GRUB_AS_LIST (se)); -+ if (se->adv) -+ grub_dhcp6_options_free (se->adv); -+ if (se->reply) -+ grub_dhcp6_options_free (se->reply); -+ grub_free (se); -+} -+ -+static void -+grub_dhcp6_session_remove_all (void) -+{ -+ grub_dhcp6_session_t se; -+ -+ FOR_DHCP6_SESSIONS (se) -+ { -+ grub_dhcp6_session_remove (se); -+ se = grub_dhcp6_sessions; -+ } -+} -+ -+static grub_err_t -+grub_dhcp6_session_configure_network (grub_dhcp6_session_t se) -+{ -+ char *name; -+ -+ name = grub_xasprintf ("%s:dhcp6", se->iface->card->name); -+ if (!name) -+ return grub_errno; -+ -+ grub_net_configure_by_dhcp6_info (name, se->iface->card, se->reply, 1, 0, 0); -+ grub_free (name); -+ -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_dhcp6_session_send_request (grub_dhcp6_session_t se) -+{ -+ struct grub_net_buff *nb; -+ struct grub_net_dhcp6_option *opt; -+ struct grub_net_dhcp6_packet *v6h; -+ struct grub_net_dhcp6_option_iana *ia_na; -+ struct grub_net_dhcp6_option_iaaddr *iaaddr; -+ struct udphdr *udph; -+ grub_net_network_level_address_t multicast; -+ grub_net_link_level_address_t ll_multicast; -+ grub_uint64_t elapsed; -+ struct grub_net_network_level_interface *inf = se->iface; -+ grub_dhcp6_options_t dhcp6 = se->adv; -+ grub_err_t err = GRUB_ERR_NONE; -+ -+ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); -+ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL); -+ -+ err = grub_net_link_layer_resolve (inf, &multicast, &ll_multicast); -+ if (err) -+ return err; -+ -+ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); -+ -+ if (!nb) -+ return grub_errno; -+ -+ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ err = grub_netbuff_push (nb, dhcp6->client_duid_len + sizeof (*opt)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID); -+ opt->len = grub_cpu_to_be16 (dhcp6->client_duid_len); -+ grub_memcpy (opt->data, dhcp6->client_duid , dhcp6->client_duid_len); -+ -+ err = grub_netbuff_push (nb, dhcp6->server_duid_len + sizeof (*opt)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_SERVERID); -+ opt->len = grub_cpu_to_be16 (dhcp6->server_duid_len); -+ grub_memcpy (opt->data, dhcp6->server_duid , dhcp6->server_duid_len); -+ -+ err = grub_netbuff_push (nb, sizeof (*ia_na) + sizeof (*opt)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ if (dhcp6->ia_addr) -+ { -+ err = grub_netbuff_push (nb, sizeof(*iaaddr) + sizeof (*opt)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ } -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); -+ opt->len = grub_cpu_to_be16 (sizeof (*ia_na)); -+ if (dhcp6->ia_addr) -+ opt->len += grub_cpu_to_be16 (sizeof(*iaaddr) + sizeof (*opt)); -+ -+ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data; -+ ia_na->iaid = grub_cpu_to_be32 (dhcp6->iaid); -+ -+ ia_na->t1 = grub_cpu_to_be32 (dhcp6->t1); -+ ia_na->t2 = grub_cpu_to_be32 (dhcp6->t2); -+ -+ if (dhcp6->ia_addr) -+ { -+ opt = (struct grub_net_dhcp6_option *)ia_na->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IAADDR); -+ opt->len = grub_cpu_to_be16 (sizeof (*iaaddr)); -+ iaaddr = (struct grub_net_dhcp6_option_iaaddr *)opt->data; -+ grub_set_unaligned64 (iaaddr->addr, dhcp6->ia_addr->ipv6[0]); -+ grub_set_unaligned64 (iaaddr->addr + 8, dhcp6->ia_addr->ipv6[1]); -+ -+ iaaddr->preferred_lifetime = grub_cpu_to_be32 (dhcp6->preferred_lifetime); -+ iaaddr->valid_lifetime = grub_cpu_to_be32 (dhcp6->valid_lifetime); -+ } -+ -+ err = grub_netbuff_push (nb, sizeof (*opt) + 2 * sizeof (grub_uint16_t)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ opt = (struct grub_net_dhcp6_option*) nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ORO); -+ opt->len = grub_cpu_to_be16_compile_time (2 * sizeof (grub_uint16_t)); -+ grub_set_unaligned16 (opt->data, grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_BOOTFILE_URL)); -+ grub_set_unaligned16 (opt->data + 2, grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_DNS_SERVERS)); -+ -+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ opt = (struct grub_net_dhcp6_option*) nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME); -+ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t)); -+ -+ /* the time is expressed in hundredths of a second */ -+ elapsed = grub_divmod64 (grub_get_time_ms () - se->start_time, 10, 0); -+ -+ if (elapsed > 0xffff) -+ elapsed = 0xffff; -+ -+ grub_set_unaligned16 (opt->data, grub_cpu_to_be16 ((grub_uint16_t)elapsed)); -+ -+ err = grub_netbuff_push (nb, sizeof (*v6h)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ v6h = (struct grub_net_dhcp6_packet *) nb->data; -+ v6h->message_type = GRUB_NET_DHCP6_REQUEST; -+ v6h->transaction_id = se->transaction_id; -+ -+ err = grub_netbuff_push (nb, sizeof (*udph)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ udph = (struct udphdr *) nb->data; -+ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT); -+ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT); -+ udph->chksum = 0; -+ udph->len = grub_cpu_to_be16 (nb->tail - nb->data); -+ -+ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP, -+ &inf->address, -+ &multicast); -+ err = grub_net_send_ip_packet (inf, &multicast, &ll_multicast, nb, -+ GRUB_NET_IP_UDP); -+ -+ grub_netbuff_free (nb); -+ -+ return err; -+} -+ -+struct grub_net_network_level_interface * -+grub_net_configure_by_dhcpv6_reply (const char *name, -+ struct grub_net_card *card, -+ grub_net_interface_flags_t flags, -+ const struct grub_net_dhcp6_packet *v6h, -+ grub_size_t size, -+ int is_def, -+ char **device, char **path) -+{ -+ struct grub_net_network_level_interface *inf; -+ grub_dhcp6_options_t dhcp6; -+ -+ dhcp6 = grub_dhcp6_options_get (v6h, size); -+ if (!dhcp6) -+ { -+ grub_print_error (); -+ return NULL; -+ } -+ -+ grub_net_configure_by_dhcp6_info (name, card, dhcp6, is_def, flags, &inf); -+ -+ if (device && dhcp6->boot_file_proto && dhcp6->boot_file_server_ip) -+ { -+ *device = grub_xasprintf ("%s,%s", dhcp6->boot_file_proto, dhcp6->boot_file_server_ip); -+ grub_print_error (); -+ } -+ if (path && dhcp6->boot_file_path) -+ { -+ *path = grub_strdup (dhcp6->boot_file_path); -+ grub_print_error (); -+ if (*path) -+ { -+ char *slash; -+ slash = grub_strrchr (*path, '/'); -+ if (slash) -+ *slash = 0; -+ else -+ **path = 0; -+ } -+ } -+ -+ grub_dhcp6_options_free (dhcp6); -+ 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, - } - } - -+grub_err_t -+grub_net_process_dhcp6 (struct grub_net_buff *nb, -+ struct grub_net_card *card __attribute__ ((unused))) -+{ -+ const struct grub_net_dhcp6_packet *v6h; -+ grub_dhcp6_session_t se; -+ grub_size_t size; -+ grub_dhcp6_options_t options; -+ -+ v6h = (const struct grub_net_dhcp6_packet *) nb->data; -+ size = nb->tail - nb->data; -+ -+ options = grub_dhcp6_options_get (v6h, size); -+ if (!options) -+ return grub_errno; -+ -+ if (!options->client_duid || !options->server_duid || !options->ia_addr) -+ { -+ grub_dhcp6_options_free (options); -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "Bad DHCPv6 Packet"); -+ } -+ -+ FOR_DHCP6_SESSIONS (se) -+ { -+ if (se->transaction_id == v6h->transaction_id && -+ grub_memcmp (options->client_duid, &se->duid, sizeof (se->duid)) == 0 && -+ se->iaid == options->iaid) -+ break; -+ } -+ -+ if (!se) -+ { -+ grub_dprintf ("bootp", "DHCPv6 session not found\n"); -+ grub_dhcp6_options_free (options); -+ return GRUB_ERR_NONE; -+ } -+ -+ if (v6h->message_type == GRUB_NET_DHCP6_ADVERTISE) -+ { -+ if (se->adv) -+ { -+ grub_dprintf ("bootp", "Skipped DHCPv6 Advertised .. \n"); -+ grub_dhcp6_options_free (options); -+ return GRUB_ERR_NONE; -+ } -+ -+ se->adv = options; -+ return grub_dhcp6_session_send_request (se); -+ } -+ else if (v6h->message_type == GRUB_NET_DHCP6_REPLY) -+ { -+ if (!se->adv) -+ { -+ grub_dprintf ("bootp", "Skipped DHCPv6 Reply .. \n"); -+ grub_dhcp6_options_free (options); -+ return GRUB_ERR_NONE; -+ } -+ -+ se->reply = options; -+ grub_dhcp6_session_configure_network (se); -+ grub_dhcp6_session_remove (se); -+ return GRUB_ERR_NONE; -+ } -+ else -+ { -+ grub_dhcp6_options_free (options); -+ } -+ -+ return GRUB_ERR_NONE; -+} -+ - static char - hexdigit (grub_uint8_t val) - { -@@ -578,7 +1313,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)), - return err; - } - --static grub_command_t cmd_getdhcp, cmd_bootp; -+static grub_err_t -+grub_cmd_bootp6 (struct grub_command *cmd __attribute__ ((unused)), -+ int argc, char **args) -+{ -+ struct grub_net_card *card; -+ grub_uint32_t iaid = 0; -+ int interval; -+ grub_err_t err; -+ grub_dhcp6_session_t se; -+ -+ err = GRUB_ERR_NONE; -+ -+ FOR_NET_CARDS (card) -+ { -+ struct grub_net_network_level_interface *iface; -+ -+ if (argc > 0 && grub_strcmp (card->name, args[0]) != 0) -+ continue; -+ -+ iface = grub_net_ipv6_get_link_local (card, &card->default_address); -+ if (!iface) -+ { -+ grub_dhcp6_session_remove_all (); -+ return grub_errno; -+ } -+ -+ grub_dhcp6_session_add (iface, iaid++); -+ } -+ -+ for (interval = 200; interval < 10000; interval *= 2) -+ { -+ int done = 1; -+ -+ FOR_DHCP6_SESSIONS (se) -+ { -+ struct grub_net_buff *nb; -+ struct grub_net_dhcp6_option *opt; -+ struct grub_net_dhcp6_packet *v6h; -+ struct grub_net_dhcp6_option_duid_ll *duid; -+ struct grub_net_dhcp6_option_iana *ia_na; -+ grub_net_network_level_address_t multicast; -+ grub_net_link_level_address_t ll_multicast; -+ struct udphdr *udph; -+ -+ multicast.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; -+ multicast.ipv6[0] = grub_cpu_to_be64_compile_time (0xff02ULL << 48); -+ multicast.ipv6[1] = grub_cpu_to_be64_compile_time (0x10002ULL); -+ -+ err = grub_net_link_layer_resolve (se->iface, -+ &multicast, &ll_multicast); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ return err; -+ } -+ -+ nb = grub_netbuff_alloc (GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); -+ -+ if (!nb) -+ { -+ grub_dhcp6_session_remove_all (); -+ return grub_errno; -+ } -+ -+ err = grub_netbuff_reserve (nb, GRUB_DHCP6_DEFAULT_NETBUFF_ALLOC_SIZE); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (grub_uint16_t)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_ELAPSED_TIME); -+ opt->len = grub_cpu_to_be16_compile_time (sizeof (grub_uint16_t)); -+ grub_set_unaligned16 (opt->data, 0); -+ -+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*duid)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_CLIENTID); -+ opt->len = grub_cpu_to_be16 (sizeof (*duid)); -+ -+ duid = (struct grub_net_dhcp6_option_duid_ll *) opt->data; -+ grub_memcpy (duid, &se->duid, sizeof (*duid)); -+ -+ err = grub_netbuff_push (nb, sizeof (*opt) + sizeof (*ia_na)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ opt = (struct grub_net_dhcp6_option *)nb->data; -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); -+ opt->len = grub_cpu_to_be16 (sizeof (*ia_na)); -+ ia_na = (struct grub_net_dhcp6_option_iana *)opt->data; -+ ia_na->iaid = grub_cpu_to_be32 (se->iaid); -+ ia_na->t1 = 0; -+ ia_na->t2 = 0; -+ -+ err = grub_netbuff_push (nb, sizeof (*v6h)); -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ v6h = (struct grub_net_dhcp6_packet *)nb->data; -+ v6h->message_type = GRUB_NET_DHCP6_SOLICIT; -+ v6h->transaction_id = se->transaction_id; -+ -+ grub_netbuff_push (nb, sizeof (*udph)); -+ -+ udph = (struct udphdr *) nb->data; -+ udph->src = grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT); -+ udph->dst = grub_cpu_to_be16_compile_time (DHCP6_SERVER_PORT); -+ udph->chksum = 0; -+ udph->len = grub_cpu_to_be16 (nb->tail - nb->data); -+ -+ udph->chksum = grub_net_ip_transport_checksum (nb, GRUB_NET_IP_UDP, -+ &se->iface->address, &multicast); -+ -+ err = grub_net_send_ip_packet (se->iface, &multicast, -+ &ll_multicast, nb, GRUB_NET_IP_UDP); -+ done = 0; -+ grub_netbuff_free (nb); -+ -+ if (err) -+ { -+ grub_dhcp6_session_remove_all (); -+ return err; -+ } -+ } -+ if (!done) -+ grub_net_poll_cards (interval, 0); -+ } -+ -+ FOR_DHCP6_SESSIONS (se) -+ { -+ grub_error_push (); -+ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, -+ N_("couldn't autoconfigure %s"), -+ se->iface->card->name); -+ } -+ -+ grub_dhcp6_session_remove_all (); -+ -+ return err; -+} -+ -+static grub_command_t cmd_getdhcp, cmd_bootp, cmd_bootp6; - - void - grub_bootp_init (void) -@@ -589,6 +1491,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.")); -+ cmd_bootp6 = grub_register_command ("net_bootp6", grub_cmd_bootp6, -+ N_("[CARD]"), -+ N_("perform a DHCPv6 autoconfiguration")); - } - - void -@@ -596,4 +1501,5 @@ grub_bootp_fini (void) - { - grub_unregister_command (cmd_getdhcp); - grub_unregister_command (cmd_bootp); -+ 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, - { - struct udphdr *udph; - udph = (struct udphdr *) nb->data; -+ -+ if (proto == GRUB_NET_IP_UDP && udph->dst == grub_cpu_to_be16_compile_time (DHCP6_CLIENT_PORT)) -+ { -+ if (udph->chksum) -+ { -+ grub_uint16_t chk, expected; -+ chk = udph->chksum; -+ udph->chksum = 0; -+ expected = grub_net_ip_transport_checksum (nb, -+ GRUB_NET_IP_UDP, -+ source, -+ dest); -+ if (expected != chk) -+ { -+ grub_dprintf ("net", "Invalid UDP checksum. " -+ "Expected %x, got %x\n", -+ grub_be_to_cpu16 (expected), -+ grub_be_to_cpu16 (chk)); -+ grub_netbuff_free (nb); -+ return GRUB_ERR_NONE; -+ } -+ udph->chksum = chk; -+ } -+ -+ err = grub_netbuff_pull (nb, sizeof (*udph)); -+ if (err) -+ { -+ grub_netbuff_free (nb); -+ return err; -+ } -+ -+ err = grub_net_process_dhcp6 (nb, card); -+ if (err) -+ grub_print_error (); -+ -+ grub_netbuff_free (nb); -+ return GRUB_ERR_NONE; -+ } -+ - 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 - grub_uint8_t vendor[0]; - } GRUB_PACKED; - -+struct grub_net_dhcp6_packet -+{ -+ grub_uint32_t message_type:8; -+ grub_uint32_t transaction_id:24; -+ grub_uint8_t dhcp_options[0]; -+} GRUB_PACKED; -+ -+struct grub_net_dhcp6_option { -+ grub_uint16_t code; -+ grub_uint16_t len; -+ grub_uint8_t data[0]; -+} GRUB_PACKED; -+ -+struct grub_net_dhcp6_option_iana { -+ grub_uint32_t iaid; -+ grub_uint32_t t1; -+ grub_uint32_t t2; -+ grub_uint8_t data[0]; -+} GRUB_PACKED; -+ -+struct grub_net_dhcp6_option_iaaddr { -+ grub_uint8_t addr[16]; -+ grub_uint32_t preferred_lifetime; -+ grub_uint32_t valid_lifetime; -+ grub_uint8_t data[0]; -+} GRUB_PACKED; -+ -+struct grub_net_dhcp6_option_duid_ll -+{ -+ grub_uint16_t type; -+ grub_uint16_t hw_type; -+ grub_uint8_t hwaddr[6]; -+} GRUB_PACKED; -+ -+enum -+ { -+ GRUB_NET_DHCP6_SOLICIT = 1, -+ GRUB_NET_DHCP6_ADVERTISE = 2, -+ GRUB_NET_DHCP6_REQUEST = 3, -+ GRUB_NET_DHCP6_REPLY = 7 -+ }; -+ -+enum -+ { -+ DHCP6_CLIENT_PORT = 546, -+ DHCP6_SERVER_PORT = 547 -+ }; -+ -+enum -+ { -+ GRUB_NET_DHCP6_OPTION_CLIENTID = 1, -+ GRUB_NET_DHCP6_OPTION_SERVERID = 2, -+ GRUB_NET_DHCP6_OPTION_IA_NA = 3, -+ GRUB_NET_DHCP6_OPTION_IAADDR = 5, -+ GRUB_NET_DHCP6_OPTION_ORO = 6, -+ GRUB_NET_DHCP6_OPTION_ELAPSED_TIME = 8, -+ GRUB_NET_DHCP6_OPTION_DNS_SERVERS = 23, -+ GRUB_NET_DHCP6_OPTION_BOOTFILE_URL = 59 -+ }; -+ - #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, - grub_size_t size, - int is_def, char **device, char **path); - -+struct grub_net_network_level_interface * -+grub_net_configure_by_dhcpv6_reply (const char *name, -+ struct grub_net_card *card, -+ grub_net_interface_flags_t flags, -+ const struct grub_net_dhcp6_packet *v6, -+ grub_size_t size, -+ int is_def, char **device, char **path); -+ - grub_err_t - grub_net_add_ipv4_local (struct grub_net_network_level_interface *inf, - int mask); -@@ -476,6 +544,10 @@ void - grub_net_process_dhcp (struct grub_net_buff *nb, - struct grub_net_card *card); - -+grub_err_t -+grub_net_process_dhcp6 (struct grub_net_buff *nb, -+ struct grub_net_card *card); -+ - 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/0004-efinet-UEFI-IPv6-PXE-support.patch b/0004-efinet-UEFI-IPv6-PXE-support.patch deleted file mode 100644 index 4265950..0000000 --- a/0004-efinet-UEFI-IPv6-PXE-support.patch +++ /dev/null @@ -1,127 +0,0 @@ -From ca482c7c1efe5faf792bf0912a116ea8e0642e24 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Wed, 15 Apr 2015 14:48:30 +0800 -Subject: [PATCH 4/8] efinet: UEFI IPv6 PXE support - -When grub2 image is booted from UEFI IPv6 PXE, the DHCPv6 Reply packet is -cached in firmware buffer which can be obtained by PXE Base Code protocol. The -network interface can be setup through the parameters in that obtained packet. - -Signed-off-by: Michael Chang -Signed-off-by: Ken Lin ---- - grub-core/net/drivers/efi/efinet.c | 24 +++++++++++++---- - include/grub/efi/api.h | 55 +++++++++++++++++++++++++++++++++++++- - 2 files changed, 73 insertions(+), 6 deletions(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index 5388f95..fc90415 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -378,11 +378,25 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, - if (! pxe) - continue; - pxe_mode = pxe->mode; -- grub_net_configure_by_dhcp_ack (card->name, card, 0, -- (struct grub_net_bootp_packet *) -- &pxe_mode->dhcp_ack, -- sizeof (pxe_mode->dhcp_ack), -- 1, device, path); -+ -+ if (pxe_mode->using_ipv6) -+ { -+ grub_net_configure_by_dhcpv6_reply (card->name, card, 0, -+ (struct grub_net_dhcp6_packet *) -+ &pxe_mode->dhcp_ack, -+ sizeof (pxe_mode->dhcp_ack), -+ 1, device, path); -+ if (grub_errno) -+ grub_print_error (); -+ } -+ else -+ { -+ grub_net_configure_by_dhcp_ack (card->name, card, 0, -+ (struct grub_net_bootp_packet *) -+ &pxe_mode->dhcp_ack, -+ sizeof (pxe_mode->dhcp_ack), -+ 1, device, path); -+ } - return; - } - } -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index c7c9f0e..92f9b5a 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -1452,14 +1452,67 @@ typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output - - typedef grub_uint8_t grub_efi_pxe_packet_t[1472]; - -+typedef struct { -+ grub_uint8_t addr[4]; -+} grub_efi_pxe_ipv4_address_t; -+ -+typedef struct { -+ grub_uint8_t addr[16]; -+} grub_efi_pxe_ipv6_address_t; -+ -+typedef struct { -+ grub_uint8_t addr[32]; -+} grub_efi_pxe_mac_address_t; -+ -+typedef union { -+ grub_uint32_t addr[4]; -+ grub_efi_pxe_ipv4_address_t v4; -+ grub_efi_pxe_ipv6_address_t v6; -+} grub_efi_pxe_ip_address_t; -+ -+#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8 -+typedef struct { -+ grub_uint8_t filters; -+ grub_uint8_t ip_cnt; -+ grub_uint16_t reserved; -+ grub_efi_pxe_ip_address_t ip_list[GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT]; -+} grub_efi_pxe_ip_filter_t; -+ -+typedef struct { -+ grub_efi_pxe_ip_address_t ip_addr; -+ grub_efi_pxe_mac_address_t mac_addr; -+} grub_efi_pxe_arp_entry_t; -+ -+typedef struct { -+ grub_efi_pxe_ip_address_t ip_addr; -+ grub_efi_pxe_ip_address_t subnet_mask; -+ grub_efi_pxe_ip_address_t gw_addr; -+} grub_efi_pxe_route_entry_t; -+ -+ -+#define GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 -+#define GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 -+ - typedef struct grub_efi_pxe_mode - { -- grub_uint8_t unused[52]; -+ grub_uint8_t started; -+ grub_uint8_t ipv6_available; -+ grub_uint8_t ipv6_supported; -+ grub_uint8_t using_ipv6; -+ grub_uint8_t unused[16]; -+ grub_efi_pxe_ip_address_t station_ip; -+ grub_efi_pxe_ip_address_t subnet_mask; - grub_efi_pxe_packet_t dhcp_discover; - grub_efi_pxe_packet_t dhcp_ack; - grub_efi_pxe_packet_t proxy_offer; - grub_efi_pxe_packet_t pxe_discover; - grub_efi_pxe_packet_t pxe_reply; -+ grub_efi_pxe_packet_t pxe_bis_reply; -+ grub_efi_pxe_ip_filter_t ip_filter; -+ grub_uint32_t arp_cache_entries; -+ grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES]; -+ grub_uint32_t route_table_entries; -+ grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES]; - } grub_efi_pxe_mode_t; - - typedef struct grub_efi_pxe --- -2.6.6 - diff --git a/0005-grub.texi-Add-net_bootp6-doument.patch b/0005-grub.texi-Add-net_bootp6-doument.patch deleted file mode 100644 index e097598..0000000 --- a/0005-grub.texi-Add-net_bootp6-doument.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 2c997c8c058b41d3a59a81f2bf654288b7cdf8f2 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Tue, 5 May 2015 14:19:24 +0800 -Subject: [PATCH 5/8] grub.texi: Add net_bootp6 doument - -Update grub documentation for net_bootp6 command. - -Signed-off-by: Michael Chang -Signed-off-by: Ken Lin ---- - docs/grub.texi | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/docs/grub.texi b/docs/grub.texi -index 82f6fa4..60b4aa0 100644 ---- a/docs/grub.texi -+++ b/docs/grub.texi -@@ -5173,6 +5173,7 @@ See @uref{http://wiki.xen.org/wiki/XSM} for more detail. - * net_add_dns:: Add a DNS server - * net_add_route:: Add routing entry - * net_bootp:: Perform a bootp autoconfiguration -+* net_bootp6:: Perform a DHCPv6 autoconfiguration - * net_del_addr:: Remove IP address from interface - * net_del_dns:: Remove a DNS server - * net_del_route:: Remove a route entry -@@ -5254,6 +5255,22 @@ Sets environment variable @samp{net_}@var{}@samp{_dhcp_extensionspath} - - @end deffn - -+@node net_bootp6 -+@subsection net_bootp6 -+ -+@deffn Command net_bootp6 [@var{card}] -+Perform configuration of @var{card} using DHCPv6 protocol. If no card name is -+specified, try to configure all existing cards. If configuration was -+successful, interface with name @var{card}@samp{:dhcp6} and configured address -+is added to @var{card}. -+ -+@table @samp -+@item 1 (Domain Name Server) -+Adds all servers from option value to the list of servers used during name -+resolution. -+@end table -+ -+@end deffn - - @node net_del_addr - @subsection net_del_addr --- -2.6.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 deleted file mode 100644 index fd0d536..0000000 --- a/0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 8191aae462f8b755972a0a801f4adbdd6ecaa66c Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 14 Jul 2016 18:45:14 +0800 -Subject: [PATCH 6/8] bootp: Add processing DHCPACK packet from HTTP Boot - -The vendor class identifier with the string "HTTPClient" is used to denote the -packet as responding to HTTP boot request. In DHCP4 config, the filename for -HTTP boot is the URL of the boot file while for PXE boot it is the path to the -boot file. As a consequence, the next-server becomes obseleted because the HTTP -URL already contains the server address for the boot file. For DHCP6 config, -there's no difference definition in existing config as dhcp6.bootfile-url can -be used to specify URL for both HTTP and PXE boot file. - -This patch adds processing for "HTTPClient" vendor class identifier in DHCPACK -packet by treating it as HTTP format, not as the PXE format. - -Signed-off-by: Michael Chang -Signed-off-by: Ken Lin ---- - grub-core/net/bootp.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++-- - 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 - -+ if (size > OFFSET_OF (vendor, bp)) -+ { -+ char *cidvar; -+ const char *cid; -+ -+ parse_dhcp_vendor (name, &bp->vendor, size - OFFSET_OF (vendor, bp), &mask); -+ cidvar = grub_xasprintf ("net_%s_%s", name, "vendor_class_identifier"); -+ cid = grub_env_get (cidvar); -+ grub_free (cidvar); -+ -+ if (cid && grub_strcmp (cid, "HTTPClient") == 0) -+ { -+ char *proto, *ip, *pa; -+ -+ 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); -+ grub_env_set ("net_default_interface", name); -+ grub_env_export ("net_default_interface"); -+ } -+ if (device && !*device) -+ { -+ *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; -+ -+ grub_free (proto); -+ grub_free (ip); -+ grub_free (pa); -+ return inter; -+ } -+ } -+ - 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; - } - } -- 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 - 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 - diff --git a/0007-efinet-Setting-network-from-UEFI-device-path.patch b/0007-efinet-Setting-network-from-UEFI-device-path.patch deleted file mode 100644 index 5bcc72c..0000000 --- a/0007-efinet-Setting-network-from-UEFI-device-path.patch +++ /dev/null @@ -1,389 +0,0 @@ -From 369df8e3006000a4acacc674f5882d8729781811 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Sun, 10 Jul 2016 23:46:31 +0800 -Subject: [PATCH 7/8] efinet: Setting network from UEFI device path - -The PXE Base Code protocol used to obtain cached PXE DHCPACK packet is no -longer provided for HTTP Boot. Instead, we have to get the HTTP boot -information from the device path nodes defined in following UEFI Specification -sections. - - 9.3.5.12 IPv4 Device Path - 9.3.5.13 IPv6 Device Path - 9.3.5.23 Uniform Resource Identifiers (URI) Device Path - -This patch basically does: - -include/grub/efi/api.h: -Add new structure of Uniform Resource Identifiers (URI) Device Path - -grub-core/net/drivers/efi/efinet.c: -Check if PXE Base Code is available, if not it will try to obtain the netboot -information from the device path where the image booted from. The DHCPACK -packet is recoverd from the information in device patch and feed into the same -DHCP packet processing functions to ensure the network interface is setting up -the same way it used to be. - -Signed-off-by: Michael Chang -Signed-off-by: Ken Lin ---- - grub-core/net/drivers/efi/efinet.c | 268 +++++++++++++++++++++++++++++++++++-- - include/grub/efi/api.h | 11 ++ - 2 files changed, 270 insertions(+), 9 deletions(-) - -diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c -index fc90415..2d3b00f 100644 ---- a/grub-core/net/drivers/efi/efinet.c -+++ b/grub-core/net/drivers/efi/efinet.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -324,6 +325,221 @@ grub_efinet_findcards (void) - grub_free (handles); - } - -+static struct grub_net_buff * -+grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6) -+{ -+ grub_efi_uint16_t uri_len; -+ grub_efi_device_path_t *ldp, *ddp; -+ grub_efi_uri_device_path_t *uri_dp; -+ struct grub_net_buff *nb; -+ grub_err_t err; -+ -+ ddp = grub_efi_duplicate_device_path (dp); -+ ldp = grub_efi_find_last_device_path (ddp); -+ -+ if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE -+ || GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE) -+ { -+ grub_free (ddp); -+ return NULL; -+ } -+ -+ uri_len = GRUB_EFI_DEVICE_PATH_LENGTH (ldp) > 4 ? GRUB_EFI_DEVICE_PATH_LENGTH (ldp) - 4 : 0; -+ -+ if (!uri_len) -+ { -+ grub_free (ddp); -+ return NULL; -+ } -+ -+ uri_dp = (grub_efi_uri_device_path_t *) ldp; -+ -+ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; -+ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -+ ldp->length = sizeof (*ldp); -+ -+ ldp = grub_efi_find_last_device_path (ddp); -+ -+ 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)) -+ { -+ grub_free (ddp); -+ return NULL; -+ } -+ -+ nb = grub_netbuff_alloc (512); -+ if (!nb) -+ return NULL; -+ -+ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE) -+ { -+ grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp; -+ struct grub_net_bootp_packet *bp; -+ grub_uint8_t *ptr; -+ -+ bp = (struct grub_net_bootp_packet *) nb->tail; -+ err = grub_netbuff_put (nb, sizeof (*bp) + 4); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ -+ if (sizeof(bp->boot_file) < uri_len) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ grub_memcpy (bp->boot_file, uri_dp->uri, uri_len); -+ grub_memcpy (&bp->your_ip, ipv4->local_ip_address, sizeof (bp->your_ip)); -+ grub_memcpy (&bp->server_ip, ipv4->remote_ip_address, sizeof (bp->server_ip)); -+ -+ bp->vendor[0] = GRUB_NET_BOOTP_RFC1048_MAGIC_0; -+ bp->vendor[1] = GRUB_NET_BOOTP_RFC1048_MAGIC_1; -+ bp->vendor[2] = GRUB_NET_BOOTP_RFC1048_MAGIC_2; -+ bp->vendor[3] = GRUB_NET_BOOTP_RFC1048_MAGIC_3; -+ -+ ptr = nb->tail; -+ err = grub_netbuff_put (nb, sizeof (ipv4->subnet_mask) + 2); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ *ptr++ = GRUB_NET_BOOTP_NETMASK; -+ *ptr++ = sizeof (ipv4->subnet_mask); -+ grub_memcpy (ptr, ipv4->subnet_mask, sizeof (ipv4->subnet_mask)); -+ -+ ptr = nb->tail; -+ err = grub_netbuff_put (nb, sizeof (ipv4->gateway_ip_address) + 2); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ *ptr++ = GRUB_NET_BOOTP_ROUTER; -+ *ptr++ = sizeof (ipv4->gateway_ip_address); -+ grub_memcpy (ptr, ipv4->gateway_ip_address, sizeof (ipv4->gateway_ip_address)); -+ -+ ptr = nb->tail; -+ err = grub_netbuff_put (nb, sizeof ("HTTPClient") + 1); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ *ptr++ = GRUB_NET_BOOTP_VENDOR_CLASS_IDENTIFIER; -+ *ptr++ = sizeof ("HTTPClient") - 1; -+ grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); -+ -+ ptr = nb->tail; -+ err = grub_netbuff_put (nb, 1); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ *ptr = GRUB_NET_BOOTP_END; -+ *use_ipv6 = 0; -+ -+ ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; -+ ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -+ ldp->length = sizeof (*ldp); -+ ldp = grub_efi_find_last_device_path (ddp); -+ -+ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE) -+ { -+ grub_efi_mac_address_device_path_t *mac = (grub_efi_mac_address_device_path_t *) ldp; -+ bp->hw_type = mac->if_type; -+ bp->hw_len = sizeof (bp->mac_addr); -+ grub_memcpy (bp->mac_addr, mac->mac_address, bp->hw_len); -+ } -+ } -+ else -+ { -+ grub_efi_ipv6_device_path_t *ipv6 = (grub_efi_ipv6_device_path_t *) ldp; -+ -+ struct grub_net_dhcp6_packet *d6p; -+ struct grub_net_dhcp6_option *opt; -+ struct grub_net_dhcp6_option_iana *iana; -+ struct grub_net_dhcp6_option_iaaddr *iaaddr; -+ -+ d6p = (struct grub_net_dhcp6_packet *)nb->tail; -+ err = grub_netbuff_put (nb, sizeof(*d6p)); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ d6p->message_type = GRUB_NET_DHCP6_REPLY; -+ -+ opt = (struct grub_net_dhcp6_option *)nb->tail; -+ err = grub_netbuff_put (nb, sizeof(*opt)); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IA_NA); -+ opt->len = grub_cpu_to_be16_compile_time (sizeof(*iana) + sizeof(*opt) + sizeof(*iaaddr)); -+ -+ err = grub_netbuff_put (nb, sizeof(*iana)); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ -+ opt = (struct grub_net_dhcp6_option *)nb->tail; -+ err = grub_netbuff_put (nb, sizeof(*opt)); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_IAADDR); -+ opt->len = grub_cpu_to_be16_compile_time (sizeof (*iaaddr)); -+ -+ iaaddr = (struct grub_net_dhcp6_option_iaaddr *)nb->tail; -+ err = grub_netbuff_put (nb, sizeof(*iaaddr)); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ grub_memcpy (iaaddr->addr, ipv6->local_ip_address, sizeof(ipv6->local_ip_address)); -+ -+ opt = (struct grub_net_dhcp6_option *)nb->tail; -+ err = grub_netbuff_put (nb, sizeof(*opt) + uri_len); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_BOOTFILE_URL); -+ opt->len = grub_cpu_to_be16 (uri_len); -+ grub_memcpy (opt->data, uri_dp->uri, uri_len); -+ -+ *use_ipv6 = 1; -+ } -+ -+ grub_free (ddp); -+ return nb; -+} -+ - static void - grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, - char **path) -@@ -340,6 +556,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, - grub_efi_device_path_t *cdp; - struct grub_efi_pxe *pxe; - struct grub_efi_pxe_mode *pxe_mode; -+ grub_uint8_t *packet_buf; -+ grub_size_t packet_bufsz ; -+ int ipv6; -+ struct grub_net_buff *nb = NULL; -+ - if (card->driver != &efidriver) - continue; - cdp = grub_efi_get_device_path (card->efi_handle); -@@ -359,11 +580,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, - ldp = grub_efi_find_last_device_path (dp); - 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)) -+ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE -+ && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE)) - continue; - dup_dp = grub_efi_duplicate_device_path (dp); - if (!dup_dp) - continue; -+ -+ if (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_URI_DEVICE_PATH_SUBTYPE) -+ { -+ dup_ldp = grub_efi_find_last_device_path (dup_dp); -+ 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); -+ } -+ - dup_ldp = grub_efi_find_last_device_path (dup_dp); - dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; - dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; -@@ -375,16 +606,31 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, - } - pxe = grub_efi_open_protocol (hnd, &pxe_io_guid, - GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -- if (! pxe) -- continue; -- pxe_mode = pxe->mode; -+ if (!pxe) -+ { -+ nb = grub_efinet_create_dhcp_ack_from_device_path (dp, &ipv6); -+ if (!nb) -+ { -+ grub_print_error (); -+ continue; -+ } -+ packet_buf = nb->head; -+ packet_bufsz = nb->tail - nb->head; -+ } -+ else -+ { -+ pxe_mode = pxe->mode; -+ packet_buf = (grub_uint8_t *) &pxe_mode->dhcp_ack; -+ packet_bufsz = sizeof (pxe_mode->dhcp_ack); -+ ipv6 = pxe_mode->using_ipv6; -+ } - -- if (pxe_mode->using_ipv6) -+ if (ipv6) - { - grub_net_configure_by_dhcpv6_reply (card->name, card, 0, - (struct grub_net_dhcp6_packet *) -- &pxe_mode->dhcp_ack, -- sizeof (pxe_mode->dhcp_ack), -+ packet_buf, -+ packet_bufsz, - 1, device, path); - if (grub_errno) - grub_print_error (); -@@ -393,10 +639,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, - { - grub_net_configure_by_dhcp_ack (card->name, card, 0, - (struct grub_net_bootp_packet *) -- &pxe_mode->dhcp_ack, -- sizeof (pxe_mode->dhcp_ack), -+ packet_buf, -+ packet_bufsz, - 1, device, path); - } -+ -+ if (nb) -+ grub_netbuff_free (nb); -+ - return; - } - } -diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h -index 92f9b5a..d5a1256 100644 ---- a/include/grub/efi/api.h -+++ b/include/grub/efi/api.h -@@ -825,6 +825,8 @@ struct grub_efi_ipv4_device_path - grub_efi_uint16_t remote_port; - grub_efi_uint16_t protocol; - grub_efi_uint8_t static_ip_address; -+ grub_efi_ipv4_address_t gateway_ip_address; -+ grub_efi_ipv4_address_t subnet_mask; - } GRUB_PACKED; - typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t; - -@@ -879,6 +881,15 @@ struct grub_efi_sata_device_path - } GRUB_PACKED; - typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t; - -+#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24 -+ -+struct grub_efi_uri_device_path -+{ -+ grub_efi_device_path_t header; -+ grub_efi_uint8_t uri[0]; -+} GRUB_PACKED; -+typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t; -+ - #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10 - - /* Media Device Path. */ --- -2.6.6 - diff --git a/0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch b/0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch deleted file mode 100644 index 1818217..0000000 --- a/0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch +++ /dev/null @@ -1,340 +0,0 @@ -From 0c7ae6d7527d08e54a6eeebddb6c5c697c4b37d2 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 14 Jul 2016 17:48:45 +0800 -Subject: [PATCH 8/8] efinet: Setting DNS server from UEFI protocol - -In the URI device path node, any name rahter than address can be used for -looking up the resources so that DNS service become needed to get answer of the -name's address. Unfortunately the DNS is not defined in any of the device path -nodes so that we use the EFI_IP4_CONFIG2_PROTOCOL and EFI_IP6_CONFIG_PROTOCOL -to obtain it. - -These two protcols are defined the sections of UEFI specification. - - 27.5 EFI IPv4 Configuration II Protocol - 27.7 EFI IPv6 Configuration Protocol - -include/grub/efi/api.h: -Add new structure and protocol UUID of EFI_IP4_CONFIG2_PROTOCOL and -EFI_IP6_CONFIG_PROTOCOL. - -grub-core/net/drivers/efi/efinet.c: -Use the EFI_IP4_CONFIG2_PROTOCOL and EFI_IP6_CONFIG_PROTOCOL to obtain the list -of DNS server address for IPv4 and IPv6 respectively. The address of DNS -servers is structured into DHCPACK packet and feed into the same DHCP packet -processing functions to ensure the network interface is setting up the same way -it used to be. - -Signed-off-by: Michael Chang -Signed-off-by: Ken Lin ---- - grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++ - 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 -@@ -30,6 +30,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); - /* GUID. */ - static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID; - static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; -+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; -+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID; - - static grub_err_t - send_card_buffer (struct grub_net_card *dev, -@@ -325,6 +327,125 @@ grub_efinet_findcards (void) - grub_free (handles); - } - -+static grub_efi_handle_t -+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path, -+ grub_efi_device_path_t **r_device_path) -+{ -+ grub_efi_handle_t handle; -+ grub_efi_status_t status; -+ -+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path, -+ protocol, &device_path, &handle); -+ -+ if (status != GRUB_EFI_SUCCESS) -+ return 0; -+ -+ if (r_device_path) -+ *r_device_path = device_path; -+ -+ return handle; -+} -+ -+static grub_efi_ipv4_address_t * -+grub_dns_server_ip4_address (grub_efi_device_path_t *dp, grub_efi_uintn_t *num_dns) -+{ -+ grub_efi_handle_t hnd; -+ grub_efi_status_t status; -+ grub_efi_ip4_config2_protocol_t *conf; -+ grub_efi_ipv4_address_t *addrs; -+ grub_efi_uintn_t data_size = 1 * sizeof (grub_efi_ipv4_address_t); -+ -+ hnd = grub_efi_locate_device_path (&ip4_config_guid, dp, NULL); -+ -+ if (!hnd) -+ return 0; -+ -+ conf = grub_efi_open_protocol (hnd, &ip4_config_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!conf) -+ return 0; -+ -+ addrs = grub_malloc (data_size); -+ if (!addrs) -+ return 0; -+ -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); -+ -+ if (status == GRUB_EFI_BUFFER_TOO_SMALL) -+ { -+ grub_free (addrs); -+ addrs = grub_malloc (data_size); -+ if (!addrs) -+ return 0; -+ -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); -+ } -+ -+ if (status != GRUB_EFI_SUCCESS) -+ { -+ grub_free (addrs); -+ return 0; -+ } -+ -+ *num_dns = data_size / sizeof (grub_efi_ipv4_address_t); -+ return addrs; -+} -+ -+static grub_efi_ipv6_address_t * -+grub_dns_server_ip6_address (grub_efi_device_path_t *dp, grub_efi_uintn_t *num_dns) -+{ -+ grub_efi_handle_t hnd; -+ grub_efi_status_t status; -+ grub_efi_ip6_config_protocol_t *conf; -+ grub_efi_ipv6_address_t *addrs; -+ grub_efi_uintn_t data_size = 1 * sizeof (grub_efi_ipv6_address_t); -+ -+ hnd = grub_efi_locate_device_path (&ip6_config_guid, dp, NULL); -+ -+ if (!hnd) -+ return 0; -+ -+ conf = grub_efi_open_protocol (hnd, &ip6_config_guid, -+ GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ -+ if (!conf) -+ return 0; -+ -+ addrs = grub_malloc (data_size); -+ if (!addrs) -+ return 0; -+ -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); -+ -+ if (status == GRUB_EFI_BUFFER_TOO_SMALL) -+ { -+ grub_free (addrs); -+ addrs = grub_malloc (data_size); -+ if (!addrs) -+ return 0; -+ -+ status = efi_call_4 (conf->get_data, conf, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, -+ &data_size, addrs); -+ } -+ -+ if (status != GRUB_EFI_SUCCESS) -+ { -+ grub_free (addrs); -+ return 0; -+ } -+ -+ *num_dns = data_size / sizeof (grub_efi_ipv6_address_t); -+ return addrs; -+} -+ - 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 - grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp; - struct grub_net_bootp_packet *bp; - grub_uint8_t *ptr; -+ grub_efi_ipv4_address_t *dns; -+ grub_efi_uintn_t num_dns; - - 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 - *ptr++ = sizeof ("HTTPClient") - 1; - grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); - -+ dns = grub_dns_server_ip4_address (dp, &num_dns); -+ if (dns) -+ { -+ grub_efi_uintn_t size_dns = sizeof (*dns) * num_dns; -+ -+ ptr = nb->tail; -+ err = grub_netbuff_put (nb, size_dns + 2); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ *ptr++ = GRUB_NET_BOOTP_DNS; -+ *ptr++ = size_dns; -+ grub_memcpy (ptr, dns, size_dns); -+ grub_free (dns); -+ } -+ - 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 - struct grub_net_dhcp6_option *opt; - struct grub_net_dhcp6_option_iana *iana; - struct grub_net_dhcp6_option_iaaddr *iaaddr; -+ grub_efi_ipv6_address_t *dns; -+ grub_efi_uintn_t num_dns; - - 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 - opt->len = grub_cpu_to_be16 (uri_len); - grub_memcpy (opt->data, uri_dp->uri, uri_len); - -+ dns = grub_dns_server_ip6_address (dp, &num_dns); -+ if (dns) -+ { -+ grub_efi_uintn_t size_dns = sizeof (*dns) * num_dns; -+ -+ opt = (struct grub_net_dhcp6_option *)nb->tail; -+ err = grub_netbuff_put (nb, sizeof(*opt) + size_dns); -+ if (err) -+ { -+ grub_free (ddp); -+ grub_netbuff_free (nb); -+ return NULL; -+ } -+ opt->code = grub_cpu_to_be16_compile_time (GRUB_NET_DHCP6_OPTION_DNS_SERVERS); -+ opt->len = grub_cpu_to_be16 (size_dns); -+ grub_memcpy (opt->data, dns, size_dns); -+ grub_free (dns); -+ } -+ - *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 -@@ -334,6 +334,16 @@ - { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \ - } - -+#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \ -+ { 0x5b446ed1, 0xe30b, 0x4faa, \ -+ { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ -+ } -+ -+#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \ -+ { 0x937fe521, 0x95ae, 0x4d1a, \ -+ { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ -+ } -+ - struct grub_efi_sal_system_table - { - grub_uint32_t signature; -@@ -1749,6 +1759,72 @@ struct grub_efi_block_io - }; - typedef struct grub_efi_block_io grub_efi_block_io_t; - -+enum grub_efi_ip4_config2_data_type { -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, -+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MAXIMUM -+}; -+typedef enum grub_efi_ip4_config2_data_type grub_efi_ip4_config2_data_type_t; -+ -+struct grub_efi_ip4_config2_protocol -+{ -+ grub_efi_status_t (*set_data) (struct grub_efi_ip4_config2_protocol *this, -+ grub_efi_ip4_config2_data_type_t data_type, -+ grub_efi_uintn_t data_size, -+ void *data); -+ -+ grub_efi_status_t (*get_data) (struct grub_efi_ip4_config2_protocol *this, -+ grub_efi_ip4_config2_data_type_t data_type, -+ grub_efi_uintn_t *data_size, -+ void *data); -+ -+ grub_efi_status_t (*register_data_notify) (struct grub_efi_ip4_config2_protocol *this, -+ grub_efi_ip4_config2_data_type_t data_type, -+ grub_efi_event_t event); -+ -+ grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip4_config2_protocol *this, -+ grub_efi_ip4_config2_data_type_t data_type, -+ grub_efi_event_t event); -+}; -+typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t; -+ -+enum grub_efi_ip6_config_data_type { -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DUP_ADDR_DETECT_TRANSMITS, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, -+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MAXIMUM -+}; -+typedef enum grub_efi_ip6_config_data_type grub_efi_ip6_config_data_type_t; -+ -+struct grub_efi_ip6_config_protocol -+{ -+ grub_efi_status_t (*set_data) (struct grub_efi_ip6_config_protocol *this, -+ grub_efi_ip6_config_data_type_t data_type, -+ grub_efi_uintn_t data_size, -+ void *data); -+ -+ grub_efi_status_t (*get_data) (struct grub_efi_ip6_config_protocol *this, -+ grub_efi_ip6_config_data_type_t data_type, -+ grub_efi_uintn_t *data_size, -+ void *data); -+ -+ grub_efi_status_t (*register_data_notify) (struct grub_efi_ip6_config_protocol *this, -+ grub_efi_ip6_config_data_type_t data_type, -+ grub_efi_event_t event); -+ -+ grub_efi_status_t (*unregister_datanotify) (struct grub_efi_ip6_config_protocol *this, -+ grub_efi_ip6_config_data_type_t data_type, -+ grub_efi_event_t event); -+}; -+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 - diff --git a/20_memtest86+ b/20_memtest86+ deleted file mode 100644 index 97c5bfd..0000000 --- a/20_memtest86+ +++ /dev/null @@ -1,59 +0,0 @@ -#! /bin/sh -set -e - -# grub-mkconfig helper script. -# Copyright (C) 2011 Michal Ambroz -# Adapted for openSUSE by Andrey Borzenkov -# -# 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. -# -# 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 the script. If not, see . - -. /usr/share/grub2/grub-mkconfig_lib - -export TEXTDOMAIN=grub2 -export TEXTDOMAINDIR=/usr/share/locale - -# memset86+ requires the x86 real mode -# which is not available with UEFI booting. -if [ -d /sys/firmware/efi ]; then - exit 0 -fi - -CLASS="--class memtest86 --class gnu --class tools" - -if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS=Memtest -else - OS="${GRUB_DISTRIBUTOR} Memtest" - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" -fi - -memtest=/boot/memtest.bin - -if grub_file_is_not_garbage "$memtest" ; then - gettext_printf "Found memtest image: %s\n" "$memtest" >&2 - basename=`basename $memtest` - dirname=`dirname $memtest` - rel_dirname=`make_system_path_relative_to_its_root $dirname` - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE_BOOT}")" - - printf "menuentry '%s' %s \$menuentry_id_option '%s' {\n" "${OS}" "${CLASS}" "memtest-$boot_device_id" - prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" - printf '%s\n' "${prepare_boot_cache}" - message="$(gettext_printf "Loading memtest ...\n" | grub_quote)" - cat << EOF - echo '$message' - linux16 ${rel_dirname}/${basename} -} -EOF -fi diff --git a/80_suse_btrfs_snapshot b/80_suse_btrfs_snapshot deleted file mode 100644 index 9826426..0000000 --- a/80_suse_btrfs_snapshot +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -set -e -if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] && - [ "x${GRUB_FS}" = "xbtrfs" ] ; then - cat < [Enter] "engage" - '^[' => [ESC] "abort" / return to previous "state" - '^i' => [TAB] try completion (in edit & shell mode) - -Available Keys in Menu Mode: - '^a' first entry '^e' last entry - '^p' previous entry '^n' next entry - '^g' previous page '^c' next page - '^f' boot selected entry/enter sub-menu (same as '^j') - 'e' edit selected entry 'c' enter grub-shell - -Available Keys in Edit Mode: - '^p' previous line '^n' next line - '^b' backward char '^f' forward char - '^a' beginning of line '^e' end of line - '^h' backspace '^d' delete - '^k' kill (to end of) line '^y' yank - '^o' open line '^l' refresh screen - '^x' boot entry '^c' enter grub-shell - -Availble Keys on Command Line Mode: - '^p' previous command '^n' next command (from history) - '^a' beginning of line '^e' end of line - '^b' backward char '^f' forward char - '^h' backspace '^d' delete - '^k' kill (to end of) line '^u' discard line - '^y' yank - diff --git a/README.openSUSE b/README.openSUSE new file mode 100644 index 0000000..d0a86cc --- /dev/null +++ b/README.openSUSE @@ -0,0 +1,48 @@ +Using GNU GRUB 2 in openSUSE +============================ + +Though GRUB 2 provides various feature enhancements over previous GRUB +version (referred to as "GRUB", or "GRUB Legacy"), it did not reach its +stability and feature completness yet, and thus is not ready to replace +it for the whole user base. This package is primarily intended to +encourage testing and accelerate distribution integration. + +It is generally safe to install the package. It is able to co-exist with +existing GRUB installation and adds itself to the GRUB menu upon +installation, so you'll able to select GRUB 2 from GRUB menu during +the boot. + +Utilities +--------- + +The GRUB 2 utilities are prefixed (or postfixed) with 'grub2': + +grub2-editenv +grub2-mkimage +grub2-mkelfimage +grub2-mkrescue +grub2-emu +grub2-install +grub2-mkdevicemap +grub2-probe +grub2-setup +update-grub2 + +Documentation +------------- + +The GRUB 2 lacks documentation. While you are encouraged to contribute +the documentation, you can use the GRUB 2 Wiki [1] as primary source of +information pertaining to this development snapshot. + +[1] http://grub.enbug.org/ + +If you intend to install grub2 as your primary boot loader refer to +the GRUB 2 Wiki for information on how to set it up. + +Support channels +---------------- + +If you find a bug in this package, report them to the openSUSE Bugzilla [2]. + +[2] http://bugzilla.novell.com/ diff --git a/SLES-UEFI-CA-Certificate.crt b/SLES-UEFI-CA-Certificate.crt deleted file mode 100644 index 56f3fce..0000000 --- a/SLES-UEFI-CA-Certificate.crt +++ /dev/null @@ -1,39 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIG5TCCBM2gAwIBAgIBATANBgkqhkiG9w0BAQsFADCBpjEtMCsGA1UEAwwkU1VT -RSBMaW51eCBFbnRlcnByaXNlIFNlY3VyZSBCb290IENBMQswCQYDVQQGEwJERTES -MBAGA1UEBwwJTnVyZW1iZXJnMSEwHwYDVQQKDBhTVVNFIExpbnV4IFByb2R1Y3Rz -IEdtYkgxEzARBgNVBAsMCkJ1aWxkIFRlYW0xHDAaBgkqhkiG9w0BCQEWDWJ1aWxk -QHN1c2UuZGUwHhcNMTMwMTIyMTQyMDA4WhcNMzQxMjE4MTQyMDA4WjCBpjEtMCsG -A1UEAwwkU1VTRSBMaW51eCBFbnRlcnByaXNlIFNlY3VyZSBCb290IENBMQswCQYD -VQQGEwJERTESMBAGA1UEBwwJTnVyZW1iZXJnMSEwHwYDVQQKDBhTVVNFIExpbnV4 -IFByb2R1Y3RzIEdtYkgxEzARBgNVBAsMCkJ1aWxkIFRlYW0xHDAaBgkqhkiG9w0B -CQEWDWJ1aWxkQHN1c2UuZGUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC -AQCrLYL1Uq02iIgro6x6PFESFDtUKU7xO/bJanI7+AQAroowFuLBI67BBSmoq3hR -QnH3OtQusGV8y+wvjaaunppvWMfjViZ88zssj5fKXrDr5U6BB566DJgHreWaEs2d -FD13XpKRr3Nk9zdjAJu5YsR7hI1NMXsnj1X8w71OY9HLjv+Kq9917PJwZQjOGnAJ -BQTi0ogHuLiwDqMKgg5rrYD4cJDPzoLEmEXnwHDIOSiWdD0bCzhN6GQDKldIxQ2O -d/mjUgzB+dWslIb+bUKaoJgDtyPV20W74t7Y2uwoaEVr9QkPoM3tOPttf4qsWo8B -J1TgeoF01ZeKcvSyvOXCKbfAN9sqURK2ZUTNThqZ//VPQmJP6fByrMJsbvTOSsQt -HI+fFPrg1DC2KT8SzuGtWDRscHZ7MofvUKEQolVgkGwp8u68t/RAAwDpUdqIajzi -yfp9qSDD+9uMeyiLa4rrAr2ATGohNBa0qha95slgvSepXbYKuHG5b4fWMsG7z4Uc -dqE2vK8cQma1nsAeQBaq2/89294TOHEzKyspesfCBCnKQ3q+l9xelYRdvapj1CH/ -cfUZf2/6X3VHN1P88RfRrPubswmrcOCEBT41upa2WKRDJ1GS6YhL6LJnrZSTjfe+ -KsfNVS1D+KqSKiK0hfk6YK6O88mMGeAKQs3Ap8WthBLf0QIDAQABo4IBGjCCARYw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPU1Az5OFOQJLHPxaEt7f6LF+dV8w -gdMGA1UdIwSByzCByIAUPU1Az5OFOQJLHPxaEt7f6LF+dV+hgaykgakwgaYxLTAr -BgNVBAMMJFNVU0UgTGludXggRW50ZXJwcmlzZSBTZWN1cmUgQm9vdCBDQTELMAkG -A1UEBhMCREUxEjAQBgNVBAcMCU51cmVtYmVyZzEhMB8GA1UECgwYU1VTRSBMaW51 -eCBQcm9kdWN0cyBHbWJIMRMwEQYDVQQLDApCdWlsZCBUZWFtMRwwGgYJKoZIhvcN -AQkBFg1idWlsZEBzdXNlLmRlggEBMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0B -AQsFAAOCAgEANtdMT47CjQtuERYa5jfygIO5F+urB4fl8pYcQQ/hTPE0KtAnAtrS -1strtMrVQ1t7Wu3fVbWYA6MZMXXkcwyyNbaWfj6roaSC6G5ZqCJ69oSyzaCbyaTI -eOgzIIiVGOAj7tiM6T88Xp9qx4Xa3F6UQHF6xfwBT3nNKerGKOG01p7mBfBewwO5 -Hxp7OAZmennUxV1uuT5/AsArxw9lMlawXhIAS7tRYHW+32D4tjHPDycldOw1hBjt -z5JdehBiTmxhJ6onl0HSpsX84IMSbkeFIxLfxIF0TNas1pGnSGmh8FcV+ck9js3P -yamJcNkgCstIwo3QZ2D5YdtQjOusyEuGjCIpDIQx36OMzeOo0SayOdzb2dSmcrHv -4DIkXDUELyIzu79A2R2KR7OQaGL6HGAVy6+yXHHygTbbUrb6ck2+aOG8913ChABc -ZAiSFFRKVZzzj7FeIxZNA8GBUbhd20eQB2fUXDypeAnTG6P3dtTs84xNb1qGm3VC -OAKjkWYQijLWmAOs9Q4NM/AXOeDTgXxA7iX7kWHRNeDbACirp7zM2ZOIP5ObIS6z -yMqcG9DecSVbXiH3MJDTBoB1idQTTyreqpM/l6N8xNNVjEiLJGMEM1SeYq6S1lFV -a+GcdOaLYkh7ya3I42l/tDOqH2OLIf7FEtocnc1xU6jTz8au1tZxec8= ------END CERTIFICATE----- diff --git a/fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-new-glibc.patch b/fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-new-glibc.patch deleted file mode 100644 index 55e4d43..0000000 --- a/fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-new-glibc.patch +++ /dev/null @@ -1,17 +0,0 @@ -Index: grub-2.02~rc1/grub-core/osdep/linux/hostdisk.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/linux/hostdisk.c -+++ grub-2.02~rc1/grub-core/osdep/linux/hostdisk.c -@@ -45,6 +45,12 @@ - #include - #include - -+#if defined(MAJOR_IN_MKDEV) -+#include -+#elif defined(MAJOR_IN_SYSMACROS) -+#include -+#endif -+ - # include /* ioctl */ - # include - # ifndef BLKFLSBUF diff --git a/grub-1.95-grubdir.patch b/grub-1.95-grubdir.patch new file mode 100644 index 0000000..c0753fb --- /dev/null +++ b/grub-1.95-grubdir.patch @@ -0,0 +1,17 @@ +This should ideally be done using transformations. +Alternatively, /boot/grub may be used, no grub's files there should conflict +with grub2 and they both can share the same device.map. + +Lubomir Rintel + +--- grub2.orig/include/grub/util/misc.h 2007-11-28 14:10:01.000000000 +0100 ++++ grub2/include/grub/util/misc.h 2007-11-28 14:10:20.000000000 +0100 +@@ -28,7 +28,7 @@ + /* NetBSD uses /boot for its boot block. */ + # define DEFAULT_DIRECTORY "/grub" + #else +-# define DEFAULT_DIRECTORY "/boot/grub" ++# define DEFAULT_DIRECTORY "/boot/grub2" + #endif + + #define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map" diff --git a/grub-1.97.2.tar.gz b/grub-1.97.2.tar.gz new file mode 100644 index 0000000..a5fdcb7 --- /dev/null +++ b/grub-1.97.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98c1d2623ce809ec25ba9136ea59c15a4580c71478d122be765e819cb06a1c49 +size 1249181 diff --git a/grub-2.02~rc1.tar.xz b/grub-2.02~rc1.tar.xz deleted file mode 100644 index 07fc14c..0000000 --- a/grub-2.02~rc1.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:445239e9b96d1143c194c1d37851cf4196b83701c60172e49665e9d453d80278 -size 6051964 diff --git a/grub.default b/grub.default index 798fc4d..638d4e5 100644 --- a/grub.default +++ b/grub.default @@ -1,39 +1,2 @@ -# If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg' afterwards to update -# /boot/grub2/grub.cfg. - -# Uncomment to set your own custom distributor. If you leave it unset or empty, the default -# policy is to determine the value from /etc/os-release -# GRUB_DISTRIBUTOR="" - -GRUB_DEFAULT=0 -GRUB_HIDDEN_TIMEOUT=0 -GRUB_HIDDEN_TIMEOUT_QUIET=true -GRUB_TIMEOUT=10 -GRUB_CMDLINE_LINUX_DEFAULT="" -GRUB_CMDLINE_LINUX="" - -# Uncomment to automatically save last booted menu entry in GRUB2 environment -# variable `saved_entry' -#GRUB_SAVEDEFAULT="true" - -# Uncomment to enable BadRAM filtering, modify to suit your needs -# This works with Linux (no patch required) and with any kernel that obtains -# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) -#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" - -# Uncomment to disable graphical terminal (grub-pc only) -#GRUB_TERMINAL=console - -# The resolution used on graphical terminal -# note that you can use only modes which your graphic card supports via VBE -# you can see them in real GRUB with the command `vbeinfo' -#GRUB_GFXMODE=640x480 - -# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux -#GRUB_DISABLE_LINUX_UUID=true - -# Uncomment to disable generation of recovery mode menu entries -#GRUB_DISABLE_LINUX_RECOVERY="true" - -# Uncomment to get a beep at grub start -#GRUB_INIT_TUNE="480 440 1" +GRUB_CMDLINE_LINUX="quiet" +GRUB_DISTRIBUTOR="openSUSE" diff --git a/grub2-Add-hidden-menu-entries.patch b/grub2-Add-hidden-menu-entries.patch deleted file mode 100644 index 8ee7929..0000000 --- a/grub2-Add-hidden-menu-entries.patch +++ /dev/null @@ -1,232 +0,0 @@ -From a06004f4c668abd7c760a2818d0a8205da7568e7 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Tue, 26 Apr 2016 15:29:25 +0200 -Subject: [PATCH v3] Add hidden menu entries - -The menu infrastructure is quite powerful. It allows you to define menu -entries that can contain arbitrary grub commands that can do a lot more -than just boot kernel entries. - -For some of these it makes sense to hide them inside the normal menu -though and instead have them available through hotkeys that get advertised -differently. My main use case is to switch to the serial console when -gfxterm is loaded. - -So this patch adds support for hidden menu entries that are accessible -using hotkeys, but are not accessible in the grub menu. - -Signed-off-by: Alexander Graf - ---- - -v1 -> v2: - - - fix default entry selection - -v2 -> v3: - - - replace "--hidden" parameter with new command "hiddenentry" - -diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c -index dd9d9f1..b282c4f 100644 ---- a/grub-core/commands/legacycfg.c -+++ b/grub-core/commands/legacycfg.c -@@ -133,7 +133,7 @@ legacy_file (const char *filename) - args[0] = oldname; - grub_normal_add_menu_entry (1, args, NULL, NULL, "legacy", - NULL, NULL, -- entrysrc, 0); -+ entrysrc, 0, 0); - grub_free (args); - entrysrc[0] = 0; - grub_free (oldname); -@@ -186,7 +186,7 @@ legacy_file (const char *filename) - } - args[0] = entryname; - grub_normal_add_menu_entry (1, args, NULL, NULL, NULL, -- NULL, NULL, entrysrc, 0); -+ NULL, NULL, entrysrc, 0, 0); - grub_free (args); - } - -diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c -index 58d4dad..b4d6c31 100644 ---- a/grub-core/commands/menuentry.c -+++ b/grub-core/commands/menuentry.c -@@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args, - char **classes, const char *id, - const char *users, const char *hotkey, - const char *prefix, const char *sourcecode, -- int submenu) -+ int submenu, int hidden) - { - int menu_hotkey = 0; - char **menu_args = NULL; -@@ -188,8 +188,11 @@ grub_normal_add_menu_entry (int argc, const char **args, - (*last)->args = menu_args; - (*last)->sourcecode = menu_sourcecode; - (*last)->submenu = submenu; -+ (*last)->hidden = hidden; -+ -+ if (!hidden) -+ menu->size++; - -- menu->size++; - return GRUB_ERR_NONE; - - fail: -@@ -286,7 +289,8 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args) - users, - ctxt->state[2].arg, 0, - ctxt->state[3].arg, -- ctxt->extcmd->cmd->name[0] == 's'); -+ ctxt->extcmd->cmd->name[0] == 's', -+ ctxt->extcmd->cmd->name[0] == 'h'); - - src = args[argc - 1]; - args[argc - 1] = NULL; -@@ -303,7 +307,8 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args) - ctxt->state[0].args, ctxt->state[4].arg, - users, - ctxt->state[2].arg, prefix, src + 1, -- ctxt->extcmd->cmd->name[0] == 's'); -+ ctxt->extcmd->cmd->name[0] == 's', -+ ctxt->extcmd->cmd->name[0] == 'h'); - - src[len - 1] = ch; - args[argc - 1] = src; -@@ -311,7 +316,7 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args) - return r; - } - --static grub_extcmd_t cmd, cmd_sub; -+static grub_extcmd_t cmd, cmd_sub, cmd_hidden; - - void - grub_menu_init (void) -@@ -327,6 +332,13 @@ grub_menu_init (void) - | GRUB_COMMAND_FLAG_EXTRACTOR, - N_("BLOCK"), N_("Define a submenu."), - options); -+ cmd_hidden = grub_register_extcmd ("hiddenentry", grub_cmd_menuentry, -+ GRUB_COMMAND_FLAG_BLOCKS -+ | GRUB_COMMAND_ACCEPT_DASH -+ | GRUB_COMMAND_FLAG_EXTRACTOR, -+ N_("BLOCK"), -+ N_("Define a hidden menu entry."), -+ options); - } - - void -diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c -index 719e2fb..2a151fe 100644 ---- a/grub-core/normal/menu.c -+++ b/grub-core/normal/menu.c -@@ -40,6 +40,8 @@ - grub_err_t (*grub_gfxmenu_try_hook) (int entry, grub_menu_t menu, - int nested) = NULL; - -+#define MENU_INCLUDE_HIDDEN 0x10000 -+ - enum timeout_style { - TIMEOUT_STYLE_MENU, - TIMEOUT_STYLE_COUNTDOWN, -@@ -80,8 +82,20 @@ grub_menu_get_entry (grub_menu_t menu, int no) - { - grub_menu_entry_t e; - -- for (e = menu->entry_list; e && no > 0; e = e->next, no--) -- ; -+ if (no & MENU_INCLUDE_HIDDEN) { -+ no &= ~MENU_INCLUDE_HIDDEN; -+ -+ for (e = menu->entry_list; e && no > 0; e = e->next, no--) -+ ; -+ } else { -+ for (e = menu->entry_list; e && no > 0; e = e->next, no--) { -+ /* Skip hidden entries */ -+ while (e && e->hidden) -+ e = e->next; -+ } -+ while (e && e->hidden) -+ e = e->next; -+ } - - return e; - } -@@ -93,10 +107,10 @@ get_entry_index_by_hotkey (grub_menu_t menu, int hotkey) - grub_menu_entry_t entry; - int i; - -- for (i = 0, entry = menu->entry_list; i < menu->size; -+ for (i = 0, entry = menu->entry_list; entry; - i++, entry = entry->next) - if (entry->hotkey == hotkey) -- return i; -+ return i | MENU_INCLUDE_HIDDEN; - - return -1; - } -@@ -510,6 +524,10 @@ get_entry_number (grub_menu_t menu, const char *name) - grub_menu_entry_t e = menu->entry_list; - int i; - -+ /* Skip hidden entries */ -+ while (e && e->hidden) -+ e = e->next; -+ - grub_errno = GRUB_ERR_NONE; - - for (i = 0; e; i++) -@@ -521,6 +539,10 @@ get_entry_number (grub_menu_t menu, const char *name) - break; - } - e = e->next; -+ -+ /* Skip hidden entries */ -+ while (e && e->hidden) -+ e = e->next; - } - - if (! e) -diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index e22bb91..4ac2d6b 100644 ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -290,6 +290,10 @@ print_entries (grub_menu_t menu, const struct menu_viewer_data *data) - e, data); - if (e) - e = e->next; -+ -+ /* Skip hidden entries */ -+ while (e && e->hidden) -+ e = e->next; - } - - grub_term_gotoxy (data->term, -diff --git a/include/grub/menu.h b/include/grub/menu.h -index ee2b5e9..eb8a86b 100644 ---- a/include/grub/menu.h -+++ b/include/grub/menu.h -@@ -58,6 +58,8 @@ struct grub_menu_entry - - int submenu; - -+ int hidden; -+ - /* The next element. */ - struct grub_menu_entry *next; - }; -diff --git a/include/grub/normal.h b/include/grub/normal.h -index 218cbab..bcb4124 100644 ---- a/include/grub/normal.h -+++ b/include/grub/normal.h -@@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes, - const char *id, - const char *users, const char *hotkey, - const char *prefix, const char *sourcecode, -- int submenu); -+ int submenu, int hidden); - - grub_err_t - grub_normal_set_password (const char *user, const char *password); diff --git a/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch b/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch deleted file mode 100644 index 309138d..0000000 --- a/grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 6225854682a736e4312ce15b34c90fff03b002db Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Fri, 6 Jul 2012 15:55:18 +0800 -Subject: [PATCH] add GRUB_CMDLINE_LINUX_RECOVERY for recovery mode - -References: [openSUSE-factory] Has FailSafe or Safe Mode been removed - permanently from 12.2? -Patch-Mainline: no - -We adapt the script a bit in order to support openSUSE's failsafe -booting mode. We don't use single user mode but with specific kernel -command line options decided in YaST. These command line could be -applied to grub2's recovery mode via the new setting -GRUB_CMDLINE_LINUX_RECOVERY. ---- - util/grub-mkconfig.in | 3 ++- - util/grub.d/10_linux.in | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -Index: grub-2.02~beta2/util/grub-mkconfig.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig.in -+++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -227,7 +227,8 @@ export GRUB_DEFAULT \ - GRUB_ENABLE_CRYPTODISK \ - GRUB_BADRAM \ - GRUB_OS_PROBER_SKIP_LIST \ -- GRUB_DISABLE_SUBMENU -+ GRUB_DISABLE_SUBMENU \ -+ GRUB_CMDLINE_LINUX_RECOVERY - - if test "x${grub_cfg}" != "x"; then - rm -f "${grub_cfg}.new" -Index: grub-2.02~beta2/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 -@@ -240,7 +240,7 @@ while [ "x$list" != "x" ] ; do - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then - linux_entry "${OS}" "${version}" recovery \ -- "single ${GRUB_CMDLINE_LINUX}" -+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_RECOVERY}" - fi - - list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '` diff --git a/grub2-SUSE-Add-the-t-hotkey.patch b/grub2-SUSE-Add-the-t-hotkey.patch deleted file mode 100644 index 2e84634..0000000 --- a/grub2-SUSE-Add-the-t-hotkey.patch +++ /dev/null @@ -1,68 +0,0 @@ -From f6be3d41e24e685846dfc90ac1ca447501813687 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Tue, 26 Apr 2016 15:59:03 +0200 -Subject: [PATCH] SUSE: Add the "t" hotkey - -While graphical output is fancy and nice, in some environments (EFI) we can -only have fancy graphical on frame buffer _or_ ugly serial on any output. - -To give the user a nicely graphical screen in the default case, but still -allow them to get their boot menu on the serial console, let's add a new -hidden option "t" that switches the output device back to the firmware default. - -Signed-off-by: Alexander Graf - ---- - -v1 -> v2 - - - use hiddenentry instead of --hidden - -diff --git a/Makefile.util.def b/Makefile.util.def -index f9caccb..d94de92 100644 ---- a/Makefile.util.def -+++ b/Makefile.util.def -@@ -504,6 +504,12 @@ script = { - installdir = grubconf; - }; - -+script = { -+ name = '95_textmode'; -+ common = util/grub.d/95_textmode.in; -+ installdir = grubconf; -+}; -+ - program = { - mansection = 1; - name = grub-mkrescue; -diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in -index 93a9023..b6ec7e2 100644 ---- a/util/grub.d/00_header.in -+++ b/util/grub.d/00_header.in -@@ -184,6 +184,9 @@ EOF - fi - fi - -+ if [ -d /sys/firmware/efi ]; then -+ echo 'echo "Please press 't' to show the boot menu on this console"' -+ fi - cat << EOF - set gfxmode=${GRUB_GFXMODE} - load_video -diff --git a/util/grub.d/95_textmode.in b/util/grub.d/95_textmode.in -new file mode 100644 -index 0000000..fa48cf9 ---- /dev/null -+++ b/util/grub.d/95_textmode.in -@@ -0,0 +1,11 @@ -+#!/bin/sh -+ -+if [ -d /sys/firmware/efi ]; then -+ echo " -+ # On EFI systems we can only have graphics *or* serial, so allow the user -+ # to switch between the two -+ hiddenentry 'Text mode' --hotkey 't' { -+ set textmode=true -+ terminal_output console -+ }" -+fi 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-btrfs-01-add-ability-to-boot-from-subvolumes.patch b/grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch deleted file mode 100644 index 1de5274..0000000 --- a/grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch +++ /dev/null @@ -1,696 +0,0 @@ -From: Jeff Mahoney -Subject: grub2/btrfs: Add ability to boot from subvolumes - -This patch adds the ability to specify a different root on a btrfs -filesystem too boot from other than the default one. - -btrfs-list-snapshots will list the subvolumes available on the -filesystem. - -set btrfs_subvol= and set btrfs_subvolid= will specify -which subvolume to use and any pathnames provided with either of those -variables set will start using that root. If the subvolume or subvolume id -doesn't exist, then an error case will result. - -It is possible to boot into a separate GRUB instance by exporting the -variable and loading the config file from the subvolume. - -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 -=================================================================== ---- 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 - #include -+#include -+#include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -64,9 +67,11 @@ struct grub_btrfs_superblock - grub_uint64_t generation; - grub_uint64_t root_tree; - grub_uint64_t chunk_tree; -- grub_uint8_t dummy2[0x20]; -+ grub_uint8_t dummy2[0x18]; -+ grub_uint64_t bytes_used; - grub_uint64_t root_dir_objectid; -- grub_uint8_t dummy3[0x41]; -+ grub_uint64_t num_devices; -+ grub_uint8_t dummy3[0x39]; - struct grub_btrfs_device this_device; - char label[0x100]; - grub_uint8_t dummy4[0x100]; -@@ -105,6 +110,7 @@ struct grub_btrfs_data - grub_uint64_t exttree; - grub_size_t extsize; - struct grub_btrfs_extent_data *extent; -+ grub_uint64_t fs_tree; - }; - - struct grub_btrfs_chunk_item -@@ -171,6 +177,14 @@ struct grub_btrfs_leaf_descriptor - } *data; - }; - -+struct grub_btrfs_root_ref -+{ -+ grub_uint64_t dirid; -+ grub_uint64_t sequence; -+ grub_uint16_t name_len; -+ const char name[0]; -+} __attribute__ ((packed)); -+ - struct grub_btrfs_time - { - grub_int64_t sec; -@@ -215,6 +229,14 @@ struct grub_btrfs_extent_data - - #define GRUB_BTRFS_OBJECT_ID_CHUNK 0x100 - -+#define GRUB_BTRFS_ROOT_TREE_OBJECTID 1ULL -+#define GRUB_BTRFS_FS_TREE_OBJECTID 5ULL -+#define GRUB_BTRFS_ROOT_REF_KEY 156 -+#define GRUB_BTRFS_ROOT_ITEM_KEY 132 -+ -+static grub_uint64_t btrfs_default_subvolid = 0; -+static char *btrfs_default_subvol = NULL; -+ - 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 - return GRUB_ERR_NONE; - } - -+static grub_err_t -+get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, -+ grub_uint64_t objectid, grub_uint64_t offset, -+ grub_uint64_t *fs_root); -+ -+static grub_err_t -+lookup_root_by_id(struct grub_btrfs_data *data, grub_uint64_t id) -+{ -+ grub_err_t err; -+ grub_uint64_t tree; -+ -+ err = get_fs_root(data, data->sblock.root_tree, id, -1, &tree); -+ if (!err) -+ data->fs_tree = tree; -+ return err; -+} -+ -+static grub_err_t -+find_path (struct grub_btrfs_data *data, -+ const char *path, struct grub_btrfs_key *key, -+ grub_uint64_t *tree, grub_uint8_t *type); -+ -+static grub_err_t -+lookup_root_by_name(struct grub_btrfs_data *data, const char *path) -+{ -+ grub_err_t err; -+ grub_uint64_t tree = 0; -+ grub_uint8_t type; -+ struct grub_btrfs_key key; -+ -+ err = find_path (data, path, &key, &tree, &type); -+ if (err) -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); -+ -+ if (key.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0) -+ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path); -+ -+ data->fs_tree = tree; -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+btrfs_handle_subvol(struct grub_btrfs_data *data __attribute__ ((unused))) -+{ -+ if (btrfs_default_subvol) -+ return lookup_root_by_name(data, btrfs_default_subvol); -+ -+ if (btrfs_default_subvolid) -+ return lookup_root_by_id(data, btrfs_default_subvolid); -+ -+ data->fs_tree = 0; -+ -+ return GRUB_ERR_NONE; -+} -+ -+ - static struct grub_btrfs_data * - grub_btrfs_mount (grub_device_t dev) - { -@@ -865,6 +943,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; - -+ err = btrfs_handle_subvol (data); -+ if (err) -+ { -+ grub_free (data); -+ return NULL; -+ } -+ - return data; - } - -@@ -1226,6 +1311,91 @@ get_root (struct grub_btrfs_data *data, - } - - static grub_err_t -+find_pathname(struct grub_btrfs_data *data, grub_uint64_t objectid, -+ grub_uint64_t fs_root, const char *name, char **pathname) -+{ -+ grub_err_t err; -+ struct grub_btrfs_key key = { -+ .object_id = objectid, -+ .type = GRUB_BTRFS_ITEM_TYPE_INODE_REF, -+ .offset = 0, -+ }; -+ struct grub_btrfs_key key_out; -+ struct grub_btrfs_leaf_descriptor desc; -+ char *p = grub_strdup (name); -+ grub_disk_addr_t elemaddr; -+ grub_size_t elemsize; -+ grub_size_t alloc = grub_strlen(name) + 1; -+ -+ err = lower_bound(data, &key, &key_out, fs_root, -+ &elemaddr, &elemsize, &desc, 0); -+ if (err) -+ return grub_error(err, "lower_bound caught %d\n", err); -+ -+ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_INODE_REF) -+ next(data, &desc, &elemaddr, &elemsize, &key_out); -+ -+ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_INODE_REF) -+ { -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, -+ "Can't find inode ref for {%"PRIuGRUB_UINT64_T -+ ", %u, %"PRIuGRUB_UINT64_T"} %"PRIuGRUB_UINT64_T -+ "/%"PRIuGRUB_SIZE"\n", -+ key_out.object_id, key_out.type, -+ key_out.offset, elemaddr, elemsize); -+ } -+ -+ -+ while (key_out.type == GRUB_BTRFS_ITEM_TYPE_INODE_REF && -+ key_out.object_id != key_out.offset) { -+ struct grub_btrfs_inode_ref *inode_ref; -+ char *new; -+ -+ inode_ref = grub_malloc(elemsize + 1); -+ if (!inode_ref) -+ return grub_error(GRUB_ERR_OUT_OF_MEMORY, -+ "couldn't allocate memory for inode_ref (%"PRIuGRUB_SIZE")\n", elemsize); -+ -+ err = grub_btrfs_read_logical(data, elemaddr, inode_ref, elemsize, 0); -+ if (err) -+ return grub_error(err, "read_logical caught %d\n", err); -+ -+ alloc += grub_le_to_cpu16 (inode_ref->n) + 2; -+ new = grub_malloc(alloc); -+ if (!new) -+ return grub_error(GRUB_ERR_OUT_OF_MEMORY, -+ "couldn't allocate memory for name (%"PRIuGRUB_SIZE")\n", alloc); -+ -+ grub_memcpy(new, inode_ref->name, grub_le_to_cpu16 (inode_ref->n)); -+ if (p) -+ { -+ new[grub_le_to_cpu16 (inode_ref->n)] = '/'; -+ grub_strcpy (new + grub_le_to_cpu16 (inode_ref->n) + 1, p); -+ grub_free(p); -+ } -+ else -+ new[grub_le_to_cpu16 (inode_ref->n)] = 0; -+ grub_free(inode_ref); -+ -+ p = new; -+ -+ key.object_id = key_out.offset; -+ -+ err = lower_bound(data, &key, &key_out, fs_root, &elemaddr, -+ &elemsize, &desc, 0); -+ if (err) -+ return grub_error(err, "lower_bound caught %d\n", err); -+ -+ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_INODE_REF) -+ next(data, &desc, &elemaddr, &elemsize, &key_out); -+ -+ } -+ -+ *pathname = p; -+ return 0; -+} -+ -+static grub_err_t - 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, - char *origpath = NULL; - unsigned symlinks_max = 32; - -- err = get_root (data, key, tree, type); -- if (err) -- return err; -- - origpath = grub_strdup (path); - if (!origpath) - return grub_errno; - -+ if (data->fs_tree) -+ { -+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -+ *tree = data->fs_tree; -+ /* This is a tree root, so everything starts at objectid 256 */ -+ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); -+ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -+ key->offset = 0; -+ } -+ else -+ { -+ err = get_root (data, key, tree, type); -+ if (err) -+ return err; -+ } -+ - while (1) - { - while (path[0] == '/') -@@ -1423,9 +1605,21 @@ find_path (struct grub_btrfs_data *data, - path = path_alloc = tmp; - if (path[0] == '/') - { -- err = get_root (data, key, tree, type); -- if (err) -- return err; -+ if (data->fs_tree) -+ { -+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -+ *tree = data->fs_tree; -+ /* This is a tree root, so everything starts at objectid 256 */ -+ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); -+ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -+ key->offset = 0; -+ } -+ else -+ { -+ err = get_root (data, key, tree, type); -+ if (err) -+ return err; -+ } - } - continue; - } -@@ -1666,6 +1860,20 @@ grub_btrfs_read (grub_file_t file, char - data->tree, file->offset, buf, len); - } - -+static char * -+btrfs_unparse_uuid(struct grub_btrfs_data *data) -+{ -+ return grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", -+ grub_be_to_cpu16 (data->sblock.uuid[0]), -+ grub_be_to_cpu16 (data->sblock.uuid[1]), -+ grub_be_to_cpu16 (data->sblock.uuid[2]), -+ grub_be_to_cpu16 (data->sblock.uuid[3]), -+ grub_be_to_cpu16 (data->sblock.uuid[4]), -+ grub_be_to_cpu16 (data->sblock.uuid[5]), -+ grub_be_to_cpu16 (data->sblock.uuid[6]), -+ grub_be_to_cpu16 (data->sblock.uuid[7])); -+} -+ - 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 - if (!data) - return grub_errno; - -- *uuid = grub_xasprintf ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x", -- grub_be_to_cpu16 (data->sblock.uuid[0]), -- grub_be_to_cpu16 (data->sblock.uuid[1]), -- grub_be_to_cpu16 (data->sblock.uuid[2]), -- grub_be_to_cpu16 (data->sblock.uuid[3]), -- grub_be_to_cpu16 (data->sblock.uuid[4]), -- grub_be_to_cpu16 (data->sblock.uuid[5]), -- grub_be_to_cpu16 (data->sblock.uuid[6]), -- grub_be_to_cpu16 (data->sblock.uuid[7])); -+ *uuid = btrfs_unparse_uuid(data); - - grub_btrfs_unmount (data); - -@@ -1742,6 +1942,242 @@ grub_btrfs_embed (grub_device_t device _ - } - #endif - -+static grub_err_t -+grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc, -+ char **argv) -+{ -+ grub_device_t dev; -+ char *devname; -+ struct grub_btrfs_data *data; -+ char *uuid; -+ -+ if (argc < 1) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required"); -+ -+ devname = grub_file_get_device_name(argv[0]); -+ -+ if (!devname) -+ return grub_errno; -+ -+ dev = grub_device_open (devname); -+ grub_free (devname); -+ if (!dev) -+ return grub_errno; -+ -+ data = grub_btrfs_mount (dev); -+ if (!data) -+ { -+ grub_device_close(dev); -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "failed to open fs"); -+ } -+ -+ if (data->sblock.label) -+ grub_printf("Label: '%s' ", data->sblock.label); -+ else -+ grub_printf("Label: none "); -+ -+ uuid = btrfs_unparse_uuid(data); -+ -+ grub_printf(" uuid: %s\n\tTotal devices %" PRIuGRUB_UINT64_T -+ " FS bytes used %" PRIuGRUB_UINT64_T "\n", -+ uuid, grub_cpu_to_le64(data->sblock.num_devices), -+ grub_cpu_to_le64(data->sblock.bytes_used)); -+ -+ grub_btrfs_unmount (data); -+ -+ return 0; -+} -+ -+static grub_err_t -+get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, -+ grub_uint64_t objectid, grub_uint64_t offset, -+ grub_uint64_t *fs_root) -+{ -+ grub_err_t err; -+ struct grub_btrfs_key key_in = { -+ .object_id = objectid, -+ .type = GRUB_BTRFS_ROOT_ITEM_KEY, -+ .offset = offset, -+ }, key_out; -+ struct grub_btrfs_leaf_descriptor desc; -+ grub_disk_addr_t elemaddr; -+ grub_size_t elemsize; -+ struct grub_btrfs_root_item ri; -+ -+ err = lower_bound(data, &key_in, &key_out, tree, -+ &elemaddr, &elemsize, &desc, 0); -+ -+ if (err) -+ return err; -+ -+ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM || elemaddr == 0) -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, -+ N_("can't find fs root for subvol %"PRIuGRUB_UINT64_T"\n"), -+ key_in.object_id); -+ -+ err = grub_btrfs_read_logical (data, elemaddr, &ri, sizeof (ri), 0); -+ if (err) -+ return err; -+ -+ *fs_root = ri.tree; -+ -+ return GRUB_ERR_NONE; -+} -+ -+static const struct grub_arg_option options[] = { -+ {"output", 'o', 0, N_("Output to a variable instead of the console."), -+ N_("VARNAME"), ARG_TYPE_STRING}, -+ {"path-only", 'p', 0, N_("Show only the path of the subvolume."), 0, 0}, -+ {"id-only", 'i', 0, N_("Show only the id of the subvolume."), 0, 0}, -+ {0, 0, 0, 0, 0, 0} -+}; -+ -+static grub_err_t -+grub_cmd_btrfs_list_subvols (struct grub_extcmd_context *ctxt, -+ int argc, char **argv) -+{ -+ struct grub_btrfs_data *data; -+ grub_device_t dev; -+ char *devname; -+ grub_uint64_t tree; -+ struct grub_btrfs_key key_in = { -+ .object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID), -+ .type = GRUB_BTRFS_ROOT_REF_KEY, -+ .offset = 0, -+ }, key_out; -+ struct grub_btrfs_leaf_descriptor desc; -+ grub_disk_addr_t elemaddr; -+ grub_uint64_t fs_root = 0; -+ grub_size_t elemsize; -+ grub_size_t allocated = 0; -+ int r = 0; -+ grub_err_t err; -+ char *buf = NULL; -+ int print = 1; -+ int path_only = ctxt->state[1].set; -+ int num_only = ctxt->state[2].set; -+ char *varname = NULL; -+ char *output = NULL; -+ -+ if (ctxt->state[0].set) { -+ varname = ctxt->state[0].arg; -+ print = 0; -+ } -+ -+ if (argc < 1) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required"); -+ -+ devname = grub_file_get_device_name(argv[0]); -+ if (!devname) -+ return grub_errno; -+ -+ dev = grub_device_open (devname); -+ grub_free (devname); -+ if (!dev) -+ return grub_errno; -+ -+ data = grub_btrfs_mount(dev); -+ if (!data) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "could not open device"); -+ -+ tree = data->sblock.root_tree; -+ err = get_fs_root(data, tree, grub_cpu_to_le64_compile_time (GRUB_BTRFS_FS_TREE_OBJECTID), -+ 0, &fs_root); -+ if (err) -+ goto out; -+ -+ err = lower_bound(data, &key_in, &key_out, tree, -+ &elemaddr, &elemsize, &desc, 0); -+ -+ if (err) -+ { -+ grub_btrfs_unmount(data); -+ return err; -+ } -+ -+ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_REF || elemaddr == 0) -+ { -+ r = next(data, &desc, &elemaddr, &elemsize, &key_out); -+ } -+ -+ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_REF) { -+ err = GRUB_ERR_FILE_NOT_FOUND; -+ grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("can't find root refs")); -+ goto out; -+ } -+ -+ do -+ { -+ struct grub_btrfs_root_ref *ref; -+ char *p = NULL; -+ -+ if (key_out.type != GRUB_BTRFS_ITEM_TYPE_ROOT_REF) -+ { -+ r = 0; -+ break; -+ } -+ -+ if (elemsize > allocated) -+ { -+ grub_free(buf); -+ allocated = 2 * elemsize; -+ buf = grub_malloc(allocated + 1); -+ if (!buf) -+ { -+ r = -grub_errno; -+ break; -+ } -+ } -+ ref = (struct grub_btrfs_root_ref *)buf; -+ -+ err = grub_btrfs_read_logical(data, elemaddr, buf, elemsize, 0); -+ if (err) -+ { -+ r = -err; -+ break; -+ } -+ buf[elemsize] = 0; -+ -+ find_pathname(data, ref->dirid, fs_root, ref->name, &p); -+ -+ if (print) -+ { -+ if (num_only) -+ grub_printf("ID %"PRIuGRUB_UINT64_T"\n", key_out.offset); -+ else if (path_only) -+ grub_printf("%s\n", p); -+ else -+ grub_printf("ID %"PRIuGRUB_UINT64_T" path %s\n", key_out.offset, p); -+ } else { -+ char *old = output; -+ if (num_only) -+ output = grub_xasprintf("%s%"PRIuGRUB_UINT64_T"\n", -+ old ?: "", key_out.offset); -+ else if (path_only) -+ output = grub_xasprintf("%s%s\n", old ?: "", p); -+ else -+ output = grub_xasprintf("%sID %"PRIuGRUB_UINT64_T" path %s\n", -+ old ?: "", key_out.offset, p); -+ -+ if (old) -+ grub_free(old); -+ } -+ -+ r = next(data, &desc, &elemaddr, &elemsize, &key_out); -+ } while(r > 0); -+ -+ if (output) -+ grub_env_set(varname, output); -+ -+out: -+ free_iterator(&desc); -+ grub_btrfs_unmount(data); -+ -+ grub_device_close (dev); -+ -+ return 0; -+} -+ - static struct grub_fs grub_btrfs_fs = { - .name = "btrfs", - .dir = grub_btrfs_dir, -@@ -1757,12 +2193,88 @@ static struct grub_fs grub_btrfs_fs = { - #endif - }; - -+static grub_command_t cmd_info; -+static grub_extcmd_t cmd_list_subvols; -+ -+static char * -+subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val) -+{ -+ unsigned long long result = 0; -+ -+ grub_errno = GRUB_ERR_NONE; -+ if (*val) -+ { -+ result = grub_strtoull(val, NULL, 10); -+ if (grub_errno) -+ return NULL; -+ } -+ -+ grub_free (btrfs_default_subvol); -+ btrfs_default_subvol = NULL; -+ btrfs_default_subvolid = result; -+ return grub_strdup(val); -+} -+ -+static const char * -+subvolid_get_env (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val __attribute__ ((unused))) -+{ -+ if (btrfs_default_subvol) -+ return grub_xasprintf("subvol:%s", btrfs_default_subvol); -+ else if (btrfs_default_subvolid) -+ return grub_xasprintf("%"PRIuGRUB_UINT64_T, btrfs_default_subvolid); -+ else -+ return ""; -+} -+ -+static char * -+subvol_set_env (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val) -+{ -+ grub_free (btrfs_default_subvol); -+ btrfs_default_subvol = grub_strdup (val); -+ btrfs_default_subvolid = 0; -+ return grub_strdup(val); -+} -+ -+static const char * -+subvol_get_env (struct grub_env_var *var __attribute__ ((unused)), -+ const char *val __attribute__ ((unused))) -+{ -+ if (btrfs_default_subvol) -+ return btrfs_default_subvol; -+ else if (btrfs_default_subvolid) -+ return grub_xasprintf("subvolid:%" PRIuGRUB_UINT64_T, -+ btrfs_default_subvolid); -+ else -+ return ""; -+} -+ - GRUB_MOD_INIT (btrfs) - { - grub_fs_register (&grub_btrfs_fs); -+ cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, -+ "DEVICE", -+ "Print BtrFS info about DEVICE."); -+ cmd_list_subvols = grub_register_extcmd("btrfs-list-subvols", -+ grub_cmd_btrfs_list_subvols, 0, -+ "[-p|-n] [-o var] DEVICE", -+ "Print list of BtrFS subvolumes on " -+ "DEVICE.", options); -+ grub_register_variable_hook ("btrfs_subvol", subvol_get_env, -+ subvol_set_env); -+ grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, -+ subvolid_set_env); - } - - GRUB_MOD_FINI (btrfs) - { -+ grub_register_variable_hook ("btrfs_subvol", NULL, NULL); -+ grub_register_variable_hook ("btrfs_subvolid", NULL, NULL); -+ grub_unregister_command (cmd_info); -+ grub_unregister_extcmd (cmd_list_subvols); - grub_fs_unregister (&grub_btrfs_fs); - } -+ -+// vim: si et sw=2: -Index: grub-2.02~beta2/include/grub/btrfs.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/btrfs.h -+++ grub-2.02~beta2/include/grub/btrfs.h -@@ -29,6 +29,7 @@ enum - GRUB_BTRFS_ITEM_TYPE_ROOT_ITEM = 0x84, - GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF = 0x90, - GRUB_BTRFS_ITEM_TYPE_DEVICE = 0xd8, -+ GRUB_BTRFS_ITEM_TYPE_ROOT_REF = 0x9c, - GRUB_BTRFS_ITEM_TYPE_CHUNK = 0xe4 - }; - diff --git a/grub2-btrfs-02-export-subvolume-envvars.patch b/grub2-btrfs-02-export-subvolume-envvars.patch deleted file mode 100644 index 65e1a6e..0000000 --- a/grub2-btrfs-02-export-subvolume-envvars.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Michael Chang -Subject: export btrfs_subvol and btrfs_subvolid - -We should export btrfs_subvol and btrfs_subvolid to have both visible -to subsidiary configuration files loaded using configfile. - -Signed-off-by: Michael Chang - -Index: grub-2.00/grub-core/fs/btrfs.c -=================================================================== ---- grub-2.00.orig/grub-core/fs/btrfs.c -+++ grub-2.00/grub-core/fs/btrfs.c -@@ -2252,6 +2252,8 @@ GRUB_MOD_INIT (btrfs) - subvol_set_env); - grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, - subvolid_set_env); -+ grub_env_export ("btrfs_subvol"); -+ grub_env_export ("btrfs_subvolid"); - } - - GRUB_MOD_FINI (btrfs) diff --git a/grub2-btrfs-03-follow_default.patch b/grub2-btrfs-03-follow_default.patch deleted file mode 100644 index 9c797b8..0000000 --- a/grub2-btrfs-03-follow_default.patch +++ /dev/null @@ -1,187 +0,0 @@ -Index: grub-2.02~beta2/grub-core/fs/btrfs.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/fs/btrfs.c -+++ grub-2.02~beta2/grub-core/fs/btrfs.c -@@ -913,6 +913,7 @@ grub_btrfs_mount (grub_device_t dev) - { - struct grub_btrfs_data *data; - grub_err_t err; -+ const char *relpath = grub_env_get ("btrfs_relative_path"); - - if (!dev->disk) - { -@@ -943,11 +944,14 @@ grub_btrfs_mount (grub_device_t dev) - data->devices_attached[0].dev = dev; - data->devices_attached[0].id = data->sblock.this_device.device_id; - -- err = btrfs_handle_subvol (data); -- if (err) -+ if (relpath && (relpath[0] == '1' || relpath[0] == 'y')) - { -- grub_free (data); -- return NULL; -+ err = btrfs_handle_subvol (data); -+ if (err) -+ { -+ grub_free (data); -+ return NULL; -+ } - } - - return data; -@@ -1407,24 +1411,39 @@ find_path (struct grub_btrfs_data *data, - grub_size_t allocated = 0; - struct grub_btrfs_dir_item *direl = NULL; - struct grub_btrfs_key key_out; -+ int follow_default; - const char *ctoken; - grub_size_t ctokenlen; - char *path_alloc = NULL; - char *origpath = NULL; - unsigned symlinks_max = 32; -+ const char *relpath = grub_env_get ("btrfs_relative_path"); - -+ follow_default = 0; - origpath = grub_strdup (path); - if (!origpath) - return grub_errno; - -- if (data->fs_tree) -+ if (relpath && (relpath[0] == '1' || relpath[0] == 'y')) - { -- *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -- *tree = data->fs_tree; -- /* This is a tree root, so everything starts at objectid 256 */ -- key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); -- key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -- key->offset = 0; -+ if (data->fs_tree) -+ { -+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -+ *tree = data->fs_tree; -+ /* This is a tree root, so everything starts at objectid 256 */ -+ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); -+ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -+ key->offset = 0; -+ } -+ else -+ { -+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -+ *tree = data->sblock.root_tree; -+ key->object_id = data->sblock.root_dir_objectid; -+ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -+ key->offset = 0; -+ follow_default = 1; -+ } - } - else - { -@@ -1435,15 +1454,23 @@ find_path (struct grub_btrfs_data *data, - - while (1) - { -- while (path[0] == '/') -- path++; -- if (!path[0]) -- break; -- slash = grub_strchr (path, '/'); -- if (!slash) -- slash = path + grub_strlen (path); -- ctoken = path; -- ctokenlen = slash - path; -+ if (!follow_default) -+ { -+ while (path[0] == '/') -+ path++; -+ if (!path[0]) -+ break; -+ slash = grub_strchr (path, '/'); -+ if (!slash) -+ slash = path + grub_strlen (path); -+ ctoken = path; -+ ctokenlen = slash - path; -+ } -+ else -+ { -+ ctoken = "default"; -+ ctokenlen = sizeof ("default") - 1; -+ } - - if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) - { -@@ -1454,7 +1481,9 @@ find_path (struct grub_btrfs_data *data, - - if (ctokenlen == 1 && ctoken[0] == '.') - { -- path = slash; -+ if (!follow_default) -+ path = slash; -+ follow_default = 0; - continue; - } - if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.') -@@ -1485,8 +1514,9 @@ find_path (struct grub_btrfs_data *data, - *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; - key->object_id = key_out.offset; - -- path = slash; -- -+ if (!follow_default) -+ path = slash; -+ follow_default = 0; - continue; - } - -@@ -1555,7 +1585,9 @@ find_path (struct grub_btrfs_data *data, - return err; - } - -- path = slash; -+ if (!follow_default) -+ path = slash; -+ follow_default = 0; - if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK) - { - struct grub_btrfs_inode inode; -@@ -1605,14 +1637,26 @@ find_path (struct grub_btrfs_data *data, - path = path_alloc = tmp; - if (path[0] == '/') - { -- if (data->fs_tree) -+ if (relpath && (relpath[0] == '1' || relpath[0] == 'y')) - { -- *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -- *tree = data->fs_tree; -- /* This is a tree root, so everything starts at objectid 256 */ -- key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); -- key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -- key->offset = 0; -+ if (data->fs_tree) -+ { -+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -+ *tree = data->fs_tree; -+ /* This is a tree root, so everything starts at objectid 256 */ -+ key->object_id = grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK); -+ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -+ key->offset = 0; -+ } -+ else -+ { -+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; -+ *tree = data->sblock.root_tree; -+ key->object_id = data->sblock.root_dir_objectid; -+ key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM; -+ key->offset = 0; -+ follow_default = 1; -+ } - } - else - { -@@ -2268,6 +2312,7 @@ GRUB_MOD_INIT (btrfs) - subvolid_set_env); - grub_env_export ("btrfs_subvol"); - grub_env_export ("btrfs_subvolid"); -+ grub_env_export ("btrfs_relative_path"); - } - - GRUB_MOD_FINI (btrfs) diff --git a/grub2-btrfs-04-grub2-install.patch b/grub2-btrfs-04-grub2-install.patch deleted file mode 100644 index ef33936..0000000 --- a/grub2-btrfs-04-grub2-install.patch +++ /dev/null @@ -1,160 +0,0 @@ -Index: grub-2.02~rc1/grub-core/osdep/unix/config.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/unix/config.c -+++ grub-2.02~rc1/grub-core/osdep/unix/config.c -@@ -219,6 +219,19 @@ grub_util_load_config (struct grub_util_ - if (v) - cfg->grub_distributor = xstrdup (v); - -+ v = getenv ("SUSE_BTRFS_SNAPSHOT_BOOTING"); -+ if (v) -+ { -+ if (grub_strncmp(v, "true", sizeof ("true") - 1) == 0) -+ { -+ cfg->is_suse_btrfs_snapshot_enabled = 1; -+ } -+ else -+ { -+ cfg->is_suse_btrfs_snapshot_enabled = 0; -+ } -+ } -+ - cfgfile = grub_util_get_config_filename (); - if (!grub_util_is_regular (cfgfile)) - return; -@@ -242,8 +255,8 @@ grub_util_load_config (struct grub_util_ - *ptr++ = *iptr; - } - -- strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\n\" " -- "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\""); -+ strcpy (ptr, "'; printf \"GRUB_ENABLE_CRYPTODISK=%s\\nGRUB_DISTRIBUTOR=%s\\nSUSE_BTRFS_SNAPSHOT_BOOTING=%s\\n\" " -+ "\"$GRUB_ENABLE_CRYPTODISK\" \"$GRUB_DISTRIBUTOR\" \"$SUSE_BTRFS_SNAPSHOT_BOOTING\""); - - argv[2] = script; - argv[3] = '\0'; -Index: grub-2.02~rc1/include/grub/emu/config.h -=================================================================== ---- grub-2.02~rc1.orig/include/grub/emu/config.h -+++ grub-2.02~rc1/include/grub/emu/config.h -@@ -37,6 +37,7 @@ struct grub_util_config - { - int is_cryptodisk_enabled; - char *grub_distributor; -+ int is_suse_btrfs_snapshot_enabled; - }; - - void -Index: grub-2.02~rc1/util/config.c -=================================================================== ---- grub-2.02~rc1.orig/util/config.c -+++ grub-2.02~rc1/util/config.c -@@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct - cfg->is_cryptodisk_enabled = 1; - continue; - } -+ if (grub_strncmp (ptr, "SUSE_BTRFS_SNAPSHOT_BOOTING=", -+ sizeof ("SUSE_BTRFS_SNAPSHOT_BOOTING=") - 1) == 0) -+ { -+ ptr += sizeof ("SUSE_BTRFS_SNAPSHOT_BOOTING=") - 1; -+ if (*ptr == '"' || *ptr == '\'') -+ ptr++; -+ if (grub_strncmp(ptr, "true", sizeof ("true") - 1) == 0) -+ cfg->is_suse_btrfs_snapshot_enabled = 1; -+ continue; -+ } - if (grub_strncmp (ptr, "GRUB_DISTRIBUTOR=", - sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0) - { -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 -@@ -828,6 +828,8 @@ fill_core_services (const char *core_ser - free (sysv_plist); - } - -+extern int use_relative_path_on_btrfs; -+ - int - main (int argc, char *argv[]) - { -@@ -861,6 +863,9 @@ main (int argc, char *argv[]) - - grub_util_load_config (&config); - -+ if (config.is_suse_btrfs_snapshot_enabled) -+ use_relative_path_on_btrfs = 1; -+ - if (!bootloader_id && config.grub_distributor) - { - char *ptr; -@@ -1347,6 +1352,16 @@ main (int argc, char *argv[]) - fprintf (load_cfg_f, "set debug='%s'\n", - debug_image); - } -+ -+ if (config.is_suse_btrfs_snapshot_enabled -+ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0) -+ { -+ if (!load_cfg_f) -+ load_cfg_f = grub_util_fopen (load_cfg, "wb"); -+ have_load_cfg = 1; -+ fprintf (load_cfg_f, "set btrfs_relative_path='y'\n"); -+ } -+ - char *prefix_drive = NULL; - char *install_drive = NULL; - -Index: grub-2.02~rc1/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/linux/getroot.c -+++ grub-2.02~rc1/grub-core/osdep/linux/getroot.c -@@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_p - return NULL; - } - -+int use_relative_path_on_btrfs = 0; - - char ** - grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) -@@ -519,6 +520,12 @@ again: - { - ret = grub_find_root_devices_from_btrfs (dir); - fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); -+ if (use_relative_path_on_btrfs) -+ { -+ if (fs_prefix) -+ free (fs_prefix); -+ fs_prefix = xstrdup ("/"); -+ } - } - else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) - { -Index: grub-2.02~rc1/util/grub-mkrelpath.c -=================================================================== ---- grub-2.02~rc1.orig/util/grub-mkrelpath.c -+++ grub-2.02~rc1/util/grub-mkrelpath.c -@@ -40,9 +40,12 @@ struct arguments - }; - - static struct argp_option options[] = { -+ {"relative", 'r', 0, 0, "use relative path on btrfs", 0}, - { 0, 0, 0, 0, 0, 0 } - }; - -+extern int use_relative_path_on_btrfs; -+ - static error_t - argp_parser (int key, char *arg, struct argp_state *state) - { -@@ -52,6 +55,9 @@ argp_parser (int key, char *arg, struct - - switch (key) - { -+ case 'r': -+ use_relative_path_on_btrfs = 1; -+ break; - case ARGP_KEY_ARG: - if (state->arg_num == 0) - arguments->pathname = xstrdup (arg); diff --git a/grub2-btrfs-05-grub2-mkconfig.patch b/grub2-btrfs-05-grub2-mkconfig.patch deleted file mode 100644 index 224e464..0000000 --- a/grub2-btrfs-05-grub2-mkconfig.patch +++ /dev/null @@ -1,136 +0,0 @@ ---- - util/grub-mkconfig.in | 3 ++- - util/grub-mkconfig_lib.in | 4 ++++ - util/grub.d/00_header.in | 23 ++++++++++++++++++++++- - util/grub.d/10_linux.in | 11 ++++++++++- - util/grub.d/20_linux_xen.in | 4 ++++ - 5 files changed, 42 insertions(+), 3 deletions(-) - -Index: grub-2.02~beta2/util/grub-mkconfig_lib.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig_lib.in -+++ grub-2.02~beta2/util/grub-mkconfig_lib.in -@@ -49,7 +49,11 @@ grub_warn () - - make_system_path_relative_to_its_root () - { -+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] ; then -+ "${grub_mkrelpath}" -r "$1" -+ else - "${grub_mkrelpath}" "$1" -+ fi - } - - is_path_readable_by_grub () -Index: grub-2.02~beta2/util/grub.d/00_header.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub.d/00_header.in -+++ grub-2.02~beta2/util/grub.d/00_header.in -@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" - - . "$pkgdatadir/grub-mkconfig_lib" - -+if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] && -+ [ "x${GRUB_FS}" = "xbtrfs" ] ; then -+ cat </dev/null || true` -@@ -236,7 +240,12 @@ while [ "x$list" != "x" ] ; do - if [ $PLATFORM != "emu" ]; then - hotkey=0 - else -- rel_dirname=$dirname -+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ] && -+ [ "x${GRUB_FS}" = "xbtrfs" ] ; then -+ rel_dirname="\${btrfs_subvol}$dirname" -+ else -+ rel_dirname="$dirname" -+ fi - fi - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` - alt_version=`echo $version | sed -e "s,\.old$,,g"` -Index: grub-2.02~beta2/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 -@@ -71,10 +71,14 @@ fi - - case x"$GRUB_FS" in - xbtrfs) -+ if [ "x${SUSE_BTRFS_SNAPSHOT_BOOTING}" = "xtrue" ]; then -+ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} \${extra_cmdline}" -+ else - rootsubvol="`make_system_path_relative_to_its_root /`" - rootsubvol="${rootsubvol#/}" - if [ "x${rootsubvol}" != x ]; then - GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" -+ fi - fi;; - xzfs) - rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` diff --git a/grub2-btrfs-06-subvol-mount.patch b/grub2-btrfs-06-subvol-mount.patch deleted file mode 100644 index c3accb7..0000000 --- a/grub2-btrfs-06-subvol-mount.patch +++ /dev/null @@ -1,512 +0,0 @@ -Index: grub-2.02~rc1/grub-core/fs/btrfs.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/fs/btrfs.c -+++ grub-2.02~rc1/grub-core/fs/btrfs.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -245,6 +246,12 @@ static grub_err_t - grub_btrfs_read_logical (struct grub_btrfs_data *data, - grub_disk_addr_t addr, void *buf, grub_size_t size, - int recursion_depth); -+static grub_err_t -+get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key, -+ grub_uint64_t *tree, grub_uint8_t *type); -+ -+grub_uint64_t -+find_mtab_subvol_tree (const char *path, char **path_in_subvol); - - static grub_err_t - read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) -@@ -887,9 +894,26 @@ lookup_root_by_name(struct grub_btrfs_da - grub_err_t err; - grub_uint64_t tree = 0; - grub_uint8_t type; -+ grub_uint64_t saved_tree; - struct grub_btrfs_key key; - -+ if (path[0] == '\0') -+ { -+ data->fs_tree = 0; -+ return GRUB_ERR_NONE; -+ } -+ -+ err = get_root (data, &key, &tree, &type); -+ if (err) -+ return err; -+ -+ saved_tree = data->fs_tree; -+ data->fs_tree = tree; -+ - err = find_path (data, path, &key, &tree, &type); -+ -+ data->fs_tree = saved_tree; -+ - if (err) - return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); - -@@ -1758,11 +1782,20 @@ grub_btrfs_dir (grub_device_t device, co - int r = 0; - grub_uint64_t tree; - grub_uint8_t type; -+ char *new_path = NULL; - - if (!data) - return grub_errno; - -- err = find_path (data, path, &key_in, &tree, &type); -+ tree = find_mtab_subvol_tree (path, &new_path); -+ -+ if (tree) -+ data->fs_tree = tree; -+ -+ err = find_path (data, new_path ? new_path : path, &key_in, &tree, &type); -+ if (new_path) -+ grub_free (new_path); -+ - if (err) - { - grub_btrfs_unmount (data); -@@ -1864,11 +1897,21 @@ grub_btrfs_open (struct grub_file *file, - struct grub_btrfs_inode inode; - grub_uint8_t type; - struct grub_btrfs_key key_in; -+ grub_uint64_t tree; -+ char *new_path = NULL; - - if (!data) - return grub_errno; - -- err = find_path (data, name, &key_in, &data->tree, &type); -+ tree = find_mtab_subvol_tree (name, &new_path); -+ -+ if (tree) -+ data->fs_tree = tree; -+ -+ err = find_path (data, new_path ? new_path : name, &key_in, &data->tree, &type); -+ if (new_path) -+ grub_free (new_path); -+ - if (err) - { - grub_btrfs_unmount (data); -@@ -2039,6 +2082,150 @@ grub_cmd_btrfs_info (grub_command_t cmd - return 0; - } - -+struct grub_btrfs_mtab -+{ -+ struct grub_btrfs_mtab *next; -+ struct grub_btrfs_mtab **prev; -+ char *path; -+ char *subvol; -+ grub_uint64_t tree; -+}; -+ -+typedef struct grub_btrfs_mtab* grub_btrfs_mtab_t; -+ -+static struct grub_btrfs_mtab *btrfs_mtab; -+ -+#define FOR_GRUB_MTAB(var) FOR_LIST_ELEMENTS (var, btrfs_mtab) -+#define FOR_GRUB_MTAB_SAFE(var, next) FOR_LIST_ELEMENTS_SAFE((var), (next), btrfs_mtab) -+ -+static void -+add_mountpoint (const char *path, const char *subvol, grub_uint64_t tree) -+{ -+ grub_btrfs_mtab_t m = grub_malloc (sizeof (*m)); -+ -+ m->path = grub_strdup (path); -+ m->subvol = grub_strdup (subvol); -+ m->tree = tree; -+ grub_list_push (GRUB_AS_LIST_P (&btrfs_mtab), GRUB_AS_LIST (m)); -+} -+ -+static grub_err_t -+grub_cmd_btrfs_mount_subvol (grub_command_t cmd __attribute__ ((unused)), int argc, -+ char **argv) -+{ -+ char *devname, *dirname, *subvol; -+ struct grub_btrfs_key key_in; -+ grub_uint8_t type; -+ grub_uint64_t tree; -+ grub_uint64_t saved_tree; -+ grub_err_t err; -+ struct grub_btrfs_data *data = NULL; -+ grub_device_t dev = NULL; -+ -+ if (argc < 3) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "required and "); -+ -+ devname = grub_file_get_device_name(argv[0]); -+ dev = grub_device_open (devname); -+ grub_free (devname); -+ -+ if (!dev) -+ { -+ err = grub_errno; -+ goto err_out; -+ } -+ -+ dirname = argv[1]; -+ subvol = argv[2]; -+ -+ data = grub_btrfs_mount (dev); -+ if (!data) -+ { -+ err = grub_errno; -+ goto err_out; -+ } -+ -+ err = find_path (data, dirname, &key_in, &tree, &type); -+ if (err) -+ goto err_out; -+ -+ if (type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) -+ { -+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory")); -+ goto err_out; -+ } -+ -+ err = get_root (data, &key_in, &tree, &type); -+ -+ if (err) -+ goto err_out; -+ -+ saved_tree = data->fs_tree; -+ data->fs_tree = tree; -+ err = find_path (data, subvol, &key_in, &tree, &type); -+ data->fs_tree = saved_tree; -+ -+ if (err) -+ goto err_out; -+ -+ if (key_in.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0) -+ { -+ err = grub_error (GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", subvol); -+ goto err_out; -+ } -+ -+ grub_btrfs_unmount (data); -+ grub_device_close (dev); -+ add_mountpoint (dirname, subvol, tree); -+ -+ return GRUB_ERR_NONE; -+ -+err_out: -+ -+ if (data) -+ grub_btrfs_unmount (data); -+ -+ if (dev) -+ grub_device_close (dev); -+ -+ return err; -+} -+ -+grub_uint64_t -+find_mtab_subvol_tree (const char *path, char **path_in_subvol) -+{ -+ grub_btrfs_mtab_t m, cm; -+ grub_uint64_t tree; -+ -+ if (!path || !path_in_subvol) -+ return 0; -+ -+ *path_in_subvol = NULL; -+ tree = 0; -+ cm = NULL; -+ -+ FOR_GRUB_MTAB (m) -+ { -+ if (grub_strncmp (path, m->path, grub_strlen (m->path)) == 0) -+ { -+ if (!cm) -+ cm = m; -+ else -+ if (grub_strcmp (m->path, cm->path) > 0) -+ cm = m; -+ } -+ } -+ -+ if (cm) -+ { -+ const char *s = path + grub_strlen (cm->path); -+ *path_in_subvol = (s[0] == '\0') ? grub_strdup ("/") : grub_strdup (s); -+ tree = cm->tree; -+ } -+ -+ return tree; -+} -+ - static grub_err_t - get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, - grub_uint64_t objectid, grub_uint64_t offset, -@@ -2245,6 +2432,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; - - static char * -@@ -2308,6 +2496,9 @@ GRUB_MOD_INIT (btrfs) - cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info, - "DEVICE", - "Print BtrFS info about DEVICE."); -+ cmd_mount_subvol = grub_register_command("btrfs-mount-subvol", grub_cmd_btrfs_mount_subvol, -+ "DEVICE DIRECTORY SUBVOL", -+ "Set btrfs DEVICE the DIRECTORY a mountpoint of SUBVOL."); - cmd_list_subvols = grub_register_extcmd("btrfs-list-subvols", - grub_cmd_btrfs_list_subvols, 0, - "[-p|-n] [-o var] DEVICE", -Index: grub-2.02~rc1/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/linux/getroot.c -+++ grub-2.02~rc1/grub-core/osdep/linux/getroot.c -@@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key - grub_uint32_t unused[9]; - }; - -+struct btrfs_ioctl_search_header { -+ grub_uint64_t transid; -+ grub_uint64_t objectid; -+ grub_uint64_t offset; -+ grub_uint32_t type; -+ grub_uint32_t len; -+}; -+ - struct btrfs_ioctl_search_args { - struct btrfs_ioctl_search_key key; - grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key)) -@@ -378,6 +386,109 @@ get_btrfs_fs_prefix (const char *mount_p - - int use_relative_path_on_btrfs = 0; - -+static char * -+get_btrfs_subvol (const char *path) -+{ -+ struct btrfs_ioctl_ino_lookup_args args; -+ grub_uint64_t tree_id; -+ int fd = -1; -+ char *ret = NULL; -+ -+ fd = open (path, O_RDONLY); -+ -+ if (fd < 0) -+ return NULL; -+ -+ memset (&args, 0, sizeof(args)); -+ args.objectid = GRUB_BTRFS_TREE_ROOT_OBJECTID; -+ -+ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) -+ goto error; -+ -+ tree_id = args.treeid; -+ -+ while (tree_id != GRUB_BTRFS_ROOT_VOL_OBJECTID) -+ { -+ struct btrfs_ioctl_search_args sargs; -+ struct grub_btrfs_root_backref *br; -+ struct btrfs_ioctl_search_header *search_header; -+ char *old; -+ grub_uint16_t len; -+ grub_uint64_t inode_id; -+ -+ memset (&sargs, 0, sizeof(sargs)); -+ -+ sargs.key.tree_id = 1; -+ sargs.key.min_objectid = tree_id; -+ sargs.key.max_objectid = tree_id; -+ -+ sargs.key.min_offset = 0; -+ sargs.key.max_offset = ~0ULL; -+ sargs.key.min_transid = 0; -+ sargs.key.max_transid = ~0ULL; -+ sargs.key.min_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; -+ sargs.key.max_type = GRUB_BTRFS_ITEM_TYPE_ROOT_BACKREF; -+ -+ sargs.key.nr_items = 1; -+ -+ if (ioctl (fd, BTRFS_IOC_TREE_SEARCH, &sargs) < 0) -+ goto error; -+ -+ if (sargs.key.nr_items == 0) -+ goto error; -+ -+ search_header = (struct btrfs_ioctl_search_header *)sargs.buf; -+ br = (struct grub_btrfs_root_backref *) (search_header + 1); -+ -+ len = grub_le_to_cpu16 (br->n); -+ inode_id = grub_le_to_cpu64 (br->inode_id); -+ tree_id = search_header->offset; -+ -+ old = ret; -+ ret = malloc (len + 1); -+ memcpy (ret, br->name, len); -+ ret[len] = '\0'; -+ -+ if (inode_id != GRUB_BTRFS_TREE_ROOT_OBJECTID) -+ { -+ char *s; -+ -+ memset(&args, 0, sizeof(args)); -+ args.treeid = search_header->offset; -+ args.objectid = inode_id; -+ -+ if (ioctl (fd, BTRFS_IOC_INO_LOOKUP, &args) < 0) -+ goto error; -+ -+ s = xasprintf ("%s%s", args.name, ret); -+ free (ret); -+ ret = s; -+ } -+ -+ if (old) -+ { -+ char *s = xasprintf ("%s/%s", ret, old); -+ free (ret); -+ free (old); -+ ret = s; -+ } -+ } -+ -+ close (fd); -+ return ret; -+ -+error: -+ -+ if (fd >= 0) -+ close (fd); -+ if (ret) -+ free (ret); -+ -+ return NULL; -+} -+ -+void (*grub_find_root_btrfs_mount_path_hook)(const char *mount_path); -+ - char ** - grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) - { -@@ -519,12 +630,15 @@ again: - else if (grub_strcmp (entries[i].fstype, "btrfs") == 0) - { - ret = grub_find_root_devices_from_btrfs (dir); -- fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); - if (use_relative_path_on_btrfs) - { -- if (fs_prefix) -- free (fs_prefix); - fs_prefix = xstrdup ("/"); -+ if (grub_find_root_btrfs_mount_path_hook) -+ grub_find_root_btrfs_mount_path_hook (entries[i].enc_path); -+ } -+ else -+ { -+ fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); - } - } - else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0) -@@ -1144,6 +1258,34 @@ grub_util_get_grub_dev_os (const char *o - return grub_dev; - } - -+ -+char * -+grub_util_get_btrfs_subvol (const char *path, char **mount_path) -+{ -+ char *mp = NULL; -+ -+ if (mount_path) -+ *mount_path = NULL; -+ -+ auto void -+ mount_path_hook (const char *m) -+ { -+ mp = strdup (m); -+ } -+ -+ grub_find_root_btrfs_mount_path_hook = mount_path_hook; -+ grub_free (grub_find_root_devices_from_mountinfo (path, NULL)); -+ grub_find_root_btrfs_mount_path_hook = NULL; -+ -+ if (!mp) -+ return NULL; -+ -+ if (mount_path) -+ *mount_path = mp; -+ -+ return get_btrfs_subvol (mp); -+} -+ - char * - grub_make_system_path_relative_to_its_root_os (const char *path) - { -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 -@@ -1560,6 +1560,42 @@ main (int argc, char *argv[]) - prefix_drive = xasprintf ("(%s)", grub_drives[0]); - } - -+#ifdef __linux__ -+ -+ if (config.is_suse_btrfs_snapshot_enabled -+ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0) -+ { -+ char *subvol = NULL; -+ char *mount_path = NULL; -+ -+ if (!load_cfg_f) -+ load_cfg_f = grub_util_fopen (load_cfg, "wb"); -+ have_load_cfg = 1; -+ -+ subvol = grub_util_get_btrfs_subvol (platdir, &mount_path); -+ -+ if (subvol && mount_path) -+ { -+ char *def_subvol; -+ -+ def_subvol = grub_util_get_btrfs_subvol ("/", NULL); -+ -+ if (def_subvol) -+ { -+ if (grub_strcmp (subvol, def_subvol) != 0) -+ fprintf (load_cfg_f, "btrfs-mount-subvol ($root) %s %s\n", mount_path, subvol); -+ free (def_subvol); -+ } -+ } -+ -+ if (subvol) -+ free (subvol); -+ if (mount_path) -+ free (mount_path); -+ } -+ -+#endif -+ - char mkimage_target[200]; - const char *core_name = NULL; - -Index: grub-2.02~rc1/include/grub/emu/getroot.h -=================================================================== ---- grub-2.02~rc1.orig/include/grub/emu/getroot.h -+++ grub-2.02~rc1/include/grub/emu/getroot.h -@@ -53,6 +53,11 @@ char ** - grub_find_root_devices_from_mountinfo (const char *dir, char **relroot); - #endif - -+#ifdef __linux__ -+char * -+grub_util_get_btrfs_subvol (const char *path, char **mount_path); -+#endif -+ - /* Devmapper functions provided by getroot_devmapper.c. */ - void - grub_util_pull_devmapper (const char *os_dev); diff --git a/grub2-btrfs-07-subvol-fallback.patch b/grub2-btrfs-07-subvol-fallback.patch deleted file mode 100644 index 357aa44..0000000 --- a/grub2-btrfs-07-subvol-fallback.patch +++ /dev/null @@ -1,46 +0,0 @@ -Index: grub-2.02~beta3/grub-core/fs/btrfs.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/fs/btrfs.c -+++ grub-2.02~beta3/grub-core/fs/btrfs.c -@@ -925,10 +925,40 @@ lookup_root_by_name(struct grub_btrfs_da - } - - static grub_err_t -+lookup_root_by_name_fallback(struct grub_btrfs_data *data, const char *path) -+{ -+ grub_err_t err; -+ grub_uint64_t tree = 0; -+ grub_uint8_t type; -+ struct grub_btrfs_key key; -+ -+ err = find_path (data, path, &key, &tree, &type); -+ if (err) -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); -+ -+ if (key.object_id != grub_cpu_to_le64_compile_time (GRUB_BTRFS_OBJECT_ID_CHUNK) || tree == 0) -+ return grub_error(GRUB_ERR_BAD_FILE_TYPE, "%s: not a subvolume\n", path); -+ -+ data->fs_tree = tree; -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t - btrfs_handle_subvol(struct grub_btrfs_data *data __attribute__ ((unused))) - { - if (btrfs_default_subvol) -- return lookup_root_by_name(data, btrfs_default_subvol); -+ { -+ grub_err_t err; -+ err = lookup_root_by_name(data, btrfs_default_subvol); -+ -+ /* Fallback to old schemes */ -+ if (err == GRUB_ERR_FILE_NOT_FOUND) -+ { -+ err = GRUB_ERR_NONE; -+ return lookup_root_by_name_fallback(data, btrfs_default_subvol); -+ } -+ return err; -+ } - - if (btrfs_default_subvolid) - return lookup_root_by_id(data, btrfs_default_subvolid); diff --git a/grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch b/grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch deleted file mode 100644 index 5b8c62f..0000000 --- a/grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch +++ /dev/null @@ -1,58 +0,0 @@ -Index: grub-2.02~beta2/grub-core/normal/menu.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/normal/menu.c -+++ grub-2.02~beta2/grub-core/normal/menu.c -@@ -575,6 +575,44 @@ print_countdown (struct grub_term_coordi - grub_refresh (); - } - -+/* bsc#956046 - The first entry titled 'Bootable snapshot #$NUM' is inserted on -+ top at runtime to display current snapshot information. If default entry is -+ using number as key to index the entry, the result will be shifted so here we -+ add specical handling to shift it back. We apply this workaround until a better -+ solution can be found. */ -+static void -+workaround_snapshot_menu_default_entry (grub_menu_t menu, const char *name, int *default_entry) -+{ -+ grub_menu_entry_t entry; -+ -+ if ((entry = grub_menu_get_entry (menu, 0)) -+ && entry->submenu -+ && grub_strncmp (entry->title, "Bootable snapshot", sizeof("Bootable snapshot") - 1) == 0) -+ { -+ const char *val; -+ -+ if (*default_entry == -1 && menu->size > 1) -+ { -+ *default_entry = 1; -+ return; -+ } -+ -+ val = grub_env_get (name); -+ -+ grub_error_push (); -+ -+ if (val) -+ grub_strtoul (val, 0, 0); -+ -+ if (*default_entry < (menu->size - 1) && grub_errno == GRUB_ERR_NONE) -+ ++(*default_entry); -+ -+ grub_error_pop (); -+ } -+ -+ return; -+} -+ - #define GRUB_MENU_PAGE_SIZE 10 - - /* Show the menu and handle menu entry selection. Returns the menu entry -@@ -593,6 +631,8 @@ run_menu (grub_menu_t menu, int nested, - - default_entry = get_entry_number (menu, "default"); - -+ workaround_snapshot_menu_default_entry (menu, "default", &default_entry); -+ - /* If DEFAULT_ENTRY is not within the menu entries, fall back to - the first entry. */ - if (default_entry < 0 || default_entry >= menu->size) diff --git a/grub2-btrfs-workaround-grub2-once.patch b/grub2-btrfs-workaround-grub2-once.patch deleted file mode 100644 index a914e88..0000000 --- a/grub2-btrfs-workaround-grub2-once.patch +++ /dev/null @@ -1,475 +0,0 @@ -Index: grub-2.02~beta3/grub-core/kern/fs.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/kern/fs.c -+++ grub-2.02~beta3/grub-core/kern/fs.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - grub_fs_t grub_fs_list = 0; - -@@ -228,6 +229,13 @@ grub_fs_blocklist_read (grub_file_t file - size, buf) != GRUB_ERR_NONE) - return -1; - -+ if (file->read_hook) -+ { -+ grub_disk_addr_t part_start; -+ -+ part_start = grub_partition_get_start (file->device->disk->partition); -+ file->read_hook (p->offset + sector + part_start, (unsigned)offset, (unsigned)size, file->read_hook_data); -+ } - ret += size; - len -= size; - sector -= ((size + offset) >> GRUB_DISK_SECTOR_BITS); -Index: grub-2.02~beta3/util/grub-editenv.c -=================================================================== ---- grub-2.02~beta3.orig/util/grub-editenv.c -+++ grub-2.02~beta3/util/grub-editenv.c -@@ -23,8 +23,11 @@ - #include - #include - #include --#include -+#include - #include -+#include -+#include -+#include - - #include - #include -@@ -120,6 +123,140 @@ block, use `rm %s'."), - NULL, help_filter, NULL - }; - -+struct fs_envblk_spec { -+ const char *fs_name; -+ int offset; -+ int size; -+} fs_envblk_spec[] = { -+ { "btrfs", 256 * 1024, GRUB_DISK_SECTOR_SIZE }, -+ { NULL, 0, 0 } -+}; -+ -+struct fs_envblk { -+ struct fs_envblk_spec *spec; -+ const char *dev; -+}; -+ -+typedef struct fs_envblk_spec *fs_envblk_spec_t; -+typedef struct fs_envblk *fs_envblk_t; -+ -+fs_envblk_t fs_envblk = NULL; -+ -+static int -+read_envblk_fs (const char *varname, const char *value, void *hook_data) -+{ -+ grub_envblk_t *p_envblk = (grub_envblk_t *)hook_data; -+ -+ if (!p_envblk || !fs_envblk) -+ return 0; -+ -+ if (strcmp (varname, "env_block") == 0) -+ { -+ int off, sz; -+ char *p; -+ -+ off = strtol (value, &p, 10); -+ if (*p == '+') -+ sz = strtol (p+1, &p, 10); -+ -+ if (*p == '\0') -+ { -+ FILE *fp; -+ char *buf; -+ -+ off <<= GRUB_DISK_SECTOR_BITS; -+ sz <<= GRUB_DISK_SECTOR_BITS; -+ -+ fp = grub_util_fopen (fs_envblk->dev, "rb"); -+ if (! fp) -+ grub_util_error (_("cannot open `%s': %s"), fs_envblk->dev, -+ strerror (errno)); -+ -+ -+ if (fseek (fp, off, SEEK_SET) < 0) -+ grub_util_error (_("cannot seek `%s': %s"), fs_envblk->dev, -+ strerror (errno)); -+ -+ buf = xmalloc (sz); -+ if ((fread (buf, 1, sz, fp)) != sz) -+ grub_util_error (_("cannot read `%s': %s"), fs_envblk->dev, -+ strerror (errno)); -+ -+ fclose (fp); -+ -+ *p_envblk = grub_envblk_open (buf, sz); -+ } -+ } -+ -+ return 0; -+} -+ -+static void -+create_envblk_fs (void) -+{ -+ FILE *fp; -+ char *buf; -+ const char *device; -+ int offset, size; -+ -+ if (!fs_envblk) -+ return; -+ -+ device = fs_envblk->dev; -+ offset = fs_envblk->spec->offset; -+ size = fs_envblk->spec->size; -+ -+ fp = grub_util_fopen (device, "r+b"); -+ if (! fp) -+ grub_util_error (_("cannot open `%s': %s"), device, strerror (errno)); -+ -+ buf = xmalloc (size); -+ memcpy (buf, GRUB_ENVBLK_SIGNATURE, sizeof (GRUB_ENVBLK_SIGNATURE) - 1); -+ memset (buf + sizeof (GRUB_ENVBLK_SIGNATURE) - 1, '#', size - sizeof (GRUB_ENVBLK_SIGNATURE) + 1); -+ -+ if (fseek (fp, offset, SEEK_SET) < 0) -+ grub_util_error (_("cannot seek `%s': %s"), device, strerror (errno)); -+ -+ if (fwrite (buf, 1, size, fp) != size) -+ grub_util_error (_("cannot write to `%s': %s"), device, strerror (errno)); -+ -+ grub_util_file_sync (fp); -+ free (buf); -+ fclose (fp); -+} -+ -+static grub_envblk_t -+open_envblk_fs (grub_envblk_t envblk) -+{ -+ grub_envblk_t envblk_fs = NULL; -+ char *val; -+ int offset, size; -+ -+ if (!fs_envblk) -+ return NULL; -+ -+ offset = fs_envblk->spec->offset; -+ size = fs_envblk->spec->size; -+ -+ grub_envblk_iterate (envblk, &envblk_fs, read_envblk_fs); -+ -+ if (envblk_fs && grub_envblk_size (envblk_fs) == size) -+ return envblk_fs; -+ -+ create_envblk_fs (); -+ -+ offset = offset >> GRUB_DISK_SECTOR_BITS; -+ size = (size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS; -+ -+ val = xasprintf ("%d+%d", offset, size); -+ if (! grub_envblk_set (envblk, "env_block", val)) -+ grub_util_error ("%s", _("environment block too small")); -+ grub_envblk_iterate (envblk, &envblk_fs, read_envblk_fs); -+ free (val); -+ -+ return envblk_fs; -+} -+ - static grub_envblk_t - open_envblk_file (const char *name) - { -@@ -176,10 +313,17 @@ static void - list_variables (const char *name) - { - grub_envblk_t envblk; -+ grub_envblk_t envblk_fs = NULL; - - envblk = open_envblk_file (name); -+ grub_envblk_iterate (envblk, &envblk_fs, read_envblk_fs); - grub_envblk_iterate (envblk, NULL, print_var); - grub_envblk_close (envblk); -+ if (envblk_fs) -+ { -+ grub_envblk_iterate (envblk_fs, NULL, print_var); -+ grub_envblk_close (envblk_fs); -+ } - } - - static void -@@ -202,6 +346,38 @@ write_envblk (const char *name, grub_env - } - - static void -+write_envblk_fs (grub_envblk_t envblk) -+{ -+ FILE *fp; -+ const char *device; -+ int offset, size; -+ -+ if (!fs_envblk) -+ return; -+ -+ device = fs_envblk->dev; -+ offset = fs_envblk->spec->offset; -+ size = fs_envblk->spec->size; -+ -+ if (grub_envblk_size (envblk) > size) -+ grub_util_error ("%s", _("environment block too small")); -+ -+ fp = grub_util_fopen (device, "r+b"); -+ -+ if (! fp) -+ grub_util_error (_("cannot open `%s': %s"), device, strerror (errno)); -+ -+ if (fseek (fp, offset, SEEK_SET) < 0) -+ grub_util_error (_("cannot seek `%s': %s"), device, strerror (errno)); -+ -+ if (fwrite (grub_envblk_buffer (envblk), 1, grub_envblk_size (envblk), fp) != grub_envblk_size (envblk)) -+ grub_util_error (_("cannot write to `%s': %s"), device, strerror (errno)); -+ -+ grub_util_file_sync (fp); -+ fclose (fp); -+} -+ -+static void - set_variables (const char *name, int argc, char *argv[]) - { - grub_envblk_t envblk; -@@ -217,8 +393,26 @@ set_variables (const char *name, int arg - - *(p++) = 0; - -- if (! grub_envblk_set (envblk, argv[0], p)) -- grub_util_error ("%s", _("environment block too small")); -+ if (strcmp (argv[0], "next_entry") == 0 && fs_envblk) -+ { -+ grub_envblk_t envblk_fs; -+ envblk_fs = open_envblk_fs (envblk); -+ if (!envblk_fs) -+ grub_util_error ("%s", _("can't open fs environment block")); -+ if (! grub_envblk_set (envblk_fs, argv[0], p)) -+ grub_util_error ("%s", _("environment block too small")); -+ write_envblk_fs (envblk_fs); -+ grub_envblk_close (envblk_fs); -+ } -+ else if (strcmp (argv[0], "env_block") == 0) -+ { -+ grub_util_warn ("can't set env_block as it's read-only"); -+ } -+ else -+ { -+ if (! grub_envblk_set (envblk, argv[0], p)) -+ grub_util_error ("%s", _("environment block too small")); -+ } - - argc--; - argv++; -@@ -226,26 +420,158 @@ set_variables (const char *name, int arg - - write_envblk (name, envblk); - grub_envblk_close (envblk); -+ - } - - static void - unset_variables (const char *name, int argc, char *argv[]) - { - grub_envblk_t envblk; -+ grub_envblk_t envblk_fs; - - envblk = open_envblk_file (name); -+ -+ envblk_fs = NULL; -+ if (fs_envblk) -+ envblk_fs = open_envblk_fs (envblk); -+ - while (argc) - { - grub_envblk_delete (envblk, argv[0]); - -+ if (envblk_fs) -+ grub_envblk_delete (envblk_fs, argv[0]); -+ - argc--; - argv++; - } - - write_envblk (name, envblk); - grub_envblk_close (envblk); -+ -+ if (envblk_fs) -+ { -+ write_envblk_fs (envblk_fs); -+ grub_envblk_close (envblk_fs); -+ } -+} -+ -+int have_abstraction = 0; -+static void -+probe_abstraction (grub_disk_t disk) -+{ -+ if (disk->partition == NULL) -+ grub_util_info ("no partition map found for %s", disk->name); -+ -+ if (disk->dev->id == GRUB_DISK_DEVICE_DISKFILTER_ID || -+ disk->dev->id == GRUB_DISK_DEVICE_CRYPTODISK_ID) -+ { -+ have_abstraction = 1; -+ } - } - -+static fs_envblk_t -+probe_fs_envblk (fs_envblk_spec_t spec) -+{ -+ char **grub_devices; -+ char **curdev, **curdrive; -+ size_t ndev = 0; -+ char **grub_drives; -+ grub_device_t grub_dev = NULL; -+ grub_fs_t grub_fs; -+ const char *fs_envblk_device; -+ -+#ifdef __s390x__ -+ return NULL; -+#endif -+ -+ grub_util_biosdisk_init (DEFAULT_DEVICE_MAP); -+ grub_init_all (); -+ grub_gcry_init_all (); -+ -+ grub_lvm_fini (); -+ grub_mdraid09_fini (); -+ grub_mdraid1x_fini (); -+ grub_diskfilter_fini (); -+ grub_diskfilter_init (); -+ grub_mdraid09_init (); -+ grub_mdraid1x_init (); -+ grub_lvm_init (); -+ -+ grub_devices = grub_guess_root_devices (DEFAULT_DIRECTORY); -+ -+ if (!grub_devices || !grub_devices[0]) -+ grub_util_error (_("cannot find a device for %s (is /dev mounted?)"), DEFAULT_DIRECTORY); -+ -+ fs_envblk_device = grub_devices[0]; -+ -+ for (curdev = grub_devices; *curdev; curdev++) -+ { -+ grub_util_pull_device (*curdev); -+ ndev++; -+ } -+ -+ grub_drives = xmalloc (sizeof (grub_drives[0]) * (ndev + 1)); -+ -+ for (curdev = grub_devices, curdrive = grub_drives; *curdev; curdev++, -+ curdrive++) -+ { -+ *curdrive = grub_util_get_grub_dev (*curdev); -+ if (! *curdrive) -+ grub_util_error (_("cannot find a GRUB drive for %s. Check your device.map"), -+ *curdev); -+ } -+ *curdrive = 0; -+ -+ grub_dev = grub_device_open (grub_drives[0]); -+ if (! grub_dev) -+ grub_util_error ("%s", grub_errmsg); -+ -+ grub_fs = grub_fs_probe (grub_dev); -+ if (! grub_fs) -+ grub_util_error ("%s", grub_errmsg); -+ -+ if (grub_dev->disk) -+ { -+ probe_abstraction (grub_dev->disk); -+ } -+ for (curdrive = grub_drives + 1; *curdrive; curdrive++) -+ { -+ grub_device_t dev = grub_device_open (*curdrive); -+ if (!dev) -+ continue; -+ if (dev->disk) -+ probe_abstraction (dev->disk); -+ grub_device_close (dev); -+ } -+ -+ free (grub_drives); -+ grub_device_close (grub_dev); -+ grub_gcry_fini_all (); -+ grub_fini_all (); -+ grub_util_biosdisk_fini (); -+ -+ fs_envblk_spec_t p; -+ -+ for (p = spec; p->fs_name; p++) -+ { -+ if (strcmp (grub_fs->name, p->fs_name) == 0 && !have_abstraction) -+ { -+ if (p->offset % GRUB_DISK_SECTOR_SIZE == 0 && -+ p->size % GRUB_DISK_SECTOR_SIZE == 0) -+ { -+ fs_envblk = xmalloc (sizeof (fs_envblk_t)); -+ fs_envblk->spec = p; -+ fs_envblk->dev = strdup(fs_envblk_device); -+ return fs_envblk; -+ } -+ } -+ } -+ -+ return NULL; -+} -+ -+ - int - main (int argc, char *argv[]) - { -@@ -277,6 +603,9 @@ main (int argc, char *argv[]) - command = argv[curindex++]; - } - -+ if (strcmp (filename, DEFAULT_ENVBLK_PATH) == 0) -+ fs_envblk = probe_fs_envblk (fs_envblk_spec); -+ - if (strcmp (command, "create") == 0) - grub_util_create_envblk_file (filename); - else if (strcmp (command, "list") == 0) -Index: grub-2.02~beta3/util/grub.d/00_header.in -=================================================================== ---- grub-2.02~beta3.orig/util/grub.d/00_header.in -+++ grub-2.02~beta3/util/grub.d/00_header.in -@@ -46,6 +46,11 @@ cat << EOF - if [ -s \$prefix/grubenv ]; then - load_env - fi -+ -+if [ "\${env_block}" ] ; then -+ load_env -f "\${env_block}" -+fi -+ - EOF - if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then - cat < -Subject: Introduce a 'read_file' sub-command. -References: bsc#892852, bsc#891946 -Patch-Mainline: not yet - -Needed to allow s390x-emu to be telecontrolled via LOADPARM. ---- - grub-core/commands/read.c | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - ---- a/grub-core/commands/read.c -+++ b/grub-core/commands/read.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -77,16 +78,49 @@ grub_cmd_read (grub_command_t cmd __attr - return 0; - } - -+static grub_err_t -+grub_cmd_read_from_file (grub_command_t cmd __attribute__ ((unused)), int argc, char **args) -+{ -+ char *line; -+ int i = 0; -+ grub_file_t file; -+ -+ if (argc < 1) -+ 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++]); -+ if (! file) -+ return grub_errno; -+ while ( i < argc ) -+ { -+ line = grub_file_getline (file); -+ if ( !line ) -+ break; -+ grub_env_set (args[i++], line); -+ grub_free (line); -+ } -+ grub_file_close (file); -+ if (i != argc) -+ return GRUB_ERR_OUT_OF_RANGE; -+ return 0; -+} -+ - static grub_command_t cmd; -+static grub_command_t cme; - - GRUB_MOD_INIT(read) - { - cmd = grub_register_command ("read", grub_cmd_read, - N_("[ENVVAR]"), - N_("Set variable with user input.")); -+ cme = grub_register_command ("read_file", grub_cmd_read_from_file, -+ N_("FILE ENVVAR [...]"), -+ N_("Set variable(s) with line(s) from FILE.")); - } - - GRUB_MOD_FINI(read) - { - grub_unregister_command (cmd); -+ grub_unregister_command (cme); - } diff --git a/grub2-default-distributor.patch b/grub2-default-distributor.patch deleted file mode 100644 index 0eda6ab..0000000 --- a/grub2-default-distributor.patch +++ /dev/null @@ -1,200 +0,0 @@ -Index: grub-2.02~beta3/grub-core/osdep/unix/config.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/osdep/unix/config.c -+++ grub-2.02~beta3/grub-core/osdep/unix/config.c -@@ -61,6 +61,143 @@ grub_util_get_localedir (void) - return LOCALEDIR; - } - -+#ifdef __linux__ -+static char * -+os_release_get_val (const char *buf, const char *key) -+{ -+ const char *ptr = buf; -+ char *ret; -+ -+ while (*ptr && grub_isspace(*ptr)) -+ ptr++; -+ -+ if (*ptr == '#') -+ return NULL; -+ -+ if (grub_strncmp (ptr, key, grub_strlen (key)) != 0) -+ return NULL; -+ -+ ptr += grub_strlen (key); -+ if (*ptr++ != '=' || *ptr == '\0') -+ return NULL; -+ -+ if (*ptr == '"' || *ptr == '\'') -+ { -+ char c = *ptr; -+ int i = 0; -+ char *tmp, *ptmp; -+ -+ if (*++ptr == '\0') -+ return NULL; -+ -+ tmp = grub_strdup (ptr); -+ if ((ptmp = grub_strrchr (tmp, c))) -+ *ptmp = '\0'; -+ -+ ret = malloc (grub_strlen (tmp) + 1); -+ ptmp = tmp; -+ while (*ptmp) -+ { -+ if (*ptmp != '\\' || *(ptmp + 1) != c) -+ ret[i++] = *ptmp; -+ ++ptmp; -+ } -+ -+ grub_free (tmp); -+ ret[i] = '\0'; -+ } -+ else -+ { -+ char *pret; -+ -+ ret = grub_strdup (ptr); -+ if ((pret = grub_strchr (ret, ' '))) -+ *pret = '\0'; -+ } -+ -+ return ret; -+} -+ -+static char* -+grub_util_default_distributor (void) -+{ -+ char *cfgfile; -+ char buf[1024]; -+ FILE *fp = NULL; -+ char *os_pretty_name = NULL; -+ char *os_name = NULL; -+ char *os_version = NULL; -+ -+ cfgfile = grub_util_path_concat (2, GRUB_SYSCONFDIR, "os-release"); -+ if (!grub_util_is_regular (cfgfile)) -+ { -+ grub_free (cfgfile); -+ return NULL; -+ } -+ -+ fp = grub_util_fopen (cfgfile, "r"); -+ -+ if (!fp) -+ { -+ grub_util_warn (_("cannot open configuration file `%s': %s"), -+ cfgfile, strerror (errno)); -+ grub_free (cfgfile); -+ return NULL; -+ } -+ -+ grub_free (cfgfile); -+ -+ while (fgets (buf, sizeof (buf), fp)) -+ { -+ if (buf[grub_strlen(buf) - 1] == '\n') -+ buf[grub_strlen(buf) - 1] = '\0'; -+ -+ if (!os_pretty_name -+ && (os_pretty_name = os_release_get_val (buf, "PRETTY_NAME"))) -+ continue; -+ if (!os_name -+ && (os_name = os_release_get_val (buf, "NAME"))) -+ continue; -+ if (!os_version -+ && (os_version = os_release_get_val (buf, "VERSION"))) -+ continue; -+ if (os_pretty_name && os_name && os_version) -+ break; -+ } -+ -+ fclose (fp); -+ -+ if (os_name && grub_strncmp (os_name, "openSUSE Tumbleweed", sizeof ("openSUSE Tumbleweed") - 1) == 0) -+ { -+ grub_free (os_name); -+ if (os_version) -+ grub_free (os_version); -+ -+ return os_pretty_name; -+ } -+ else if (os_name && os_version) -+ { -+ char *os_name_version; -+ -+ os_name_version = grub_xasprintf ("%s %s", os_name, os_version); -+ -+ grub_free (os_name); -+ grub_free (os_version); -+ if (os_pretty_name) -+ grub_free (os_pretty_name); -+ -+ return os_name_version; -+ } -+ -+ if (os_pretty_name) -+ grub_free (os_pretty_name); -+ if (os_version) -+ grub_free (os_version); -+ -+ return os_name; -+} -+#endif -+ - void - grub_util_load_config (struct grub_util_config *cfg) - { -@@ -125,7 +262,17 @@ grub_util_load_config (struct grub_util_ - waitpid (pid, NULL, 0); - } - if (f) -- return; -+ { -+#ifdef __linux__ -+ if (!cfg->grub_distributor || cfg->grub_distributor[0] == '\0') -+ { -+ if (cfg->grub_distributor) -+ grub_free (cfg->grub_distributor); -+ cfg->grub_distributor = grub_util_default_distributor (); -+ } -+#endif -+ return; -+ } - - f = grub_util_fopen (cfgfile, "r"); - if (f) -@@ -136,4 +283,13 @@ grub_util_load_config (struct grub_util_ - else - grub_util_warn (_("cannot open configuration file `%s': %s"), - cfgfile, strerror (errno)); -+ -+#ifdef __linux__ -+ if (!cfg->grub_distributor || cfg->grub_distributor[0] == '\0') -+ { -+ if (cfg->grub_distributor) -+ grub_free (cfg->grub_distributor); -+ cfg->grub_distributor = grub_util_default_distributor (); -+ } -+#endif - } -Index: grub-2.02~beta3/util/grub-mkconfig.in -=================================================================== ---- grub-2.02~beta3.orig/util/grub-mkconfig.in -+++ grub-2.02~beta3/util/grub-mkconfig.in -@@ -206,6 +206,14 @@ GRUB_ACTUAL_DEFAULT="$GRUB_DEFAULT" - - if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ s,^saved_entry=,,p'`" ; fi - -+if [ x"${GRUB_DISTRIBUTOR}" = x ] && [ -f "${sysconfdir}/os-release" ] ; then -+ . "${sysconfdir}/os-release" -+ if echo "$NAME" | grep -q "^openSUSE Tumbleweed" ; then -+ GRUB_DISTRIBUTOR="${PRETTY_NAME}" -+ else -+ GRUB_DISTRIBUTOR="${NAME} ${VERSION}" -+ fi -+fi - - # These are defined in this script, export them here so that user can - # override them. diff --git a/grub2-dlsym-v4.patch b/grub2-dlsym-v4.patch new file mode 100644 index 0000000..100c210 --- /dev/null +++ b/grub2-dlsym-v4.patch @@ -0,0 +1,30 @@ +2008-05-07: Lubomir Rintel + + * kern/dl.c (grub_dl_resolve_symbols): Let the + grub_gdb_trapvec symbol be resolved correctly (instead of 0). + +--- grub2/kern/dl.c 2008-01-26 21:34:58.000000000 +0100 ++++ grub2-gdb/kern/dl.c 2008-05-07 09:27:08.000000000 +0200 +@@ -352,16 +352,18 @@ grub_dl_resolve_symbols (grub_dl_t mod, + { + case STT_NOTYPE: + /* Resolve a global symbol. */ +- if (sym->st_name != 0 && sym->st_shndx == 0) ++ if (sym->st_name == 0) ++ break; ++ ++ if (sym->st_shndx == 0) /* external */ + { + sym->st_value = (Elf_Addr) grub_dl_resolve_symbol (name); + if (! sym->st_value) + return grub_error (GRUB_ERR_BAD_MODULE, + "the symbol `%s' not found", name); +- } +- else +- sym->st_value = 0; + break; ++ } ++ /* nonexternal, same as STT_OBJECT */ + + case STT_OBJECT: + sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod, diff --git a/grub2-editenv-add-warning-message.patch b/grub2-editenv-add-warning-message.patch deleted file mode 100644 index 82674f4..0000000 --- a/grub2-editenv-add-warning-message.patch +++ /dev/null @@ -1,36 +0,0 @@ -Index: grub-2.02~beta2/util/editenv.c -=================================================================== ---- grub-2.02~beta2.orig/util/editenv.c -+++ grub-2.02~beta2/util/editenv.c -@@ -30,12 +30,14 @@ - #include - - #define DEFAULT_ENVBLK_SIZE 1024 -+#define GRUB_ENVBLK_MESSAGE "# WARNING: Do not edit this file other than by grub2-editenv\n" - - void - grub_util_create_envblk_file (const char *name) - { - FILE *fp; - char *buf; -+ char *pbuf; - char *namenew; - - buf = xmalloc (DEFAULT_ENVBLK_SIZE); -@@ -46,9 +48,13 @@ grub_util_create_envblk_file (const char - grub_util_error (_("cannot open `%s': %s"), namenew, - strerror (errno)); - -- memcpy (buf, GRUB_ENVBLK_SIGNATURE, sizeof (GRUB_ENVBLK_SIGNATURE) - 1); -- memset (buf + sizeof (GRUB_ENVBLK_SIGNATURE) - 1, '#', -- DEFAULT_ENVBLK_SIZE - sizeof (GRUB_ENVBLK_SIGNATURE) + 1); -+ pbuf = buf; -+ memcpy (pbuf, GRUB_ENVBLK_SIGNATURE, sizeof (GRUB_ENVBLK_SIGNATURE) - 1); -+ pbuf += sizeof (GRUB_ENVBLK_SIGNATURE) - 1; -+ memcpy (pbuf, GRUB_ENVBLK_MESSAGE, sizeof (GRUB_ENVBLK_MESSAGE) - 1); -+ pbuf += sizeof (GRUB_ENVBLK_MESSAGE) - 1; -+ memset (pbuf , '#', -+ DEFAULT_ENVBLK_SIZE - sizeof (GRUB_ENVBLK_SIGNATURE) - sizeof (GRUB_ENVBLK_MESSAGE) + 2); - - if (fwrite (buf, 1, DEFAULT_ENVBLK_SIZE, fp) != DEFAULT_ENVBLK_SIZE) - grub_util_error (_("cannot write to `%s': %s"), namenew, 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 30f0afa..0000000 --- a/grub2-efi-Free-malloc-regions-on-exit.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 0c5fbc745846a53cc04ac1052cfbd35c699394c5 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Thu, 19 May 2016 15:01:06 +0200 -Subject: [PATCH] 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 ---- - grub-core/kern/efi/init.c | 1 + - grub-core/kern/efi/mm.c | 24 ++++++++++++++++++++++++ - include/grub/efi/efi.h | 1 + - 3 files changed, 26 insertions(+) - -Index: grub-2.02~beta3/grub-core/kern/efi/init.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/kern/efi/init.c -+++ grub-2.02~beta3/grub-core/kern/efi/init.c -@@ -167,4 +167,5 @@ grub_efi_fini (void) - { - grub_efidisk_fini (); - grub_console_fini (); -+ grub_efi_memory_fini (); - } -Index: grub-2.02~beta3/grub-core/kern/efi/mm.c -=================================================================== ---- grub-2.02~beta3.orig/grub-core/kern/efi/mm.c -+++ grub-2.02~beta3/grub-core/kern/efi/mm.c -@@ -49,6 +49,12 @@ static grub_efi_uintn_t finish_desc_size - static grub_efi_uint32_t finish_desc_version; - int grub_efi_is_finished = 0; - -+struct efi_allocation { -+ grub_uint64_t start_addr; -+ grub_uint64_t pages; -+} efi_allocated_memory[16]; -+unsigned int efi_allocated_memory_idx = 0; -+ - /* Allocate pages below a specified address */ - void * - grub_efi_allocate_pages_max (grub_efi_physical_address_t max, -@@ -440,6 +446,13 @@ add_memory_regions (grub_efi_memory_desc - (void *) ((grub_addr_t) start), - (unsigned) pages); - -+ /* Track up to 16 regions that we allocate from */ -+ if (efi_allocated_memory_idx < ARRAY_SIZE(efi_allocated_memory)) { -+ efi_allocated_memory[efi_allocated_memory_idx].start_addr = start; -+ efi_allocated_memory[efi_allocated_memory_idx].pages = pages; -+ efi_allocated_memory_idx++; -+ } -+ - grub_mm_init_region (addr, PAGES_TO_BYTES (pages)); - - required_pages -= pages; -@@ -451,6 +464,17 @@ add_memory_regions (grub_efi_memory_desc - grub_fatal ("too little memory"); - } - -+void -+grub_efi_memory_fini (void) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < efi_allocated_memory_idx; i++) { -+ grub_efi_free_pages (efi_allocated_memory[i].start_addr, -+ efi_allocated_memory[i].pages); -+ } -+} -+ - #if 0 - /* Print the memory map. */ - static void -Index: grub-2.02~beta3/include/grub/efi/efi.h -=================================================================== ---- grub-2.02~beta3.orig/include/grub/efi/efi.h -+++ grub-2.02~beta3/include/grub/efi/efi.h -@@ -51,6 +51,7 @@ EXPORT_FUNC(grub_efi_get_memory_map) (gr - 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); diff --git a/grub2-efi-HP-workaround.patch b/grub2-efi-HP-workaround.patch deleted file mode 100644 index 5b53090..0000000 --- a/grub2-efi-HP-workaround.patch +++ /dev/null @@ -1,93 +0,0 @@ -Index: grub-2.02~beta2/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 -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - - grub_addr_t grub_modbase; - -@@ -48,6 +49,67 @@ grub_efi_init (void) - void (*grub_efi_net_config) (grub_efi_handle_t hnd, - char **device, - char **path); -+static char * -+workaround_efi_firmware_path (const char *device, const char *path) -+{ -+ char *config = NULL;; -+ char *config_upper = NULL; -+ char *path_upper = NULL; -+ char *ret_path = NULL; -+ grub_file_t config_fd = NULL; -+ char *s; -+ -+ if (!device || !path) -+ return NULL; -+ -+ /* only workaround if booting off from cd device */ -+ if (grub_strncmp (device, "cd", 2) != 0) -+ goto quit; -+ -+ config = grub_xasprintf ("(%s)%s/grub.cfg", device, path); -+ config_fd = grub_file_open (config); -+ -+ /* everything's fine, so quit the workaround */ -+ if (config_fd) -+ goto quit; -+ -+ /* reset grub error state because noone else does... */ -+ grub_errno = GRUB_ERR_NONE; -+ -+ /* try again, this time upper case path */ -+ path_upper = grub_strdup (path); -+ if (! path_upper) -+ goto quit; -+ -+ s = path_upper; -+ for (; *s; s++) *s = grub_toupper(*s); -+ -+ config_upper = grub_xasprintf ("(%s)%s/grub.cfg", device, path_upper); -+ if (! config_upper) -+ goto quit; -+ -+ config_fd = grub_file_open (config_upper); -+ -+ /* if config can be found by the upper case path, return it */ -+ if (config_fd) -+ ret_path = grub_strdup (path_upper); -+ -+quit: -+ -+ if (config_fd) -+ grub_file_close (config_fd); -+ -+ if (grub_errno) -+ grub_errno = GRUB_ERR_NONE; -+ -+ if (config) -+ grub_free (config); -+ -+ if (config_upper) -+ grub_free (config_upper); -+ -+ return ret_path; -+} - - void - grub_machine_get_bootlocation (char **device, char **path) -@@ -69,6 +131,12 @@ grub_machine_get_bootlocation (char **de - p = grub_strrchr (*path, '/'); - if (p) - *p = '\0'; -+ -+ if ((p = workaround_efi_firmware_path (*device, *path))) -+ { -+ grub_free (*path); -+ *path = p; -+ } - } - } - diff --git a/grub2-efi-chainload-harder.patch b/grub2-efi-chainload-harder.patch deleted file mode 100644 index b1557cf..0000000 --- a/grub2-efi-chainload-harder.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- - grub-core/loader/efi/chainloader.c | 62 +++++++++++++++++++++---------------- - 1 file changed, 36 insertions(+), 26 deletions(-) - -Index: grub-2.02~beta2/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 -@@ -326,40 +326,41 @@ grub_secure_mode (void) - static grub_efi_boolean_t - read_header (void *data, grub_efi_uint32_t size, pe_coff_loader_image_context_t *context) - { -- grub_efi_guid_t guid = SHIM_LOCK_GUID; -- grub_efi_shim_lock_t *shim_lock; -- grub_efi_status_t status; -- -- shim_lock = grub_efi_locate_protocol (&guid, NULL); -+ char *msdos = (char *)data; -+ struct grub_pe32_header_no_msdos_stub *pe32 = (struct grub_pe32_header_no_msdos_stub *)data; - -- if (!shim_lock) -+ if (size < sizeof (*pe32)) - { -- grub_error (GRUB_ERR_BAD_ARGUMENT, "no shim lock protocol"); -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid image"); - return 0; - } - -- status = shim_lock->context (data, size, context); -- -- if (status == GRUB_EFI_SUCCESS) -+ if (grub_memcmp (msdos, "MZ", 2) == 0) - { -- grub_dprintf ("chain", "context success\n"); -- return 1; -+ grub_uint32_t off = *((grub_uint32_t *) (msdos + 0x3c)); -+ pe32 = (struct grub_pe32_header_no_msdos_stub *) ((char *)data + off); - } - -- switch (status) -+ if (grub_memcmp (pe32->signature, "PE\0\0", 4) != 0 || -+ pe32->coff_header.machine != GRUB_PE32_MACHINE_X86_64 || -+ pe32->optional_header.magic != GRUB_PE32_PE64_MAGIC) - { -- case GRUB_EFI_UNSUPPORTED: -- grub_error (GRUB_ERR_BAD_ARGUMENT, "context error unsupported"); -- break; -- case GRUB_EFI_INVALID_PARAMETER: -- grub_error (GRUB_ERR_BAD_ARGUMENT, "context error invalid parameter"); -- break; -- default: -- grub_error (GRUB_ERR_BAD_ARGUMENT, "context error code"); -- break; -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "Not supported image"); -+ return 0; - } - -- return 0; -+ context->number_of_rva_and_sizes = pe32->optional_header.num_data_directories; -+ context->size_of_headers = pe32->optional_header.header_size; -+ context->image_size = pe32->optional_header.image_size; -+ context->image_address = pe32->optional_header.image_base; -+ context->entry_point = pe32->optional_header.entry_addr; -+ context->reloc_dir = &pe32->optional_header.base_relocation_table; -+ context->sec_dir = &pe32->optional_header.certificate_table; -+ context->number_of_sections = pe32->coff_header.num_sections; -+ context->pe_hdr = pe32; -+ context->first_section = (struct grub_pe32_section_table *)((char *)(&pe32->optional_header) + pe32->coff_header.optional_header_size); -+ -+ return 1; - } - - static void* -@@ -623,6 +624,9 @@ error_exit: - if (buffer) - efi_call_1 (b->free_pool, buffer); - -+ if (grub_errno) -+ grub_print_error (); -+ - return 0; - - } -@@ -845,6 +849,19 @@ grub_cmd_chainloader (grub_command_t cmd - status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path, - boot_image, fsize, - &image_handle); -+#ifdef SUPPORT_SECURE_BOOT -+ if (status == GRUB_EFI_SECURITY_VIOLATION && !grub_secure_mode()) -+ { -+ /* If it failed with security violation while not in secure boot mode, -+ the firmware might be broken. We try to workaround on that by forcing -+ the SB method! (bsc#887793) */ -+ grub_dprintf ("chain", "Possible firmware flaw! Security violation while not in secure boot mode.\n"); -+ grub_file_close (file); -+ grub_loader_set (grub_secureboot_chainloader_boot, -+ grub_secureboot_chainloader_unload, 0); -+ return 0; -+ } -+#endif - if (status != GRUB_EFI_SUCCESS) - { - if (status == GRUB_EFI_OUT_OF_RESOURCES) diff --git a/grub2-efi-chainloader-root.patch b/grub2-efi-chainloader-root.patch deleted file mode 100644 index 0c588a1..0000000 --- a/grub2-efi-chainloader-root.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Raymund Will -Subject: Use device part of chainloader target, if present. -References: bnc#871857, bnc#880177 -Patch-Mainline: no - -Otherwise chainloading is restricted to '$root', which might not even -be readable by EFI! - -v1. use grub_file_get_device_name() to get device name - -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 -=================================================================== ---- 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 - *(--p16) = 0; - } - -+ grub_dprintf ("chain", "cmd='%s'\n", filename); - file = grub_file_open (filename); - if (! file) - goto fail; - -- /* Get the root device's device path. */ -- dev = grub_device_open (0); -+ /* Get the device path from filename. */ -+ char *devname = grub_file_get_device_name (filename); -+ dev = grub_device_open (devname); -+ if (devname) -+ grub_free (devname); - if (! dev) - goto fail; - diff --git a/grub2-efi-disable-video-cirrus-and-bochus.patch b/grub2-efi-disable-video-cirrus-and-bochus.patch deleted file mode 100644 index 1d37519..0000000 --- a/grub2-efi-disable-video-cirrus-and-bochus.patch +++ /dev/null @@ -1,35 +0,0 @@ -Index: grub-2.02~beta2/grub-core/Makefile.core.def -=================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -1921,13 +1921,13 @@ module = { - module = { - name = video_cirrus; - x86 = video/cirrus.c; -- enable = x86; -+ enable = x86_noefi; - }; - - module = { - name = video_bochs; - x86 = video/bochs.c; -- enable = x86; -+ enable = x86_noefi; - }; - - module = { -Index: grub-2.02~beta2/gentpl.py -=================================================================== ---- grub-2.02~beta2.orig/gentpl.py -+++ grub-2.02~beta2/gentpl.py -@@ -80,6 +80,10 @@ GROUPS["fdt"] = [ "arm64_efi", "arm_uboo - GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"] - GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc") - -+# x86 without efi -+GROUPS["x86_noefi"] = GROUPS["x86"][:] -+GROUPS["x86_noefi"].remove("i386_efi"); GROUPS["x86_noefi"].remove("x86_64_efi"); -+ - # - # Create platform => groups reverse map, where groups covering that - # platform are ordered by their sizes diff --git a/grub2-efi-gop-add-blt.patch b/grub2-efi-gop-add-blt.patch deleted file mode 100644 index 7acf273..0000000 --- a/grub2-efi-gop-add-blt.patch +++ /dev/null @@ -1,59 +0,0 @@ -From dc56925653819582777ddc5c761a56f52dddd8f1 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Wed, 1 Feb 2017 23:10:45 +0100 -Subject: [PATCH] grub-core/video/efi_gop.c: Add support for BLT_ONLY adapters - -EFI GOP has support for multiple different bitness types of frame buffers -and for a special "BLT only" type which is always defined to be RGBx. - -Because grub2 doesn't ever directly access the frame buffer but instead -only renders graphics via the BLT interface anyway, we can easily support -these adapters. - -The reason this has come up now is the emerging support for virtio-gpu -in OVMF. That adapter does not have the notion of a memory mapped frame -buffer and thus is BLT only. - -Signed-off-by: Alexander Graf ---- - grub-core/video/efi_gop.c | 2 ++ - include/grub/efi/graphics_output.h | 3 ++- - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c -index 7f9d1c2..c9e40e8 100644 ---- a/grub-core/video/efi_gop.c -+++ b/grub-core/video/efi_gop.c -@@ -121,6 +121,7 @@ grub_video_gop_get_bpp (struct grub_efi_gop_mode_info *in) - { - case GRUB_EFI_GOT_BGRA8: - case GRUB_EFI_GOT_RGBA8: -+ case GRUB_EFI_GOT_BLT_ONLY: - return 32; - - case GRUB_EFI_GOT_BITMASK: -@@ -187,6 +188,7 @@ grub_video_gop_fill_real_mode_info (unsigned mode, - switch (in->pixel_format) - { - case GRUB_EFI_GOT_RGBA8: -+ case GRUB_EFI_GOT_BLT_ONLY: - out->red_mask_size = 8; - out->red_field_pos = 0; - out->green_mask_size = 8; -diff --git a/include/grub/efi/graphics_output.h b/include/grub/efi/graphics_output.h -index 1297774..e438812 100644 ---- a/include/grub/efi/graphics_output.h -+++ b/include/grub/efi/graphics_output.h -@@ -28,7 +28,8 @@ typedef enum - { - GRUB_EFI_GOT_RGBA8, - GRUB_EFI_GOT_BGRA8, -- GRUB_EFI_GOT_BITMASK -+ GRUB_EFI_GOT_BITMASK, -+ GRUB_EFI_GOT_BLT_ONLY, - } - grub_efi_gop_pixel_format_t; - --- -1.8.5.6 - diff --git a/grub2-efi-xen-chainload.patch b/grub2-efi-xen-chainload.patch deleted file mode 100644 index 298b40e..0000000 --- a/grub2-efi-xen-chainload.patch +++ /dev/null @@ -1,166 +0,0 @@ -From: Raymund Will -Subject: Use chainloader to boot xen.efi under UEFI. -References: bnc#871857, bnc#879148 -Patch-Mainline: no - -As XEN on SLE12 is not multiboot2 ready, some very dirty hacking -is necessary to boot via xen.efi and separate configfile snippets -(as done in SLE11SP3 secureboot). - -To that end said configfile snippets, xen efi-binaries, kernels and initrds -need to copied to the EFI system partition during 'grub2-mkconfig'! - -V0: -- first, somewhat fragile version, without any sort of cleanup for ESP. -V1: -- add missing whitespace. (bnc879148) -V2: -- second, much less fragile version, using only one config file per - XEN hypervisor version with sections for different kernels, avoiding - useless duplicates for sym-linked hypervisors. and removing previously - installed files from ESP. - ---- - util/grub.d/20_linux_xen.in | 88 +++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 86 insertions(+), 2 deletions(-) - -Index: grub-2.02~beta2/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 -@@ -21,6 +21,8 @@ prefix="@prefix@" - exec_prefix="@exec_prefix@" - datarootdir="@datarootdir@" - -+ME=$(basename $0) -+ - . "$pkgdatadir/grub-mkconfig_lib" - - export TEXTDOMAIN=@PACKAGE@ -@@ -36,9 +38,11 @@ CLASS="--class gnu-linux --class gnu --c - - if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS=GNU/Linux -+ os=linux - else - OS="${GRUB_DISTRIBUTOR}" -- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" -+ os="$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)" -+ CLASS="--class ${os} ${CLASS}" - fi - - # loop-AES arranges things so that /dev/loop/X can be our root device, but -@@ -85,6 +89,31 @@ esac - - title_correction_code= - -+if [ -d /sys/firmware/efi ]; then -+ is_efi=true -+ err_msg="" -+ efi_dir="/boot/efi/efi/${os}" -+ grub_dir=/boot/@PACKAGE@ -+ xen_dir=/usr/lib64/efi -+ for d in $grub_dir $efi_dir $xen_dir; do -+ [ ! -d "$d" ] || continue -+ err_msg="${err_msg}$ME: Essential directory '$d' not found!\n" -+ done -+ if ! [ -d "$efi_dir" -a -d "$grub_dir" -a -d "$xen_dir" ]; then -+ err_msg="${err_msg}$ME: XEN configuration skipped!\n" -+ else -+ rm -f $grub_dir/xen*.cfg -+ if [ -s $efi_dir/grub.xen-files ]; then -+ for f in $(sort $efi_dir/grub.xen-files| uniq); do -+ rm -f $efi_dir/$f -+ done -+ : > $efi_dir/grub.xen-files -+ fi -+ fi -+else -+ is_efi=false -+fi -+ - linux_entry () - { - os="$1" -@@ -122,6 +151,40 @@ linux_entry () - save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/" - fi - -+ if $is_efi; then -+ xen_cfg=${xen_basename/.efi/.cfg} -+ if [ "$section_count" = 0 ]; then -+ cat <<-EOF > $grub_dir/$xen_cfg -+ # disclaimer -+ [global] -+ #default= -+ EOF -+ fi -+ section_count=$(expr $section_count + 1) -+ if [ x$type != xrecovery ] ; then -+ section="config.$section_count" -+ else -+ section="failsafe.$section_count" -+ fi -+ cat <<-EOF >> $grub_dir/$xen_cfg -+ -+ [$section] -+ options=${xen_args} -+ kernel=${basename} root=${linux_root_device_thisversion} ${args} -+ ramdisk=${initrd} -+ EOF -+ message="$(gettext_printf "Loading Xen %s with Linux %s ..." ${xen_version} ${version})" -+ sed "s/^/$submenu_indentation/" <<-EOF -+ echo '$(echo "$message" | grub_quote)' -+ chainloader \$cmdpath/${xen_basename} ${xen_basename} $section -+ } -+ EOF -+ for f in ${grub_dir}/$xen_cfg ${xen_dir}/${xen_basename} ${dirname}/${basename} ${dirname}/${initrd}; do -+ cp --preserve=timestamps $f $efi_dir -+ echo $(basename $f) >> $efi_dir/grub.xen-files -+ done -+ return -+ fi - if [ -z "${prepare_boot_cache}" ]; then - prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)" - fi -@@ -219,6 +282,24 @@ while [ "x${xen_list}" != "x" ] ; do - xen_dirname=`dirname ${current_xen}` - rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname` - xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"` -+ xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '` -+ if $is_efi; then -+ xen_basename=${xen_basename/.gz/.efi} -+ if ! [ -f ${xen_dir}/${xen_basename} ]; then -+ echo "Skip missing hypervisor $xen_dir/$xen_basename" >&2 -+ continue -+ elif [ -L ${xen_dir}/${xen_basename} ]; then -+ xen_target=$(basename $(readlink -e ${xen_dir}/${xen_basename})) -+ if [ -f ${efi_dir}/${xen_target} ]; then -+ echo "Skip duplicate $xen_dir/$xen_basename for $xen_target" >&2 -+ continue -+ fi -+ elif [ -n "$err_msg" ]; then -+ break -+ fi -+ gettext_printf "Found hypervisor: %s\n" "$current_xen" >&2 -+ section_count=0 -+ fi - if [ -z "$boot_device_id" ]; then - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" - fi -@@ -283,7 +364,6 @@ while [ "x${xen_list}" != "x" ] ; do - if [ x"$is_top_level" != xtrue ]; then - echo ' }' - fi -- xen_list=`echo $xen_list | tr ' ' '\n' | fgrep -vx "$current_xen" | tr '\n' ' '` - done - - # If at least one kernel was found, then we need to -@@ -293,3 +373,7 @@ if [ x"$is_top_level" != xtrue ]; then - fi - - echo "$title_correction_code" -+ -+if [ -n "$err_msg" ]; then -+ echo -en "$err_msg" >&2 -+fi diff --git a/grub2-efi-xen-cmdline.patch b/grub2-efi-xen-cmdline.patch deleted file mode 100644 index d3342f1..0000000 --- a/grub2-efi-xen-cmdline.patch +++ /dev/null @@ -1,27 +0,0 @@ -Index: grub-2.02~beta2/util/grub-mkconfig.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig.in -+++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -260,7 +260,8 @@ export GRUB_DEFAULT \ - GRUB_DISABLE_SUBMENU \ - GRUB_CMDLINE_LINUX_RECOVERY \ - GRUB_USE_LINUXEFI \ -- SUSE_BTRFS_SNAPSHOT_BOOTING -+ SUSE_BTRFS_SNAPSHOT_BOOTING \ -+ SUSE_CMDLINE_XENEFI - - if test "x${grub_cfg}" != "x"; then - rm -f "${grub_cfg}.new" -Index: grub-2.02~beta2/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 -@@ -176,7 +176,7 @@ linux_entry () - message="$(gettext_printf "Loading Xen %s with Linux %s ..." ${xen_version} ${version})" - sed "s/^/$submenu_indentation/" <<-EOF - echo '$(echo "$message" | grub_quote)' -- chainloader \$cmdpath/${xen_basename} ${xen_basename} $section -+ chainloader \$cmdpath/${xen_basename} ${xen_basename} ${SUSE_CMDLINE_XENEFI} $section - } - EOF - for f in ${grub_dir}/$xen_cfg ${xen_dir}/${xen_basename} ${dirname}/${basename} ${dirname}/${initrd}; do diff --git a/grub2-efi_gop-avoid-low-resolution.patch b/grub2-efi_gop-avoid-low-resolution.patch deleted file mode 100644 index 5226539..0000000 --- a/grub2-efi_gop-avoid-low-resolution.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- - grub-core/video/efi_gop.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - ---- a/grub-core/video/efi_gop.c -+++ b/grub-core/video/efi_gop.c -@@ -358,6 +358,7 @@ grub_video_gop_setup (unsigned int width - grub_err_t err; - unsigned bpp; - int found = 0; -+ int avoid_low_resolution = 1; - unsigned long long best_volume = 0; - unsigned int preferred_width = 0, preferred_height = 0; - grub_uint8_t *buffer; -@@ -376,8 +377,11 @@ grub_video_gop_setup (unsigned int width - } - } - -+again: - /* Keep current mode if possible. */ -- if (gop->mode->info) -+ if (gop->mode->info && -+ (!avoid_low_resolution || -+ (gop->mode->info->width >= 800 && gop->mode->info->height >= 600))) - { - bpp = grub_video_gop_get_bpp (gop->mode->info); - if (bpp && ((width == gop->mode->info->width -@@ -450,6 +454,11 @@ grub_video_gop_setup (unsigned int width - - if (!found) - { -+ if (avoid_low_resolution && gop->mode->info) -+ { -+ avoid_low_resolution = 0; -+ goto again; -+ } - grub_dprintf ("video", "GOP: no mode found\n"); - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found"); - } diff --git a/grub2-emu-4-all.patch b/grub2-emu-4-all.patch deleted file mode 100644 index 38ff1ee..0000000 --- a/grub2-emu-4-all.patch +++ /dev/null @@ -1,170 +0,0 @@ ---- - Makefile.util.def | 10 +++++----- - configure.ac | 1 + - grub-core/Makefile.core.def | 14 +++++--------- - grub-core/osdep/unix/emuconsole.c | 5 +++-- - 4 files changed, 14 insertions(+), 16 deletions(-) - -Index: grub-2.02~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; - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - cppflags = '-DGRUB_SETUP_FUNC=grub_util_bios_setup'; -- emu_condition = COND_NOT_s390x; -+ emu_condition = COND_NOT_emu; - }; - - program = { -@@ -373,7 +373,7 @@ program = { - ldadd = grub-core/gnulib/libgnu.a; - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; - cppflags = '-DGRUB_SETUP_FUNC=grub_util_sparc_setup'; -- emu_condition = COND_NOT_s390x; -+ emu_condition = COND_NOT_emu; - }; - - program = { -@@ -389,7 +389,7 @@ program = { - ldadd = libgrubkern.a; - ldadd = grub-core/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 = { - ldadd = libgrubkern.a; - ldadd = grub-core/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 = { - ldadd = libgrubkern.a; - ldadd = grub-core/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 -=================================================================== ---- grub-2.02~rc1.orig/grub-core/Makefile.core.def -+++ grub-2.02~rc1/grub-core/Makefile.core.def -@@ -1057,7 +1057,7 @@ module = { - module = { - name = videotest; - common = commands/videotest.c; -- emu_condition = COND_NOT_s390x; -+ emu_condition = COND_NOT_emu; - }; - - module = { -@@ -1470,7 +1470,7 @@ module = { - common = gfxmenu/gui_progress_bar.c; - common = gfxmenu/gui_util.c; - common = gfxmenu/gui_string_util.c; -- emu_condition = COND_NOT_s390x; -+ emu_condition = COND_NOT_emu; - }; - - module = { -@@ -1886,13 +1886,13 @@ module = { - name = gfxterm; - common = term/gfxterm.c; - enable = videomodules; -- emu_condition = COND_NOT_s390x; -+ emu_condition = COND_NOT_emu; - }; - - module = { - name = gfxterm_background; - common = term/gfxterm_background.c; -- emu_condition = COND_NOT_s390x; -+ emu_condition = COND_NOT_emu; - }; - - module = { -@@ -2005,9 +2005,7 @@ module = { - enable = i386_pc; - enable = i386_efi; - enable = x86_64_efi; -- enable = emu; - enable = xen; -- emu_condition = COND_NOT_s390x; - }; - - module = { -@@ -2054,7 +2052,7 @@ module = { - module = { - name = gfxterm_menu; - common = tests/gfxterm_menu.c; -- emu_condition = COND_NOT_s390x; -+ emu_condition = COND_NOT_emu; - }; - - module = { -@@ -2205,9 +2203,7 @@ module = { - enable = i386_pc; - enable = i386_efi; - enable = x86_64_efi; -- enable = emu; - enable = xen; -- emu_condition = COND_NOT_s390x; - }; - - module = { -Index: grub-2.02~rc1/configure.ac -=================================================================== ---- grub-2.02~rc1.orig/configure.ac -+++ grub-2.02~rc1/configure.ac -@@ -1884,6 +1884,7 @@ AC_SUBST(BUILD_LIBM) - - AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone]) - AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) -+AM_CONDITIONAL([COND_NOT_emu], [test x$platform != xemu]) - 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 -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/unix/emuconsole.c -+++ grub-2.02~rc1/grub-core/osdep/unix/emuconsole.c -@@ -50,13 +50,12 @@ static struct termios new_tty; - static int console_mode = 0; - - #define MAX_LEN 1023 --#if defined(__s390x__) -+ - static int - dummy (void) - { - return 0; - } --#endif - #if 0 - static char msg[MAX_LEN+1]; - static void -@@ -128,6 +127,7 @@ readkey (struct grub_term_input *term) - return -1; - } - -+#if defined(__s390x__) - #define NO_KEY ((grub_uint8_t)-1) - static int - readkey_dumb (struct grub_term_input *term) -@@ -158,6 +158,7 @@ readkey_dumb (struct grub_term_input *te - p = c; - return c; - } -+#endif - - static void - grub_dumb_putchar (struct grub_term_output *term, diff --git a/grub2-fix-error-terminal-gfxterm-isn-t-found.patch b/grub2-fix-error-terminal-gfxterm-isn-t-found.patch deleted file mode 100644 index e9e9bd8..0000000 --- a/grub2-fix-error-terminal-gfxterm-isn-t-found.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e2e0fe44cf2a03744e96f886f95ab2c2a8aed331 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Wed, 18 Jul 2012 14:54:32 +0800 -Subject: [PATCH] fix error: terminal 'gfxterm' isn't found - -References: bnc#771393 -Patch-Mainline: no - -If set GRUB_TERMINAL="gfxterm", the error message "terminal -'gfxterm' isn't found" will be logged to screen. This is caused -by GRUB_TERMINAL_INPUT erroneously set to gfxterm. This patch -fixes the issue by not setting it. ---- - util/grub-mkconfig.in | 6 +++++- - 1 files changed, 5 insertions(+), 1 deletions(-) - -Index: grub-2.02~beta2/util/grub-mkconfig.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig.in -+++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -150,7 +150,11 @@ fi - - # XXX: should this be deprecated at some point? - if [ "x${GRUB_TERMINAL}" != "x" ] ; then -- GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}" -+# bnc#771393 - fix error: terminal 'gfxterm' isn't found. -+# by not specifying 'gfxterm' to GRUB_TERMINAL_INPUT -+ if [ "x${GRUB_TERMINAL}" != "xgfxterm" ]; then -+ GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}" -+ fi - GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}" - fi - 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-fix-menu-in-xen-host-server.patch b/grub2-fix-menu-in-xen-host-server.patch deleted file mode 100644 index 895abdf..0000000 --- a/grub2-fix-menu-in-xen-host-server.patch +++ /dev/null @@ -1,130 +0,0 @@ -From b411dc88b46890400a2e1ba0aa8650e00f738c23 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 19 Jul 2012 18:43:55 +0800 -Subject: [PATCH] fix menu in xen host server - -References: bnc#771689, bnc#757895 -Patch-Mainline: no - -When system is configred as "Xen Virtual Machines Host Server", the -grub2 menu is not well organized. We could see some issues on it. - - - Many duplicated xen entries generated by links to xen hypervisor - - Non bootable kernel entries trying to boot xen kernel natively - - The -dbg xen hypervisor takes precedence over release version - -This patch fixes above three issues. - -v2: -References: bnc#877040 -Create only hypervisor pointed by /boot/xen.gz symlink to not clutter -the menu with multiple versions and also not include -dbg. Use custom.cfg -if you need any other custom entries. - ---- - util/grub-mkconfig_lib.in | 5 +++++ - util/grub.d/10_linux.in | 12 ++++++++++-- - util/grub.d/20_linux_xen.in | 6 ++++-- - 3 files changed, 19 insertions(+), 4 deletions(-) - -Index: grub-2.02~beta2/util/grub-mkconfig_lib.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig_lib.in -+++ grub-2.02~beta2/util/grub-mkconfig_lib.in -@@ -248,6 +248,11 @@ version_test_gt () - *.old:*.old) ;; - *.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;; - *:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;; -+# bnc#757895 - Grub2 menu items incorrect when "Xen Virtual Machines Host Server" selected -+# The dbg version should be placed after release version -+ dbg-*:dbg-*) ;; -+ dbg-*:*) version_test_gt_a="" ;; -+ *:dbg-*) version_test_gt_b="" ;; - esac - version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b" - return "$?" -Index: grub-2.02~beta2/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 -@@ -26,6 +26,12 @@ datarootdir="@datarootdir@" - export TEXTDOMAIN=@PACKAGE@ - export TEXTDOMAINDIR="@localedir@" - -+if [ ! -e /proc/xen/xsd_port -a -e /proc/xen ]; then -+# we're running on xen domU guest -+# prevent setting up nested virt on HVM or PV domU guest -+ exit 0 -+fi -+ - CLASS="--class gnu-linux --class gnu --class os --class xen" - - if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then -@@ -166,10 +172,18 @@ file_is_not_sym () { - esac - } - --xen_list= --for i in /boot/xen*; do -- if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then xen_list="$xen_list $i" ; fi --done -+# bnc#877040 - Duplicate entries for boot menu created -+# only create /boot/xen.gz symlink boot entry -+if test -L /boot/xen.gz; then -+ xen_list=`readlink -f /boot/xen.gz` -+else -+ # bnc#757895 - Grub2 menu items incorrect when "Xen Virtual Machines Host Server" selected -+ # wildcard expasion with correct suffix (.gz) for not generating many duplicated menu entries -+ xen_list= -+ for i in /boot/xen*.gz; do -+ if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then xen_list="$xen_list $i" ; fi -+ done -+fi - prepare_boot_cache= - boot_device_id= - -Index: grub-2.02~beta2/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 -@@ -209,6 +209,40 @@ while [ "x$list" != "x" ] ; do - fi - done - -+ # try to get the kernel config if $linux is a symlink -+ if test -z "${config}" ; then -+ lnk_version=`basename \`readlink -f $linux\` | sed -e "s,^[^0-9]*-,,g"` -+ if (test -n ${lnk_version} && test -e "${dirname}/config-${lnk_version}") ; then -+ config="${dirname}/config-${lnk_version}" -+ fi -+ fi -+ -+ # check if we are in xen domU -+ if [ ! -e /proc/xen/xsd_port -a -e /proc/xen ]; then -+ # we're running on xen domU guest -+ dmi=/sys/class/dmi/id -+ if [ -r "${dmi}/product_name" -a -r "${dmi}/sys_vendor" ]; then -+ product_name=`cat ${dmi}/product_name` -+ sys_vendor=`cat ${dmi}/sys_vendor` -+ if test "${sys_vendor}" = "Xen" -a "${product_name}" = "HVM domU"; then -+ # xen HVM guest -+ xen_pv_domU=false -+ fi -+ fi -+ else -+ # we're running on baremetal or xen dom0 -+ xen_pv_domU=false -+ fi -+ -+ if test "$xen_pv_domU" = "false" ; then -+ # prevent xen kernel without pv_opt support from booting -+ if (grep -qx "CONFIG_XEN=y" "${config}" 2> /dev/null && ! grep -qx "CONFIG_PARAVIRT=y" "${config}" 2> /dev/null); then -+ echo "Skip xenlinux kernel $linux" >&2 -+ list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` -+ continue -+ fi -+ fi -+ - initramfs= - if test -n "${config}" ; then - initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` diff --git a/grub2-fix-multi-device-root-kernel-argument.patch b/grub2-fix-multi-device-root-kernel-argument.patch deleted file mode 100644 index 65a93bf..0000000 --- a/grub2-fix-multi-device-root-kernel-argument.patch +++ /dev/null @@ -1,44 +0,0 @@ -Index: grub-2.02~beta2/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 -@@ -45,12 +45,14 @@ esac - - # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter - # and mounting btrfs requires user space scanning, so force UUID in this case. --if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -+if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -- || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then -+ || uses_abstraction "${GRUB_DEVICE}" lvm ) && test -e "${GRUB_DEVICE}"; then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} - else -- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -+ if [ "x${GRUB_DEVICE_UUID}" != "x" ]; then -+ LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -+ fi - fi - - if [ "x$GRUB_CONMODE" != "x" ]; then -Index: grub-2.02~beta2/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 -@@ -55,12 +55,14 @@ esac - - # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter - # and mounting btrfs requires user space scanning, so force UUID in this case. --if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ -+if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ -- || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then -+ || uses_abstraction "${GRUB_DEVICE}" lvm ) && test -e "${GRUB_DEVICE}"; then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} - else -- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -+ if [ "x${GRUB_DEVICE_UUID}" != "x" ]; then -+ LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -+ fi - fi - - # Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT. diff --git a/grub2-getroot-treat-mdadm-ddf-as-simple-device.patch b/grub2-getroot-treat-mdadm-ddf-as-simple-device.patch deleted file mode 100644 index a4a8126..0000000 --- a/grub2-getroot-treat-mdadm-ddf-as-simple-device.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Michael Chang -Subject: treat mdadm ddf fakeraid as simple device -References: bnc#872360 -Patch-Mainline: no - -Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c -+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c -@@ -117,7 +117,7 @@ struct btrfs_ioctl_search_args { - struct btrfs_ioctl_fs_info_args) - - static int --grub_util_is_imsm (const char *os_dev); -+grub_util_is_imsm_or_ddf (const char *os_dev); - - - #define ESCAPED_PATH_MAX (4 * PATH_MAX) -@@ -603,10 +603,10 @@ out: - } - - static int --grub_util_is_imsm (const char *os_dev) -+grub_util_is_imsm_or_ddf (const char *os_dev) - { - int retry; -- int is_imsm = 0; -+ int is_imsm_or_ddf = 0; - int container_seen = 0; - const char *dev = os_dev; - -@@ -667,10 +667,17 @@ grub_util_is_imsm (const char *os_dev) - if (strncmp (buf, "MD_METADATA=imsm", - sizeof ("MD_METADATA=imsm") - 1) == 0) - { -- is_imsm = 1; -+ is_imsm_or_ddf = 1; - grub_util_info ("%s is imsm", dev); - break; - } -+ if (strncmp (buf, "MD_METADATA=ddf", -+ sizeof ("MD_METADATA=ddf") - 1) == 0) -+ { -+ is_imsm_or_ddf = 1; -+ grub_util_info ("%s is ddf", dev); -+ break; -+ } - } - - free (buf); -@@ -681,7 +688,7 @@ grub_util_is_imsm (const char *os_dev) - - if (dev != os_dev) - free ((void *) dev); -- return is_imsm; -+ return is_imsm_or_ddf; - } - - char * -@@ -1018,7 +1025,7 @@ grub_util_get_dev_abstraction_os (const - - /* Check for RAID. */ - if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev) -- && !grub_util_is_imsm (os_dev)) -+ && !grub_util_is_imsm_or_ddf (os_dev)) - return GRUB_DEV_ABSTRACTION_RAID; - return GRUB_DEV_ABSTRACTION_NONE; - } diff --git a/grub2-iterate-and-hook-for-extended-partition.patch b/grub2-iterate-and-hook-for-extended-partition.patch deleted file mode 100644 index e7dabc4..0000000 --- a/grub2-iterate-and-hook-for-extended-partition.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Michael Chang - -The same as in the previous patch, add a support for installing grub -into an extended partition. - -Here, we do not ignore extended partitions anymore. Instead we call a -hook that makes sure we have the partition when installing. - -Signed-off-by: Jiri Slaby -References: https://bugzilla.novell.com/show_bug.cgi?id=750897 - -From: Andrey Borzenkov - -Apply this logic only to primary extended partition. Ignore extended -partitions that are used to link together logical partitions. - -References: https://bugzilla.novell.com/show_bug.cgi?id=785341 ---- -Index: grub-2.00/grub-core/partmap/msdos.c -=================================================================== ---- grub-2.00.orig/grub-core/partmap/msdos.c -+++ grub-2.00/grub-core/partmap/msdos.c -@@ -188,13 +188,20 @@ grub_partition_msdos_iterate (grub_disk_ - (unsigned long long) p.len); - - /* If this partition is a normal one, call the hook. */ -- if (! grub_msdos_partition_is_empty (e->type) -- && ! grub_msdos_partition_is_extended (e->type)) -+ if (! grub_msdos_partition_is_empty (e->type)) - { -- p.number++; -+ if (!grub_msdos_partition_is_extended (e->type) || p.number < 3) -+ { -+ p.number++; - -- if (hook (disk, &p, hook_data)) -- return grub_errno; -+ /* prevent someone doing mkfs or mkswap on an -+ extended partition, but leave room for LILO */ -+ if (grub_msdos_partition_is_extended (e->type)) -+ p.len = 2; -+ -+ if (hook (disk, &p, hook_data)) -+ return grub_errno; -+ } - } - else if (p.number < 3) - /* If this partition is a logical one, shouldn't increase the diff --git a/grub2-linguas.sh-no-rsync.patch b/grub2-linguas.sh-no-rsync.patch deleted file mode 100644 index df9f653..0000000 --- a/grub2-linguas.sh-no-rsync.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Andrey Borzenkov -Subject: disable rsync to make it possible to use in RPM build - -We need to create po/LINGUAS to generate message catalogs. Use -linguas.sh to ensure we always use the same rules as upstream, but -disable rsync. -Index: grub-2.02~beta2/linguas.sh -=================================================================== ---- grub-2.02~beta2.orig/linguas.sh 2015-11-02 20:47:03.471686784 +0300 -+++ grub-2.02~beta2/linguas.sh 2015-11-02 20:48:15.707687638 +0300 -@@ -1,8 +1,8 @@ - #!/bin/sh - --rsync -Lrtvz --exclude=ko.po translationproject.org::tp/latest/grub/ po -+#rsync -Lrtvz --exclude=ko.po translationproject.org::tp/latest/grub/ po - --autogenerated="en@quot en@hebrew de@hebrew en@cyrillic en@greek en@arabic en@piglatin de_CH" -+autogenerated="en@quot" # en@hebrew de@hebrew en@cyrillic en@greek en@arabic en@piglatin de_CH" - - - for x in $autogenerated; do diff --git a/grub2-linux.patch b/grub2-linux.patch index 6463296..09eedc1 100644 --- a/grub2-linux.patch +++ b/grub2-linux.patch @@ -1,44 +1,13 @@ -Index: grub-2.02~beta2/util/grub.d/10_linux.in +Index: 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 -@@ -31,7 +31,7 @@ CLASS="--class gnu-linux --class gnu --c - if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS=GNU/Linux - else -- OS="${GRUB_DISTRIBUTOR} GNU/Linux" -+ OS="${GRUB_DISTRIBUTOR}" - 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 () - message="$(gettext_printf "Loading Linux %s ..." ${version})" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' -- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} -+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ${args} +--- util/grub.d/10_linux.in.orig ++++ util/grub.d/10_linux.in +@@ -49,7 +49,7 @@ menuentry "$1" { + EOF + prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" + cat << EOF +- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2 ++ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} $2 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 -=================================================================== ---- grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in -+++ grub-2.02~beta2/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 - else -- OS="${GRUB_DISTRIBUTOR} GNU/Linux" -+ OS="${GRUB_DISTRIBUTOR}" - 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 () - fi - multiboot ${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} - EOF - if test -n "${initrd}" ; then - # TRANSLATORS: ramdisk isn't identifier. Should be translated. + cat << EOF diff --git a/grub2-menu-unrestricted.patch b/grub2-menu-unrestricted.patch deleted file mode 100644 index c4a1e5f..0000000 --- a/grub2-menu-unrestricted.patch +++ /dev/null @@ -1,23 +0,0 @@ -Index: grub-2.02~beta2/grub-core/normal/menu.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/normal/menu.c -+++ grub-2.02~beta2/grub-core/normal/menu.c -@@ -213,7 +213,17 @@ grub_menu_execute_entry(grub_menu_entry_ - grub_size_t sz = 0; - - if (entry->restricted) -- err = grub_auth_check_authentication (entry->users); -+ { -+ int auth_check = 1; -+ if (entry->users && entry->users[0] == 0) -+ { -+ const char *unr = grub_env_get ("unrestricted_menu"); -+ if (unr && (unr[0] == '1' || unr[0] == 'y')) -+ auth_check = 0; -+ } -+ if (auth_check) -+ err = grub_auth_check_authentication (entry->users); -+ } - - if (err) - { diff --git a/grub2-mkconfig-aarch64.patch b/grub2-mkconfig-aarch64.patch deleted file mode 100644 index c105797..0000000 --- a/grub2-mkconfig-aarch64.patch +++ /dev/null @@ -1,14 +0,0 @@ -grub-mkonfig: Look for Image-* on aarch64 - -Index: grub-2.02~beta2/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 -@@ -190,6 +190,7 @@ EOF - machine=`uname -m` - case "x$machine" in - xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; -+ xaarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;; - xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;; - *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \ - /boot/kernel-*" ;; diff --git a/grub2-mkconfig-arm.patch b/grub2-mkconfig-arm.patch deleted file mode 100644 index 00423b1..0000000 --- a/grub2-mkconfig-arm.patch +++ /dev/null @@ -1,12 +0,0 @@ -Index: grub-2.02~beta3/util/grub.d/10_linux.in -=================================================================== ---- grub-2.02~beta3.orig/util/grub.d/10_linux.in -+++ grub-2.02~beta3/util/grub.d/10_linux.in -@@ -193,6 +193,7 @@ machine=`uname -m` - case "x$machine" in - xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; - xaarch64) klist="/boot/Image-* /Image-* /boot/kernel-*" ;; -+ xarm*) klist="/boot/zImage-* /zImage-* /boot/kernel-*" ;; - xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;; - *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \ - /boot/kernel-*" ;; diff --git a/grub2-once b/grub2-once deleted file mode 100644 index 3a402c6..0000000 --- a/grub2-once +++ /dev/null @@ -1,291 +0,0 @@ -#!/usr/bin/perl -# -# (C) 2014 mchang@suse.com -# -# 2014-02-20 jw@suse.de - -use strict; - -my $grub2_dir; -my $grub2_reboot; -my $grub2_editenv; -my $show_mapped; -my $id_name; -my @menuentry; -my @enumentry; -my %E; - -sub dPrint($) { - #print( STDERR @_[0]); -} - -sub sh_test($) { - my ( $exp ) = @_; - - dPrint( "?? '$exp' "); - $exp .= " ]" if ( $exp =~ m{^\[.*[^\]]\s*$} ); # gnaaa - #my $t = qx{set -x; $exp}; - my $t = qx{$exp}; - my $ret = $? >> 8; - $ret = ($ret == 0) ? 1 : 0; - dPrint("=> $ret ($t)\n"); - return $ret; -} - -sub read_cfg($$) { - my ($dir, $cfg) = @_; - - my $fh; - my $m = ""; - my $state = 1; # 1 == normal, 010 == if-false, 011 == if-true, 110 == else-false, 111 == else-true - my @State = (); - - if ($dir) { - %E = ( "config_directory" => $dir ); - dPrint("# VE: 'cd'='$dir'\n"); - $dir .= "/"; - if ($> == 0) { - open($fh, "$grub2_editenv - list |") || die "cannot read grub2 environment: $!\n"; - while (<$fh>) { - chomp; - if ( m{^([^\s=]+?)=(.*)$} ) { - my ($k, $v) = ($1, $2); - $v =~ s{^"([^"]*)"$}{$1}; - dPrint("# VE: '$k'='$v'\n"); - $E{$k} = $v; - } - } - close($fh); - } - } - - dPrint("# open($dir$cfg)\n"); - open($fh, "<$dir$cfg") || die "cannot read $cfg in $dir: $!\n"; - - LINE: while ( <$fh> ) { - s{^#.*$}{}; # get rid of trailing comments, - s{\s+$}{}; # trailing whitespace - s{\s*;$}{}; # including semicolons - next if (m{^\s*$}); # and empty lines. - s{^\s*}{ }; # force leading whitespace to one - - dPrint(sprintf("#%d: '%s' [%s]%04b\n", $., $_, join(",",@State), $state)); - if ( m{^ fi$} ) { - $state = pop( @State); - $m .= "$_\n"; - dPrint(sprintf(">FI: [%s]0b%04b\n", join(",",@State), $state)); - next; - } - if ($state & 0b10) { # {if,else}-* - if ( m{^ elif\s+(.*?)\s*; then$} && !($state & 0b1000)) { - if ($state & 0b1) { - $state = 0b110; # else-false - } else { - $state = 0b010 + sh_test( $1); # if-? - dPrint(sprintf("=EI: 0b%03b\n", $state)); - $m .= "$_\n"; - next; - } - } elsif ( m{^ else$} && !($state & 0b1000)) { - if (($state & 0b111) == 0b010) { # in 'if' but neither 'else' nor 'true' - $state = 0b111; # else-true - } else { - $state = 0b110; # else-false - } - $m .= "$_\n"; - dPrint(sprintf("=EL: 0b%03b\n", $state)); - next; - } - } - if ($state & 0b1) { # *-true or normal - dPrint("-I1: $_\n"); - } else { # *-false - dPrint("-I0: $_\n"); - if ( m{^ if (.*?)\s*; then$} ) { - push( @State, $state); - $state = 0b1000; - $m .= "$_\n"; - } - next; - } - - while ( m'(?:[^\\])(\$(?:{([^}]+?)}|([A-Za-z0-9_]+)))' ) { - my ($s, $k1, $k2) = ($1, $2, $3); - my $k = (defined($k1)) ? $k1 : $k2; - dPrint("# VT: '$k'\n"); - if (exists( $E{$k})) { - $s =~ s{([\$\{\}\"])}{\\$1}g; - dPrint("# VB: '$_'\n"); - s{$s}{$E{$k}} || die; - dPrint("# VR: '$_'\n"); - } else { - $s =~ s{([\$\{\}\"])}{\\$1}g; - s{$s}{} || die; - dPrint("# VR: '$_'\n"); - } - } - - if ( m{^ if (.*?)\s*; then$} ) { - push( @State, $state); - $state = 0b010 + sh_test( $1); - dPrint(sprintf("$title" : "$title"; - my $eId = (($pId ne "") ? "$pId>" : "") . $c++; - - if ($type eq "menuentry") { - push @menuentry, $name; - push @enumentry, [$name, $eId]; - } elsif ($type eq "submenu") { - parse_menuentry ($name, $eId, $data); - } - } -} - -# Enable restore grubenv service (bnc#892358) -# Restore grubenv settings for booting default entry to workaround the grub2-once cannot -# work and function properly on lvm, md and s390. -sub enable_restore_grubenv_service { - - my $systemctl="/usr/bin/systemctl"; - - if (-x $systemctl) { - system "$systemctl --no-reload enable grub2-once >/dev/null 2>&1"; - } -} - -$id_name = ""; -if (@ARGV == 2 && ($ARGV[0] eq "--show-mapped")) { - $show_mapped = 1; - $id_name = $ARGV[1]; -} elsif (@ARGV == 1) { - $show_mapped = 0; - $id_name = $ARGV[0]; -} - -die "wrong command line options, try --help\n" if ($id_name eq ""); - -open(SYSCONF, ") { - if (/^#/) { - next - }; - if (/LOADER_TYPE="(.*)"/) { - my $bl = $1; - if ($bl eq "grub2" || $bl eq "grub2-efi") { - $grub2_dir = "/boot/grub2"; - $grub2_reboot = "/usr/sbin/grub2-reboot"; - $grub2_editenv = "/usr/bin/grub2-editenv"; - } - last; - } -} - -close (SYSCONF); - -if ($id_name eq "--help" or $id_name eq "-h") - { - print "Usage: grub2-once [--show-mapped ID | --list | ID | NAME_SUBSTRING ]\n"; - system "$grub2_reboot \"--help\""; - exit 0; - } - -die "no grub2_dir" if ($grub2_dir eq ""); - -my $m = read_cfg( $grub2_dir, "grub.cfg"); -# Note: only *one* top-level call to parse_menuentry() is possible -# or else it will start again with 0 (and no parent)! -parse_menuentry ("", "", $m); - -my $ret = ""; -my $name = ""; -my $id = -1; - -if ($id_name eq '--enum') { - foreach my $e (@enumentry) { - printf "%-7s %s\n", $e->[1], $e->[0]; - } - exit 0; -} - -if ($id_name eq '--list') - { - my $c = 0; - foreach my $e (@menuentry) - { - printf "%6d %s\n", $c, $e; - $c++; - } - exit 0; - } - -if ($id_name =~ m!^[0-9]+$!) { - - if ($id_name < @menuentry) { - $id = $id_name; - $name = $menuentry[$id]; - $ret = $name; - } - -} else { - - my $i = -1; - my $c = 0; - - $name = $id_name; - - foreach my $e (@menuentry) { - if ($e =~ qr!\Q$name\E!) { - $i = $c; - last; - } - } continue { - ++$c; - } - - if ($i >= 0) { - $id = $i; - $name = $menuentry[$id]; - $ret = "$id"; - } -} - -if ($show_mapped > 0) { - print $ret; -} else { - system "$grub2_reboot \"$name\""; - enable_restore_grubenv_service; -} - diff --git a/grub2-once.service b/grub2-once.service deleted file mode 100644 index 80e6211..0000000 --- a/grub2-once.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Restore grubenv -DefaultDependencies=no -After=local-fs.target -Before=sysinit.target shutdown.target -Conflicts=shutdown.target -ConditionPathIsReadWrite=/boot/grub2/grubenv - -[Service] -Type=oneshot -ExecStart=-/usr/bin/grub2-editenv /boot/grub2/grubenv unset next_entry -ExecStartPost=-/usr/bin/systemctl disable grub2-once.service -StandardOutput=syslog - -[Install] -WantedBy=sysinit.target diff --git a/grub2-pass-corret-root-for-nfsroot.patch b/grub2-pass-corret-root-for-nfsroot.patch deleted file mode 100644 index 6e6447b..0000000 --- a/grub2-pass-corret-root-for-nfsroot.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 340fd0c8717c2bf33163a18bfec72243b0e51862 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Thu, 30 Aug 2012 15:43:17 +0800 -Subject: [PATCH] Pass corret root= for nfsroot - -References: bnc#774548 -Patch-Mainline: no - -Fix / is mounted on nfs. The fix is to pass kernel parameters -with correct root= for nfs. However since grub2 doesn't support -nfs file system module, the /boot on nfs is not possible and -grub2-probe not work in probing nfs mounted path. The fix is merely -on the script level and not use grub2-probe for above reasons. ---- - util/grub-mkconfig.in | 37 ++++++++++++++++++++++++++++++------- - 1 files changed, 30 insertions(+), 7 deletions(-) - -Index: grub-2.02~beta2/util/grub-mkconfig.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig.in -+++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -128,22 +128,47 @@ 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 -+probe_nfsroot_device () { -+ while read line ; do -+ part1=`echo $line | sed -e 's! - .*$!!'` -+ part2=`echo $line | sed -n -e 's! - \(.*\)$!\n\1!p' | sed 1d` - --# Device containing our /boot partition. Usually the same as GRUB_DEVICE. --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 -+ set -- $part1 -+ path=$5 -+ -+ set -- $part2 -+ fstype=$1 -+ device=$2 -+ -+ if [ "x${path}" = "x/" ] && -+ [ "x${fstype}" = "xnfs" -o "x${fstype}" = "xnfs4" ] ; then -+ echo "${fstype}:$device" -+ return -+ fi -+ done -+} -Date: Wed, 28 Mar 2012 14:46:41 -0500 -Subject: [PATCH] Migrate PPC from Yaboot to Grub2 - -Add configuration support for serial terminal consoles. This will set the -maximum screen size so that text is not overwritten. - ---- - Makefile.util.def | 7 +++ - util/grub.d/20_ppc_terminfo.in | 114 ++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 121 insertions(+), 0 deletions(-) - create mode 100644 util/grub.d/20_ppc_terminfo.in - -Index: grub-2.02~beta2/Makefile.util.def -=================================================================== ---- grub-2.02~beta2.orig/Makefile.util.def -+++ grub-2.02~beta2/Makefile.util.def -@@ -485,6 +485,13 @@ script = { - }; - - script = { -+ name = '20_ppc_terminfo'; -+ common = util/grub.d/20_ppc_terminfo.in; -+ installdir = grubconf; -+ condition = COND_HOST_LINUX; -+}; -+ -+script = { - name = '30_os-prober'; - common = util/grub.d/30_os-prober.in; - installdir = grubconf; -Index: grub-2.02~beta2/util/grub.d/20_ppc_terminfo.in -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/util/grub.d/20_ppc_terminfo.in -@@ -0,0 +1,114 @@ -+#! /bin/sh -+set -e -+ -+# grub-mkconfig helper script. -+# Copyright (C) 2006,2007,2008,2009,2010 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 . -+ -+prefix=@prefix@ -+exec_prefix=@exec_prefix@ -+bindir=@bindir@ -+libdir=@libdir@ -+. "@datadir@/@PACKAGE@/grub-mkconfig_lib" -+ -+export TEXTDOMAIN=@PACKAGE@ -+export TEXTDOMAINDIR=@localedir@ -+ -+X=80 -+Y=24 -+TERMINAL=ofconsole -+ -+argument () { -+ opt=$1 -+ shift -+ -+ if test $# -eq 0; then -+ echo "$0: option requires an argument -- '$opt'" 1>&2 -+ exit 1 -+ fi -+ echo $1 -+} -+ -+check_terminfo () { -+ -+ while test $# -gt 0 -+ do -+ option=$1 -+ shift -+ -+ case "$option" in -+ terminfo | TERMINFO) -+ ;; -+ -+ -g) -+ NEWXY=`argument $option "$@"` -+ NEWX=`echo $NEWXY | cut -d x -f 1` -+ NEWY=`echo $NEWXY | cut -d x -f 2` -+ -+ if [ ${NEWX} -ge 80 ] ; then -+ X=${NEWX} -+ else -+ echo "Warning: ${NEWX} is less than the minimum size of 80" -+ fi -+ -+ if [ ${NEWY} -ge 24 ] ; then -+ Y=${NEWY} -+ else -+ echo "Warning: ${NEWY} is less than the minimum size of 24" -+ fi -+ -+ shift -+ ;; -+ -+ *) -+# # accept console or ofconsole -+# if [ "$option" != "console" -a "$option" != "ofconsole" ] ; then -+# echo "Error: GRUB_TERMINFO unknown console: $option" -+# exit 1 -+# fi -+# # perfer console -+# TERMINAL=console -+ # accept ofconsole -+ if [ "$option" != "ofconsole" ] ; then -+ echo "Error: GRUB_TERMINFO unknown console: $option" -+ exit 1 -+ fi -+ # perfer console -+ TERMINAL=ofconsole -+ ;; -+ esac -+ -+ done -+ -+} -+ -+if ! uname -m | grep -q ppc ; then -+ exit 0 -+fi -+ -+if [ "x${GRUB_TERMINFO}" != "x" ] ; then -+ F1=`echo ${GRUB_TERMINFO} | cut -d " " -f 1` -+ -+ if [ "${F1}" != "terminfo" ] ; then -+ echo "Error: GRUB_TERMINFO is set to \"${GRUB_TERMINFO}\" The first word should be terminfo." -+ exit 1 -+ fi -+ -+ check_terminfo ${GRUB_TERMINFO} -+fi -+ -+cat << EOF -+ terminfo -g ${X}x${Y} ${TERMINAL} -+EOF diff --git a/grub2-ppc64-cas-reboot-support.patch b/grub2-ppc64-cas-reboot-support.patch deleted file mode 100644 index 422dd2a..0000000 --- a/grub2-ppc64-cas-reboot-support.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 9d1411ffa7290c1cbdc9ee95bb5fcc5506e63e0f Mon Sep 17 00:00:00 2001 -From: Paulo Flabiano Smorigo -Date: Thu, 20 Sep 2012 18:07:39 -0300 -Subject: [PATCH 096/152] IBM client architecture (CAS) reboot support - -This is an implementation of IBM client architecture (CAS) reboot for GRUB. - -There are cases where the POWER firmware must reboot in order to support -specific features requested by a kernel. The kernel calls -ibm,client-architecture-support and it may either return or reboot with the new -feature set. eg: - -Calling ibm,client-architecture-support.../ -Elapsed time since release of system processors: 70959 mins 50 secs -Welcome to GRUB! - -Instead of return to the GRUB menu, it will check if the flag for CAS reboot is -set. If so, grub will automatically boot the last booted kernel using the same -parameters ---- - grub-core/kern/ieee1275/openfw.c | 62 ++++++++++++++++++++++++++++++++++++++++ - grub-core/normal/main.c | 19 ++++++++++++ - grub-core/script/execute.c | 7 +++++ - include/grub/ieee1275/ieee1275.h | 2 ++ - 4 files changed, 90 insertions(+) - -Index: grub-2.02~beta2/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 @@ - return NULL; - } - -+/* Check if it's a CAS reboot. If so, set the script to be executed. */ -+int -+grub_ieee1275_cas_reboot (char *script) -+{ -+ grub_uint32_t ibm_ca_support_reboot; -+ grub_uint32_t ibm_fw_nbr_reboots; -+ char property_value[10]; -+ grub_ssize_t actual; -+ grub_ieee1275_ihandle_t options; -+ -+ if (grub_ieee1275_finddevice ("/options", &options) < 0) -+ return -1; -+ -+ /* Check two properties, one is enough to get cas reboot value */ -+ ibm_ca_support_reboot = 0; -+ if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, -+ "ibm,client-architecture-support-reboot", -+ &ibm_ca_support_reboot, -+ sizeof (ibm_ca_support_reboot), -+ &actual) >= 0) -+ grub_dprintf("ieee1275", "ibm,client-architecture-support-reboot: %u\n", -+ ibm_ca_support_reboot); -+ -+ ibm_fw_nbr_reboots = 0; -+ if (grub_ieee1275_get_property (options, "ibm,fw-nbr-reboots", -+ property_value, sizeof (property_value), -+ &actual) >= 0) -+ { -+ property_value[sizeof (property_value) - 1] = 0; -+ ibm_fw_nbr_reboots = (grub_uint8_t) grub_strtoul (property_value, 0, 10); -+ grub_dprintf("ieee1275", "ibm,fw-nbr-reboots: %u\n", ibm_fw_nbr_reboots); -+ } -+ -+ if (ibm_ca_support_reboot || ibm_fw_nbr_reboots) -+ { -+ if (! grub_ieee1275_get_property_length (options, "boot-last-label", &actual)) -+ { -+ if (actual > 1024) -+ script = grub_realloc (script, actual + 1); -+ grub_ieee1275_get_property (options, "boot-last-label", script, actual, -+ &actual); -+ return 0; -+ } -+ } -+ -+ grub_ieee1275_set_boot_last_label (""); -+ -+ return -1; -+} -+ -+int grub_ieee1275_set_boot_last_label (const char *text) -+{ -+ grub_ieee1275_ihandle_t options; -+ grub_ssize_t actual; -+ -+ 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) -+ grub_ieee1275_set_property (options, "boot-last-label", text, -+ grub_strlen (text), &actual); -+ return 0; -+} -Index: grub-2.02~beta2/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 -@@ -33,6 +33,9 @@ - #include - #include - #include -+#ifdef GRUB_MACHINE_IEEE1275 -+#include -+#endif - - GRUB_MOD_LICENSE ("GPLv3+"); - -@@ -275,6 +278,21 @@ - { - menu = read_config_file (config); - -+#ifdef GRUB_MACHINE_IEEE1275 -+ int boot; -+ boot = 0; -+ char *script; -+ script = grub_malloc (1024); -+ if (! grub_ieee1275_cas_reboot (script)) -+ { -+ if (! grub_script_execute_sourcecode (script)) -+ boot = 1; -+ } -+ grub_free (script); -+ if (boot) -+ grub_command_execute ("boot", 0, 0); -+#endif -+ - /* Ignore any error. */ - grub_errno = GRUB_ERR_NONE; - } -Index: grub-2.02~beta2/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 - #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 @@ - grub_err_t ret = 0; - struct grub_script *parsed_script; - -+#ifdef GRUB_MACHINE_IEEE1275 -+ grub_ieee1275_set_boot_last_label (source); -+#endif -+ - while (source) - { - char *line; -Index: grub-2.02~beta2/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 @@ - 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));) - diff --git a/grub2-ppc64le-disable-video.patch b/grub2-ppc64le-disable-video.patch deleted file mode 100644 index 24ddbcb..0000000 --- a/grub2-ppc64le-disable-video.patch +++ /dev/null @@ -1,49 +0,0 @@ -Index: grub-2.02~beta2/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 -@@ -90,7 +90,10 @@ grub_ieee1275_find_options (void) - } - - if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0) -- grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS); -+ { -+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_TREE_SCANNING_FOR_DISKS); -+ grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT); -+ } - - /* 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 -=================================================================== ---- 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_MOD_INIT(ieee1275_fb) - { -- find_display (); -- if (display) -- grub_video_register (&grub_video_ieee1275_adapter); -+ if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT)) -+ { -+ find_display (); -+ if (display) -+ grub_video_register (&grub_video_ieee1275_adapter); -+ } - } - - GRUB_MOD_FINI(ieee1275_fb) -Index: grub-2.02~beta2/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_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN, -+ -+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT - }; - - extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); diff --git a/grub2-ppc64le-memory-map.patch b/grub2-ppc64le-memory-map.patch deleted file mode 100644 index 5642585..0000000 --- a/grub2-ppc64le-memory-map.patch +++ /dev/null @@ -1,84 +0,0 @@ -Index: grub-2.02~beta2/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 -@@ -302,6 +302,34 @@ grub_ieee1275_map (grub_addr_t phys, gru - return args.catch_result; - } - -+/* Preallocate IEEE1275_MAX_MAP_RESOURCE map tracks to track the -+ * map regions allocated to us by the firmware. Cannot -+ * dynamically allocate them, since the heap is not set -+ * yet. -+ */ -+struct grub_map_track grub_map_track[IEEE1275_MAX_MAP_RESOURCE]; -+int grub_map_track_index=0; -+ -+void -+grub_releasemap () -+{ -+ int i=0; -+ for (i=grub_map_track_index-1; i >= 0; i--) -+ grub_ieee1275_release(grub_map_track[i].addr, grub_map_track[i].size); -+ grub_map_track_index = 0; -+ return; -+} -+ -+static void -+grub_track_map (grub_addr_t addr, grub_size_t size) -+{ -+ if (grub_map_track_index >= IEEE1275_MAX_MAP_RESOURCE) -+ return; -+ grub_map_track[grub_map_track_index].addr = addr; -+ grub_map_track[grub_map_track_index++].size = size; -+ return; -+} -+ - grub_err_t - grub_claimmap (grub_addr_t addr, grub_size_t size) - { -@@ -317,6 +345,7 @@ grub_claimmap (grub_addr_t addr, grub_si - return grub_errno; - } - -+ grub_track_map (addr, size); - return GRUB_ERR_NONE; - } - -Index: grub-2.02~beta2/include/grub/ieee1275/ieee1275.h -=================================================================== ---- grub-2.02~beta2.orig/include/grub/ieee1275/ieee1275.h -+++ grub-2.02~beta2/include/grub/ieee1275/ieee1275.h -@@ -30,6 +30,12 @@ struct grub_ieee1275_mem_region - unsigned int size; - }; - -+#define IEEE1275_MAX_MAP_RESOURCE 10 -+struct grub_map_track { -+ grub_addr_t addr; -+ grub_size_t size; -+}; -+ - #define IEEE1275_MAX_PROP_LEN 8192 - #define IEEE1275_MAX_PATH_LEN 256 - -@@ -214,6 +220,7 @@ int EXPORT_FUNC(grub_ieee1275_millisecon - - - 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 -=================================================================== ---- 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 - void - grub_exit (void) - { -+ grub_releasemap(); - grub_ieee1275_exit (); - } - 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 deleted file mode 100644 index 9c2ebe2..0000000 --- a/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch +++ /dev/null @@ -1,304 +0,0 @@ -From f38ada424e7d991a0121253ba1abc430b86a990b Mon Sep 17 00:00:00 2001 -From: John Jolly -Date: Wed, 22 Jan 2014 01:18:10 -0700 -Subject: [PATCH 1/3] - Changes made and files added in order to allow s390x - build - ---- - grub-core/kern/emu/cache_s.S | 1 + - grub-core/kern/emu/lite.c | 2 ++ - grub-core/kern/s390x/dl.c | 37 +++++++++++++++++++++++++++++++++++ - grub-core/lib/s390x/setjmp.S | 46 ++++++++++++++++++++++++++++++++++++++++++++ - grub-core/lib/setjmp.S | 2 ++ - include/grub/cache.h | 2 +- - include/grub/s390x/setjmp.h | 29 ++++++++++++++++++++++++++++ - include/grub/s390x/time.h | 27 ++++++++++++++++++++++++++ - include/grub/s390x/types.h | 32 ++++++++++++++++++++++++++++++ - 9 files changed, 177 insertions(+), 1 deletion(-) - create mode 100644 grub-core/kern/s390x/dl.c - create mode 100644 grub-core/lib/s390x/setjmp.S - create mode 100644 include/grub/s390x/setjmp.h - 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 -=================================================================== ---- 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__) - #include "../powerpc/cache.S" - #elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || defined(__mips__) -+#elif defined(__s390x__) - #else - #error "No target cpu type is defined" - #endif -Index: grub-2.02~beta2/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" - #include "../arm64/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 -=================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/dl.c -+++ grub-2.02~beta2/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__) - grub_size_t tramp; - grub_size_t got; - grub_err_t err; -@@ -245,7 +245,7 @@ grub_dl_load_segments (grub_dl_t mod, co - talign = s->sh_addralign; - } - --#if !defined (__i386__) && !defined (__x86_64__) -+#if !defined (__i386__) && !defined (__x86_64__) && !defined (__s390x__) - err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got); - if (err) - return err; -@@ -308,7 +308,7 @@ grub_dl_load_segments (grub_dl_t mod, co - mod->segment = seg; - } - } --#if !defined (__i386__) && !defined (__x86_64__) -+#if !defined (__i386__) && !defined (__x86_64__) && !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 -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/kern/s390x/dl.c -@@ -0,0 +1,40 @@ -+/* dl.c - arch-dependent part of loadable module support */ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2002,2004,2005,2007,2009 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 -+ -+/* Check if EHDR is a valid ELF header. */ -+grub_err_t -+grub_arch_dl_check_header (void *ehdr) -+{ -+ (void)(ehdr); -+ return GRUB_ERR_BUG; -+} -+ -+/* Relocate symbols. */ -+grub_err_t -+grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr, -+ Elf_Shdr *s, grub_dl_segment_t seg) -+{ -+ (void)(mod); -+ (void)(ehdr); -+ (void)(s); -+ (void)(seg); -+ return GRUB_ERR_BUG; -+} -Index: grub-2.02~beta2/grub-core/lib/s390x/setjmp.S -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/lib/s390x/setjmp.S -@@ -0,0 +1,46 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2005,2007,2009 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 -+ -+ .file "setjmp.S" -+ -+GRUB_MOD_LICENSE "GPLv3+" -+ -+ .text -+ -+/* -+ * int grub_setjmp (grub_jmp_buf env) -+ */ -+FUNCTION(grub_setjmp) -+ stmg %r11,%r15,0(%r2) -+ lghi %r2,0 -+ br %r14 -+ -+/* -+ * int grub_longjmp (grub_jmp_buf env, int val) -+ */ -+FUNCTION(grub_longjmp) -+ chi %r3,0 -+ jne .L2 -+ lghi %r3,1 -+.L2: -+ lmg %r11,%r15,0(%r2) -+ lgr %r2,%r3 -+ br %r14 -Index: grub-2.02~beta2/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__) - #include "./arm64/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 -=================================================================== ---- grub-2.02~beta2.orig/include/grub/cache.h -+++ grub-2.02~beta2/include/grub/cache.h -@@ -23,7 +23,7 @@ - #include - #include - --#if defined (__i386__) || defined (__x86_64__) -+#if defined (__i386__) || defined (__x86_64__) || defined (__s390x__) - 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 -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/include/grub/s390x/setjmp.h -@@ -0,0 +1,29 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2002,2004,2006,2007,2009 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_SETJMP_CPU_HEADER -+#define GRUB_SETJMP_CPU_HEADER 1 -+ -+#include -+ -+typedef grub_uint64_t grub_jmp_buf[5]; -+ -+int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); -+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 -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/include/grub/s390x/time.h -@@ -0,0 +1,27 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2007 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 KERNEL_CPU_TIME_HEADER -+#define KERNEL_CPU_TIME_HEADER 1 -+ -+static __inline void -+grub_cpu_idle (void) -+{ -+} -+ -+#endif /* ! KERNEL_CPU_TIME_HEADER */ -Index: grub-2.02~beta2/include/grub/s390x/types.h -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/include/grub/s390x/types.h -@@ -0,0 +1,32 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2002,2004,2006,2007 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_TYPES_CPU_HEADER -+#define GRUB_TYPES_CPU_HEADER 1 -+ -+/* The size of void *. */ -+#define GRUB_TARGET_SIZEOF_VOID_P 8 -+ -+/* The size of long. */ -+#define GRUB_TARGET_SIZEOF_LONG 8 -+ -+/* s390x is big-endian. */ -+#define GRUB_TARGET_WORDS_BIGENDIAN 1 -+ -+ -+#endif /* ! GRUB_TYPES_CPU_HEADER */ diff --git a/grub2-s390x-02-kexec-module-added-to-emu.patch b/grub2-s390x-02-kexec-module-added-to-emu.patch deleted file mode 100644 index 0e60963..0000000 --- a/grub2-s390x-02-kexec-module-added-to-emu.patch +++ /dev/null @@ -1,342 +0,0 @@ ---- - grub-core/Makefile.am | 1 - grub-core/Makefile.core.def | 2 - grub-core/kern/emu/main.c | 4 - grub-core/kern/emu/misc.c | 18 ++++ - grub-core/loader/emu/linux.c | 173 +++++++++++++++++++++++++++++++++++++++++++ - include/grub/emu/exec.h | 4 - include/grub/emu/hostfile.h | 3 - include/grub/emu/misc.h | 3 - 8 files changed, 204 insertions(+), 4 deletions(-) - -Index: grub-2.02~beta2/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; - arm64 = loader/arm64/linux.c; -+ emu = loader/emu/linux.c; - common = loader/linux.c; - common = lib/cmdline.c; -- enable = noemu; - }; - - module = { -Index: grub-2.02~beta2/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 -@@ -0,0 +1,173 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2006,2007,2008,2009,2010 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 -+#include -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_dl_t my_mod; -+ -+static char *kernel_path; -+static char *initrd_path; -+static char *boot_cmdline; -+ -+static grub_err_t -+grub_linux_boot (void) -+{ -+ grub_err_t rc = GRUB_ERR_NONE; -+ char *initrd_param; -+ const char *kexec[] = { "kexec", "-l", kernel_path, boot_cmdline, NULL, NULL }; -+ const char *systemctl[] = { "systemctl", "kexec", NULL }; -+ int kexecute = grub_util_get_kexecute(); -+ -+ if (initrd_path) { -+ initrd_param = grub_xasprintf("--initrd=%s", initrd_path); -+ kexec[3] = initrd_param; -+ kexec[4] = boot_cmdline; -+ } else { -+ initrd_param = grub_xasprintf("%s", ""); -+ //return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("initrd required!")); -+ } -+ -+ grub_printf("%serforming 'kexec -l %s %s %s'\n", -+ (kexecute) ? "P" : "Not p", -+ kernel_path, initrd_param, boot_cmdline); -+ -+ if (kexecute) -+ rc = grub_util_exec(kexec); -+ -+ grub_free(initrd_param); -+ -+ if (rc != GRUB_ERR_NONE) { -+ grub_error (rc, N_("Error trying to perform kexec load operation.")); -+ grub_sleep (3); -+ return rc; -+ } -+ if (kexecute < 1) -+ grub_fatal (N_("Use '"PACKAGE"-emu --kexec' to force a system restart.")); -+ -+ grub_printf("Performing 'systemctl kexec' (%s) ", -+ (kexecute==1) ? "do-or-die" : "just-in-case"); -+ rc = grub_util_exec (systemctl); -+ -+ if (kexecute == 1) -+ grub_fatal (N_("Error trying to perform 'systemctl kexec'")); -+ -+ /* need to check read-only root before resetting hard!? */ -+ grub_printf("Performing 'kexec -e'"); -+ kexec[1] = "-e"; -+ kexec[2] = NULL; -+ rc = grub_util_exec(kexec); -+ if ( rc != GRUB_ERR_NONE ) -+ grub_fatal (N_("Error trying to directly perform 'kexec -e'.")); -+ -+ return rc; -+} -+ -+static grub_err_t -+grub_linux_unload (void) -+{ -+ grub_dl_unref (my_mod); -+ if ( boot_cmdline != NULL ) -+ grub_free (boot_cmdline); -+ boot_cmdline = NULL; -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) -+{ -+ int i; -+ char *tempstr; -+ -+ grub_dl_ref (my_mod); -+ -+ if (argc == 0) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -+ -+ if ( !grub_util_is_regular(argv[0]) ) -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find kernel file %s"), argv[0]); -+ -+ if ( kernel_path != NULL ) -+ grub_free(kernel_path); -+ -+ kernel_path = grub_xasprintf("%s", argv[0]); -+ -+ if ( boot_cmdline != NULL ) { -+ grub_free(boot_cmdline); -+ boot_cmdline = NULL; -+ } -+ -+ if ( argc > 1 ) -+ { -+ boot_cmdline = grub_xasprintf("--command-line=%s", argv[1]); -+ for ( i = 2; i < argc; i++ ) { -+ tempstr = grub_xasprintf("%s %s", boot_cmdline, argv[i]); -+ grub_free(boot_cmdline); -+ boot_cmdline = tempstr; -+ } -+ } -+ -+ grub_loader_set (grub_linux_boot, grub_linux_unload, 0); -+ -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]) -+{ -+ if (argc == 0) -+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -+ -+ if ( !grub_util_is_regular(argv[0]) ) -+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find initrd file %s"), argv[0]); -+ -+ if ( initrd_path != NULL ) -+ grub_free(initrd_path); -+ -+ initrd_path = grub_xasprintf("%s", argv[0]); -+ -+ grub_dl_unref (my_mod); -+ -+ return GRUB_ERR_NONE; -+} -+ -+static grub_command_t cmd_linux, cmd_initrd; -+ -+GRUB_MOD_INIT(linux) -+{ -+ cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux.")); -+ cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0, N_("Load initrd.")); -+ my_mod = mod; -+ kernel_path = NULL; -+ initrd_path = NULL; -+ boot_cmdline = NULL; -+} -+ -+GRUB_MOD_FINI(linux) -+{ -+ grub_unregister_command (cmd_linux); -+ grub_unregister_command (cmd_initrd); -+} -Index: grub-2.02~beta2/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 -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - - int -@@ -29,7 +30,7 @@ - int - grub_util_is_special_file (const char *path); - int --grub_util_is_regular (const char *path); -+EXPORT_FUNC(grub_util_is_regular) (const char *path); - - char * - grub_util_path_concat (size_t n, ...); -Index: grub-2.02~beta2/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 -@@ -23,6 +23,8 @@ - #include - - #include -+#include -+ - pid_t - grub_util_exec_pipe (const char *const *argv, int *fd); - pid_t -@@ -32,7 +34,7 @@ - grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file, - const char *stdout_file, const char *stderr_file); - int --grub_util_exec (const char *const *argv); -+EXPORT_FUNC(grub_util_exec) (const char *const *argv); - 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 -=================================================================== ---- 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 @@ - 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 -+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/exec.h - 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 -=================================================================== ---- 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 @@ - 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}, -+ {"kexec", 'X', 0, 0, N_("try the untryable."), 0}, - { 0, 0, 0, 0, 0, 0 } - }; - -@@ -163,6 +164,9 @@ - case 'v': - verbosity++; - break; -+ case 'X': -+ grub_util_set_kexecute(); -+ break; - - case ARGP_KEY_ARG: - { -Index: grub-2.02~beta2/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 @@ - #include - - int verbosity; -+int kexecute; - - void - grub_util_warn (const char *fmt, ...) -@@ -80,7 +81,7 @@ - vfprintf (stderr, fmt, ap); - va_end (ap); - fprintf (stderr, ".\n"); -- exit (1); -+ grub_exit (); - } - - void * -@@ -138,6 +139,9 @@ - void - grub_exit (void) - { -+#if defined (GRUB_KERNEL) -+ grub_reboot(); -+#endif - exit (1); - } - #endif -@@ -199,3 +203,15 @@ - - fclose (fp); - } -+ -+void -+grub_util_set_kexecute(void) -+{ -+ kexecute++; -+} -+ -+int -+grub_util_get_kexecute(void) -+{ -+ return kexecute; -+} -Index: grub-2.02~beta2/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)); - -+void EXPORT_FUNC(grub_util_set_kexecute) (void); -+int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT; -+ - grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); - - #ifdef HAVE_DEVICE_MAPPER diff --git a/grub2-s390x-03-output-7-bit-ascii.patch b/grub2-s390x-03-output-7-bit-ascii.patch deleted file mode 100644 index d834954..0000000 --- a/grub2-s390x-03-output-7-bit-ascii.patch +++ /dev/null @@ -1,530 +0,0 @@ -Vn: - * recognize 'dev/sclp_line0' as 3215-look-alike. [bnc#876743] -Vn+1: - * revamp readkey_dumb(). -Vn+2: - * support hotkeys on all line-mode terminals, not only 3215. [bnc#885668] - ---- - grub-core/kern/emu/main.c | 8 + - grub-core/normal/menu_text.c | 54 +++++++- - grub-core/normal/term.c | 2 - grub-core/osdep/unix/emuconsole.c | 238 +++++++++++++++++++++++++++++++++++++- - include/grub/term.h | 4 - 5 files changed, 294 insertions(+), 12 deletions(-) - ---- a/grub-core/osdep/unix/emuconsole.c -+++ b/grub-core/osdep/unix/emuconsole.c -@@ -39,17 +39,61 @@ - - #include - -+#include -+#include -+ - extern struct grub_terminfo_output_state grub_console_terminfo_output; - static int original_fl; - static int saved_orig; - static struct termios orig_tty; - static struct termios new_tty; -+static int console_mode = 0; -+ -+#define MAX_LEN 1023 -+#if defined(__s390x__) -+static int -+dummy (void) -+{ -+ return 0; -+} -+#endif -+#if 0 -+static char msg[MAX_LEN+1]; -+static void -+dprint (int len) -+{ -+ if (len < 0) -+ return; -+ if (len > MAX_LEN) -+ len = MAX_LEN; -+ write (2, msg, len); -+} -+#define dprintf(fmt, vargs...) dprint(snprintf(msg, MAX_LEN, fmt, ## vargs)) -+#else -+#define dprintf(fmt, vargs...) {} -+#endif - - static void --put (struct grub_term_output *term __attribute__ ((unused)), const int c) -+put (struct grub_term_output *term, const int c) - { - char chr = c; - ssize_t actual; -+ struct grub_terminfo_output_state *data -+ = (struct grub_terminfo_output_state *) term->data; -+ -+ if (term->flags & GRUB_TERM_DUMB) { -+ if (c == '\n') { -+ data->pos.y++; -+ data->pos.x = 0; -+ } else { -+ data->pos.x++; -+ } -+ if (0) { -+ if (c == ' ') chr = '_'; -+ if (c == GRUB_TERM_BACKSPACE) chr = '{'; -+ if (c == '\b') chr = '<'; -+ } -+ } - - actual = write (STDOUT_FILENO, &chr, 1); - if (actual < 1) -@@ -60,17 +104,152 @@ put (struct grub_term_output *term __att - } - - static int --readkey (struct grub_term_input *term __attribute__ ((unused))) -+readkey (struct grub_term_input *term) - { - grub_uint8_t c; - ssize_t actual; - -+ fd_set readfds; -+ struct timeval timeout; -+ int sel; -+ FD_SET (0, &readfds); -+ timeout.tv_sec = 0; -+ timeout.tv_usec = 500000; -+ if ((sel=select (1, &readfds, (fd_set *)0, (fd_set *)0, &timeout)) <= 0) -+ { -+ if (sel < 0 && errno == EINTR) -+ return 0x03; /* '^C' */ -+ return -1; -+ } -+ - actual = read (STDIN_FILENO, &c, 1); - if (actual > 0) - return c; - return -1; - } - -+#define NO_KEY ((grub_uint8_t)-1) -+static int -+readkey_dumb (struct grub_term_input *term) -+{ -+ grub_uint8_t c; -+ static grub_uint8_t p = NO_KEY; -+ -+ c = readkey (term); -+ if (c == NO_KEY) -+ return -1; -+ if ((p == '^' || p == '\n') && c == '\n') /* solitary '^' or '\n'? */ -+ { -+ c = p; /* use immediately! */ -+ p = '\n'; -+ } -+ else if ((c == '\n' || c == '^') && p != c) /* non-duplicate specials? */ -+ { -+ p = c; /* remember! */ -+ c = NO_KEY; -+ } -+ else if (p == '^') -+ { -+ if (c != '^') -+ c &= 0x1F; -+ p = NO_KEY; -+ } -+ else -+ p = c; -+ return c; -+} -+ -+static void -+grub_dumb_putchar (struct grub_term_output *term, -+ const struct grub_unicode_glyph *c) -+{ -+ unsigned i; -+ -+ /* For now, do not try to use a surrogate pair. */ -+ if (c->base > 0xffff) -+ put (term, '?'); -+ else -+ put (term, (c->base & 0xffff)); -+ -+ if (0) { -+ for (i = 0; i < c->ncomb; i++) -+ if (c->base < 0xffff) -+ put (term, grub_unicode_get_comb (c)[i].code); -+ } -+} -+ -+static struct grub_term_coordinate -+grub_dumb_getxy (struct grub_term_output *term) -+{ -+ struct grub_terminfo_output_state *data -+ = (struct grub_terminfo_output_state *) term->data; -+ -+ dprintf ("<%d,%d>", data->pos.x, data->pos.y); -+ return data->pos; -+} -+ -+static struct grub_term_coordinate -+grub_dumb_getwh (struct grub_term_output *term) -+{ -+ static int once = 0; -+ struct grub_terminfo_output_state *data -+ = (struct grub_terminfo_output_state *) term->data; -+ -+ if (!once++) -+ dprintf ("dumb_getwh: w=%d h=%d\n", data->size.x, data->size.y); -+ return data->size; -+} -+ -+static void -+grub_dumb_gotoxy (struct grub_term_output *term, -+ struct grub_term_coordinate pos) -+{ -+ struct grub_terminfo_output_state *data -+ = (struct grub_terminfo_output_state *) term->data; -+ -+ if (pos.x > grub_term_width (term) || pos.y > grub_term_height (term)) -+ { -+ grub_error (GRUB_ERR_BUG, "invalid point (%u,%u)", pos.x, pos.y); -+ return; -+ } -+ -+ dprintf("goto(%d,%d)", pos.x, pos.y); -+ if (pos.x > (grub_term_width (term) - 4)) { -+ dprintf (" really?"); -+ //return; -+ } -+ -+ if (data->gotoxy) -+ { -+ int i; -+ dprintf ("data-gotoxy"); -+ if (data->pos.y != pos.y) { -+ put (term, '\n'); -+ -+ for (i = 1; i < pos.x; i++ ) -+ put (term, ' '); -+ } -+ } -+ else -+ { -+ int i = 0; -+ if (data->pos.y != pos.y || data->pos.x > pos.x) { -+ if (data->pos.y >= pos.y) data->pos.y = pos.y - 1; -+ if (pos.y - data->pos.y > 3) data->pos.y = pos.y - 2; -+ dprintf (" <%dnl>+%d", (pos.y - data->pos.y), pos.x); -+ for (i = data->pos.y; i < pos.y; i++ ) -+ put (term, '\n'); -+ } -+ for (i = data->pos.x; i < pos.x; i++ ) -+ put (term, ' '); -+ dprintf ("#%d", i); -+ grub_dumb_getxy (term); -+ } -+ -+ dprintf ("\n"); -+ data->pos = pos; -+} -+ - static grub_err_t - grub_console_init_input (struct grub_term_input *term) - { -@@ -105,7 +284,8 @@ static grub_err_t - grub_console_init_output (struct grub_term_output *term) - { - struct winsize size; -- if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &size) >= 0) -+ if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &size) >= 0 && -+ size.ws_col > 0 && size.ws_row > 0) - { - grub_console_terminfo_output.size.x = size.ws_col; - grub_console_terminfo_output.size.y = size.ws_row; -@@ -115,6 +295,8 @@ grub_console_init_output (struct grub_te - grub_console_terminfo_output.size.x = 80; - grub_console_terminfo_output.size.y = 24; - } -+ if (console_mode == 3215) -+ grub_console_terminfo_output.size.x -= 1; - - grub_terminfo_output_init (term); - -@@ -161,24 +343,72 @@ static struct grub_term_output grub_cons - void - grub_console_init (void) - { -+#if ! defined(__s390x__) - const char *cs = nl_langinfo (CODESET); - if (cs && grub_strcasecmp (cs, "UTF-8")) - grub_console_term_output.flags = GRUB_TERM_CODE_TYPE_UTF8_LOGICAL; - else - grub_console_term_output.flags = GRUB_TERM_CODE_TYPE_ASCII; -+#else -+ char link[MAX_LEN+1]; -+ ssize_t len = readlink ("/proc/self/fd/0", link, MAX_LEN); -+ -+ if (len > 0) -+ link[len] = 0; -+ else -+ link[0] = 0; -+ if (grub_strncmp ("/dev/ttyS", link, 9) == 0 ) -+ console_mode = 3215; -+ else if (grub_strncmp ("/dev/3270/tty", link, 13) == 0 ) -+ console_mode = 3270; -+ else if (grub_strncmp ("/dev/sclp_line", link, 14) == 0 ) -+ console_mode = 3215; -+ grub_console_term_output.flags = GRUB_TERM_CODE_TYPE_ASCII; -+ switch (console_mode) -+ { -+ case 3215: -+ grub_console_term_output.flags |= GRUB_TERM_DUMB; -+ /* FALLTHROUGH */ -+ case 3270: -+ grub_console_term_output.flags |= GRUB_TERM_LINE; -+ grub_console_term_output.flags |= GRUB_TERM_NO_ECHO; -+ grub_console_terminfo_input.readkey = readkey_dumb; -+ break; -+ default: -+ break; -+ } -+#endif -+ if (grub_console_term_output.flags & GRUB_TERM_DUMB) -+ { -+ grub_console_term_output.putchar = grub_dumb_putchar, -+ grub_console_term_output.getxy = grub_dumb_getxy; -+ grub_console_term_output.getwh = grub_dumb_getwh; -+ grub_console_term_output.gotoxy = grub_dumb_gotoxy; -+ grub_console_term_output.cls = (void *) dummy; -+ grub_console_term_output.setcolorstate = (void *) dummy; -+ grub_console_term_output.setcursor = (void *) dummy; -+ grub_console_term_output.progress_update_divisor = GRUB_PROGRESS_NO_UPDATE; -+ } - grub_term_register_input ("console", &grub_console_term_input); - grub_term_register_output ("console", &grub_console_term_output); - grub_terminfo_init (); -- grub_terminfo_output_register (&grub_console_term_output, "vt100-color"); -+ grub_terminfo_output_register (&grub_console_term_output, -+ (grub_console_term_output.flags & GRUB_TERM_DUMB) ? "dumb":"vt100-color"); - } - - void - grub_console_fini (void) - { -+ dprintf( "grub_console_fini: %d\n", grub_console_term_output.flags & GRUB_TERM_DUMB); - if (saved_orig) - { - fcntl (STDIN_FILENO, F_SETFL, original_fl); - tcsetattr(STDIN_FILENO, TCSANOW, &orig_tty); - } -+ if (!(grub_console_term_output.flags & GRUB_TERM_DUMB)) -+ { -+ const char clear[] = { 0x1b, 'c', 0 }; -+ write (STDOUT_FILENO, clear, 2); -+ } - saved_orig = 0; - } ---- a/grub-core/normal/menu_text.c -+++ b/grub-core/normal/menu_text.c -@@ -113,6 +113,7 @@ draw_border (struct grub_term_output *te - { - int i; - -+ if (! (term->flags & GRUB_TERM_DUMB)) { - grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); - - grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1, -@@ -142,7 +143,7 @@ draw_border (struct grub_term_output *te - grub_putcode (GRUB_UNICODE_CORNER_LR, term); - - grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); -- -+ } - grub_term_gotoxy (term, - (struct grub_term_coordinate) { geo->first_entry_x - 1, - (geo->first_entry_y - 1 + geo->num_entries -@@ -155,6 +156,15 @@ print_message (int nested, int edit, str - int ret = 0; - grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); - -+ if (edit && (term->flags & GRUB_TERM_LINE)) -+ { -+ ret += grub_print_message_indented_real -+ (_("Minimum Emacs-like screen editing is supported. '^i' lists " -+ "completions. Type '^x' to boot, '^c' for a command-line " -+ "or '^[' to discard edits and return to the GRUB menu."), -+ STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); -+ } -+ else - if (edit) - { - ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \ -@@ -165,10 +175,15 @@ command-line or ESC to discard edits and - } - else - { -+#if defined(__s390x__hotkey) -+ ret += grub_print_message_indented_real -+ (_("Select a menu option by pressing the hotkey specified. "), -+ STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); -+#else - char *msg_translated; - - msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which " -- "entry is highlighted."), -+ "entry is highlighted. "), - GRUB_UNICODE_UPARROW, - GRUB_UNICODE_DOWNARROW); - if (!msg_translated) -@@ -177,6 +192,7 @@ command-line or ESC to discard edits and - STANDARD_MARGIN, term, dry_run); - - grub_free (msg_translated); -+#endif - - if (nested) - { -@@ -211,6 +227,10 @@ print_entry (int y, int highlight, grub_ - - title = entry ? entry->title : ""; - title_len = grub_strlen (title); -+ -+ if ((data->term->flags & GRUB_TERM_DUMB) && title[0] == '\0') -+ return; -+ - unicode_title = grub_malloc (title_len * sizeof (*unicode_title)); - if (! unicode_title) - /* XXX How to show this error? */ -@@ -244,6 +264,14 @@ print_entry (int y, int highlight, grub_ - if (data->geo.num_entries > 1) - grub_putcode (highlight ? '*' : ' ', data->term); - -+ if ((data->term->flags & GRUB_TERM_LINE) && title[0] != '\0') { -+ grub_putcode('(', data->term); -+ grub_putcode((entry && entry->hotkey >= '0' && entry->hotkey <= 'z') ? -+ entry->hotkey : ' ', data->term); -+ grub_putcode(')', data->term); -+ grub_putcode(' ', data->term); -+ } -+ - grub_print_ucs4_menu (unicode_title, - unicode_title + len, - 0, -@@ -413,6 +441,8 @@ grub_menu_init_page (int nested, int edi - grub_term_highlight_color = old_color_highlight; - geo->timeout_y = geo->first_entry_y + geo->num_entries - + geo->border + empty_lines; -+ if (term->flags & GRUB_TERM_DUMB) -+ geo->timeout_y = 1; - if (bottom_message) - { - grub_term_gotoxy (term, -@@ -422,6 +452,8 @@ grub_menu_init_page (int nested, int edi - print_message (nested, edit, term, 0); - geo->timeout_y += msg_num_lines; - } -+ if (term->flags & GRUB_TERM_DUMB) -+ geo->timeout_y = 1; - geo->right_margin = grub_term_width (term) - - geo->first_entry_x - - geo->entry_width - 1; -@@ -433,12 +465,19 @@ menu_text_print_timeout (int timeout, vo - struct menu_viewer_data *data = dataptr; - char *msg_translated = 0; - -- grub_term_gotoxy (data->term, -+ if (data->geo.timeout_y) -+ grub_term_gotoxy (data->term, - (struct grub_term_coordinate) { 0, data->geo.timeout_y }); - -+ if (data->term->flags & GRUB_TERM_DUMB) -+ { -+ if (! data->geo.timeout_y) -+ data->timeout_msg = TIMEOUT_TERSE; -+ data->geo.timeout_y = 0; -+ } - if (data->timeout_msg == TIMEOUT_TERSE - || data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN) -- msg_translated = grub_xasprintf (_("%ds"), timeout); -+ msg_translated = grub_xasprintf (_(" %ds"), timeout); - else - msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout); - if (!msg_translated) -@@ -468,6 +507,8 @@ menu_text_print_timeout (int timeout, vo - data->term); - grub_free (msg_translated); - -+ if (data->term->flags & GRUB_TERM_DUMB) -+ return; - grub_term_gotoxy (data->term, - (struct grub_term_coordinate) { - grub_term_cursor_x (&data->geo), -@@ -495,7 +536,7 @@ menu_text_set_chosen_entry (int entry, v - data->first = entry; - complete_redraw = 1; - } -- if (complete_redraw) -+ if (complete_redraw || (data->term->flags & GRUB_TERM_DUMB)) - print_entries (data->menu, data); - else - { -@@ -525,6 +566,9 @@ menu_text_clear_timeout (void *dataptr) - struct menu_viewer_data *data = dataptr; - int i; - -+ if ((data->term->flags & GRUB_TERM_DUMB)) -+ return; -+ - for (i = 0; i < data->geo.timeout_lines;i++) - { - grub_term_gotoxy (data->term, (struct grub_term_coordinate) { ---- a/grub-core/normal/term.c -+++ b/grub-core/normal/term.c -@@ -981,7 +981,7 @@ grub_print_ucs4_menu (const grub_uint32_ - { - print_ucs4_real (str, last_position, margin_left, margin_right, - term, 0, 0, 1, skip_lines, max_lines, -- contchar, 1, pos); -+ contchar, (term->flags & GRUB_TERM_DUMB)? 0 : 1, pos); - } - - void ---- a/grub-core/kern/emu/main.c -+++ b/grub-core/kern/emu/main.c -@@ -174,6 +174,12 @@ static struct argp argp = { - NULL, help_filter, NULL - }; - -+void -+ignore (int num __attribute__ ((unused))) -+{ -+ return; -+} -+ - - - #pragma GCC diagnostic ignored "-Wmissing-prototypes" -@@ -212,7 +218,7 @@ main (int argc, char *argv[]) - sleep (1); - } - -- signal (SIGINT, SIG_IGN); -+ signal (SIGINT, (sighandler_t) &ignore); - grub_console_init (); - grub_host_init (); - ---- a/include/grub/term.h -+++ b/include/grub/term.h -@@ -99,8 +99,10 @@ grub_term_color_state; - #define GRUB_TERM_NO_EDIT (1 << 1) - /* Set when the terminal cannot do fancy things. */ - #define GRUB_TERM_DUMB (1 << 2) -+/* Set when the terminal is line oriented. */ -+#define GRUB_TERM_LINE (1 << 3) - /* Which encoding does terminal expect stream to be. */ --#define GRUB_TERM_CODE_TYPE_SHIFT 3 -+#define GRUB_TERM_CODE_TYPE_SHIFT 4 - #define GRUB_TERM_CODE_TYPE_MASK (7 << GRUB_TERM_CODE_TYPE_SHIFT) - /* Only ASCII characters accepted. */ - #define GRUB_TERM_CODE_TYPE_ASCII (0 << GRUB_TERM_CODE_TYPE_SHIFT) diff --git a/grub2-s390x-04-grub2-install.patch b/grub2-s390x-04-grub2-install.patch deleted file mode 100644 index 80408fa..0000000 --- a/grub2-s390x-04-grub2-install.patch +++ /dev/null @@ -1,1066 +0,0 @@ -From: Raymund Will -Subject: Allow s390x-emu to be "installed" -References: fate#314213, bnc#866867, bnc#868909, bnc#874155, bnc#876743, - bnc#879136, bnc#889562, bnc#889572 -Patch-Mainline: no - -V2: - * try harder to find root filesystem (incl. subvol-handling). - * read /etc/sysconfig/bootloader as final fallback. -V3: - * refresh initrd by default, prefer running kernel and - re-zipl despite minor issues. [bnc#866867, fate#314213] -V4: - * append 'quiet splash=silent' for 'initgrub'-boot. - * properly check for dracut script during 'grub2-install'. - * move 'zipl2grub.pl' to '/usr/sbin/grub2-zipl-setup'. -V5: - * actually call 'grub2-zipl-setup' from 'grub2-install'. - * handle 'GRUB{,_EMU}_CONMODE'. [bnc#868909] -V6: - * grub2-zipl-setup: support 'xz' initrd compression. [bnc#874155] -V7: - * dracut-grub2.sh: use 'showconsole' to determine console device. [bnc#876743] - * dracut-grub2.sh: and fall back to '/dev/console' (instead of 'tty1'). - * dracut-grub2.sh: introduce "debug()" helper function. -V8: - * grub2-zipl-setup: replace poor choice in '/sysroot/sys' check. [bnc#879136] - * grub2-zipl-setup: fix typo in '/sysroot/proc' check. -V9: - * grub2-zipl-setup: honor GRUB_DISABLE_LINUX_UUID. [bnc#885854] -V10: - * grub2-zipl-setup: fix stupid typo in previous fix. [bnc#889562, bnc#889572] -V11: - * grub2-zipl-setup: disable 'grub-mkrelpath' acrobatics. [bnc#889572] -V12: - * dracut-grub2.sh: try to mount '/.snapshots' if missing. [bnc#892014] - * dracut-grub2.sh: use '/dev/shm' for debug output, so it's accessible - from grub2-emu's shell. -V13: - * grub2-zipl-setup: make initrd mount '/boot', if needed. [bnc#873951, bnc#892088] - * dracut-grub2.sh: provide /boot from above to grub2-emu in chroot. -V14: - * grub2-zipl-setup: actually remove obsolete kernel/initrds. [bnc#892810] -V15: - * zipl2grub.conf: turn of zipl-prompt and quiescent plymouth. [bsc#898198] -V16: - * dracut-grub2.sh: force read-only '/usr' for kexec. [bsc#932951] - ---- - Makefile.util.def | 39 +++ - configure.ac | 9 - grub-core/Makefile.core.def | 7 - grub-core/osdep/basic/no_platform.c | 7 - grub-core/osdep/unix/platform.c | 11 - grub-core/osdep/windows/platform.c | 6 - include/grub/util/install.h | 4 - util/grub-install-common.c | 1 - util/grub-install.c | 43 +++ - util/s390x/dracut-grub2.sh.in | 110 +++++++++ - util/s390x/dracut-module-setup.sh.in | 19 + - util/s390x/zipl2grub.conf.in | 26 ++ - util/s390x/zipl2grub.pl.in | 424 +++++++++++++++++++++++++++++++++++ - 13 files changed, 702 insertions(+), 4 deletions(-) - -Index: grub-2.02~rc1/Makefile.util.def -=================================================================== ---- grub-2.02~rc1.orig/Makefile.util.def -+++ grub-2.02~rc1/Makefile.util.def -@@ -352,6 +352,7 @@ program = { - ldadd = grub-core/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; - 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 = { - ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; -+ emu_condition = COND_NOT_s390x; - }; - - program = { -@@ -417,6 +420,7 @@ program = { - ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; -+ emu_condition = COND_NOT_s390x; - }; - - data = { -@@ -628,6 +632,7 @@ program = { - common = grub-core/disk/host.c; - - common = util/resolve.c; -+ emu_condition = COND_s390x; - common = grub-core/kern/emu/argp_common.c; - common = grub-core/osdep/init.c; - -@@ -697,6 +702,38 @@ script = { - }; - - script = { -+ name = grub-zipl-setup; -+ installdir = sbin; -+ common = util/s390x/zipl2grub.pl.in; -+ enable = emu; -+ emu_condition = COND_s390x; -+}; -+ -+data = { -+ name = zipl2grub.conf.in; -+ common = util/s390x/zipl2grub.conf.in; -+ installdir = grubconf; -+ enable = emu; -+ emu_condition = COND_s390x; -+}; -+ -+script = { -+ name = dracut-module-setup.sh; -+ common = util/s390x/dracut-module-setup.sh.in; -+ enable = emu; -+ emu_condition = COND_s390x; -+ installdir = platform; -+}; -+ -+script = { -+ name = dracut-grub.sh; -+ common = util/s390x/dracut-grub2.sh.in; -+ enable = emu; -+ emu_condition = COND_s390x; -+ installdir = platform; -+}; -+ -+script = { - name = grub-mkconfig_lib; - common = util/grub-mkconfig_lib.in; - installdir = noinst; -@@ -1308,6 +1345,7 @@ program = { - ldadd = libgrubkern.a; - ldadd = grub-core/gnulib/libgnu.a; - ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; -+ emu_condition = COND_NOT_s390x; - }; - - program = { -Index: grub-2.02~rc1/configure.ac -=================================================================== ---- grub-2.02~rc1.orig/configure.ac -+++ grub-2.02~rc1/configure.ac -@@ -181,9 +181,9 @@ if test x$platform != xemu ; then - esac - fi - --if test x"$target_cpu-$platform" = xsparc64-emu ; then -- target_m64=1 --fi -+case x"$target_cpu-$platform" in -+ xsparc64-emu | xs390x-emu) target_m64=1 ;; -+esac - - 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]) -+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]) -Index: grub-2.02~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,6 +1057,7 @@ module = { - module = { - name = videotest; - common = commands/videotest.c; -+ emu_condition = COND_NOT_s390x; - }; - - module = { -@@ -1469,6 +1470,7 @@ module = { - common = gfxmenu/gui_progress_bar.c; - common = gfxmenu/gui_util.c; - common = gfxmenu/gui_string_util.c; -+ emu_condition = COND_NOT_s390x; - }; - - module = { -@@ -1884,11 +1886,13 @@ module = { - name = gfxterm; - common = term/gfxterm.c; - enable = videomodules; -+ emu_condition = COND_NOT_s390x; - }; - - module = { - name = gfxterm_background; - common = term/gfxterm_background.c; -+ emu_condition = COND_NOT_s390x; - }; - - module = { -@@ -2003,6 +2007,7 @@ module = { - enable = x86_64_efi; - enable = emu; - enable = xen; -+ emu_condition = COND_NOT_s390x; - }; - - module = { -@@ -2049,6 +2054,7 @@ module = { - module = { - name = gfxterm_menu; - common = tests/gfxterm_menu.c; -+ emu_condition = COND_NOT_s390x; - }; - - module = { -@@ -2201,6 +2207,7 @@ module = { - enable = x86_64_efi; - enable = emu; - enable = xen; -+ emu_condition = COND_NOT_s390x; - }; - - module = { -Index: grub-2.02~rc1/grub-core/osdep/basic/no_platform.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/basic/no_platform.c -+++ grub-2.02~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")); - } -+ -+void -+grub_install_zipl (const char *d, int i, int f) -+{ -+ grub_util_error ("%s", _("no zIPL routines are available for your platform")); -+} -+ -Index: grub-2.02~rc1/grub-core/osdep/unix/platform.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/unix/platform.c -+++ grub-2.02~rc1/grub-core/osdep/unix/platform.c -@@ -233,3 +233,14 @@ grub_install_sgi_setup (const char *inst - imgfile, destname, NULL }); - grub_util_warn ("%s", _("You will have to set `SystemPartition' and `OSLoader' manually.")); - } -+ -+void -+grub_install_zipl (const char *dest, int install, int force) -+{ -+ if (grub_util_exec ((const char * []){ PACKAGE"-zipl-setup", -+ verbosity ? "-v" : "", -+ install ? "" : "--debug", -+ !force ? "" : "--force", -+ "-z", dest, NULL })) -+ grub_util_error (_("`%s' failed.\n"), PACKAGE"-zipl-setup"); -+} -Index: grub-2.02~rc1/grub-core/osdep/windows/platform.c -=================================================================== ---- grub-2.02~rc1.orig/grub-core/osdep/windows/platform.c -+++ grub-2.02~rc1/grub-core/osdep/windows/platform.c -@@ -422,3 +422,9 @@ grub_install_sgi_setup (const char *inst - { - grub_util_error ("%s", _("no SGI routines are available for your platform")); - } -+ -+void -+grub_install_zipl (const char *d, int i, int f) -+{ -+ grub_util_error ("%s", _("no zIPL routines are available for your platform")); -+} -Index: grub-2.02~rc1/include/grub/util/install.h -=================================================================== ---- grub-2.02~rc1.orig/include/grub/util/install.h -+++ grub-2.02~rc1/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, -+ GRUB_INSTALL_PLATFORM_S390X_EMU, - GRUB_INSTALL_PLATFORM_MAX - }; - -@@ -219,6 +220,9 @@ void - grub_install_sgi_setup (const char *install_device, - const char *imgfile, const char *destname); - -+void -+grub_install_zipl (const char *d, int i, int f); -+ - int - grub_install_compress_gzip (const char *src, const char *dest); - int -Index: grub-2.02~rc1/util/grub-install-common.c -=================================================================== ---- grub-2.02~rc1.orig/util/grub-install-common.c -+++ grub-2.02~rc1/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" }, -+ [GRUB_INSTALL_PLATFORM_S390X_EMU] = { "s390x", "emu" }, - }; - - char * -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 -@@ -66,6 +66,7 @@ static int force_file_id = 0; - static char *disk_module = NULL; - static char *efidir = NULL; - static char *macppcdir = NULL; -+static char *zipldir = NULL; - static int force = 0; - static int have_abstractions = 0; - static int have_cryptodisk = 0; -@@ -106,6 +107,7 @@ enum - OPTION_NO_BOOTSECTOR, - OPTION_NO_RS_CODES, - OPTION_MACPPC_DIRECTORY, -+ OPTION_ZIPL_DIRECTORY, - OPTION_LABEL_FONT, - OPTION_LABEL_COLOR, - OPTION_LABEL_BGCOLOR, -@@ -181,6 +183,11 @@ argp_parser (int key, char *arg, struct - efidir = xstrdup (arg); - return 0; - -+ case OPTION_ZIPL_DIRECTORY: -+ free (zipldir); -+ zipldir = xstrdup (arg); -+ return 0; -+ - case OPTION_DISK_MODULE: - free (disk_module); - disk_module = xstrdup (arg); -@@ -298,6 +305,8 @@ static struct argp_option options[] = { - N_("use DIR as the EFI System Partition root."), 2}, - {"macppc-directory", OPTION_MACPPC_DIRECTORY, N_("DIR"), 0, - N_("use DIR for PPC MAC install."), 2}, -+ {"zipl-directory", OPTION_ZIPL_DIRECTORY, N_("DIR"), 0, -+ N_("use DIR as the zIPL Boot Partition root."), 2}, - {"label-font", OPTION_LABEL_FONT, N_("FILE"), 0, N_("use FILE as font for label"), 2}, - {"label-color", OPTION_LABEL_COLOR, N_("COLOR"), 0, N_("use COLOR for label"), 2}, - {"label-bgcolor", OPTION_LABEL_BGCOLOR, N_("COLOR"), 0, N_("use COLOR for label background"), 2}, -@@ -324,6 +333,8 @@ get_default_platform (void) - return "arm64-efi"; - #elif defined (__amd64__) || defined (__x86_64__) || defined (__i386__) - return grub_install_get_default_x86_platform (); -+#elif defined (__s390x__) -+ return "s390x-emu"; - #else - return NULL; - #endif -@@ -495,6 +506,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_S390X_EMU: - return 0; - - /* pacify warning. */ -@@ -907,6 +920,7 @@ main (int argc, char *argv[]) - case GRUB_INSTALL_PLATFORM_ARM_UBOOT: - case GRUB_INSTALL_PLATFORM_I386_XEN: - case GRUB_INSTALL_PLATFORM_X86_64_XEN: -+ 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: - case GRUB_INSTALL_PLATFORM_I386_XEN: - case GRUB_INSTALL_PLATFORM_X86_64_XEN: -+ case GRUB_INSTALL_PLATFORM_S390X_EMU: - free (install_device); - install_device = NULL; - break; -@@ -1213,6 +1228,20 @@ main (int argc, char *argv[]) - } - } - -+ if (platform == GRUB_INSTALL_PLATFORM_S390X_EMU) -+ { -+ if (!zipldir) -+ { -+ char *d = grub_util_path_concat (2, bootdir, "zipl"); -+ if (!grub_util_is_directory (d)) -+ { -+ free (d); -+ grub_util_error ("%s", _("cannot find zIPL directory")); -+ } -+ zipldir = d; -+ } -+ } -+ - 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: - case GRUB_INSTALL_PLATFORM_I386_XEN: - case GRUB_INSTALL_PLATFORM_X86_64_XEN: -+ 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[]) - strcpy (mkimage_target, "sparc64-ieee1275-raw"); - core_name = "core.img"; - break; -+ case GRUB_INSTALL_PLATFORM_S390X_EMU: -+ strcpy (mkimage_target, "grub2-emu"); -+ core_name = mkimage_target; -+ break; - /* pacify warning. */ - case GRUB_INSTALL_PLATFORM_MAX: - break; -@@ -1585,6 +1619,7 @@ main (int argc, char *argv[]) - core_name); - char *prefix = xasprintf ("%s%s", prefix_drive ? : "", - relative_grubdir); -+ if (core_name != mkimage_target) - grub_install_make_image_wrap (/* source dir */ grub_install_source_directory, - /*prefix */ prefix, - /* output */ imgfile, -@@ -1623,6 +1658,10 @@ main (int argc, char *argv[]) - /* image target */ mkimage_target, 0); - } - break; -+ -+ case GRUB_INSTALL_PLATFORM_S390X_EMU: -+ break; -+ - case GRUB_INSTALL_PLATFORM_ARM_EFI: - case GRUB_INSTALL_PLATFORM_ARM64_EFI: - case GRUB_INSTALL_PLATFORM_IA64_EFI: -@@ -1884,6 +1923,10 @@ main (int argc, char *argv[]) - } - break; - -+ case GRUB_INSTALL_PLATFORM_S390X_EMU: -+ grub_install_zipl (zipldir, install_bootsector, force); -+ break; -+ - case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON: - case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS: - case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS: -Index: grub-2.02~rc1/util/s390x/dracut-grub2.sh.in -=================================================================== ---- /dev/null -+++ grub-2.02~rc1/util/s390x/dracut-grub2.sh.in -@@ -0,0 +1,110 @@ -+#!/bin/sh -+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+#getargbool() { true; } -+ -+if getargbool 0 initgrub && [ ! -e /grub2skip ] || [ -e /grub2force ]; then -+ #type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh -+ checkro() { -+ local tgt="$1" -+ local dev mp fs opts dc -+ local rofs=true -+ while read dev mp fs opts dc; do -+ [ "$mp" = "$tgt" ] || continue -+ case ",$opts," in -+ (*,ro,*) rofs=true;; -+ (*) rofs=false;; -+ esac -+ done < /proc/mounts -+ echo $rofs -+ } -+ checkd() { -+ [ -d $1 ] && echo true || echo false -+ } -+ checke() { -+ [ -e $1 ] && echo true || echo false -+ } -+ checksnap() { -+ if [ -e /sysroot/.snapshots/grub-snapshot.cfg ]; then -+ echo true -+ elif grep -qE '^[^#\s]+\s+/.snapshots\s+' /sysroot/etc/fstab; then -+ echo false -+ else -+ echo true -+ fi -+ } -+ checkboot() { -+ [ -d /boot/grub2 ] && echo false || echo true -+ } -+ getterm() { -+ local term="$(getarg TERM)" -+ [ -z "$term" ] && term=dumb -+ echo $term -+ } -+ debug() { -+ if [ -n "$1" ]; then -+ echo "$1" >> /dev/.grub2.debug -+ fi -+ shift; -+ [ -n "$*" ] || return 0 -+ echo "+ $*" >> /dev/.grub2.debug -+ "$@" >> /dev/.grub2.debug -+ } -+ -+ exec_prefix=@exec_prefix@ -+ bindir=@bindir@ -+ if [ -e /sysroot$bindir/grub2-emu ]; then -+ -+ export TERM=$(getterm) -+ export grub2rofs=$(checkro /sysroot) -+ export grub2roufs=$(checkro /sysroot/usr) -+ export grub2sysfs=$(checkd /sysroot/sys/devices/system/memory) -+ export grub2procfs=$(checkd /sysroot/proc/self) -+ export grub2bootfs=$(checkboot) -+ export grub2devfs=$(checkd /sysroot/dev/disk) -+ export grub2snap=$(checksnap) -+ debug "" export -p -+ -+ _ctty="$(RD_DEBUG= getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}" -+ if [ -z "$_ctty" ]; then -+ _ctty=$(showconsole) -+ fi -+ if [ -z "$_ctty" ]; then -+ _ctty=console -+ while [ -f /sys/class/tty/$_ctty/active ]; do -+ _ctty=$(cat /sys/class/tty/$_ctty/active) -+ _ctty=${_ctty##* } # last one in the list -+ done -+ _ctty=/dev/$_ctty -+ fi -+ [ -c "$_ctty" ] || _ctty=/dev/console -+ case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty";; esac -+ -+ CTTY="$CTTY --wait" -+ $grub2rofs || mount -o remount,ro /sysroot -+ $grub2roufs || mount -o remount,ro /sysroot/usr -+ $grub2sysfs || mount --bind {,/sysroot}/sys -+ $grub2procfs || mount --bind {,/sysroot}/proc -+ $grub2bootfs || mount --bind {,/sysroot}/boot -+ $grub2devfs || mount --bind {,/sysroot}/dev -+ $grub2snap || chroot /sysroot mount -rn /.snapshots -+ debug "" cat /proc/mounts -+ -+ debug "Trying grub2-emu (ro=$grub2rofs, TERM=$TERM, ctty=$_ctty)..." -+ setsid $CTTY -- chroot /sysroot $bindir/grub2-emu -X -X 0<>$_ctty 1>&0 2>&0 -+ if [ -e /grub2force ] && [ $(cat /sys/kernel/kexec_loaded) = 1 ]; then -+ systemctl kexec -+ fi -+ -+ $grub2snap || umount /sysroot/.snapshots -+ $grub2devfs || umount /sysroot/dev -+ $grub2bootfs || umount /sysroot/boot -+ $grub2procfs || umount /sysroot/proc -+ $grub2sysfs || umount /sysroot/sys -+ $grub2roufs || mount -o remount,rw /sysroot/usr -+ $grub2rofs || mount -o remount,rw /sysroot -+ else -+ info "No $bindir/grub2-emu in /sysroot--trying to proceed without kexec..." -+ fi -+fi -+ -Index: grub-2.02~rc1/util/s390x/dracut-module-setup.sh.in -=================================================================== ---- /dev/null -+++ grub-2.02~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; -*- -+# ex: ts=8 sw=4 sts=4 et filetype=sh -+ -+# called by dracut -+check() { -+ local _arch=$(uname -m) -+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 -+ return 0 -+} -+ -+# called by dracut -+install() { -+ inst_hook cleanup 99 "$moddir/grub2.sh" -+ inst_multiple showconsole -+ inst_multiple mount umount chroot cat grep /usr/bin/setsid -+ #inst_multiple grub2-emu kexec -+} -+ -Index: grub-2.02~rc1/util/s390x/zipl2grub.conf.in -=================================================================== ---- /dev/null -+++ grub-2.02~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. -+ -+[defaultboot] -+defaultmenu = menu -+ -+[grub2] -+ target = @zipldir@ -+ ramdisk = @zipldir@/initrd,0x2000000 -+ image = @zipldir@/image -+ parameters = "root=@GRUB_DEVICE@ @GRUB_EMU_CONMODE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ initgrub quiet splash=silent plymouth.enable=0 " -+ -+[skip-grub2] -+ target = @zipldir@ -+ ramdisk = @zipldir@/initrd,0x2000000 -+ image = @zipldir@/image -+ parameters = "root=@GRUB_DEVICE@ @GRUB_CONMODE@ @GRUB_CMDLINE_LINUX@ @GRUB_CMDLINE_LINUX_DEFAULT@ " -+ -+:menu -+ target = @zipldir@ -+ timeout = 16 -+ default = 1 -+ prompt = 0 -+ 1 = grub2 -+ 2 = skip-grub2 -+ -Index: grub-2.02~rc1/util/s390x/zipl2grub.pl.in -=================================================================== ---- /dev/null -+++ grub-2.02~rc1/util/s390x/zipl2grub.pl.in -@@ -0,0 +1,424 @@ -+#!/usr/bin/perl -+use strict; -+ -+my $C = $0; $C =~ s{^.*/}{}; -+ -+my $in = '@sysconfdir@/default/zipl2grub.conf.in'; -+my $default = '@sysconfdir@/default/grub'; -+my $fallback = '@sysconfdir@/zipl.conf'; -+my $sysconfbl = '@sysconfdir@/sysconfig/bootloader'; -+my $zipldir = ""; -+my $running = ""; -+my $refresh = 1; # needs to default to "on" until most bugs are shaken out! -+my $force = 0; -+my $verbose = 0; -+my $debug = 0; -+my $miss = 0; -+my $cfg = ""; -+my %fsdev = (); -+my %fstype = (); -+ -+my %C = ( -+ GRUB_CMDLINE_LINUX_DEFAULT => "quiet splash=silent", -+ GRUB_DISABLE_LINUX_UUID => "false", -+); -+ -+my %Mandatory = ( -+ GRUB_CMDLINE_LINUX_DEFAULT => 1, -+ GRUB_DEVICE => 1, -+); -+ -+sub Panic($$) { -+ printf( STDERR "%s", $_[1]); -+ exit( $_[0]); -+} -+sub Info($$) { -+ printf( STDERR "%s", $_[1]) if ($_[0] <= $verbose); -+} -+sub System(@) { -+ my (@C) =@_; -+ Info( 1, "+ " . join( " ", @C) . "\n"); -+ return 0 if ($debug); -+ system( @C); -+ if ($? == -1) { -+ Panic( $?, "$C[0]: Failed to execute: $!\n"); -+ } elsif ($? & 127) { -+ Panic( $?, sprintf( "$C[0]: Died with signal %d with%s coredump\n", -+ ($? & 127), ($? & 128) ? '' : 'out')); -+ } elsif ( $? >> 8 != 0 ) { -+ Panic( $?, "$C[0]: Failed\n"); -+ } -+ return( 0); -+} -+sub cp($$) { -+ my @C = ( "cp", "-p", $_[0], $_[1]); -+ System( @C); -+} -+sub rm($) { -+ return( 0) unless ( -l $_[0] || -e $_[0]); -+ Info( 2, "+ rm $_[0]\n"); -+ return 0 if ($debug); -+ unlink( $_[0]) || Panic( 1, "$C: unlink: $!.\n"); -+} -+sub mv($$) { -+ Info( 1, "+ mv $_[0] $_[1]\n"); -+ return 0 if ($debug); -+ rename($_[0], $_[1]) || Panic( 1, "$C: rename: $!.\n"); -+} -+sub ln($$) { -+ Info( 1, "+ ln -sf $_[0] $_[1]\n"); -+ return 0 if ($debug); -+ unlink( $_[1]) || Panic( 1, "$C: unlink: $!.\n") if ( -e $_[1]); -+ symlink($_[0], $_[1]) || Panic( 1, "$C: symlink: $!.\n"); -+} -+sub BootCopy($$$) { -+ my( $file, $dir, $tgt) = @_; -+ my $curr = "$dir/$tgt"; -+ my $prev = "$dir/$tgt.prev"; -+ Info(4, "Copy /boot/$file $dir $tgt\n"); -+ if ( -l $curr ) { -+ my $curf = readlink( $curr); -+ if ( $curf ne $file ) { -+ if ( -l $prev ) { -+ my $pref = readlink( $prev); -+ $pref = "$dir/$pref" unless ($pref =~ m{^/}); -+ rm( $pref); -+ } -+ mv( $curr, $prev); -+ } -+ } -+ cp( "/boot/$file", "$dir/$file"); -+ ln( $file, $curr); -+} -+sub MkInitrd($$$) { -+ my( $initrd, $dir, $version) = @_; -+ my @C = ( "dracut", "--hostonly", "--force"); -+ my $uuid; -+ if ( exists( $fsdev{"/boot"}) ) { -+ chomp( $uuid = qx{grub2-probe --target=fs_uuid /boot}); -+ my ($dev, $type) = ($fsdev{"/boot"}, $fstype{"/boot"}); -+ if ( $type eq "auto" ) { -+ chomp( $type = qx{grub2-probe --target=fs /boot}); -+ } -+ if ($C{GRUB_DISABLE_LINUX_UUID} eq "true" && -+ $dev =~ m{^(UUID=|/dev/disk/by-uuid/)}) { -+ chomp( $dev = qx{grub2-probe --target=device /boot}); -+ } -+ push @C, "--mount", "$dev /boot $type ro"; -+ } -+ push @C, "$dir/$initrd", $version; -+ System( @C); -+ ln( $initrd, "$dir/initrd"); -+} -+sub ChkInitrd($$) { -+ my( $dir, $initrd) = @_; -+ my $found = -1; -+ my $d = $dir; -+ my $pattern = qr{lib/dracut/hooks/cleanup/99-grub2.sh}; -+ my $show = "cleanup/99-grub2.sh"; -+ my $cat = undef; -+ my $magic; -+ -+ return $found unless (-r "$dir/$initrd"); -+ open( IN, "< $dir/$initrd") || return $found; -+ my $rd = sysread( IN, $magic, 6); -+ close( IN); -+ return $found unless (defined( $rd) && $rd == 6); -+ $cat = "xzcat" if ($magic eq "\xFD7zXZ\x00"); -+ $cat = "zcat" if (substr($magic, 0, 2) eq "\037\213"); -+ $cat = "cat" if (substr($magic, 0, 5) eq "07070"); -+ return $found unless (defined($cat)); -+ -+ my $modinst = "/usr/lib/dracut/modules.d/99grub2/module-setup.sh"; -+ if ( -r $modinst ) { -+ my( $hook, $ord, $script); -+ my $pat = qr{^\s*inst_hook\s+(\S+)\s+([0-9]+)\s+\"\$moddir/(grub2\.sh)\"}; -+ open( IN, "< $modinst") || die; -+ while ( ) { -+ next unless ($_ =~ $pat); -+ $show = "$1/$2-$3"; -+ $pattern = qr{lib/dracut/hooks/$show}o; -+ last; -+ } -+ close( IN); -+ } -+ -+ $found = 0; -+ Info( 3, "+ $cat $d/$initrd | cpio -it | grep '$show'\n"); -+ open( IN, "$cat $d/$initrd | cpio -it 2>/dev/null |") || -+ Panic( 1, "$C: cpio: $!.\n"); -+ while ( ) { -+ $found = 1 if ($_ =~ $pattern); -+ } -+ close( IN); -+ return $found; -+} -+ -+sub Usage($) { -+ my @cat = ("", -+ "Parameter error.", -+ "zIPL directory missing.", -+ "Configuration template missing.", -+ "Configuration template unreadable.", -+ "zIPL directory not accesible.", -+ "" -+ ); -+ my $msg = ""; -+ -+ $msg .= sprintf( "%s: %s\n", $C, $cat[$_[0]]) if ($_[0] > 0); -+ $msg .= "Usage: $C [-v] [-d] [-f] [-T template] [-z ZIPLDIR]\n"; -+ Panic( $_[0], $msg . "\n"); -+} -+ -+die if ($[ != 0); -+while ( $#ARGV >= 0 ) { -+ $_ = shift; -+ next if /^$/; -+ last if /^--$/; -+ (/^--verbose$/ || /^-v$/) && ($verbose++, next); -+ (/^--quiet$/ || /^-q$/) && ($verbose = 0, next); -+ (/^--debug$/ || /^-d$/) && ($debug = 1, $verbose++, next); -+ (/^--force$/ || /^-f$/) && ($force = $refresh = 1, next); -+ (/^--refresh$/ || /^-r$/) && ($refresh = 1, next); -+ (/^--keep$/ || /^-k$/) && ($refresh = 0, next); -+ (/^--?help/ || /^-h/) && (Usage(0)); -+ (/^--zipldir$/ || /^-z$/) && ($zipldir = shift || Usage(2), next); -+ (/^--template$/ || /^-T$/) && ($in = shift || Usage(3), next); -+ (/^-/) && (Usage(1)); -+ Usage(1); -+} -+Usage(4) if (! -r $in); -+ -+if ($zipldir) { -+ $C{zipldir} = $zipldir; # command-line wins -+} elsif ( exists( $C{zipldir}) ) { -+ $zipldir = $C{zipldir}; # otherwise fall back to config -+} else { -+ $zipldir = $C{zipldir} = "/boot/zipl"; # but don't proceed without... -+} -+Usage(5) if (! -d $zipldir); -+if ( $zipldir eq "/boot" ) { -+ Panic( 5, "$C: zIPL directory '/boot' not supported!\n"); -+} -+ -+if ( ! -r $default && ! -r $fallback && ! -r $sysconfbl ) { -+ Panic( 0, "$C: No configuration files found. Retry later!\n"); -+} -+if ( -r $default ) { -+ open( IN, "< $default") || die; -+ while ( ) { -+ chomp; -+ s{^\s*#.*$}{}; -+ next if m{^\s*$}; -+ s{x}{\x01xx\x01}g; -+ s{\\\"}{\x01x1\x01}g; -+ s{\\\'}{\x01x2\x01}g; -+ Info( 5, "<$_>\n"); -+ if ( m{^([^\s=]+)='([^']*)'\s*(?:#.*)?$} || -+ m{^([^\s=]+)="([^"]*)"\s*(?:#.*)?$} || -+ m{^([^\s=]+)=(\S*)\s*(?:#.*)?$} ) { -+ my ( $k, $v) = ($1, $2); -+ $v =~ s{\x01x2\x01}{\\'}g; -+ $v =~ s{\x01x1\x01}{\\"}g; -+ $v =~ s{\x01xx\x01}{x}g; -+ $C{$k} = $v; -+ next; -+ } -+ print( STDERR "$default:$.: parse error ignored.\n"); -+ } -+ close( IN); -+} -+if ( -r "/etc/fstab" ) { -+ my $regex = qr{^(\S+)\s+(\S+)\s+(\S+)\s+\S+\s+\S+\s+\S+\s*(?:#.*)?$}; -+ open( IN, "< /etc/fstab") || die; -+ while ( ) { -+ next if ( m{^\s*#} ); -+ my ($dev, $mp, $type) = (m{$regex}o); -+ $fsdev{$mp} = $dev; -+ $fstype{$mp} = $type; -+ } -+ close( IN); -+} -+ -+if ( ! exists( $C{GRUB_DEVICE}) && -+ $C{GRUB_CMDLINE_LINUX_DEFAULT} eq "quiet splash=silent" && -+ -r $fallback ) { -+ # configuration incomplete, let's try fallback -+ open( IN, "< $fallback") || die; -+ my $section = ""; -+ while( ){ -+ if ( m{^\[([^\]]+)\]\s*$} ) { -+ $section = $1; -+ } -+ if ( $section eq "ipl" && -+ m{^\s*parameters\s*=\s*\"root=(\S+)(?:\s*|\s+([^\"]+))\"} ) { -+ $C{GRUB_DEVICE} = $1; -+ $C{GRUB_CMDLINE_LINUX_DEFAULT} = $2 if (defined($2) && $2 !~ m{^\s*$}); -+ last; -+ } -+ } -+ close( IN); -+ $default = $fallback; -+} -+ -+if ( ! exists( $C{GRUB_DEVICE}) && exists( $fsdev{"/"}) ) { -+ my( $dev, $type, $subvol) = ( $fsdev{"/"}, $fstype{"/"}, ""); -+ if ( $dev !~ m{^(UUID=|/dev/disk/by-uuid/)} || -+ $C{GRUB_DISABLE_LINUX_UUID} ne "true" ) { -+ $C{GRUB_DEVICE} = $dev; -+ # grub2-mkrelpath fails on rollback -- and provides no known merit... -+ #chomp( $subvol = qx{grub2-mkrelpath /}) if ( $type eq "btrfs" ); -+ #$subvol =~ s{^/}{}; -+ #$C{GRUB_DEVICE} .= " rootflags=subvol=$subvol" if ($subvol); -+ } -+} -+if ( ! exists( $C{GRUB_DEVICE}) ) { -+ my( $dev, $uuid, $type, $subvol) = ("", "", "", ""); -+ chomp( $dev = qx{grub2-probe --target=device /}); -+ chomp( $uuid = qx{grub2-probe --device $dev --target=fs_uuid}); -+ if ( $dev ) { -+ if ( $uuid && $C{GRUB_DISABLE_LINUX_UUID} ne "true" ) { -+ $C{GRUB_DEVICE} = "UUID=$uuid"; -+ } else { -+ $C{GRUB_DEVICE} = "$dev"; -+ } -+ chomp( $type = qx{stat -f --printf='%T' /}); -+ # grub2-mkrelpath fails on rollback -- and provides no known merit... -+ #chomp( $subvol = qx{grub2-mkrelpath /}) if ( $type eq "btrfs" ); -+ #$subvol =~ s{^/}{}; -+ #$C{GRUB_DEVICE} .= " rootflags=subvol=$subvol" if ($subvol); -+ } -+} -+if ( $C{GRUB_CMDLINE_LINUX_DEFAULT} eq "quiet splash=silent" && -+ -r $sysconfbl) { -+ open( IN, "< $sysconfbl") || die; -+ while ( ) { -+ next if ( m{^\s*#} ); -+ if ( m{^DEFAULT_APPEND=".*"(?:\s*|\s+#.*)$} ) { -+ $C{GRUB_CMDLINE_LINUX_DEFAULT} = $1; -+ } -+ } -+ close( IN); -+} -+ -+if ( ! exists( $C{GRUB_DEVICE})) { -+ Panic( 0, "$C: Default not ready and no fallback. Please retry later!\n"); -+} -+ -+if ( ! exists( $C{GRUB_EMU_CONMODE}) && exists( $C{GRUB_CONMODE}) ) { -+ # GRUB_CONMODE is used for 'grub2-emu' as well -+ $C{GRUB_EMU_CONMODE} = $C{GRUB_CONMODE}; -+} -+if ( exists( $C{GRUB_EMU_CONMODE}) && !exists( $C{GRUB_CONMODE}) ) { -+ # pick up 'conmode=' from CMDLINE -+ my $found = ""; -+ foreach ( "GRUB_CMDLINE_LINUX", "GRUB_CMDLINE_LINUX_DEFAULT" ) { -+ next unless ($C{$_} =~ m{ ?conmode=(\S+) ?}); -+ $C{GRUB_CONMODE} = $1; -+ last; -+ } -+ if ( !exists( $C{GRUB_CONMODE}) && $C{GRUB_EMU_CONMODE} eq "3270" ) { -+ # force GRUB_CONMODE to 3215 for least surprise -+ $C{GRUB_CONMODE}="3215"; -+ } -+} -+if ( exists( $C{GRUB_EMU_CONMODE}) && exists( $C{GRUB_CONMODE})) { -+ # strip "conmode=" from GRUB_CMDLINE{,_LINUX}_DEFAULT -+ foreach ( "GRUB_CMDLINE_LINUX", "GRUB_CMDLINE_LINUX_DEFAULT" ) { -+ $C{$_} =~ s{( ?)conmode=\S+ ?}{$1}g; -+ } -+} -+foreach ("GRUB_EMU_CONMODE", "GRUB_CONMODE") { -+ next unless( exists( $C{$_}) ); -+ $C{$_} = "conmode=" . $C{$_}; -+} -+ -+if ( $debug && $verbose > 2 ) { -+ foreach ( sort( keys( %C)) ) { -+ printf( "%s=\"%s\"\n", $_, $C{$_}); -+ } -+} -+ -+open( IN, "< $in") || -+ Panic( 1, "$C: Failed to open 'zipl.conf' template: $!.\n"); -+while ( ) { -+ Info( 3, "$.. <$_$.. >"); -+ if ( $. == 1 && m{^## This} ) { -+ $_ = "## This file was written by 'grub2-install/$C'\n" . -+ "## filling '$in' as template\n"; -+ } elsif ( $. == 2 && m{^## rpm's} ) { -+ $_ = "## with values from '$default'.\n" . -+ "## In-place modifications will eventually go missing!\n"; -+ } -+ while ( m{\@([^\@\s]+)\@} ) { -+ my $k = $1; -+ my $v; -+ if ( exists( $C{$k}) ) { -+ $v = $C{$k}; -+ } elsif ( exists( $Mandatory{$k}) ) { -+ $v = "$k"; -+ $miss++; -+ } else { -+ $v = ""; -+ } -+ s{\@$k\@}{$v}g; -+ } -+ Info( 2, $_); -+ $cfg .= $_; -+} -+if ( $miss ) { -+ Info( 1, "Partially filled config:\n===\n$cfg===\n"); -+ Panic( 1, "$C: 'zipl.conf' template could not be filled. \n"); -+} -+ -+my $ziplconf = "$zipldir/config"; -+if ( ! $debug ) { -+ open( OUT, "> $ziplconf") || die; -+ print( OUT $cfg) || die; -+ close( OUT); -+} -+ -+# copy out kernel and initrd -+my $defimage = "/boot/image"; -+my $definitrd = "/boot/initrd"; -+my $ziplimage = "$zipldir/image"; -+my $ziplinitrd = "$zipldir/initrd"; -+my $Image = "$defimage"; -+ -+if ( ! $running && ! $force ) { -+ chomp( $running = qx{uname -r}); -+ Info( 1, "preferred kernel: '$running'\n"); -+ $Image .= "-$running"; -+} -+if ( ! -r $Image ) { -+ $Image = $defimage; -+} -+Panic( 1, "$C: kernel '$Image' not readable!?\n") unless (-r $Image); -+ -+if ( -l $Image ) { -+ $Image = readlink( $Image); -+} -+my ($image, $version) = ($Image =~ m{^(?:/boot/)?([^-]+-(.+))$}); -+my $initrd = "initrd-$version"; -+ -+if ( !defined($image) || !defined($version) || ! -r "/boot/$image" ) { -+ Panic( 1, "$C: weird $Image. This should never happen!\n"); -+} -+ -+if ( ! -r $ziplimage || ! -r $ziplinitrd || $refresh ) { -+ BootCopy( $image, $zipldir, "image"); -+ BootCopy( $initrd, $zipldir, "initrd") if (-r "/boot/$initrd"); -+} -+if ( $refresh || ChkInitrd( $zipldir, "initrd") <= 0 ) { -+ MkInitrd( $initrd, $zipldir, $version); -+} -+if ( ChkInitrd( $zipldir, "initrd") == 0 ) { -+ Info( 0, "$C: dracut does not work as expected! Help needed!\n"); -+ $miss++; -+} -+ -+# now: go for it! -+my @C = ( "/sbin/zipl", (($verbose) ? "-Vnc" : "-nc"), "$ziplconf" ); -+System( @C); -+exit( $miss); -+ diff --git a/grub2-s390x-05-grub2-mkconfig.patch b/grub2-s390x-05-grub2-mkconfig.patch deleted file mode 100644 index 9ec5f90..0000000 --- a/grub2-s390x-05-grub2-mkconfig.patch +++ /dev/null @@ -1,147 +0,0 @@ -From: Raymund Will -Subject: Enable grub2-mkconfig for s390x-emu -References: fate#314213, bnc#868909 -Patch-Mainline: no - -V2: - * omit subvolume-prefix for platform "emu" -V3: - * add 'conmode=' to command-line if GRUB_CONMODE exists. [bnc#868909] -V4: - * remove 's' from possible hot-keys for "bootable snapshots". [bnc#885668] - ---- - util/grub.d/10_linux.in | 63 ++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 51 insertions(+), 12 deletions(-) - -Index: grub-2.02~beta2/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 -@@ -51,6 +51,10 @@ else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} - fi - -+if [ "x$GRUB_CONMODE" != "x" ]; then -+ GRUB_CMDLINE_LINUX="conmode=${GRUB_CONMODE} ${GRUB_CMDLINE_LINUX}" -+fi -+ - case x"$GRUB_FS" in - xbtrfs) - rootsubvol="`make_system_path_relative_to_its_root /`" -@@ -67,6 +71,21 @@ esac - - title_correction_code= - -+hotkey=1 -+incr_hotkey() -+{ -+ [ -z "$hotkey" ] && return -+ expr $hotkey + 1 -+} -+print_hotkey() -+{ -+ keys="123456789abdfgijklmnoprtuvwyz" -+ if [ -z "$hotkey" ]||[ $hotkey -eq 0 ]||[ $hotkey -gt 30 ]; then -+ return -+ fi -+ echo "--hotkey=$(expr substr $keys $hotkey 1)" -+} -+ - linux_entry () - { - os="$1" -@@ -96,9 +115,11 @@ linux_entry () - title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" - grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" - fi -- echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ echo "menuentry '$(echo "$title" | grub_quote)' $(print_hotkey) ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ hotkey=$(incr_hotkey) - else -- echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ echo "menuentry '$(echo "$os" | grub_quote)' $(print_hotkey) ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" -+ hotkey=$(incr_hotkey) - fi - if [ x$type != xrecovery ] ; then - save_default_entry | grub_add_tab -@@ -121,6 +142,7 @@ linux_entry () - - echo " insmod gzio" | sed "s/^/$submenu_indentation/" - -+ if [ $PLATFORM != emu ]; then # 'search' does not work for now - if [ x$dirname = x/ ]; then - if [ -z "${prepare_root_cache}" ]; then - prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)" -@@ -132,6 +154,7 @@ linux_entry () - fi - printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" - fi -+ fi - message="$(gettext_printf "Loading Linux %s ..." ${version})" - if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then - sed "s/^/$submenu_indentation/" << EOF -@@ -166,17 +189,15 @@ EOF - - machine=`uname -m` - case "x$machine" in -- xi?86 | xx86_64) -- list= -- for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do -- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -- done ;; -- *) -- list= -- for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do -- if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -- done ;; -+ xi?86 | xx86_64) klist="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*" ;; -+ xs390 | xs390x) klist="/boot/image-* /boot/kernel-*" ;; -+ *) klist="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* \ -+ /boot/kernel-*" ;; - esac -+list= -+for i in $klist ; do -+ if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi -+done - - case "$machine" in - i?86) GENKERNEL_ARCH="x86" ;; -@@ -186,6 +207,15 @@ case "$machine" in - *) GENKERNEL_ARCH="$machine" ;; - esac - -+PLATFORM="native" -+if [ -d /sys/firmware/efi ]&&[ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then -+ PLATFORM="efi" -+else -+ case "$machine" in -+ s390*) PLATFORM="emu" ;; -+ esac -+fi -+ - prepare_boot_cache= - prepare_root_cache= - boot_device_id= -@@ -202,6 +232,11 @@ while [ "x$list" != "x" ] ; do - basename=`basename $linux` - dirname=`dirname $linux` - rel_dirname=`make_system_path_relative_to_its_root $dirname` -+ if [ $PLATFORM != "emu" ]; then -+ hotkey=0 -+ else -+ rel_dirname=$dirname -+ fi - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` - alt_version=`echo $version | sed -e "s,\.old$,,g"` - linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" -@@ -286,7 +321,8 @@ while [ "x$list" != "x" ] ; do - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" - fi - # TRANSLATORS: %s is replaced with an OS name -- echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" -+ echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' $(print_hotkey) \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" -+ hotkey=$(incr_hotkey) - is_top_level=false - fi - diff --git a/grub2-s390x-06-loadparm.patch b/grub2-s390x-06-loadparm.patch deleted file mode 100644 index e7c93ad..0000000 --- a/grub2-s390x-06-loadparm.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Raymund Will -Subject: Allow s390x-emu to telecontrolled by LOADPARM -References: bsc#892852, bsc#891946 -Patch-Mainline: no - ---- - util/grub.d/00_header.in | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -Index: grub-2.02~beta3/util/grub.d/00_header.in -=================================================================== ---- grub-2.02~beta3.orig/util/grub.d/00_header.in -+++ grub-2.02~beta3/util/grub.d/00_header.in -@@ -52,6 +52,33 @@ if [ "\${env_block}" ] ; then - fi - - EOF -+if [ "`uname -m`" = "s390x" ]; then -+ cat <' -+ regexp -s 1:z_1 -s 2:z_2 '^([0-9][0-9>]*)\.([0-9][0-9.]*)$' "\$z_gp" -+ if [ ! "\$z_1" -o ! "\$z_2" ]; then break; fi -+ set z_gp="\$z_1>\$z_2" -+ done -+ if [ ! "\$z_gp" ]; then break; fi -+ set next_entry="\$z_gp" -+ unset z_gp -+ unset loadparm -+ break -+done -+EOF -+fi - if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then - cat < 0); -- $msg .= "Usage: $C [-v] [-d] [-f] [-T template] [-z ZIPLDIR]\n"; -+ $msg .= "Usage: $C [-v] [-d] [-f] [-T template] [-z ZIPLDIR] [-i imagepath]\n"; - Panic( $_[0], $msg . "\n"); - } - -@@ -184,6 +187,7 @@ while ( $#ARGV >= 0 ) { - (/^--?help/ || /^-h/) && (Usage(0)); - (/^--zipldir$/ || /^-z$/) && ($zipldir = shift || Usage(2), next); - (/^--template$/ || /^-T$/) && ($in = shift || Usage(3), next); -+ (/^--image$/ || /^-i$/) && ($Image = shift || Usage(5), $force = 1, next); - (/^-/) && (Usage(1)); - Usage(1); - } -@@ -379,11 +383,8 @@ if ( ! $debug ) { - } - - # copy out kernel and initrd --my $defimage = "/boot/image"; --my $definitrd = "/boot/initrd"; - my $ziplimage = "$zipldir/image"; - my $ziplinitrd = "$zipldir/initrd"; --my $Image = "$defimage"; - - if ( ! $running && ! $force ) { - chomp( $running = qx{uname -r}); diff --git a/grub2-s390x-08-workaround-part-to-disk.patch b/grub2-s390x-08-workaround-part-to-disk.patch deleted file mode 100644 index d93cf8a..0000000 --- a/grub2-s390x-08-workaround-part-to-disk.patch +++ /dev/null @@ -1,15 +0,0 @@ -Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c -+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c -@@ -713,6 +713,10 @@ grub_util_part_to_disk (const char *os_d - if (! realpath (os_dev, path)) - return NULL; - -+#ifdef __s390x__ -+ return path; -+#endif -+ - if (strncmp ("/dev/", path, 5) == 0) - { - char *p = path + 5; diff --git a/grub2-secureboot-add-linuxefi.patch b/grub2-secureboot-add-linuxefi.patch deleted file mode 100644 index d1a6eca..0000000 --- a/grub2-secureboot-add-linuxefi.patch +++ /dev/null @@ -1,481 +0,0 @@ -From: Matthew Garrett -Date: 2012-07-10 11:58:52 EDT -Subject: [PATCH] Add support for linuxefi - -References: fate#314485 -Patch-Mainline: no - -Signed-off-by: Michael Chang ---- - grub-core/Makefile.core.def | 8 + - grub-core/kern/efi/mm.c | 32 ++++ - grub-core/loader/i386/efi/linux.c | 371 +++++++++++++++++++++++++++++++++++++ - include/grub/efi/efi.h | 3 + - include/grub/i386/linux.h | 1 + - 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 -=================================================================== ---- grub-2.02~beta2.orig/grub-core/Makefile.core.def -+++ grub-2.02~beta2/grub-core/Makefile.core.def -@@ -1691,6 +1691,14 @@ module = { - }; - - module = { -+ name = linuxefi; -+ efi = loader/i386/efi/linux.c; -+ efi = lib/cmdline.c; -+ enable = i386_efi; -+ enable = x86_64_efi; -+}; -+ -+module = { - 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 -=================================================================== ---- 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; - -+/* Allocate pages below a specified address */ -+void * -+grub_efi_allocate_pages_max (grub_efi_physical_address_t max, -+ grub_efi_uintn_t pages) -+{ -+ grub_efi_status_t status; -+ grub_efi_boot_services_t *b; -+ grub_efi_physical_address_t address = max; -+ -+ if (max > 0xffffffff) -+ return 0; -+ -+ b = grub_efi_system_table->boot_services; -+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address); -+ -+ if (status != GRUB_EFI_SUCCESS) -+ return 0; -+ -+ if (address == 0) -+ { -+ /* Uggh, the address 0 was allocated... This is too annoying, -+ so reallocate another one. */ -+ address = max; -+ status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS, GRUB_EFI_LOADER_DATA, pages, &address); -+ grub_efi_free_pages (0, pages); -+ if (status != GRUB_EFI_SUCCESS) -+ return 0; -+ } -+ -+ return (void *) ((grub_addr_t) address); -+} -+ - /* 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 -=================================================================== ---- /dev/null -+++ grub-2.02~beta2/grub-core/loader/i386/efi/linux.c -@@ -0,0 +1,371 @@ -+/* -+ * GRUB -- GRand Unified Bootloader -+ * Copyright (C) 2012 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 -+#include -+#include -+#include -+#include -+ -+GRUB_MOD_LICENSE ("GPLv3+"); -+ -+static grub_dl_t my_mod; -+static int loaded; -+static void *kernel_mem; -+static grub_uint64_t kernel_size; -+static grub_uint8_t *initrd_mem; -+static grub_uint32_t handover_offset; -+struct linux_kernel_params *params; -+static char *linux_cmdline; -+ -+#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 -+grub_linuxefi_boot (void) -+{ -+ handover_func hf; -+ int offset = 0; -+ -+#ifdef __x86_64__ -+ offset = 512; -+#endif -+ -+ hf = (handover_func)((char *)kernel_mem + handover_offset + offset); -+ -+ asm volatile ("cli"); -+ -+ hf (grub_efi_image_handle, grub_efi_system_table, params); -+ -+ /* Not reached */ -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_linuxefi_unload (void) -+{ -+ grub_dl_unref (my_mod); -+ loaded = 0; -+ if (initrd_mem) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size)); -+ if (linux_cmdline) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1)); -+ if (kernel_mem) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, BYTES_TO_PAGES(kernel_size)); -+ if (params) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)params, BYTES_TO_PAGES(16384)); -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), -+ int argc, char *argv[]) -+{ -+ grub_file_t *files = 0; -+ int i, nfiles = 0; -+ grub_size_t size = 0; -+ grub_uint8_t *ptr; -+ -+ if (argc == 0) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -+ goto fail; -+ } -+ -+ if (!loaded) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("you need to load the kernel first")); -+ goto fail; -+ } -+ -+ files = grub_zalloc (argc * sizeof (files[0])); -+ if (!files) -+ goto fail; -+ -+ for (i = 0; i < argc; i++) -+ { -+ grub_file_filter_disable_compression (); -+ files[i] = grub_file_open (argv[i]); -+ if (! files[i]) -+ goto fail; -+ nfiles++; -+ size += ALIGN_UP (grub_file_size (files[i]), 4); -+ } -+ -+ initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size)); -+ -+ if (!initrd_mem) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd")); -+ goto fail; -+ } -+ -+ params->ramdisk_size = size; -+ params->ramdisk_image = (grub_uint32_t)(grub_addr_t) initrd_mem; -+ -+ ptr = initrd_mem; -+ -+ for (i = 0; i < nfiles; i++) -+ { -+ grub_ssize_t cursize = grub_file_size (files[i]); -+ if (grub_file_read (files[i], ptr, cursize) != cursize) -+ { -+ if (!grub_errno) -+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"), -+ argv[i]); -+ goto fail; -+ } -+ ptr += cursize; -+ grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); -+ ptr += ALIGN_UP_OVERHEAD (cursize, 4); -+ } -+ -+ params->ramdisk_size = size; -+ -+ fail: -+ for (i = 0; i < nfiles; i++) -+ grub_file_close (files[i]); -+ grub_free (files); -+ -+ if (initrd_mem && grub_errno) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)initrd_mem, BYTES_TO_PAGES(size)); -+ -+ return grub_errno; -+} -+ -+static grub_err_t -+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), -+ int argc, char *argv[]) -+{ -+ grub_file_t file = 0; -+ struct linux_kernel_header lh; -+ grub_ssize_t len, start, filelen; -+ void *kernel; -+ -+ grub_dl_ref (my_mod); -+ -+ if (argc == 0) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -+ goto fail; -+ } -+ -+ file = grub_file_open (argv[0]); -+ if (! file) -+ goto fail; -+ -+ filelen = grub_file_size (file); -+ -+ kernel = grub_malloc(filelen); -+ -+ if (!kernel) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("cannot allocate kernel buffer")); -+ goto fail; -+ } -+ -+ if (grub_file_read (file, kernel, filelen) != filelen) -+ { -+ grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s"), argv[0]); -+ 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); -+ -+ params = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(16384)); -+ -+ if (! params) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters"); -+ goto fail; -+ } -+ -+ grub_memset (params, 0, 16384); -+ -+ if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) -+ { -+ if (!grub_errno) -+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -+ argv[0]); -+ goto fail; -+ } -+ -+ if (lh.boot_flag != grub_cpu_to_le16 (0xaa55)) -+ { -+ grub_error (GRUB_ERR_BAD_OS, N_("invalid magic number")); -+ goto fail; -+ } -+ -+ if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS) -+ { -+ grub_error (GRUB_ERR_BAD_OS, N_("too many setup sectors")); -+ goto fail; -+ } -+ -+ if (lh.version < grub_cpu_to_le16 (0x020b)) -+ { -+ grub_error (GRUB_ERR_BAD_OS, N_("kernel too old")); -+ goto fail; -+ } -+ -+ if (!lh.handover_offset) -+ { -+ grub_error (GRUB_ERR_BAD_OS, N_("kernel doesn't support EFI handover")); -+ goto fail; -+ } -+ -+ linux_cmdline = grub_efi_allocate_pages_max(0x3fffffff, -+ BYTES_TO_PAGES(lh.cmdline_size + 1)); -+ -+ if (!linux_cmdline) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate cmdline")); -+ goto fail; -+ } -+ -+ grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE)); -+ grub_create_loader_cmdline (argc, argv, -+ linux_cmdline + sizeof (LINUX_IMAGE) - 1, -+ lh.cmdline_size - (sizeof (LINUX_IMAGE) - 1)); -+ -+ lh.cmd_line_ptr = (grub_uint32_t)(grub_addr_t)linux_cmdline; -+ -+ handover_offset = lh.handover_offset; -+ -+ start = (lh.setup_sects + 1) * 512; -+ len = grub_file_size(file) - start; -+ -+ kernel_mem = grub_efi_allocate_pages(lh.pref_address, -+ BYTES_TO_PAGES(lh.init_size)); -+ -+ if (!kernel_mem) -+ kernel_mem = grub_efi_allocate_pages_max(0x3fffffff, -+ BYTES_TO_PAGES(lh.init_size)); -+ -+ if (!kernel_mem) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel")); -+ goto fail; -+ } -+ -+ if (grub_file_seek (file, start) == (grub_off_t) -1) -+ { -+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -+ argv[0]); -+ goto fail; -+ } -+ -+ if (grub_file_read (file, kernel_mem, len) != len && !grub_errno) -+ { -+ grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), -+ argv[0]); -+ } -+ -+ if (grub_errno == GRUB_ERR_NONE) -+ { -+ grub_loader_set (grub_linuxefi_boot, grub_linuxefi_unload, 0); -+ loaded = 1; -+ lh.code32_start = (grub_uint32_t)(grub_addr_t) kernel_mem; -+ } -+ -+ grub_memcpy(params, &lh, 2 * 512); -+ -+ params->type_of_loader = 0x21; -+ -+ fail: -+ -+ if (file) -+ grub_file_close (file); -+ -+ if (grub_errno != GRUB_ERR_NONE) -+ { -+ grub_dl_unref (my_mod); -+ loaded = 0; -+ } -+ -+ if (linux_cmdline && !loaded) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1)); -+ -+ if (kernel_mem && !loaded) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)kernel_mem, BYTES_TO_PAGES(kernel_size)); -+ -+ if (params && !loaded) -+ grub_efi_free_pages((grub_efi_physical_address_t)(grub_addr_t)params, BYTES_TO_PAGES(16384)); -+ -+ return grub_errno; -+} -+ -+static grub_command_t cmd_linux, cmd_initrd; -+ -+GRUB_MOD_INIT(linuxefi) -+{ -+ cmd_linux = -+ grub_register_command ("linuxefi", grub_cmd_linux, -+ 0, N_("Load Linux.")); -+ cmd_initrd = -+ grub_register_command ("initrdefi", grub_cmd_initrd, -+ 0, N_("Load initrd.")); -+ my_mod = mod; -+} -+ -+GRUB_MOD_FINI(linuxefi) -+{ -+ grub_unregister_command (cmd_linux); -+ grub_unregister_command (cmd_initrd); -+} -Index: grub-2.02~beta2/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_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 diff --git a/grub2-secureboot-chainloader.patch b/grub2-secureboot-chainloader.patch deleted file mode 100644 index a6feafa..0000000 --- a/grub2-secureboot-chainloader.patch +++ /dev/null @@ -1,690 +0,0 @@ -From 06ff1079788fedac5e3f1f12ed7bbe69228a7ae0 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Tue, 18 Dec 2012 16:54:03 +0800 -Subject: [PATCH] Add secureboot support on efi chainloader - -References: fate#314485 -Patch-Mainline: no - -Expand the chainloader to be able to verify the image by means of shim -lock protocol. The PE/COFF image is loaded and relocated by the -chainloader instead of calling LoadImage and StartImage UEFI boot -Service as they require positive verification result from keys enrolled -in KEK or DB. The shim will use MOK in addition to firmware enrolled -keys to verify the image. - -The chainloader module could be used to load other UEFI bootloaders, -such as xen.efi, and could be signed by any of MOK, KEK or DB. - -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 -=================================================================== ---- grub-2.02~beta2.orig/grub-core/loader/efi/chainloader.c -+++ grub-2.02~beta2/grub-core/loader/efi/chainloader.c -@@ -40,15 +40,31 @@ - #include - #endif - -+#ifdef __x86_64__ -+#define SUPPORT_SECURE_BOOT -+#endif -+ -+#ifdef SUPPORT_SECURE_BOOT -+#include -+#endif -+ - GRUB_MOD_LICENSE ("GPLv3+"); - - static grub_dl_t my_mod; - - static grub_efi_physical_address_t address; - static grub_efi_uintn_t pages; -+static grub_ssize_t fsize; - static grub_efi_device_path_t *file_path; - static grub_efi_handle_t image_handle; - static grub_efi_char16_t *cmdline; -+static grub_ssize_t cmdline_len; -+static grub_efi_handle_t dev_handle; -+ -+#ifdef SUPPORT_SECURE_BOOT -+static grub_efi_boolean_t debug_secureboot = 0; -+static grub_efi_status_t (*entry_point) (grub_efi_handle_t image_handle, grub_efi_system_table_t *system_table); -+#endif - - static grub_err_t - grub_chainloader_unload (void) -@@ -63,6 +79,7 @@ grub_chainloader_unload (void) - grub_free (cmdline); - cmdline = 0; - file_path = 0; -+ dev_handle = 0; - - grub_dl_unref (my_mod); - return GRUB_ERR_NONE; -@@ -187,12 +204,460 @@ make_file_path (grub_efi_device_path_t * - return file_path; - } - -+#ifdef SUPPORT_SECURE_BOOT -+#define SHIM_LOCK_GUID \ -+ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} } -+ -+struct grub_pe32_header_no_msdos_stub -+{ -+ char signature[GRUB_PE32_SIGNATURE_SIZE]; -+ struct grub_pe32_coff_header coff_header; -+ struct grub_pe64_optional_header optional_header; -+}; -+ -+struct pe_coff_loader_image_context -+{ -+ grub_efi_uint64_t image_address; -+ grub_efi_uint64_t image_size; -+ grub_efi_uint64_t entry_point; -+ grub_efi_uintn_t size_of_headers; -+ grub_efi_uint16_t image_type; -+ grub_efi_uint16_t number_of_sections; -+ struct grub_pe32_section_table *first_section; -+ struct grub_pe32_data_directory *reloc_dir; -+ struct grub_pe32_data_directory *sec_dir; -+ grub_efi_uint64_t number_of_rva_and_sizes; -+ struct grub_pe32_header_no_msdos_stub *pe_hdr; -+}; -+ -+typedef struct pe_coff_loader_image_context pe_coff_loader_image_context_t; -+ -+struct grub_efi_shim_lock -+{ -+ grub_efi_status_t (*verify)(void *buffer, -+ grub_efi_uint32_t size); -+ grub_efi_status_t (*hash)(void *data, -+ grub_efi_int32_t datasize, -+ pe_coff_loader_image_context_t *context, -+ grub_efi_uint8_t *sha256hash, -+ grub_efi_uint8_t *sha1hash); -+ grub_efi_status_t (*context)(void *data, -+ grub_efi_uint32_t size, -+ pe_coff_loader_image_context_t *context); -+}; -+ -+typedef struct grub_efi_shim_lock grub_efi_shim_lock_t; -+ -+static grub_efi_boolean_t -+grub_secure_validate (void *data, grub_efi_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) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "no shim lock protocol"); -+ return 0; -+ } -+ -+ if (shim_lock->verify (data, size) == GRUB_EFI_SUCCESS) -+ { -+ grub_dprintf ("chain", "verify success\n"); -+ return 1; -+ } -+ -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "verify failed"); -+ return 0; -+} -+ -+static grub_efi_boolean_t -+grub_secure_mode (void) -+{ -+ grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID; -+ grub_uint8_t *data; -+ grub_size_t datasize; -+ -+ data = grub_efi_get_variable ("SecureBoot", &efi_var_guid, &datasize); -+ -+ if (data) -+ { -+ grub_dprintf ("chain", "SecureBoot: %d, datasize %d\n", (int)*data, (int)datasize); -+ } -+ -+ if (data && (datasize == 1)) -+ { -+ if (*data != 1) -+ { -+ grub_dprintf ("chain", "secure boot not enabled\n"); -+ return 0; -+ } -+ } -+ else -+ { -+ grub_dprintf ("chain", "unknown secure boot status\n"); -+ return 0; -+ } -+ -+ grub_free (data); -+ -+ data = grub_efi_get_variable ("SetupMode", &efi_var_guid, &datasize); -+ -+ if (data) -+ { -+ grub_dprintf ("chain", "SetupMode: %d, datasize %d\n", (int)*data, (int)datasize); -+ } -+ -+ if (data && (datasize == 1)) -+ { -+ if (*data == 1) -+ { -+ grub_dprintf ("chain", "platform in setup mode\n"); -+ return 0; -+ } -+ } -+ -+ grub_free (data); -+ -+ return 1; -+} -+ -+static grub_efi_boolean_t -+read_header (void *data, grub_efi_uint32_t size, pe_coff_loader_image_context_t *context) -+{ -+ grub_efi_guid_t guid = SHIM_LOCK_GUID; -+ grub_efi_shim_lock_t *shim_lock; -+ grub_efi_status_t status; -+ -+ shim_lock = grub_efi_locate_protocol (&guid, NULL); -+ -+ if (!shim_lock) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "no shim lock protocol"); -+ return 0; -+ } -+ -+ status = shim_lock->context (data, size, context); -+ -+ if (status == GRUB_EFI_SUCCESS) -+ { -+ grub_dprintf ("chain", "context success\n"); -+ return 1; -+ } -+ -+ switch (status) -+ { -+ case GRUB_EFI_UNSUPPORTED: -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "context error unsupported"); -+ break; -+ case GRUB_EFI_INVALID_PARAMETER: -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "context error invalid parameter"); -+ break; -+ default: -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "context error code"); -+ break; -+ } -+ -+ return 0; -+} -+ -+static void* -+image_address (void *image, grub_efi_uint64_t sz, grub_efi_uint64_t adr) -+{ -+ if (adr > sz) -+ return NULL; -+ -+ return ((grub_uint8_t*)image + adr); -+} -+ -+static grub_efi_status_t -+relocate_coff (pe_coff_loader_image_context_t *context, void *data) -+{ -+ struct grub_pe32_data_directory *reloc_base, *reloc_base_end; -+ grub_efi_uint64_t adjust; -+ grub_efi_uint16_t *reloc, *reloc_end; -+ char *fixup, *fixup_base, *fixup_data = NULL; -+ grub_efi_uint16_t *fixup_16; -+ grub_efi_uint32_t *fixup_32; -+ grub_efi_uint64_t *fixup_64; -+ -+ grub_efi_uint64_t size = context->image_size; -+ void *image_end = (char *)data + size; -+ -+ context->pe_hdr->optional_header.image_base = (grub_uint64_t)data; -+ -+ if (context->number_of_rva_and_sizes <= 5 || context->reloc_dir->size == 0) -+ { -+ grub_dprintf ("chain", "no need to reloc, we are done\n"); -+ return GRUB_EFI_SUCCESS; -+ } -+ -+ reloc_base = image_address (data, size, context->reloc_dir->rva); -+ reloc_base_end = image_address (data, size, context->reloc_dir->rva + context->reloc_dir->size -1); -+ -+ grub_dprintf ("chain", "reloc_base %p reloc_base_end %p\n", reloc_base, reloc_base_end); -+ -+ if (!reloc_base || !reloc_base_end) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "Reloc table overflows binary"); -+ return GRUB_EFI_UNSUPPORTED; -+ } -+ -+ adjust = (grub_uint64_t)data - context->image_address; -+ -+ while (reloc_base < reloc_base_end) -+ { -+ reloc = (grub_uint16_t *)((char*)reloc_base + sizeof (struct grub_pe32_data_directory)); -+ reloc_end = (grub_uint16_t *)((char*)reloc_base + reloc_base->size); -+ -+ if ((void *)reloc_end < data || (void *)reloc_end > image_end) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "Reloc table overflows binary"); -+ return GRUB_EFI_UNSUPPORTED; -+ } -+ -+ fixup_base = image_address(data, size, reloc_base->rva); -+ -+ if (!fixup_base) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid fixupbase"); -+ return GRUB_EFI_UNSUPPORTED; -+ } -+ -+ while (reloc < reloc_end) -+ { -+ fixup = fixup_base + (*reloc & 0xFFF); -+ switch ((*reloc) >> 12) -+ { -+ case GRUB_PE32_REL_BASED_ABSOLUTE: -+ break; -+ case GRUB_PE32_REL_BASED_HIGH: -+ fixup_16 = (grub_uint16_t *)fixup; -+ *fixup_16 = (grub_uint16_t) (*fixup_16 + ((grub_uint16_t)((grub_uint32_t)adjust >> 16))); -+ if (fixup_data != NULL) -+ { -+ *(grub_uint16_t *) fixup_data = *fixup_16; -+ fixup_data = fixup_data + sizeof (grub_uint16_t); -+ } -+ break; -+ case GRUB_PE32_REL_BASED_LOW: -+ fixup_16 = (grub_uint16_t *)fixup; -+ *fixup_16 = (grub_uint16_t) (*fixup_16 + (grub_uint16_t)adjust ); -+ if (fixup_data != NULL) -+ { -+ *(grub_uint16_t *) fixup_data = *fixup_16; -+ fixup_data = fixup_data + sizeof (grub_uint16_t); -+ } -+ break; -+ case GRUB_PE32_REL_BASED_HIGHLOW: -+ fixup_32 = (grub_uint32_t *)fixup; -+ *fixup_32 = *fixup_32 + (grub_uint32_t)adjust; -+ if (fixup_data != NULL) -+ { -+ fixup_data = (char *)ALIGN_UP ((grub_addr_t)fixup_data, sizeof (grub_uint32_t)); -+ *(grub_uint32_t *) fixup_data = *fixup_32; -+ fixup_data += sizeof (grub_uint32_t); -+ } -+ break; -+ case GRUB_PE32_REL_BASED_DIR64: -+ fixup_64 = (grub_uint64_t *)fixup; -+ *fixup_64 = *fixup_64 + (grub_uint64_t)adjust; -+ if (fixup_data != NULL) -+ { -+ fixup_data = (char *)ALIGN_UP ((grub_addr_t)fixup_data, sizeof (grub_uint64_t)); -+ *(grub_uint64_t *) fixup_data = *fixup_64; -+ fixup_data += sizeof (grub_uint64_t); -+ } -+ break; -+ default: -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown relocation"); -+ return GRUB_EFI_UNSUPPORTED; -+ } -+ reloc += 1; -+ } -+ reloc_base = (struct grub_pe32_data_directory *)reloc_end; -+ } -+ -+ return GRUB_EFI_SUCCESS; -+} -+ -+static grub_efi_device_path_t * -+grub_efi_get_media_file_path (grub_efi_device_path_t *dp) -+{ -+ while (1) -+ { -+ grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp); -+ grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp); -+ -+ if (type == GRUB_EFI_END_DEVICE_PATH_TYPE) -+ break; -+ else if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE -+ && subtype == GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE) -+ return dp; -+ -+ dp = GRUB_EFI_NEXT_DEVICE_PATH (dp); -+ } -+ -+ return NULL; -+} -+ -+static grub_efi_boolean_t -+handle_image (void *data, grub_efi_uint32_t datasize) -+{ -+ grub_efi_boot_services_t *b; -+ grub_efi_loaded_image_t *li, li_bak; -+ grub_efi_status_t efi_status; -+ char *buffer = NULL; -+ char *buffer_aligned = NULL; -+ grub_efi_uint32_t i, size; -+ struct grub_pe32_section_table *section; -+ char *base, *end; -+ pe_coff_loader_image_context_t context; -+ grub_uint32_t section_alignment; -+ grub_uint32_t buffer_size; -+ -+ b = grub_efi_system_table->boot_services; -+ -+ if (read_header (data, datasize, &context)) -+ { -+ grub_dprintf ("chain", "Succeed to read header\n"); -+ } -+ else -+ { -+ grub_dprintf ("chain", "Failed to read header\n"); -+ goto error_exit; -+ } -+ -+ section_alignment = context.pe_hdr->optional_header.section_alignment; -+ buffer_size = context.image_size + section_alignment; -+ -+ efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA, -+ buffer_size, &buffer); -+ -+ if (efi_status != GRUB_EFI_SUCCESS) -+ { -+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory")); -+ goto error_exit; -+ } -+ -+ buffer_aligned = (char *)ALIGN_UP ((grub_addr_t)buffer, section_alignment); -+ -+ grub_memcpy (buffer_aligned, data, context.size_of_headers); -+ -+ section = context.first_section; -+ for (i = 0; i < context.number_of_sections; i++) -+ { -+ size = section->virtual_size; -+ if (size > section->raw_data_size) -+ size = section->raw_data_size; -+ -+ base = image_address (buffer_aligned, context.image_size, section->virtual_address); -+ end = image_address (buffer_aligned, context.image_size, section->virtual_address + size - 1); -+ -+ if (!base || !end) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid section size"); -+ goto error_exit; -+ } -+ -+ if (section->raw_data_size > 0) -+ grub_memcpy (base, (grub_efi_uint8_t*)data + section->raw_data_offset, size); -+ -+ if (size < section->virtual_size) -+ grub_memset (base + size, 0, section->virtual_size - size); -+ -+ grub_dprintf ("chain", "copied section %s\n", section->name); -+ section += 1; -+ } -+ -+ efi_status = relocate_coff (&context, buffer_aligned); -+ -+ if (efi_status != GRUB_EFI_SUCCESS) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "relocation failed"); -+ goto error_exit; -+ } -+ -+ entry_point = image_address (buffer_aligned, context.image_size, context.entry_point); -+ -+ if (!entry_point) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid entry point"); -+ goto error_exit; -+ } -+ -+ li = grub_efi_get_loaded_image (grub_efi_image_handle); -+ if (!li) -+ { -+ grub_error (GRUB_ERR_BAD_ARGUMENT, "no loaded image available"); -+ goto error_exit; -+ } -+ -+ grub_memcpy (&li_bak, li, sizeof (grub_efi_loaded_image_t)); -+ li->image_base = buffer_aligned; -+ li->image_size = context.image_size; -+ li->load_options = cmdline; -+ li->load_options_size = cmdline_len; -+ li->file_path = grub_efi_get_media_file_path (file_path); -+ li->device_handle = dev_handle; -+ if (li->file_path) -+ { -+ grub_printf ("file path: "); -+ grub_efi_print_device_path (li->file_path); -+ } -+ else -+ { -+ grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file path found"); -+ goto error_exit; -+ } -+ -+ efi_status = efi_call_2 (entry_point, grub_efi_image_handle, grub_efi_system_table); -+ -+ grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t)); -+ efi_status = efi_call_1 (b->free_pool, buffer); -+ -+ return 1; -+ -+error_exit: -+ if (buffer) -+ efi_call_1 (b->free_pool, buffer); -+ -+ return 0; -+ -+} -+ -+static grub_err_t -+grub_secureboot_chainloader_unload (void) -+{ -+ grub_efi_boot_services_t *b; -+ -+ b = grub_efi_system_table->boot_services; -+ efi_call_2 (b->free_pages, address, pages); -+ grub_free (file_path); -+ grub_free (cmdline); -+ cmdline = 0; -+ file_path = 0; -+ dev_handle = 0; -+ -+ grub_dl_unref (my_mod); -+ return GRUB_ERR_NONE; -+} -+ -+static grub_err_t -+grub_secureboot_chainloader_boot (void) -+{ -+ handle_image ((void *)address, fsize); -+ grub_loader_unset (); -+ return grub_errno; -+} -+#endif -+ - static grub_err_t - grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)), - int argc, char *argv[]) - { - grub_file_t file = 0; -- grub_ssize_t size; - 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 - grub_efi_loaded_image_t *loaded_image; - char *filename; - void *boot_image = 0; -- grub_efi_handle_t dev_handle = 0; - - if (argc == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); -@@ -212,9 +676,36 @@ grub_cmd_chainloader (grub_command_t cmd - address = 0; - image_handle = 0; - file_path = 0; -+ dev_handle = 0; - - b = grub_efi_system_table->boot_services; - -+ if (argc > 1) -+ { -+ int i; -+ grub_efi_char16_t *p16; -+ -+ for (i = 1, cmdline_len = 0; i < argc; i++) -+ cmdline_len += grub_strlen (argv[i]) + 1; -+ -+ cmdline_len *= sizeof (grub_efi_char16_t); -+ cmdline = p16 = grub_malloc (cmdline_len); -+ if (! cmdline) -+ goto fail; -+ -+ for (i = 1; i < argc; i++) -+ { -+ char *p8; -+ -+ p8 = argv[i]; -+ while (*p8) -+ *(p16++) = *(p8++); -+ -+ *(p16++) = ' '; -+ } -+ *(--p16) = 0; -+ } -+ - file = grub_file_open (filename); - if (! file) - goto fail; -@@ -260,14 +751,14 @@ grub_cmd_chainloader (grub_command_t cmd - grub_printf ("file path: "); - grub_efi_print_device_path (file_path); - -- size = grub_file_size (file); -- if (!size) -+ fsize = grub_file_size (file); -+ if (!fsize) - { - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), - filename); - goto fail; - } -- pages = (((grub_efi_uintn_t) size + ((1 << 12) - 1)) >> 12); -+ pages = (((grub_efi_uintn_t) fsize + ((1 << 12) - 1)) >> 12); - - 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 - } - - boot_image = (void *) ((grub_addr_t) address); -- if (grub_file_read (file, boot_image, size) != size) -+ if (grub_file_read (file, boot_image, fsize) != fsize) - { - 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 - } - - #if defined (__i386__) || defined (__x86_64__) -- if (size >= (grub_ssize_t) sizeof (struct grub_macho_fat_header)) -+ if (fsize >= (grub_ssize_t) sizeof (struct grub_macho_fat_header)) - { - struct grub_macho_fat_header *head = boot_image; - if (head->magic -@@ -314,20 +805,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) -- > (grub_size_t) size) -+ > (grub_size_t) fsize) - { - grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), - filename); - goto fail; - } - boot_image = (char *) boot_image + grub_cpu_to_le32 (archs[i].offset); -- size = grub_cpu_to_le32 (archs[i].size); -+ fsize = grub_cpu_to_le32 (archs[i].size); - } - } - #endif - -+#ifdef SUPPORT_SECURE_BOOT -+ /* FIXME is secure boot possible also with universal binaries? */ -+ if (debug_secureboot || (grub_secure_mode() && grub_secure_validate ((void *)address, fsize))) -+ { -+ grub_file_close (file); -+ grub_loader_set (grub_secureboot_chainloader_boot, grub_secureboot_chainloader_unload, 0); -+ return 0; -+ } -+#endif -+ - status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path, -- boot_image, size, -+ boot_image, fsize, - &image_handle); - if (status != GRUB_EFI_SUCCESS) - { -@@ -350,33 +851,10 @@ grub_cmd_chainloader (grub_command_t cmd - } - loaded_image->device_handle = dev_handle; - -- if (argc > 1) -+ if (cmdline) - { -- int i, len; -- grub_efi_char16_t *p16; -- -- for (i = 1, len = 0; i < argc; i++) -- len += grub_strlen (argv[i]) + 1; -- -- len *= sizeof (grub_efi_char16_t); -- cmdline = p16 = grub_malloc (len); -- if (! cmdline) -- goto fail; -- -- for (i = 1; i < argc; i++) -- { -- char *p8; -- -- p8 = argv[i]; -- while (*p8) -- *(p16++) = *(p8++); -- -- *(p16++) = ' '; -- } -- *(--p16) = 0; -- - loaded_image->load_options = cmdline; -- loaded_image->load_options_size = len; -+ loaded_image->load_options_size = cmdline_len; - } - - grub_file_close (file); -@@ -398,6 +876,9 @@ grub_cmd_chainloader (grub_command_t cmd - if (address) - efi_call_2 (b->free_pages, address, pages); - -+ if (cmdline) -+ grub_free (cmdline); -+ - grub_dl_unref (my_mod); - - return grub_errno; diff --git a/grub2-secureboot-no-insmod-on-sb.patch b/grub2-secureboot-no-insmod-on-sb.patch deleted file mode 100644 index 79d5a02..0000000 --- a/grub2-secureboot-no-insmod-on-sb.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 29c89e27805f7a6a22bce11ed9bb430e19c972a9 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Tue, 23 Oct 2012 10:40:49 -0400 -Subject: [PATCH 449/482] Don't allow insmod when secure boot is enabled. - -References: fate#314485 -Patch-Mainline: no - -Signed-off-by: Michael Chang ---- - grub-core/kern/dl.c | 17 +++++++++++++++++ - grub-core/kern/efi/efi.c | 28 ++++++++++++++++++++++++++++ - include/grub/efi/efi.h | 1 + - 3 files changed, 46 insertions(+) - -Index: grub-2.02~beta2/grub-core/kern/dl.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/kern/dl.c -+++ grub-2.02~beta2/grub-core/kern/dl.c -@@ -38,6 +38,10 @@ - #define GRUB_MODULES_MACHINE_READONLY - #endif - -+#ifdef GRUB_MACHINE_EFI -+#include -+#endif -+ - - - #pragma GCC diagnostic ignored "-Wcast-align" -@@ -682,6 +686,19 @@ grub_dl_load_file (const char *filename) - - grub_boot_time ("Loading module %s", filename); - -+#ifdef GRUB_MACHINE_EFI -+ if (grub_efi_secure_boot ()) -+ { -+#if 0 -+ /* This is an error, but grub2-mkconfig still generates a pile of -+ * insmod commands, so emitting it would be mostly just obnoxious. */ -+ grub_error (GRUB_ERR_ACCESS_DENIED, -+ "Secure Boot forbids loading module from %s", filename); -+#endif -+ return 0; -+ } -+#endif -+ - file = grub_file_open (filename); - if (! file) - return 0; -Index: grub-2.02~beta2/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, - return NULL; - } - -+grub_efi_boolean_t -+grub_efi_secure_boot (void) -+{ -+ grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID; -+ grub_size_t datasize; -+ char *secure_boot = NULL; -+ char *setup_mode = NULL; -+ grub_efi_boolean_t ret = 0; -+ -+ secure_boot = grub_efi_get_variable("SecureBoot", &efi_var_guid, &datasize); -+ -+ if (datasize != 1 || !secure_boot) -+ goto out; -+ -+ setup_mode = grub_efi_get_variable("SetupMode", &efi_var_guid, &datasize); -+ -+ if (datasize != 1 || !setup_mode) -+ goto out; -+ -+ if (*secure_boot && !*setup_mode) -+ ret = 1; -+ -+ out: -+ grub_free (secure_boot); -+ grub_free (setup_mode); -+ return ret; -+} -+ - #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 -=================================================================== ---- 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 - const grub_efi_guid_t *guid, - void *data, - grub_size_t datasize); -+grub_efi_boolean_t EXPORT_FUNC (grub_efi_secure_boot) (void); - int - EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1, - const grub_efi_device_path_t *dp2); diff --git a/grub2-secureboot-provide-linuxefi-config.patch b/grub2-secureboot-provide-linuxefi-config.patch deleted file mode 100644 index 3628b26..0000000 --- a/grub2-secureboot-provide-linuxefi-config.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 795ac61cba9674376d745813efdab395e35cff41 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Mon, 26 Nov 2012 15:38:54 +0800 -Subject: [PATCH] provide option in config to enable linuxefi - -References: fate#314485 -Patch-Mainline: no - -As linuxefi module requires kernel 3.6 or later which supports EFI -handover protocol, it may not be able to load kernels without that -supports in place. - -In case that things would break, and the linuxefi is really too young to -take over the position of "linux" kernel loader module, we introduce a -option GRUB_USE_LINUXEFI in the config and only explicit set it to true -will enable it. Example usage is - -GRUB_USE_LINUXEFI=true grub2-mkconfig -o /boot/efi/EFI/opensuse/grub.cfg - -This will output a grub.cfg which uses linuxefi in replace of linux and -enable verification of kernel signature if in secureboot enabled and -has shim exported protocols available. ---- - util/grub-mkconfig.in | 3 ++- - util/grub.d/10_linux.in | 4 ++-- - 2 files changed, 4 insertions(+), 3 deletions(-) - -Index: grub-2.02~beta2/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_BADRAM \ - GRUB_OS_PROBER_SKIP_LIST \ - GRUB_DISABLE_SUBMENU \ -- GRUB_CMDLINE_LINUX_RECOVERY -+ GRUB_CMDLINE_LINUX_RECOVERY \ -+ GRUB_USE_LINUXEFI - - if test "x${grub_cfg}" != "x"; then - rm -f "${grub_cfg}.new" -Index: grub-2.02~beta2/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 () - printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" - fi - message="$(gettext_printf "Loading Linux %s ..." ${version})" -- 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)' - 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 ...")" -- 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} diff --git a/grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch b/grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch deleted file mode 100644 index 8f073e4..0000000 --- a/grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Andrey Borzenkov -Subject: use linuxefi/initrdefi for Linux in 30_os-prober if secure boot is enabled -Reference: bnc#810912 - -Emit linuxefi/initrdefi for os-prober detected Linux installations if -secure boot is enabled. -Index: grub-2.02~beta2/util/grub.d/30_os-prober.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub.d/30_os-prober.in -+++ grub-2.02~beta2/util/grub.d/30_os-prober.in -@@ -41,6 +41,15 @@ if [ -z "${OSPROBED}" ] ; then - exit 0 - fi - -+# If secure boot is enabled, use linuxefi/initrdefi for Linux (bnc#810912) -+if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then -+ LINUX_LOADER_CMD=linuxefi -+ LINUX_INITRD_CMD=initrdefi -+else -+ LINUX_LOADER_CMD=linux -+ LINUX_INITRD_CMD=initrd -+fi -+ - osx_entry() { - if [ x$2 = x32 ]; then - # TRANSLATORS: it refers to kernel architecture (32-bit) -@@ -234,11 +243,11 @@ EOF - save_default_entry | grub_add_tab - printf '%s\n' "${prepare_boot_cache}" - cat << EOF -- linux ${LKERNEL} ${LPARAMS} -+ ${LINUX_LOADER_CMD} ${LKERNEL} ${LPARAMS} - EOF - if [ -n "${LINITRD}" ] ; then - cat << EOF -- initrd ${LINITRD} -+ ${LINUX_INITRD_CMD} ${LINITRD} - EOF - fi - cat << EOF -@@ -254,11 +263,11 @@ EOF - save_default_entry | sed -e "s/^/$grub_tab$grub_tab/" - printf '%s\n' "${prepare_boot_cache}" | grub_add_tab - cat << EOF -- linux ${LKERNEL} ${LPARAMS} -+ ${LINUX_LOADER_CMD} ${LKERNEL} ${LPARAMS} - EOF - if [ -n "${LINITRD}" ] ; then - cat << EOF -- initrd ${LINITRD} -+ ${LINUX_INITRD_CMD} ${LINITRD} - EOF - fi - cat << EOF diff --git a/grub2-secureboot-use-linuxefi-on-uefi.patch b/grub2-secureboot-use-linuxefi-on-uefi.patch deleted file mode 100644 index 23c28a6..0000000 --- a/grub2-secureboot-use-linuxefi-on-uefi.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 151b1691fe0cf885df101c6e6a7cb1defc50428b Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 16 Jul 2012 18:57:11 -0400 -Subject: [PATCH] Use "linuxefi" and "initrdefi" where appropriate - -References: fate#314485 -Patch-Mainline: no - -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 -=================================================================== ---- 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 () - printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" - fi - message="$(gettext_printf "Loading Linux %s ..." ${version})" -- sed "s/^/$submenu_indentation/" << EOF -+ if [ -d /sys/firmware/efi ]; then -+ sed "s/^/$submenu_indentation/" << EOF -+ echo '$(echo "$message" | grub_quote)' -+ linuxefi ${rel_dirname}/${basename} ${root_device} ${args} -+EOF -+ else -+ sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' - linux ${rel_dirname}/${basename} ${root_device} ${args} - EOF -+ fi - if test -n "${initrd}" ; then - # TRANSLATORS: ramdisk isn't identifier. Should be translated. - message="$(gettext_printf "Loading initial ramdisk ...")" -- 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} -+EOF -+ else -+ sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' - initrd ${rel_dirname}/${initrd} - EOF -+ fi - fi - sed "s/^/$submenu_indentation/" << EOF - } 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 deleted file mode 100644 index 5cbe066..0000000 --- a/grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch +++ /dev/null @@ -1,58 +0,0 @@ -Index: grub-2.02~beta2/util/setup.c -=================================================================== ---- grub-2.02~beta2.orig/util/setup.c -+++ grub-2.02~beta2/util/setup.c -@@ -501,8 +501,42 @@ SETUP (const char *dir, - err = grub_util_ldm_embed (dest_dev->disk, &nsec, maxsec, - GRUB_EMBED_PCBIOS, §ors); - else if (ctx.dest_partmap) -- err = ctx.dest_partmap->embed (dest_dev->disk, &nsec, maxsec, -- GRUB_EMBED_PCBIOS, §ors); -+ { -+ err = ctx.dest_partmap->embed (dest_dev->disk, &nsec, maxsec, -+ GRUB_EMBED_PCBIOS, §ors); -+#ifdef GRUB_SETUP_BIOS -+ if (err == GRUB_ERR_OUT_OF_RANGE -+ && dest_dev->disk->id == root_dev->disk->id -+ && dest_dev->disk->dev->id == root_dev->disk->dev->id) -+ { -+ grub_fs_t root_fs; -+ -+ root_fs = grub_fs_probe (root_dev); -+ if (root_fs && root_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, -+ GRUB_EMBED_PCBIOS, &fs_sectors); -+ if (!err && fs_nsec >= core_sectors) -+ { -+ sectors = fs_sectors; -+ nsec = fs_nsec; -+ ctx.container = root_dev->disk->partition; -+ core_dev = root_dev; -+ } -+ else -+ { -+ if (fs_sectors) -+ grub_free (fs_sectors); -+ } -+ } -+ } -+#endif -+ } - else - err = fs->embed (dest_dev, &nsec, maxsec, - GRUB_EMBED_PCBIOS, §ors); -@@ -584,7 +618,7 @@ SETUP (const char *dir, - - /* Write the core image onto the disk. */ - for (i = 0; i < nsec; i++) -- grub_disk_write (dest_dev->disk, sectors[i], 0, -+ grub_disk_write (core_dev->disk, sectors[i], 0, - GRUB_DISK_SECTOR_SIZE, - core_img + i * GRUB_DISK_SECTOR_SIZE); - diff --git a/grub2-snapper-plugin.sh b/grub2-snapper-plugin.sh deleted file mode 100644 index 355fb25..0000000 --- a/grub2-snapper-plugin.sh +++ /dev/null @@ -1,281 +0,0 @@ -#!/bin/sh -set -e - -# Copyright (C) 2006,2007,2008,2009,2010 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 . - -grub_mkconfig="/usr/sbin/grub2-mkconfig" -grub_mkrelpath="/usr/bin/grub2-mkrelpath" -grub_script_check="/usr/bin/grub2-script-check" -grub_setting="/etc/default/grub" -grub_cfg="/boot/grub2/grub.cfg" -grub_snapshot_cfg="/boot/grub2/snapshot_submenu.cfg" - -snapper_snapshot_path="/.snapshots" -snapshot_submenu_name="grub-snapshot.cfg" -snapper_snapshots_cfg="${snapper_snapshot_path}/${snapshot_submenu_name}" - -# add hotkeys for s390. (bnc#885668) -hotkey= -incr_hotkey() -{ - [ -n "$hotkey" ] || return - expr $hotkey + 1 -} -print_hotkey() -{ - keys="123456789abdfgijklmnoprstuvwyz" - if [ -z "$hotkey" ]||[ $hotkey -eq 0 ]||[ $hotkey -gt 30 ]; then - return - fi - echo "--hotkey=$(expr substr $keys $hotkey 1)" -} - - -snapshot_submenu () { - - s_dir="$1" - - snapshot="${s_dir}/snapshot" - num="`basename $s_dir`" - - # bnc#864842 Important snapshots are not marked as such in grub2 menu - # the format is "important distribution version (kernel_version, timestamp, pre/post)" - date=`xmllint --xpath '/snapshot/date/text()' "${s_dir}/info.xml" || echo ""` - date=`echo $date | sed 's/\(.*\) \(.*\):.*/\1T\2/'` - important=`xmllint --xpath "/snapshot/userdata[key='important']/value/text()" "${s_dir}/info.xml" 2>/dev/null || echo ""` - stype=`xmllint --xpath '/snapshot/type/text()' "${s_dir}/info.xml" || echo ""` - kernel_ver=`readlink ${snapshot}/boot/vmlinuz | sed -e 's/^vmlinuz-//' -e 's/-default$//'` - if [ -z "$kernel_ver" -a -L ${snapshot}/boot/image ]; then - kernel_ver=`readlink ${snapshot}/boot/image | sed -e 's/^image-//' -e 's/-default$//'` - fi - eval `cat ${snapshot}/etc/os-release` - # bsc#934252 - Replace SLES 12.1 with SLES12-SP1 for the list of snapshots - if test "${NAME}" = "SLES" -o "${NAME}" = "SLED"; then - VERSION=`echo ${VERSION} | sed -e 's!^\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)$!\1-SP\2!'` - fi - - # FATE#318101 - # Show user defined comments in grub2 menu for snapshots - # Use userdata tag "bootloader=[user defined text]" - full_desc=`xmllint --xpath "/snapshot/userdata[key='bootloader']/value/text()" "${s_dir}/info.xml" 2>/dev/null || echo ""` - test -z "$full_desc" && desc=`xmllint --xpath '/snapshot/description/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` - - # FATE#317972 - # If we have a post entry and the description field is empty, - # we should use the "Pre" number and add that description to the post entry. - if test -z "$full_desc" -a -z "$desc" -a "$stype" = "post"; then - pre_num=`xmllint --xpath '/snapshot/pre_num/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` - if test -n "$pre_num"; then - if test -f "${snapper_snapshot_path}/${pre_num}/info.xml" ; then - desc=`xmllint --xpath '/snapshot/description/text()' "${snapper_snapshot_path}/${pre_num}/info.xml" 2>/dev/null || echo ""` - fi - fi - fi - - test "$important" = "yes" && important="*" || important=" " - test "$stype" = "single" && stype="" - test -z "$stype" || stype=",$stype" - test -z "$desc" || desc=",$desc" - test -z "$full_desc" && full_desc="$kernel_ver,$date$stype$desc" - - if test "${NAME}" = "SLES" -o "${NAME}" = "SLED"; then - title="${important}${NAME}${VERSION} ($full_desc)" - else - title="${important}${NAME} ${VERSION} ($full_desc)" - fi - - if test "$s390" = "1"; then - subvol="\$2" - else - subvol="\$3" - fi - - cat </dev/null || true - fi - continue - fi - - done - - hk="" - [ -z "$hotkey" ] || hk="--hotkey=s" - - for c in $(printf '%s' "${cs}" | sort -Vr); do - if ! snapshot_submenu "$c" > "${c}/${snapshot_submenu_name}"; then - rm -f "${c}/${snapshot_submenu_name}" - continue - fi - snapshot_cfg="${snapshot_cfg} - if [ -f \"$c/${snapshot_submenu_name}\" ]; then - source \"$c/${snapshot_submenu_name}\" - fi" - done - - cat <"${snapper_snapshots_cfg}.new" -if [ -z "\$extra_cmdline" ]; then - submenu $hk "Start bootloader from a read-only snapshot" {${snapshot_cfg} - if [ x\$snapshot_found != xtrue ]; then - submenu "Not Found" { true; } - fi - } -fi -EOF - - if ${grub_script_check} "${snapper_snapshots_cfg}.new"; then - mv -f "${snapper_snapshots_cfg}.new" "${snapper_snapshots_cfg}" - fi - -} - - -snapshot_submenu_clean () { - - for s_dir in ${snapper_snapshot_path}/*; do - - snapper_cfg="${s_dir}/${snapshot_submenu_name}" - - if [ -f "$snapper_cfg" ]; then - rm -f "$snapper_cfg" - rmdir "$s_dir" 2>/dev/null || true - fi - - done - - if [ -f "${snapper_snapshot_path}/${snapshot_submenu_name}" ]; then - rm -f "${snapper_snapshot_path}/${snapshot_submenu_name}" - fi - -} - -set_grub_setting () { - - name=$1 - val=$2 - - if grep -q "$name" "$grub_setting"; then - sed -i -e "s!.*\($name\)=.*!\1=\"$val\"!" "$grub_setting" - else - echo "$name=\"$val\"" >> "$grub_setting" - fi -} - -enable_grub_settings () { - set_grub_setting SUSE_BTRFS_SNAPSHOT_BOOTING "true" -} - -disable_grub_settings () { - set_grub_setting SUSE_BTRFS_SNAPSHOT_BOOTING "false" -} - -update_grub () { - "${grub_mkconfig}" -o "${grub_cfg}" -} - -machine=`uname -m` -case "$machine" in -(s390|s390x) - hotkey=1 - s390=1 - ;; -esac -cmdline="$0 $* hotkey='$hotkey'" - -# Check the arguments. -while test $# -gt 0 -do - option=$1 - shift - - case "$option" in - -e | --enable) - opt_enable=true - ;; - -d | --disable) - opt_enable=false - ;; - -r | --refresh) - opt_refresh=true - ;; - -c | --clean) - opt_clean=true - ;; - -*) - ;; - esac -done - -if [ "x${opt_enable}" = "xtrue" ]; then - #enable_grub_settings - #update_grub - snapper_snapshots_cfg_refresh -elif [ "x${opt_enable}" = "xfalse" ]; then - #disable_grub_settings - update_grub - snapshot_submenu_clean -fi - -if [ x${opt_refresh} = "xtrue" ]; then - snapper_snapshots_cfg_refresh -fi - -if [ x${opt_clean} = "xtrue" ]; then - snapshot_submenu_clean -fi - diff --git a/grub2-suse-remove-linux-root-param.patch b/grub2-suse-remove-linux-root-param.patch deleted file mode 100644 index 8741031..0000000 --- a/grub2-suse-remove-linux-root-param.patch +++ /dev/null @@ -1,83 +0,0 @@ -Index: grub-2.02~beta2/util/grub-mkconfig.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub-mkconfig.in -+++ grub-2.02~beta2/util/grub-mkconfig.in -@@ -261,7 +261,8 @@ export GRUB_DEFAULT \ - GRUB_CMDLINE_LINUX_RECOVERY \ - GRUB_USE_LINUXEFI \ - SUSE_BTRFS_SNAPSHOT_BOOTING \ -- SUSE_CMDLINE_XENEFI -+ SUSE_CMDLINE_XENEFI \ -+ SUSE_REMOVE_LINUX_ROOT_PARAM - - if test "x${grub_cfg}" != "x"; then - rm -f "${grub_cfg}.new" -Index: grub-2.02~beta2/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 -@@ -66,7 +66,7 @@ case x"$GRUB_FS" in - else - rootsubvol="`make_system_path_relative_to_its_root /`" - rootsubvol="${rootsubvol#/}" -- if [ "x${rootsubvol}" != x ]; then -+ if [ "x${rootsubvol}" != x ] && [ "x$SUSE_REMOVE_LINUX_ROOT_PARAM" != "xtrue" ]; then - GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" - fi - fi;; -@@ -77,6 +77,10 @@ case x"$GRUB_FS" in - ;; - esac - -+if [ "x$SUSE_REMOVE_LINUX_ROOT_PARAM" = "xtrue" ]; then -+ LINUX_ROOT_DEVICE="" -+fi -+ - title_correction_code= - - hotkey=1 -Index: grub-2.02~beta2/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 -@@ -80,7 +80,7 @@ case x"$GRUB_FS" in - else - rootsubvol="`make_system_path_relative_to_its_root /`" - rootsubvol="${rootsubvol#/}" -- if [ "x${rootsubvol}" != x ]; then -+ if [ "x${rootsubvol}" != x ] && [ "x$SUSE_REMOVE_LINUX_ROOT_PARAM" != "xtrue" ]; then - GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" - fi - fi;; -@@ -91,6 +91,10 @@ case x"$GRUB_FS" in - ;; - esac - -+if [ "x$SUSE_REMOVE_LINUX_ROOT_PARAM" = "xtrue" ]; then -+ LINUX_ROOT_DEVICE="" -+fi -+ - title_correction_code= - - if [ -d /sys/firmware/efi ]; then -Index: grub-2.02~beta2/util/s390x/zipl2grub.pl.in -=================================================================== ---- grub-2.02~beta2.orig/util/s390x/zipl2grub.pl.in -+++ grub-2.02~beta2/util/s390x/zipl2grub.pl.in -@@ -361,9 +361,13 @@ while ( ) { - } else { - $v = ""; - } -- if ($k eq "GRUB_DEVICE" && $v !~ /^UUID/ && ! -e $v) { -- s{root=\@$k\@}{}g; -- next; -+ if ($k eq "GRUB_DEVICE") { -+ if (($v !~ /^UUID/ && ! -e $v) || -+ (exists( $C{SUSE_REMOVE_LINUX_ROOT_PARAM}) && -+ $C{SUSE_REMOVE_LINUX_ROOT_PARAM} eq "true")) { -+ s{root=\@$k\@}{}g; -+ next; -+ } - } - s{\@$k\@}{$v}g; - } diff --git a/grub2-systemd-sleep.sh b/grub2-systemd-sleep.sh deleted file mode 100644 index 354991f..0000000 --- a/grub2-systemd-sleep.sh +++ /dev/null @@ -1,216 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. - -set -e - -GRUB_ONCE="/usr/sbin/grub2-once" -GRUB_ENV="/boot/grub2/grubenv" -GRUB_EDITENV="/usr/bin/grub2-editenv" -GRUB_CONF="/boot/grub2/grub.cfg" -BLKID="/usr/sbin/blkid" - -error_quit() -{ - echo "$1" >&2 - exit 1 -} - -check-system() -{ - [ -x "${GRUB_ONCE}" ] || error_quit "ERROR: cannot find or execute ${GRUB_ONCE}" - [ -x "${GRUB_EDITENV}" ] || error_quit "ERROR: cannot find or execute ${GRUB_EDITENV}" - [ -x "${BLKID}" ] || error_quit "ERROR: cannot find or execute ${BLKID}" - [ -r "${GRUB_CONF}" ] || error_quit "ERROR: cannot find or read ${GRUB_CONF}" -} - -##################################################################### -# gets a list of available kernels from /boot/grub2/grub.cfg -# kernels are in the array $KERNELS -get-kernels() -{ - local I DUMMY MNT ROOTDEV - declare -i I=0 - - # we need the root partition later to decide if this is the kernel to select - while read ROOTDEV MNT DUMMY; do - [ "$ROOTDEV" = "rootfs" ] && continue # not what we are searching for - if [ "$MNT" = "/" ]; then - break - fi - done < /proc/mounts - - - while read -r LINE; do - case $LINE in - menuentry\ *) - local PATTERN="^\\s*menuentry\\s\\+\\(.\\+\\)\\s*{.*\$" - MENUENTRY_OPTS=`echo "$LINE" | sed -n -e "s/${PATTERN}/\\1/p"` - MENU_ENTRIES[$I]=`eval "printf \"%s\n\" $MENUENTRY_OPTS | head -1"` - ;; - set\ default*) - local DEFAULT=${LINE#*default=} - - if echo $DEFAULT | grep -q saved_entry ; then - local SAVED=`$GRUB_EDITENV $GRUB_ENV list | sed -n s/^saved_entry=//p` - if [ -n "$SAVED" ]; then - DEFAULT_BOOT=$($GRUB_ONCE --show-mapped "$SAVED") - fi - fi - - ;; - linux*noresume*|module*xen*noresume*) - echo " Skipping ${MENU_ENTRIES[$I]}, because it has the noresume option" >&2 - ;; - linux*root=*|module*xen*root=*) - local ROOT - ROOT=${LINE#*root=} - DUMMY=($ROOT) - ROOT=${DUMMY[0]} - - if [ x"${ROOT:0:5}" = "xUUID=" ]; then - UUID=${ROOT#UUID=} - if [ -n "$UUID" ]; then - ROOT=$($BLKID -U $UUID || true) - if [ -z "$ROOT" ]; then - echo " Skipping ${MENU_ENTRIES[$I]}, because its root device $UUID is not found" >&2 - continue - fi - fi - fi - - if [ "$(stat -Lc '%t:%T' $ROOT || true)" != "$(stat -Lc '%t:%T' $ROOTDEV || true)" ]; then - echo " Skipping ${MENU_ENTRIES[$I]}, because its root= parameter ($ROOT)" >&2 - echo " does not match the current root device ($ROOTDEV)." >&2 - continue - fi - - DUMMY=($LINE) # kernel (hd0,1)/boot/vmlinuz-ABC root=/dev/hda2 - KERNELS[$I]=${DUMMY[1]##*/} # vmlinuz-ABC - # DEBUG "Found kernel entry #${I}: '${DUMMY[1]##*/}'" INFO - let ++I - ;; - linux*|module*xen*) - # a kernel without "root="? We better skip that one... - echo " Skipping ${MENU_ENTRIES[$I]}, because it has no root= option" >&2 - ;; - *) ;; - esac - done < "$GRUB_CONF" -} - -############################################################# -# restore grub default after (eventually failed) resume -grub-once-restore() -{ - echo "INFO: Running grub-once-restore .." - check-system - $GRUB_EDITENV $GRUB_ENV unset next_entry - echo "INFO: Done." -} - -############################################################################# -# try to find a kernel image that matches the actually running kernel. -# We need this, if more than one kernel is installed. This works reasonably -# well with grub, if all kernels are named "vmlinuz-`uname -r`" and are -# located in /boot. If they are not, good luck ;-) -find-kernel-entry() -{ - NEXT_BOOT="" - ARCH=`uname -m` - declare -i I=0 - # DEBUG "running kernel: $RUNNING" DIAG - while [ -n "${KERNELS[$I]}" ]; do - BOOTING="${KERNELS[$I]}" - if IMAGE=`readlink /boot/$BOOTING` && [ -e "/boot/${IMAGE##*/}" ]; then - # DEBUG "Found kernel symlink $BOOTING => $IMAGE" INFO - BOOTING=$IMAGE - fi - case $ARCH in - ppc*) BOOTING="${BOOTING#*vmlinux-}" ;; - *) BOOTING="${BOOTING#*vmlinuz-}" ;; - esac - if [ "$RUNNING" == "$BOOTING" -a -n "${MENU_ENTRIES[$I]}" ]; then - NEXT_BOOT="${MENU_ENTRIES[$I]}" - echo " running kernel is grub menu entry $NEXT_BOOT (${KERNELS[$I]})" - break - fi - let ++I - done - # if we have not found a kernel, issue a warning. - # if we have found a kernel, we'll do "grub-once" later, after - # prepare_suspend finished. - if [ -z "$NEXT_BOOT" ]; then - echo "WARNING: no kernelfile matching the running kernel found" - fi -} - -############################################################################# -# if we did not find a kernel (or BOOT_LOADER is not GRUB) check, -# if the running kernel is still the one that will (probably) be booted for -# resume (default entry in menu.lst or, if there is none, the kernel file -# /boot/vmlinuz points to.) -# This will only work, if you use "original" SUSE kernels. -# you can always override with the config variable set to "yes" -prepare-grub() -{ - echo "INFO: Running prepare-grub .." - check-system - get-kernels - RUNNING=`uname -r` - find-kernel-entry - - if [ -z "$NEXT_BOOT" ]; then - # which kernel is booted with the default entry? - BOOTING="${KERNELS[$DEFAULT_BOOT]}" - # if there is no default entry (no menu.lst?) we fall back to - # the default of /boot/vmlinuz. - [ -z "$BOOTING" ] && BOOTING="vmlinuz" - if IMAGE=`readlink /boot/$BOOTING` && [ -e "/boot/${IMAGE##*/}" ]; then - BOOTING=$IMAGE - fi - BOOTING="${BOOTING#*vmlinuz-}" - echo "running kernel: '$RUNNING', probably booting kernel: '$BOOTING'" - if [ "$BOOTING" != "$RUNNING" ]; then - error_quit "ERROR: kernel version mismatch, cannot suspend to disk" - fi - else - # set the bootloader to the running kernel - echo " preparing boot-loader: selecting entry $NEXT_BOOT, kernel /boot/$BOOTING" - T1=`date +"%s%N"` - sync; sync; sync # this is needed to speed up grub-once on reiserfs - T2=`date +"%s%N"` - echo " running $GRUB_ONCE \"${NEXT_BOOT}\"" - ${GRUB_ONCE} "$NEXT_BOOT" - T3=`date +"%s%N"` - S=$(((T2-T1)/100000000)); S="$((S/10)).${S:0-1}" - G=$(((T3-T2)/100000000)); G="$((G/10)).${G:0-1}" - echo " time needed for sync: $S seconds, time needed for grub: $G seconds." - fi - - echo "INFO: Done." -} - - -###### main() - -eval `grep LOADER_TYPE= /etc/sysconfig/bootloader` - -if [ x"$LOADER_TYPE" != "xgrub2" -a x"$LOADER_TYPE" != "xgrub2-efi" ]; then - echo "INFO: Skip running $0 for bootloader: $LOADER_TYPE" - exit 0 -fi - -if [ "$2" = suspend ]; then - echo "INFO: Skip running $0 for $2" - exit 0 -else - echo "INFO: running $0 for $2" -fi - -if [ "$1" = pre ] ; then - prepare-grub -fi -if [ "$1" = post ] ; then - grub-once-restore -fi diff --git a/grub2-use-Unifont-for-starfield-theme-terminal.patch b/grub2-use-Unifont-for-starfield-theme-terminal.patch deleted file mode 100644 index 4e4de24..0000000 --- a/grub2-use-Unifont-for-starfield-theme-terminal.patch +++ /dev/null @@ -1,15 +0,0 @@ -DejaVu Sans is proportional font and looks pretty bad in terminal -window. Use GNU Unifont instead. -Index: grub-2.02~beta2/themes/starfield/theme.txt -=================================================================== ---- grub-2.02~beta2.orig/themes/starfield/theme.txt -+++ grub-2.02~beta2/themes/starfield/theme.txt -@@ -25,7 +25,7 @@ message-font: "DejaVu Sans Regular 12" - message-color: "#000" - message-bg-color: "#fff" - terminal-box: "terminal_box_*.png" --terminal-font: "DejaVu Sans Regular 12" -+terminal-font: "Gnu Unifont Mono Regular 16" - desktop-image: "starfield.png" - - #help bar at the bottom diff --git a/grub2-use-rpmsort-for-version-sorting.patch b/grub2-use-rpmsort-for-version-sorting.patch deleted file mode 100644 index acce2da..0000000 --- a/grub2-use-rpmsort-for-version-sorting.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -urN grub-2.02~beta2.old/util/grub-mkconfig_lib.in grub-2.02~beta2/util/grub-mkconfig_lib.in ---- grub-2.02~beta2.old/util/grub-mkconfig_lib.in 2014-04-11 15:20:42.451394845 +0200 -+++ grub-2.02~beta2/util/grub-mkconfig_lib.in 2014-04-11 15:58:02.940618803 +0200 -@@ -229,7 +229,7 @@ - version_test_numeric_a="$version_test_numeric_b" - version_test_numeric_b="$version_test_numeric_c" - fi -- if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then -+ if [ "`printf '%s\n' "$version_test_gt_a" "$version_test_gt_b" | /usr/lib/rpm/rpmsort -r | head -n1`" = "$version_test_gt_a" ] ; then - return 0 - else - return 1 diff --git a/grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch b/grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch deleted file mode 100644 index 5b226b6..0000000 --- a/grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch +++ /dev/null @@ -1,32 +0,0 @@ -From: Jeff Mahoney -Subject: grub2: use stat instead of udevadm for partition lookup -References: bnc#883635 - -sysfs_partition_path calls udevadm to resolve the sysfs path for -a block device. That can be accomplished by stating the device node -and using the major/minor to follow the symlinks in /sys/dev/block/. - -This cuts the execution time of grub2-mkconfig from 10s to 2s on -my system. - -Signed-off-by: Jeff Mahoney ---- - grub-core/osdep/linux/hostdisk.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/grub-core/osdep/linux/hostdisk.c -+++ b/grub-core/osdep/linux/hostdisk.c -@@ -105,6 +106,13 @@ sysfs_partition_path (const char *dev, c - char *buf = NULL; - size_t len = 0; - char *path = NULL; -+ struct stat st; -+ int ret; -+ -+ ret = stat(dev, &st); -+ if (ret == 0 && S_ISBLK(st.st_mode)) -+ return xasprintf ("/sys/dev/block/%u:%u/%s", -+ major (st.st_rdev), minor (st.st_rdev), entry); - - argv[0] = "udevadm"; - argv[1] = "info"; diff --git a/grub2-vbe-blacklist-preferred-1440x900x32.patch b/grub2-vbe-blacklist-preferred-1440x900x32.patch deleted file mode 100644 index 56294de..0000000 --- a/grub2-vbe-blacklist-preferred-1440x900x32.patch +++ /dev/null @@ -1,20 +0,0 @@ -Index: grub-2.02~beta2/grub-core/video/i386/pc/vbe.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/video/i386/pc/vbe.c -+++ grub-2.02~beta2/grub-core/video/i386/pc/vbe.c -@@ -1053,6 +1053,15 @@ grub_video_vbe_setup (unsigned int width - || vbe_mode_info.y_resolution > height) - /* Resolution exceeds that of preferred mode. */ - continue; -+ -+ /* Blacklist 1440x900x32 from preferred mode handling until a -+ better solution is available. This mode causes problems on -+ many Thinkpads. -+ */ -+ if (vbe_mode_info.x_resolution == 1440 && -+ vbe_mode_info.y_resolution == 900 && -+ vbe_mode_info.bits_per_pixel == 32) -+ continue; - } - else - { diff --git a/grub2-xen-linux16.patch b/grub2-xen-linux16.patch deleted file mode 100644 index 4a0a462..0000000 --- a/grub2-xen-linux16.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: grub-2.02~beta2/grub-core/loader/i386/xen.c -=================================================================== ---- grub-2.02~beta2.orig/grub-core/loader/i386/xen.c -+++ grub-2.02~beta2/grub-core/loader/i386/xen.c -@@ -688,7 +688,7 @@ fail: - return grub_errno; - } - --static grub_command_t cmd_xen, cmd_initrd, cmd_module, cmd_multiboot; -+static grub_command_t cmd_xen, cmd_initrd, cmd_module, cmd_multiboot, cmd_xen16, cmd_initrd16; - - GRUB_MOD_INIT (xen) - { -@@ -700,6 +700,10 @@ GRUB_MOD_INIT (xen) - 0, N_("Load initrd.")); - cmd_module = grub_register_command ("module", grub_cmd_module, - 0, N_("Load module.")); -+ cmd_xen16 = grub_register_command ("linux16", grub_cmd_xen, -+ 0, N_("Load Linux.")); -+ cmd_initrd16 = grub_register_command ("initrd16", grub_cmd_initrd, -+ 0, N_("Load initrd.")); - my_mod = mod; - } - -@@ -709,4 +713,6 @@ GRUB_MOD_FINI (xen) - grub_unregister_command (cmd_initrd); - grub_unregister_command (cmd_multiboot); - grub_unregister_command (cmd_module); -+ grub_unregister_command (cmd_xen16); -+ grub_unregister_command (cmd_initrd16); - } diff --git a/grub2-xen-pv-firmware.cfg b/grub2-xen-pv-firmware.cfg deleted file mode 100644 index f793389..0000000 --- a/grub2-xen-pv-firmware.cfg +++ /dev/null @@ -1,136 +0,0 @@ -insmod part_msdos -insmod part_gpt -insmod search -insmod configfile -insmod legacy_configfile - -set debian_cddev="" -set debian_cdarch="" -if [ "${grub_cpu}" = "x86_64" ]; then - debian_cdarch="amd" -fi -if [ "${grub_cpu}" = "i386" ]; then - debian_cdarch="i386" -fi -if [ -n "${debian_cdarch}" ]; then - set debian_kern="/install.${debian_cdarch}/xen/vmlinuz" - set debian_initrd="/install.${debian_cdarch}/xen/initrd.gz" - search -s debian_domUcfg -f "/install.${debian_cdarch}/xen/debian.cfg" - search -s debian_cdkern -f "${debian_kern}" - search -s debian_cdinitrd -f "${debian_initrd}" - if [ -n "${debian_domUcfg}" -a -n "${debian_cdinitrd}" -a -n "${debian_cdkern}" -a "${debian_domUcfg}" = "${debian_cdinitrd}" -a "${debian_domUcfg}" = "${debian_cdkern}" ]; then - debian_cddev="${debian_domUcfg}" - fi -fi - -set fedora_cddev="" -if [ "${grub_cpu}" = "x86_64" ]; then - set fedora_kern="/images/pxeboot/vmlinuz" - set fedora_initrd="/images/pxeboot/initrd.img" - search -s fedora_cdkern -f "${fedora_kern}" - search -s fedora_cdinitrd -f "${fedora_initrd}" - if [ -n "${fedora_cdkern}" -a -n "${fedora_cdinitrd}" -a "${fedora_cdkern}" = "${fedora_cdinitrd}" ]; then - set fedora_cddev="${fedora_cdkern}" - fi -fi - -set suse_cddev="" -search -s suse_cddev_content -f "/content" -search -s suse_cddev_product -f "/media.1/products" -if [ -n "${suse_cddev_content}" -a -n "${suse_cddev_product}" -a "${suse_cddev_content}" = "${suse_cddev_product}" ]; then - set suse_cddev="${suse_cddev_content}" -fi - -set hdcfg_list="\ -/boot/grub2/grub.cfg \ -/@/boot/grub2/grub.cfg \ -/@/.snapshots/1/snapshot/boot/grub2/grub.cfg \ -/.snapshots/1/snapshot/boot/grub2/grub.cfg \ -/grub2/grub.cfg\ -" - -set hdlst_list="\ -/boot/grub/menu.lst \ -/grub/menu.lst\ -" - -for c in ${hdcfg_list}; do - if search -s hddev -f "${c}"; then - menuentry "${hddev} Boot From Hard Disk (${c})" "${hddev}" "${c}" { - set root="${2}" - set cfg="${3}" - configfile "${cfg}" - } - break - fi -done - -for c in ${hdlst_list}; do - if search -s hddev -f "${c}"; then - menuentry "${hddev} Boot From Hard Disk (${c})" "${hddev}" "${c}" { - set root="${2}" - set cfg="${3}" - legacy_configfile "${cfg}" - } - break - fi -done - -set timeout=0 -if [ -n "${debian_cddev}" ]; then - set timeout=8 - menuentry "${debian_cddev} Debian Install" { - set root="${debian_cddev}" - linux "${debian_kern}" ignore_loglevel - initrd "${debian_initrd}" - } -fi - -if [ -n "${fedora_cddev}" ]; then - set timeout=8 - menuentry "${fedora_cddev} Fedora Install" { - set root="${fedora_cddev}" - linux "${fedora_kern}" ignore_loglevel - initrd "${fedora_initrd}" - } - menuentry "${fedora_cddev} Fedora Rescue" { - set root="${fedora_cddev}" - linux "${fedora_kern}" ignore_loglevel rescue - initrd "${fedora_initrd}" - } -fi - -if [ -n "${suse_cddev}" ]; then - if [ "${grub_cpu}" = "i386" ]; then - set suse_cdarch="i586" - else - set suse_cdarch="${grub_cpu}" - fi - set timeout=8 - set root="${suse_cddev}" - set suse_cdcfg="/boot/${suse_cdarch}/grub2-xen/grub.cfg" - set suse_cdkern="/boot/${suse_cdarch}/vmlinuz-xen" - set suse_cdinitrd="/boot/${suse_cdarch}/initrd-xen" - if [ -f "${suse_cdcfg}" ]; then - menuentry "${suse_cddev} SUSE Install menu" { - set root="${suse_cddev}" - configfile "${suse_cdcfg}" - } - elif [ -f "${suse_cdkern}" -a -f "$suse_cdinitrd" ]; then - menuentry "${suse_cddev} SUSE Install" { - linux "${suse_cdkern}" linemode=1 xencons=hvc0 - initrd "${suse_cdinitrd}" - } - menuentry "${suse_cddev} SUSE Rescue" { - linux "${suse_cdkern}" linemode=1 xencons=hvc0 rescue=1 - initrd "${suse_cdinitrd}" - } - menuentry "${suse_cddev} SUSE Upgrade" { - linux "${suse_cdkern}" linemode=1 xencons=hvc0 upgrade=1 - initrd "${suse_cdinitrd}" - } - else - echo "the device ${suse_cddev} is not xen pv bootable" - fi -fi - diff --git a/grub2-zipl-setup-fix-btrfs-multipledev.patch b/grub2-zipl-setup-fix-btrfs-multipledev.patch deleted file mode 100644 index 8fd7b5c..0000000 --- a/grub2-zipl-setup-fix-btrfs-multipledev.patch +++ /dev/null @@ -1,15 +0,0 @@ -Index: grub-2.02~beta2/util/s390x/zipl2grub.pl.in -=================================================================== ---- grub-2.02~beta2.orig/util/s390x/zipl2grub.pl.in -+++ grub-2.02~beta2/util/s390x/zipl2grub.pl.in -@@ -361,6 +361,10 @@ while ( ) { - } else { - $v = ""; - } -+ if ($k eq "GRUB_DEVICE" && $v !~ /^UUID/ && ! -e $v) { -+ s{root=\@$k\@}{}g; -+ next; -+ } - s{\@$k\@}{$v}g; - } - Info( 2, $_); diff --git a/grub2.changes b/grub2.changes index 162bcec..a731191 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,1887 +1,3 @@ -------------------------------------------------------------------- -Fri Feb 17 06:46:11 UTC 2017 - mchang@suse.com - -- grub2.spec: fix s390x file list. - -------------------------------------------------------------------- -Wed Feb 15 07:25:02 UTC 2017 - mchang@suse.com - -- Merge changes from SLE12 -- add grub2-emu-4-all.patch - * Build 'grub2-emu' wherever possible, to allow a better - implementation of that feature. -- add grub2-s390x-06-loadparm.patch, -- add grub2-commands-introduce-read_file-subcommand.patch: - * allow s390x to telecontrol grub2. (bsc#891946, bsc#892852) -- add grub2-s390x-06-loadparm.patch: - * ignore case and fix transliteration of parameter. (bsc#891946) -- add grub2-s390x-07-add-image-param-for-zipl-setup.patch - * Add --image switch to force zipl update to specific kernel - (bsc#928131) -- add grub2-s390x-08-workaround-part-to-disk.patch - * Ignore partition tables on s390x. (bsc#935127) -- add grub2-efi-chainload-harder.patch: - * allow XEN to be chain-loaded despite firmware flaws. (bnc#887793) - * Do not use shim lock protocol for reading pe header, it won't be - available when secure boot disabled (bsc#943380) - * Make firmware flaw condition be more precisely detected and add - debug message for the case - * Check msdos header to find PE file header (bsc#954126) -- grub2-s390x-04-grub2-install.patch: - * streamline boot to grub menu. (bsc#898198) - * Force '/usr' to read-only before calling kexec. (bsc#932951) -- grub2-once: - * add '--enum' option to enumerate boot-entries in a way - actually understood by 'grub2'. (bsc#892852, bsc#892811) - * Examine variables from grub environment in 'grub2-once'. (fate#319632) - -------------------------------------------------------------------- -Fri Feb 10 17:58:22 UTC 2017 - arvidjaar@gmail.com - -- new upstream version 2.02~rc1 - * rediff - - use-grub2-as-a-package-name.patch - - grub2-s390x-04-grub2-install.patch - - grub2-accept-empty-module.patch - - grub2-btrfs-04-grub2-install.patch - - grub2-btrfs-06-subvol-mount.patch - * drop upstream patches - - 0001-dns-fix-buffer-overflow-for-data-addresses-in-recv_h.patch - - 0001-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch - - 0002-configure-fix-check-for-sys-sysmacros.h-under-glibc-.patch - - 0001-Fix-fwpath-in-efi-netboot.patch - - 0001-arm64-Move-firmware-fdt-search-into-global-function.patch - - 0002-arm-efi-Use-fdt-from-firmware-when-available.patch - - grub2-arm64-mknetdir-add-suport-for-arm64-efi.patch - - 0001-10_linux-Fix-grouping-of-tests-for-GRUB_DEVICE.patch - - 0002-20_linux_xen-fix-test-for-GRUB_DEVICE.patch - - 0001-xen-make-xen-loader-callable-multiple-times.patch - - 0002-xen-avoid-memleaks-on-error.patch - - 0003-xen-reduce-number-of-global-variables-in-xen-loader.patch - - 0004-xen-add-elfnote.h-to-avoid-using-numbers-instead-of-.patch - - 0005-xen-synchronize-xen-header.patch - - 0006-xen-factor-out-p2m-list-allocation-into-separate-fun.patch - - 0007-xen-factor-out-allocation-of-special-pages-into-sepa.patch - - 0008-xen-factor-out-allocation-of-page-tables-into-separa.patch - - 0009-xen-add-capability-to-load-initrd-outside-of-initial.patch - - 0010-xen-modify-page-table-construction.patch - - 0011-xen-add-capability-to-load-p2m-list-outside-of-kerne.patch - * add - - fix-grub2-use-stat-instead-of-udevadm-for-partition-lookup-with-new-glibc.patch - fix compilation with new glibc - -------------------------------------------------------------------- -Thu Feb 9 03:45:16 UTC 2017 - mchang@suse.com - -- Fix build error on glibc-2.25 - * 0001-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch - * 0002-configure-fix-check-for-sys-sysmacros.h-under-glibc-.patch -- Fix fwpath in efi netboot (fate#321993) (bsc#1022294) - * 0001-Fix-fwpath-in-efi-netboot.patch - -------------------------------------------------------------------- -Fri Feb 3 08:18:30 UTC 2017 - mchang@suse.com - -- grub2-systemd-sleep.sh: Fix prematurely abort by commands error return code - and skip the offending menu entry (bsc#1022880) - -------------------------------------------------------------------- -Wed Feb 1 21:42:49 UTC 2017 - agraf@suse.com - -- Add support for BLT only EFI GOP adapters (FATE#322332) - * grub2-efi-gop-add-blt.patch - -------------------------------------------------------------------- -Wed Jan 25 09:58:20 UTC 2017 - schwab@linux-m68k.org - -- info-dir-entry.patch: Update info dir entry to follow renaming to grub2 - -------------------------------------------------------------------- -Mon Jan 16 10:15:52 UTC 2017 - matwey.kornilov@gmail.com - -- Add serial module to efi image. - Serial terminal is still useful even with EFI Secure Boot - -------------------------------------------------------------------- -Wed Jan 11 06:58:56 UTC 2017 - mchang@suse.com - -- Support %posttrans with marcos provided by update-bootloader-rpm-macros - package (bsc#997317) - -------------------------------------------------------------------- -Wed Jan 4 08:48:56 UTC 2017 - mchang@suse.com - -- Remove outdated README.openSUSE (bsc#907693) - -------------------------------------------------------------------- -Fri Dec 30 14:47:39 UTC 2016 - sor.alexei@meowr.ru - -- 20_memtest86+: avoid adding memtest86+ to the list with UEFI - booting. - -------------------------------------------------------------------- -Fri Oct 28 04:08:19 UTC 2016 - mchang@suse.com - -- Fix new line character in distributor (bsc#1007212) - * modified grub2-default-distributor.patch - -------------------------------------------------------------------- -Fri Oct 21 09:34:58 UTC 2016 - mchang@suse.com - -- From Juergen Gross : grub-xen: support booting huge - pv-domains (bsc#1004398) (bsc#899465) - * 0001-xen-make-xen-loader-callable-multiple-times.patch - * 0002-xen-avoid-memleaks-on-error.patch - * 0003-xen-reduce-number-of-global-variables-in-xen-loader.patch - * 0004-xen-add-elfnote.h-to-avoid-using-numbers-instead-of-.patch - * 0005-xen-synchronize-xen-header.patch - * 0006-xen-factor-out-p2m-list-allocation-into-separate-fun.patch - * 0007-xen-factor-out-allocation-of-special-pages-into-sepa.patch - * 0008-xen-factor-out-allocation-of-page-tables-into-separa.patch - * 0009-xen-add-capability-to-load-initrd-outside-of-initial.patch - * 0010-xen-modify-page-table-construction.patch - * 0011-xen-add-capability-to-load-p2m-list-outside-of-kerne.patch - -------------------------------------------------------------------- -Tue Oct 11 20:59:40 UTC 2016 - dmueller@suse.com - -- add support for netboot on arm64-efi platforms (bsc#998097) - * grub2-arm64-mknetdir-add-suport-for-arm64-efi.patch - -------------------------------------------------------------------- -Fri Sep 2 03:24:19 UTC 2016 - mchang@suse.com - -- use $PRETTY_NAME instead of $NAME $VERSION for $GRUB_DISTRIBUTOR - in openSUSE Tumbleweed (bsc#995549) - * modified grub2-default-distributor.patch -- grub2.spec: add http module to grub.efi (fate#320129) - -------------------------------------------------------------------- -Wed Aug 31 15:40:28 UTC 2016 - matz@suse.com - -- binutils 2.27 creates empty modules without a symtab. - Add patch grub2-accept-empty-module.patch to not reject them. - -------------------------------------------------------------------- -Sat Aug 20 05:42:12 UTC 2016 - arvidjaar@gmail.com - -- since version 1.7 cryptsetup defaults to SHA256 for LUKS - include - gcry_sha256 in signed EFI image - -------------------------------------------------------------------- -Fri Aug 12 08:32:05 UTC 2016 - mchang@suse.com - -- Workaround default entry in snapshot menu (bsc#956046) - * grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch -- grub2.spec: Add true command to grub.efi (bsc#993274) - -------------------------------------------------------------------- -Wed Aug 3 04:45:51 UTC 2016 - mchang@suse.com - -- grub.default: Empty GRUB_CMDLINE_LINUX_DEFAULT, the value will be fully - taken from YaST settings. (bsc#989803) - -------------------------------------------------------------------- -Wed Aug 3 04:45:34 UTC 2016 - mchang@suse.com - -- Add patches from Roberto Sassu -- Fix grub2-10_linux-avoid-multi-device-root-kernel-argument.patch, - device path is not tested if GRUB_DISABLE_LINUX_UUID="true" - - added grub2-fix-multi-device-root-kernel-argument.patch - (bsc#960776) -- grub2-zipl-setup: avoid multi-device root= kernel argument - * added grub2-zipl-setup-fix-btrfs-multipledev.patch - (bsc#960776) -- Add SUSE_REMOVE_LINUX_ROOT_PARAM configuration option - to /etc/default/grub, to remove root= and rootflags= from the - kernel command line in /boot/grub2/grub.cfg and /boot/zipl/config - - added grub2-suse-remove-linux-root-param.patch - (bsc#962585) - -------------------------------------------------------------------- -Tue Aug 2 09:05:11 UTC 2016 - mchang@suse.com - -- Support HTTP Boot IPv4 and IPv6 (fate#320129) - * 0001-misc-fix-invalid-character-recongition-in-strto-l.patch - * 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch - * 0003-bootp-New-net_bootp6-command.patch - * 0004-efinet-UEFI-IPv6-PXE-support.patch - * 0005-grub.texi-Add-net_bootp6-doument.patch - * 0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch - * 0007-efinet-Setting-network-from-UEFI-device-path.patch - * 0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch -- Fix heap corruption after dns lookup - * 0001-dns-fix-buffer-overflow-for-data-addresses-in-recv_h.patch - -------------------------------------------------------------------- -Tue Jun 28 00:31:47 CEST 2016 - ro@suse.de - -- fix filelist for s390x - -------------------------------------------------------------------- -Tue Jun 21 06:19:27 UTC 2016 - mchang@suse.com - -- Fix grub2-editenv error on encrypted lvm installation (bsc#981621) - * modified grub2-btrfs-workaround-grub2-once.patch -- Add missing closing bracket in 'grub2-snapper-plugin.sh'. -- Fix snapshot booting on s390x (bsc#955115) - * modified grub2-snapper-plugin.sh -- Fallback to old subvol name scheme to support old snapshot config - (bsc#953538) - * added grub2-btrfs-07-subvol-fallback.patch - -------------------------------------------------------------------- -Thu Jun 2 19:25:58 UTC 2016 - arvidjaar@gmail.com - -- update grub2-once with patch from Björn Voigt - skip comments in - /etc/sysconfig/bootloader (boo#963610) - -------------------------------------------------------------------- -Fri May 20 09:28:16 UTC 2016 - jengelh@inai.de - -- Make sure all systemd unit files are passed to %service_ macros. - -------------------------------------------------------------------- -Thu May 19 14:56:53 UTC 2016 - agraf@suse.com - -- Add patch to free memory on exit in efi environments (bsc#980739) - * grub2-efi-Free-malloc-regions-on-exit.patch - -------------------------------------------------------------------- -Mon May 2 13:25:02 UTC 2016 - olaf@aepfle.de - -- Remove xen-devel from BuildRequires - required headers are included in grub-2.0.2 - -------------------------------------------------------------------- -Thu Apr 28 09:06:11 UTC 2016 - agraf@suse.com - -- Add support for "t" hotkey to switch to text mode (bsc#976836) - * added grub2-SUSE-Add-the-t-hotkey.patch -- Add support for hidden menu entries (bsc#976836) - * added grub2-Add-hidden-menu-entries.patch - -------------------------------------------------------------------- -Tue Apr 19 08:21:24 UTC 2016 - mchang@suse.com - -- Correct show user defined comments in menu for snapshots (bsc#956698) - * modified grub2-snapper-plugin.sh - -------------------------------------------------------------------- -Mon Mar 21 11:27:54 UTC 2016 - mchang@suse.com - -- Fix GRUB_DISABLE_LINUX_UUID to be ignore and also fallback kernel device - won't be used if fs uuid not detected (bsc#971867) - * added 0001-10_linux-Fix-grouping-of-tests-for-GRUB_DEVICE.patch - * added 0002-20_linux_xen-fix-test-for-GRUB_DEVICE.patch - -------------------------------------------------------------------- -Tue Mar 1 18:53:17 UTC 2016 - arvidjaar@gmail.com - -- new upstream version 2.02~beta3 - * highlights of user visible changes not yet present in openSUSE package - - arm-uboot now generates position independent self relocating image, so - single binary should run on all supported systems - - loader for Xen on aarch64. grub-mkconfig support was not in time for - beta3 yet. - - improved ZFS support (extensible_dataset, large_blocks, embedded_data, - hole_birth features) - - support for IPv6 Router Advertisements - - support for persistent memory (we do not overwrite it and pass correct - information to OS) - - try to display more specific icons for os-prober generated menu entries - - grub-install detects EFI bit size and selects correct platform (x86_64-efi - or i386-efi) independent of OS bit size; needs kernel 4.0 or higher. - - LVM RAID1 support - - xnu loader fixes which should make OS X menu entry generated by os-prober - work again - - key modifiers (Ctrl-X etc) should work on EFI too - - ... and lot of fixes over entire tree - * rediff - - rename-grub-info-file-to-grub2.patch - - use-grub2-as-a-package-name.patch - - grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch - - grub2-fix-menu-in-xen-host-server.patch - - grub2-efi-HP-workaround.patch - - grub2-secureboot-chainloader.patch - - grub2-s390x-02-kexec-module-added-to-emu.patch - - grub2-s390x-04-grub2-install.patch - - grub2-s390x-05-grub2-mkconfig.patch - - grub2-efi-xen-chainload.patch - - grub2-mkconfig-aarch64.patch - - grub2-btrfs-04-grub2-install.patch - - grub2-ppc64-cas-reboot-support.patch - - 0002-Add-Virtual-LAN-support.patch - * fix grub2-secureboot-add-linuxefi.patch - use grub_memset and - grub_memcpy instead of memset and memcpy (caused errors due to - compiler warning) - * drop upstream patches - - 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch - - 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch - - 0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch - - 0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch - - 0003-efinet-open-Simple-Network-Protocol-exclusively.patch - - 0001-efinet-Check-for-immediate-completition.patch - - 0001-efinet-enable-hardware-filters-when-opening-interfac.patch - - grub2-xen-legacy-config-device-name.patch - - grub2-getroot-support-NVMe-device-names.patch - - grub2-netboot-hang.patch - - grub2-btrfs-fix-incorrect-address-reference.patch - - aarch64-reloc.patch - - grub2-glibc-2.20.patch (related code dropped upstream) - - grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch - - grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch - - grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch - - grub2-ppc64-qemu.patch - - grub2-xfs-Add-helper-for-inode-size.patch - - grub2-xfs-Fix-termination-loop-for-directory-iteration.patch - - grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch - - grub2-xfs-V5-filesystem-format-support.patch - - 0001-Add-bootargs-parser-for-open-firmware.patch - - grub2-arm64-set-correct-length.patch - - grub2-arm64-setjmp-Add-missing-license-macro.patch - - grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch - - 0001-unix-password-Fix-file-descriptor-leak.patch - - 0002-linux-getroot-fix-descriptor-leak.patch - - 0003-util-grub-mount-fix-descriptor-leak.patch - - 0004-linux-ofpath-fix-descriptor-leak.patch - - 0005-grub-fstest-fix-descriptor-leak.patch - - ppc64le.patch - - libgcc-prereq.patch - - libgcc.patch - - 0001-Fix-security-issue-when-reading-username-and-passwor.patch - - 0001-menu-fix-line-count-calculation-for-long-lines.patch - - grub2-arm64-Reduce-timer-event-frequency-by-10.patch - - 0001-unix-do-not-close-stdin-in-grub_passwd_get.patch - - 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch - - 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch - - 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch - - 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch - - 0005-i386-fix-TSC-calibration-using-PIT.patch - - biendian.patch - - ppc64_opt.patch - * drop workarounds for gdb_grub and grub.chrp, they are now installed under fixed name - * do not patch docs/Makefile.in, it is regenerated anyway - -------------------------------------------------------------------- -Tue Mar 1 11:06:34 UTC 2016 - agraf@suse.com - -- Make mkconfig search for zImage on arm - * grub2-mkconfig-arm.patch - -------------------------------------------------------------------- -Sun Feb 28 23:10:06 UTC 2016 - agraf@suse.com - -- Add support to directly pass an EFI FDT table to a kernel on 32bit arm - * 0001-arm64-Move-firmware-fdt-search-into-global-function.patch - * 0002-arm-efi-Use-fdt-from-firmware-when-available.patch - -------------------------------------------------------------------- -Fri Jan 29 03:54:15 UTC 2016 - mchang@suse.com - -- Add config option to set efi xen loader command line option (bsc#957383) - * added grub2-efi-xen-cmdline.patch - -------------------------------------------------------------------- -Thu Jan 28 12:27:27 UTC 2016 - dvaleev@suse.com - -- Drop ppc64le patches. Build stage1 as BE for Power - Droped patches: - - grub2-ppc64le-01-Add-Little-Endian-support-for-Power64-to-the-build.patch - - grub2-ppc64le-02-Build-grub-as-O1-until-we-add-savegpr-and-restgpr-ro.patch - - grub2-ppc64le-03-disable-creation-of-vsx-and-altivec-instructions.patch - - grub2-ppc64le-04-powerpc64-LE-s-linker-knows-how-to-handle-the-undefi.patch - - grub2-ppc64le-05-grub-install-can-now-recognize-and-install-a-LE-grub.patch - - grub2-ppc64le-06-set-the-ABI-version-to-0x02-in-the-e_flag-of-the-PPC.patch - - grub2-ppc64le-07-Add-IEEE1275_ADDR-helper.patch - - grub2-ppc64le-08-Fix-some-more-warnings-when-casting.patch - - grub2-ppc64le-09-Add-powerpc64-types.patch - - grub2-ppc64le-10-powerpc64-is-not-necessarily-BigEndian-anymore.patch - - grub2-ppc64le-11-Fix-warnings-when-building-powerpc-linux-loader-64bi.patch - - grub2-ppc64le-12-GRUB_ELF_R_PPC_-processing-is-applicable-only-for-32.patch - - grub2-ppc64le-13-Fix-powerpc-setjmp-longjmp-64bit-issues.patch - - grub2-ppc64le-14-Add-powerpc64-ieee1275-trampoline.patch - - grub2-ppc64le-15-Add-64bit-support-to-powerpc-startup-code.patch - - grub2-ppc64le-16-Add-grub_dl_find_section_addr.patch - - grub2-ppc64le-17-Add-ppc64-relocations.patch - - grub2-ppc64le-18-ppc64-doesn-t-need-libgcc-routines.patch - - grub2-ppc64le-19-Use-FUNC_START-FUNC_END-for-powerpc-function-definit.patch - - grub2-ppc64le-20-.TOC.-symbol-is-special-in-ppc64le-.-It-maps-to-the-.patch - - grub2-ppc64le-21-the-.toc-section-in-powerpc64le-modules-are-sometime.patch - - grub2-ppc64le-22-all-parameter-to-firmware-calls-should-to-be-BigEndi.patch - - grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch - - grub2-ppc64le-timeout.patch - - grub2-ppc64-build-ppc64-32bit.patch -- Added patches: - - biendian.patch - - grub2-ppc64-cas-reboot-support.patch - - libgcc-prereq.patch - - libgcc.patch - - ppc64_opt.patch - - ppc64le.patch - -------------------------------------------------------------------- -Wed Jan 20 11:44:27 UTC 2016 - mchang@suse.com - -- Backport upstream patches for HyperV gen2 TSC timer calbration without - RTC (bsc#904647) - * added 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch - * added 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch - * added 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch - * added 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch - * added 0005-i386-fix-TSC-calibration-using-PIT.patch - -------------------------------------------------------------------- -Wed Dec 28 16:53:54 UTC 2015 - arvidjaar@gmail.com - -- Add 0001-menu-fix-line-count-calculation-for-long-lines.patch (bsc#943585) - -------------------------------------------------------------------- -Thu Dec 17 11:04:06 UTC 2015 - olaf@aepfle.de - -- grub2-xen-pv-firmware.cfg: fix hd boot (boo#926795) - -------------------------------------------------------------------- -Wed Dec 16 05:04:37 UTC 2015 - arvidjaar@gmail.com - -- Add 0001-Fix-security-issue-when-reading-username-and-passwor.patch - Fix for CVE-2015-8370 [boo#956631] - -------------------------------------------------------------------- -Wed Dec 9 18:13:27 UTC 2015 - arvidjaar@gmail.com - -- Update grub2-efi-xen-chainload.patch - fix copying of Linux kernel - and initrd to ESP (boo#958193) - -------------------------------------------------------------------- -Mon Dec 7 08:03:41 UTC 2015 - olaf@aepfle.de - -- Rename grub2-xen.cfg to grub2-xen-pv-firmware.cfg (boo#926795) - -------------------------------------------------------------------- -Fri Dec 4 17:06:17 UTC 2015 - olaf@aepfle.de - -- grub2-xen.cfg: to handle grub1 menu.lst in PV guest (boo#926795) - -------------------------------------------------------------------- -Thu Nov 26 10:22:28 UTC 2015 - mchang@suse.com - -- Expand list of grub.cfg search path in PV Xen guest for systems - installed to btrfs snapshot. (bsc#946148) (bsc#952539) - * modified grub2-xen.cfg -- drop grub2-fix-Grub2-with-SUSE-Xen-package-install.patch (bsc#774666) - -------------------------------------------------------------------- -Wed Nov 18 19:33:42 UTC 2015 - arvidjaar@gmail.com - -- Add 0001-unix-do-not-close-stdin-in-grub_passwd_get.patch - Fix reading password by grub2-mkpasswd-pbdk2 without controlling - tty, e.g. when called from Xfce menu (boo#954519) - -------------------------------------------------------------------- -Mon Nov 1 21:30:02 UTC 2015 - arvidjaar@gmail.com - -- Modify grub2-linguas.sh-no-rsync.patch to re-enable en@quot catalog - (boo#953022). Other autogenerated catalogs still fail to build due - to missing C.UTF-8 locale. - -------------------------------------------------------------------- -Fri Oct 30 10:09:02 UTC 2015 - mchang@suse.com - -- Allow to execute menuentry unrestricted as default (fate#318574) - * added grub2-menu-unrestricted.patch - -------------------------------------------------------------------- -Thu Oct 29 04:17:08 UTC 2015 - mchang@suse.com - -- Add missing quoting for linuxefi (bsc#951962) - * modified grub2-secureboot-use-linuxefi-on-uefi.patch - * refreshed grub2-secureboot-provide-linuxefi-config.patch - -------------------------------------------------------------------- -Sun Oct 18 11:45:10 UTC 2015 - eich@suse.com - -- Include custom.cfg into the files scanned by grub2-once. - Allows to chose manually added entries as well (FATE#319632). - -------------------------------------------------------------------- -Wed Oct 7 09:01:37 UTC 2015 - mchang@suse.com - -- Upstream patches for fixing file descriptor leakage (bsc#943784) - * added 0001-unix-password-Fix-file-descriptor-leak.patch - * added 0002-linux-getroot-fix-descriptor-leak.patch - * added 0003-util-grub-mount-fix-descriptor-leak.patch - * added 0004-linux-ofpath-fix-descriptor-leak.patch - * added 0005-grub-fstest-fix-descriptor-leak.patch - -------------------------------------------------------------------- -Tue Oct 6 07:59:47 UTC 2015 - mchang@suse.com - -- Do not force ro option in linuxefi patch (bsc#948555) - * modified grub2-secureboot-use-linuxefi-on-uefi.patch - * refrehed grub2-secureboot-provide-linuxefi-config.patch - -------------------------------------------------------------------- -Wed Sep 23 20:02:47 UTC 2015 - dmueller@suse.com - -- add 0001-efinet-Check-for-immediate-completition.patch, - 0001-efinet-enable-hardware-filters-when-opening-interfac.patch, - grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch - (bsc#947203) - -------------------------------------------------------------------- -Mon Sep 14 06:36:04 UTC 2015 - mchang@suse.com - -- Set default GRUB_DISTRIBUTOR from /etc/os-release if it is empty - or not set by user (bsc#942519) - * added grub2-default-distributor.patch - * modified grub.default - -------------------------------------------------------------------- -Tue Aug 18 09:53:54 UTC 2015 - mchang@suse.com - -- add systemd-sleep-plugin subpackage (bsc#941758) -- evaluate the menu entry's title string by printf - * modified grub2-once - * added grub2-systemd-sleep.sh - -------------------------------------------------------------------- -Fri Jul 31 03:55:32 UTC 2015 - mchang@suse.com - -- fix for 'rollback' hint (bsc#901487) - * modified grub2-btrfs-05-grub2-mkconfig.patch: - -------------------------------------------------------------------- -Fri Jul 17 08:44:24 UTC 2015 - mchang@suse.com - -- Replace 12.1 with 12 SP1 for the list of snapshots (bsc#934252) - * modified grub2-snapper-plugin.sh - -------------------------------------------------------------------- -Thu Jun 18 08:43:07 UTC 2015 - mchang@suse.com - -- Fix btrfs subvol detection on BigEndian systems (bsc#933541) - * modified grub2-btrfs-06-subvol-mount.patch -- Fix grub2-mkrelpath outputs wrong path on BigEndian system - * added grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch - -------------------------------------------------------------------- -Fri Jun 12 07:20:00 UTC 2015 - mchang@suse.com - -- If we have a post entry and the description field is empty, we should use the - "Pre" number and add that description to the post entry. (fate#317972) -- Show user defined comments in grub2 menu for snapshots (fate#318101) - * modified grub2-snapper-plugin.sh - -------------------------------------------------------------------- -Sun Jun 7 04:00:56 UTC 2015 - arvidjaar@gmail.com - -- add 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch - make sure firmware path starts with '/' (boo#902982) - -------------------------------------------------------------------- -Fri Jun 5 03:46:33 UTC 2015 - mchang@suse.com - -- Fix btrfs patch on BigEndian systems (bsc#933541) - * modified grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch - * modified grub2-btrfs-06-subvol-mount.patch - -------------------------------------------------------------------- -Wed Jun 3 20:07:33 UTC 2015 - agraf@suse.com - -- Fix license for setjmp module - * added grub2-arm64-setjmp-Add-missing-license-macro.patch - -------------------------------------------------------------------- -Thu May 21 09:23:52 UTC 2015 - mchang@suse.com - -- Fix install into snapper controlled btrfs subvolume and can't - load grub modules from separate subvolume (fate#318392) - * added grub2-btrfs-06-subvol-mount.patch - * grub2-snapper-plugin.sh: use absolute subvol name - -------------------------------------------------------------------- -Tue May 19 17:47:33 UTC 2015 - arvidjaar@gmail.com - -- also Recommends mtools for grub2-mkrescue (used to create EFI - boot image) in addition to libburnia-tools. - -------------------------------------------------------------------- -Mon May 11 08:50:14 UTC 2015 - mchang@suse.com - -- Support booting opensuse installer as PV DomU (boo#926795) - * added grub2-xen.cfg for tracking default pvgrub2 xen configs rather than - generating it from spec file - * grub2-xen.cfg: from Olaf Hering - -------------------------------------------------------------------- -Sun May 10 19:38:00 UTC 2015 - arvidjaar@gmail.com - -- replace grub2-efinet-reopen-SNP-protocol-for-exclusive-use-by-grub.patch - with upstream version: - * 0001-efidisk-move-device-path-helpers-in-core-for-efinet.patch - * 0002-efinet-skip-virtual-IPv4-and-IPv6-devices-when-enume.patch - * 0003-efinet-open-Simple-Network-Protocol-exclusively.patch - Fixes EFI network boot in some QEMU configurations. - -------------------------------------------------------------------- -Wed Apr 29 13:20:20 UTC 2015 - dmueller@suse.com - -- fix grub2-mkconfig-aarch64.patch: fix arch detection broken - by malformed patch rediffing - -------------------------------------------------------------------- -Wed Apr 15 06:02:36 UTC 2015 - mchang@suse.com - -- Cleanup patch not applied - * remove grub2-enable-theme-for-terminal-window.patch - * grub2.rpmlintrc: remove addFilter("patch-not-applied") - -------------------------------------------------------------------- -Thu Apr 2 04:25:52 UTC 2015 - mchang@suse.com - -- Merge changes from SLE12 -- Do not pass root= when root is on nfs (bnc#894374) - * modified grub2-pass-corret-root-for-nfsroot.patch - * modified grub2-secureboot-provide-linuxefi-config.patch - * modified grub2-secureboot-use-linuxefi-on-uefi.patch -- Fix xen pvops kernel not appear on menu (bnc#895286) - * modified grub2-fix-menu-in-xen-host-server.patch -- Workaround grub2-once (bnc#892358) - * added grub2-btrfs-workaround-grub2-once.patch - * added grub2-once.service - * modified grub2-once -- Fix busy-loop and hang while network booting (bnc#870613) - * added grub2-netboot-hang.patch -- Add warning in grubenv file about editing it directly (bnc#887008) - * added grub2-editenv-add-warning-message.patch -- Fix broken graphics with efifb on QEMU/KVM and nomodeset (bnc#884558) - * added grub2-efi-disable-video-cirrus-and-bochus.patch -- Disable video support on Power (bnc#877142) - * added grub2-ppc64le-disable-video.patch -- Track occupied memory so it can be released on exit (bnc#885026) - * added grub2-ppc64le-memory-map.patch -- Fix grub.xen config searching path on boot partition (bnc#884828) -- Add linux16 and initrd16 to grub.xen (bnc#884830) - * added grub2-xen-linux16.patch -- VLAN tag support (fate#315753) - * added 0001-Add-bootargs-parser-for-open-firmware.patch - * added 0002-Add-Virtual-LAN-support.patch -- Use chainloader to boot xen.efi under UEFI (bnc#871857) - * added grub2-efi-xen-chainload.patch -- Use device part of chainloader target, if present (bnc#871857) - * added grub2-efi-chainloader-root.patch -- Create only hypervisor pointed by /boot/xen.gz symlink (bnc#877040) - * modified grub2-fix-Grub2-with-SUSE-Xen-package-install.patch -- Fix xen and native entries differ in grub.cfg (bnc#872014) - * modified grub2-linux.patch -- Fix install error on ddf md device (bnc#872360) - * added grub2-getroot-treat-mdadm-ddf-as-simple-device.patch -- Fix booting from NVMe device (bnc#873132) - * added grub2-getroot-support-NVMe-device-names.patch -- Document peculiarities of s390 terminals - * added README.ibm3215 -- Grub2 for System z (fate#314213) - * added grub2-s390x-02-kexec-module-added-to-emu.patch - * added grub2-s390x-03-output-7-bit-ascii.patch - * added grub2-s390x-04-grub2-install.patch - * added grub2-s390x-05-grub2-mkconfig.patch - -------------------------------------------------------------------- -Mon Mar 16 08:08:32 UTC 2015 - schwab@suse.de - -- grub2-arm64-set-correct-length.patch: arm64: set correct length of - device path end entry - -------------------------------------------------------------------- -Wed Mar 4 04:03:37 UTC 2015 - mchang@suse.com - -- grub2-efi-HP-workaround.patch: - * try to read config from all-uppercase prefix as last resort. - (bnc#872503) (boo#902982) - -------------------------------------------------------------------- -Mon Feb 16 16:25:50 UTC 2015 - arvidjaar@gmail.com - -- add luks, gcry_rijndael, gcry_sha1 to signed EFI image to support - LUKS partition in default setup (boo#917427) - -------------------------------------------------------------------- -Thu Feb 5 09:37:46 UTC 2015 - mchang@suse.com - -- enable i386-xen (boo#891043) - -------------------------------------------------------------------- -Wed Feb 4 07:43:27 UTC 2015 - mchang@suse.com - -- Downgrade os-prober dependency to Recommends (boo#898610) - -------------------------------------------------------------------- -Thu Dec 25 08:52:12 UTC 2014 - mchang@suse.com - -- grub2-snapper-plugin.sh: cleanup grub-snapshot.cfg not referring - to any snapshot (boo#909359) - -------------------------------------------------------------------- -Thu Dec 25 08:34:49 UTC 2014 - mpluskal@suse.com - -- Require efibootmgr also on i586 - -------------------------------------------------------------------- -Tue Dec 16 10:41:08 UTC 2014 - schwab@suse.de - -- Require efibootmgr also on aarch64 - -------------------------------------------------------------------- -Thu Dec 11 11:20:13 UTC 2014 - schwab@suse.de - -- grub2-snapper-plugin.sh: fix use of printf without format string; fix - quoting - -------------------------------------------------------------------- -Wed Dec 10 09:12:47 UTC 2014 - schwab@suse.de - -- grub2-arm64-Reduce-timer-event-frequency-by-10.patch: fix periodic timer - on arm64 - -------------------------------------------------------------------- -Thu Dec 4 01:42:39 UTC 2014 - agraf@suse.com - -- enable 32bit arm targets for uboot and efi - -------------------------------------------------------------------- -Sat Nov 29 18:26:00 UTC 2014 - Led - -- Replace 'echo -e' command in grub2-snapper-plugin.sh script to - 'printf' command. '-e' option of 'echo' command may be - unsupported in some POSIX-complete shells. - -------------------------------------------------------------------- -Fri Nov 14 16:06:00 UTC 2014 - Led - -- fix bashism in post script - -------------------------------------------------------------------- -Thu Oct 30 15:18:16 CET 2014 - jdelvare@suse.de - -- grub2.spec: Fix conditional construct which wasn't supported by - older versions of rpmbuild (caused error message - "parseExpressionBoolean returns -1".) - -------------------------------------------------------------------- -Thu Oct 30 07:36:15 UTC 2014 - mchang@suse.com - -- fix errors when boot is btrfs with Windows partition scheme. The - first partition is created on cylinder boundary that can't offer - enough room for core.img and also the installation has to be in - logical paritition which made MBR the only location to install. - (bnc#841247) - * add grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch - -------------------------------------------------------------------- -Tue Sep 30 03:45:04 UTC 2014 - mchang@suse.com - -- packaging 20_memtest86+ and 20_ppc_terminfo in corresponing grubarch - package - -------------------------------------------------------------------- -Mon Sep 29 07:22:29 UTC 2014 - fcastelli@suse.com - -- Add '80_suse_btrfs_snapshot' required to show btrfs snapshots inside - of the boot menu. - -------------------------------------------------------------------- -Sun Sep 28 06:16:35 UTC 2014 - arvidjaar@gmail.com - -- fix btrfs on big endian systems (ppc/ppc64) - * add grub2-btrfs-fix-get_root-key-comparison-failures-due-to-en.patch - -------------------------------------------------------------------- -Sun Sep 21 06:47:12 UTC 2014 - arvidjaar@gmail.com - -- update translations -- fix possible access to uninitialized pointer in linux loader - * add grub2-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch - * drop superceded grub2-ppc64le-23-grub-segfaults-if-initrd-is-specified-before-specify.patch - -------------------------------------------------------------------- -Thu Sep 18 09:55:57 UTC 2014 - mchang@suse.com - -- fix grub.xen not able to handle legacy menu.lst hdX names (bnc#863821) - * add grub2-xen-legacy-config-device-name.patch from arvidjaar -- fix the performance of grub2 uefi pxe is bad (bnc#871555) - * add grub2-efinet-reopen-SNP-protocol-for-exclusive-use-by-grub.patch - -------------------------------------------------------------------- -Tue Sep 16 07:08:18 UTC 2014 - schwab@suse.de - -- grub2-mkconfig-aarch64.patch: Look for Image-* instead of vmlinuz-* on - aarch64 - -------------------------------------------------------------------- -Mon Sep 15 15:30:03 UTC 2014 - arvidjaar@gmail.com - -- add grub2-glibc-2.20.patch - fix build with glibc 2.20+ - (use _DEFAULT_SOURCE to avoid warning) - -------------------------------------------------------------------- -Fri Sep 12 04:14:38 UTC 2014 - mchang@suse.com - -- fix xen pvops kernel not appear on menu (bnc#895286) - * refresh grub2-fix-menu-in-xen-host-server.patch - -------------------------------------------------------------------- -Wed Sep 10 10:34:47 UTC 2014 - mchang@suse.com - -- fix extraneous comma in printf shell command (bnc#895884) - * refresh grub2-btrfs-04-grub2-install.patch - -------------------------------------------------------------------- -Wed Aug 27 07:53:35 UTC 2014 - schwab@suse.de - -- aarch64-reloc.patch: replace with upstream solution - -------------------------------------------------------------------- -Mon Aug 25 03:10:18 UTC 2014 - mchang@suse.com - -- remove unused patch, which's supersceded by new snapper rollback - support patches - * 0001-script-provide-overridable-root-by-subvol.patch - * 0002-script-create-menus-for-btrfs-snapshot.patch - -------------------------------------------------------------------- -Fri Aug 22 10:05:13 UTC 2014 - mchang@suse.com - -- fix openqa boot error on separate boot partition - * refresh grub2-btrfs-05-grub2-mkconfig.patch - -------------------------------------------------------------------- -Thu Aug 21 06:10:07 UTC 2014 - mchang@suse.com - -- update snapper plugin for rollback support - * refresh grub2-snapper-plugin.sh - -------------------------------------------------------------------- -Fri Aug 15 07:55:54 UTC 2014 - mchang@suse.com - -- snapper rollback support patches. -- rename patch - * 0002-btrfs-add-ability-to-boot-from-subvolumes.patch to - grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch - * 0004-btrfs-export-subvolume-envvars.patch to - grub2-btrfs-02-export-subvolume-envvars.patch -- added patches - * grub2-btrfs-03-follow_default.patch - * grub2-btrfs-04-grub2-install.patch - * grub2-btrfs-05-grub2-mkconfig.patch -- remove patch - * 0003-cmdline-add-envvar-loader_cmdline_append.patch - -------------------------------------------------------------------- -Thu Aug 14 06:35:58 UTC 2014 - mchang@suse.com - -- grub2-btrfs-fix-incorrect-address-reference.patch - * Fix incorrect address reference in GRUB_BTRFS_EXTENT_REGULAR - range check (bnc#869748) - -------------------------------------------------------------------- -Wed Aug 13 02:56:22 UTC 2014 - mchang@suse.com - -- grub2-vbe-blacklist-preferred-1440x900x32.patch - * Blacklist preferred resolution 1440x900x32 which is broken on - many Thinkpads (bnc#888727) - -------------------------------------------------------------------- -Tue Aug 12 12:56:29 UTC 2014 - schwab@suse.de - -- Enable building on aarch64 -- aarch64-reloc.patch: support R_AARCH64_PREL32 relocation -- Build host tools with RPM_OPT_FLAGS - -------------------------------------------------------------------- -Mon Aug 11 14:34:55 UTC 2014 - dvaleev@suse.com - -- Fix the 64-bit trampoline code in dynamic linker (bnc#890999) - grub2-ppc64le-fix-64bit-trampoline-in-dyn-linker.patch - -------------------------------------------------------------------- -Tue Jul 29 11:46:54 CEST 2014 - tiwai@suse.de - -- Prefer a higher resolution in efi_gop driver if the mode taking - over is too small like 640x480 (bnc#887972): - grub2-efi_gop-avoid-low-resolution.patch - -------------------------------------------------------------------- -Wed Jul 9 16:26:35 UTC 2014 - dvlaeev@suse.com - -- Fix ppc64le build by fixing - grub2-xfs-V5-filesystem-format-support.patch - -------------------------------------------------------------------- -Wed Jun 25 09:20:16 UTC 2014 - jack@suse.cz - -- xfs V5 superblock support (bnc#880166 bnc#883942) - -- added patches: - * grub2-xfs-Add-helper-for-inode-size.patch - * grub2-xfs-Fix-termination-loop-for-directory-iteration.patch - * grub2-xfs-Convert-inode-numbers-to-cpu-endianity-immediate.patch - * grub2-xfs-V5-filesystem-format-support.patch - -------------------------------------------------------------------- -Fri Jun 20 19:50:28 UTC 2014 - jeffm@suse.com - -- grub2: use stat instead of udevadm for partition lookup (bnc#883635) - * Added grub2-use-stat-instead-of-udevadm-for-partition-lookup.patch - -------------------------------------------------------------------- -Tue Apr 15 08:36:46 UTC 2014 - tchvatal@suse.com - -- Fix sorting of RC kernels to be older than first regular of the - series. Fixes bnc#827531. - -- added patches: - * grub2-use-rpmsort-for-version-sorting.patch - -------------------------------------------------------------------- -Thu Apr 10 16:35:08 UTC 2014 - dvaleev@suse.com - -- Build GRUB2 for ppc64le as LittleEndian and 64bit -- Fix timeout issue on ppc64le (bnc#869166) -- Add powerpc-utils requires to grub2-powerpc-ieee1275 - -- added patches: - * grub2-ppc64-build-ppc64-32bit.patch - * grub2-ppc64-qemu.patch - * grub2-ppc64le-01-Add-Little-Endian-support-for-Power64-to-the-build.patch - * grub2-ppc64le-02-Build-grub-as-O1-until-we-add-savegpr-and-restgpr-ro.patch - * grub2-ppc64le-03-disable-creation-of-vsx-and-altivec-instructions.patch - * grub2-ppc64le-04-powerpc64-LE-s-linker-knows-how-to-handle-the-undefi.patch - * grub2-ppc64le-05-grub-install-can-now-recognize-and-install-a-LE-grub.patch - * grub2-ppc64le-06-set-the-ABI-version-to-0x02-in-the-e_flag-of-the-PPC.patch - * grub2-ppc64le-07-Add-IEEE1275_ADDR-helper.patch - * grub2-ppc64le-08-Fix-some-more-warnings-when-casting.patch - * grub2-ppc64le-09-Add-powerpc64-types.patch - * grub2-ppc64le-10-powerpc64-is-not-necessarily-BigEndian-anymore.patch - * grub2-ppc64le-11-Fix-warnings-when-building-powerpc-linux-loader-64bi.patch - * grub2-ppc64le-12-GRUB_ELF_R_PPC_-processing-is-applicable-only-for-32.patch - * grub2-ppc64le-13-Fix-powerpc-setjmp-longjmp-64bit-issues.patch - * grub2-ppc64le-14-Add-powerpc64-ieee1275-trampoline.patch - * grub2-ppc64le-15-Add-64bit-support-to-powerpc-startup-code.patch - * grub2-ppc64le-16-Add-grub_dl_find_section_addr.patch - * grub2-ppc64le-17-Add-ppc64-relocations.patch - * grub2-ppc64le-18-ppc64-doesn-t-need-libgcc-routines.patch - * grub2-ppc64le-19-Use-FUNC_START-FUNC_END-for-powerpc-function-definit.patch - * grub2-ppc64le-20-.TOC.-symbol-is-special-in-ppc64le-.-It-maps-to-the-.patch - * grub2-ppc64le-21-the-.toc-section-in-powerpc64le-modules-are-sometime.patch - * grub2-ppc64le-22-all-parameter-to-firmware-calls-should-to-be-BigEndi.patch - * grub2-ppc64le-23-grub-segfaults-if-initrd-is-specified-before-specify.patch - * grub2-ppc64le-timeout.patch -- removed patches: - * grub2-powerpc-libgcc.patch - * grub2-ppc64le-core-bigendian.patch - * grub2-ppc64le-platform.patch -------------------------------------------------------------------- -Thu Apr 10 07:39:30 UTC 2014 - mchang@suse.com - -- add grub2-x86_64-xen subpackage (bnc#863821) - -------------------------------------------------------------------- -Sat Apr 5 14:27:45 UTC 2014 - arvidjaar@gmail.com - -- rename grub2.chrp back into grub.chrp, otherwise it is not found by - grub tools -- replace grub2-use-DejaVuSansMono-for-starfield-theme.patch with - grub2-use-Unifont-for-starfield-theme-terminal.patch - use Unifont - font for terminal window - -------------------------------------------------------------------- -Thu Feb 27 04:30:07 UTC 2014 - mchang@suse.com - -- grub2-snapper-plugin: fix important snapshots are not marked as such - in grub2 menu, also display the snapshot entries in the format - "important distribution version (kernel_version, timestamp, pre/post)" - (bnc#864842) - -------------------------------------------------------------------- -Mon Feb 24 07:28:42 UTC 2014 - mchang@suse.com - -- refresh grub2-fix-menu-in-xen-host-server.patch (bnc#859361) - * prevent 10_linux from booting xen kernel without pv_opt support - on systems other than xen PV domU guest - * prevent 20_linux_xen.in from setting up nested virt running from - Xen domU -- refresh grub2-fix-Grub2-with-SUSE-Xen-package-install.patch - * adjust accordingly - -------------------------------------------------------------------- -Thu Feb 20 14:43:21 UTC 2014 - jw@suse.com - -- updating grub2-once - - added --list switch. - - improved --help and error handling. - -------------------------------------------------------------------- -Tue Feb 11 03:02:21 UTC 2014 - mchang@suse.com - -- add Supplements: packageand(snapper:grub2) in grub2-snapper-plugin - to install it while both snapper and grub2 are installed - -------------------------------------------------------------------- -Wed Feb 5 04:33:55 UTC 2014 - mchang@suse.com - -- add grub2-snapper-plugin.sh (fate#316232) - * grub2's snapper plugin for advanced btrfs snapshot menu management - * package as grub2-snapper-plugin.noarch -- refresh 0002-script-create-menus-for-btrfs-snapshot.patch - * when booting btrfs snapshots disabled, deleting snapshot master config - if it's not customized - -------------------------------------------------------------------- -Fri Jan 31 14:42:26 UTC 2014 - dvaleev@suse.com - -- Enable grub2 for PowerPC LE (ppc64le) -- Add ppc64le to exclusive arches -- Don't require gcc-32bit (PowerLE don't have 32bit toolchain) - -- added patches: - * grub2-powerpc-libgcc.patch - Provide 32bit libgcc functions for PowerLE - - * grub2-ppc64le-core-bigendian.patch - Build grub kernel and images as BE on ppc64le (BL is BE there) - - * grub2-ppc64le-platform.patch - Enable ppc64le platform - -------------------------------------------------------------------- -Fri Jan 24 13:48:13 CET 2014 - jjolly@suse.com - -- Add changes to allow build for s390x arch: added - grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch - -------------------------------------------------------------------- -Wed Jan 22 05:19:35 UTC 2014 - mchang@suse.com - -- refresh 0002-script-create-menus-for-btrfs-snapshot.patch -* Fix bootable snapshots not found while root is on Btrfs subvolume - (bnc#859587) -* Create missing slave config in /.snapshots// -* Prefix with SUSE_ for related options - -------------------------------------------------------------------- -Fri Jan 17 06:23:04 UTC 2014 - mchang@suse.com - -- refresh 0001-script-provide-overridable-root-by-subvol.patch -* Introduce $boot_prefix for setting prefix on seeking other /boot - directory. -- refresh 0002-script-create-menus-for-btrfs-snapshot.patch -* Support existing snapshots by creating their missing slave configs. -* Temporarily default to disable this feature until receiving more - tests from QA. -* Introduce GRUB_ENABLE_CUSTOM_SNAPSHOT_SUBMENU to allow custom - submenu for listing snapshots rather than the default one. - -------------------------------------------------------------------- -Wed Jan 15 15:46:31 UTC 2014 - arvidjaar@gmail.com - -- package autoiso.cfg and osdetect.cfg as documentation -- add 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch - - fix configure test for DejaVu font -- add dejavu-fonts to BR (needed to build starfield theme) -- package starfield theme as grub2-branding-upstream -- add grub2-use-DejaVuSansMono-for-starfield-theme.patch - use fixed width - font for starfield theme -- clarify that grub2 subpackage contains only user space tools - -------------------------------------------------------------------- -Wed Jan 15 06:18:10 UTC 2014 - mchang@suse.com - -- add new patches for booting btrfs snapshot (fate#316522) (fate#316232) - * 0001-script-provide-overridable-root-by-subvol.patch - * 0002-script-create-menus-for-btrfs-snapshot.patch - -------------------------------------------------------------------- -Fri Dec 27 16:36:40 UTC 2013 - arvidjaar@gmail.com - -- update to grub-2.02 beta2 - * drop upstream patches - - grub2-fix-unquoted-string-in-class.patch (different) - - grub2-cdpath.patch (modified) - - grub2-fix-parsing-of-short-LVM-PV-names.patch - - grub2-fix-descriptor-leak-in-grub_util_is_imsm.patch - - grub2-install-opt-skip-fs-probe.patch (file it patched no more exists, - functionality included upstream) - - grub2-fix-x86_64-efi-startup-stack-alignment.patch - - grub2-fix-x86_64-efi-callwrap-stack-alignment.patch - - 0001-Fix-build-with-FreeType-2.5.1.patch - * rediff - - grub2-linux.patch - - use-grub2-as-a-package-name.patch (do not patch generated configure) - - grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch - - grub2-fix-locale-en.mo.gz-not-found-error-message.patch (upstream added - explicit exclusion for en_* language only; I do not see reason to stop - with error in this case for any language). - - not-display-menu-when-boot-once.patch - - grub2-secureboot-provide-linuxefi-config.patch - - grub2-pass-corret-root-for-nfsroot.patch - - 0002-btrfs-add-ability-to-boot-from-subvolumes.patch - - grub2-fix-menu-in-xen-host-server.patch - - grub2-fix-Grub2-with-SUSE-Xen-package-install.patch - - grub2-secureboot-add-linuxefi.patch - - grub2-secureboot-no-insmod-on-sb.patch - - rename-grub-info-file-to-grub2.patch - * drop Makefile.util.am and Makefile.core.am, they are now generated - during build - * call ./autogen.sh again now when it does not need autogen anymore; drop - autoreconf call, it is called by autogen.sh - * drop 0001-btrfs-rename-skip_default-to-follow_default.patch - is not - needed anymore due to upstream changes - * package /usr/bin/grub2-file, /usr/bin/grub2-syslinux2cfg and - /usr/sbin/grub2-macbless - * use grub-install --no-bootsector instead of --grub-setup=/bin/true - in postinstall script - -------------------------------------------------------------------- -Tue Dec 17 07:20:33 UTC 2013 - mchang@suse.com - -- add new patches for booting btrfs snapshot (fate#316522) (fate#316232) - * 0001-btrfs-rename-skip_default-to-follow_default.patch - * 0002-btrfs-add-ability-to-boot-from-subvolumes.patch - * 0003-cmdline-add-envvar-loader_cmdline_append.patch - * 0004-btrfs-export-subvolume-envvars.patch - -------------------------------------------------------------------- -Tue Dec 10 19:13:53 UTC 2013 - arvidjaar@gmail.com - -- add patch 0001-Fix-build-with-FreeType-2.5.1.patch - fix build with - freetype2 >= 2.5.1 (backport from fd0df6d098b1e6a4f60275c48a3ec88d15ba1fbb) - -------------------------------------------------------------------- -Sun Dec 1 13:10:23 UTC 2013 - arvidjaar@gmail.com - -- reset executable bits on *module, *.exec and *.image files. They are not - executable. - -------------------------------------------------------------------- -Fri Nov 22 07:12:16 UTC 2013 - glin@suse.com - -- add grub2-fix-x86_64-efi-startup-stack-alignment.patch and - grub2-fix-x86_64-efi-callwrap-stack-alignment.patch: fix the - stack alignment of x86_64 efi. (bnc#841426) - -------------------------------------------------------------------- -Wed Sep 11 07:17:07 UTC 2013 - mchang@suse.com - -- use new update-bootloader option --reinit to install and update - bootloader config -- refresh grub2-secureboot-no-insmod-on-sb.patch to fobid module - loading completely. - -------------------------------------------------------------------- -Mon Sep 9 09:22:34 UTC 2013 - lnussel@suse.de - -- replace openSUSE UEFI certificate with new 2048 bit certificate. - -------------------------------------------------------------------- -Sat Jul 27 10:12:36 UTC 2013 - arvidjaar@gmail.com - -- add grub2-fix-parsing-of-short-LVM-PV-names.patch - fix PV detection in - grub-probe when PV name is less than 10 charaters -- add grub2-fix-descriptor-leak-in-grub_util_is_imsm.patch - fix decriptor - leak which later caused LVM warnings during grub-probe invocation -- remove --enable-grub-emu-usb - it is not needed on physical platform - -------------------------------------------------------------------- -Tue Jul 9 10:54:41 UTC 2013 - mchang@suse.com - -- refresh grub2-fix-menu-in-xen-host-server.patch: In domU we - have to add xen kernel to config. (bnc#825528) - -------------------------------------------------------------------- -Wed Jun 26 17:02:08 UTC 2013 - elchevive@opensuse.org - -- updated existent translations and include new ones - (es, lt, pt_BR, sl, tr) - -------------------------------------------------------------------- -Sun Jun 16 12:42:33 UTC 2013 - arvidjaar@gmail.com - -- update to current upstream trunk rev 5042 - * drop upstream patches - - grub2-correct-font-path.patch - - grub2-fix-mo-not-copied-to-grubdir-locale.patch - - grub2-stdio.in.patch - - grub2-fix-build-error-on-flex-2.5.37.patch - - grub2-quote-messages-in-grub.cfg.patch - - 30_os-prober_UEFI_support.patch - - grub2-fix-enumeration-of-extended-partition.patch - - grub2-add-device-to-os_prober-linux-menuentry.patch - - grub2-fix-tftp-endianness.patch - - efidisk-ahci-workaround - - grub2-grub-mount-return-failure-if-FUSE-failed.patch - * rediff - - rename-grub-info-file-to-grub2.patch - - grub2-linux.patch - - use-grub2-as-a-package-name.patch - - grub2-iterate-and-hook-for-extended-partition.patch - - grub2-secureboot-add-linuxefi.patch - - grub2-secureboot-no-insmod-on-sb.patch - - grub2-secureboot-chainloader.patch - * add - - grub2-linguas.sh-no-rsync.patch - + disable rsync in linguas.sh so it can be used during RPM build - + disable auto-generated catalogs, they fail at the moment due to - missing C.UTF-8 locale - * update Makefile.util.am and Makefile.core.am - * grub2-mknetdir is now in /usr/bin - * generate po/LINGUAS for message catalogs using distributed linguas.sh - * remove po/stamp-po during setup to trigger message catalogs rebuild - * package bootinfo.txt on PPC (used by grub2-mkrescue) - -------------------------------------------------------------------- -Sat Apr 13 08:48:52 UTC 2013 - arvidjaar@gmail.com - -- BuildRequires: help2man to generate man pages and package them too - -------------------------------------------------------------------- -Fri Apr 5 17:01:42 UTC 2013 - arvidjaar@gmail.com - -- add grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch (bnc#810912) - * use linuxefi in 30_os-prober if secure boot is enabled - -------------------------------------------------------------------- -Wed Apr 3 17:56:20 UTC 2013 - arvidjaar@gmail.com - -- update rename-grub-info-file-to-grub2.patch - * do not rename docs/grub2.texi here, do it in %%prep (we do it there - conditionally already). It simplifies patch refreshing using quilt - which does not support file rename. - -------------------------------------------------------------------- -Wed Apr 3 06:55:52 UTC 2013 - mchang@suse.com - -- refresh grub2-secureboot-chainloader.patch: Fix wrongly aligned - buffer address (bnc#811608) - -------------------------------------------------------------------- -Thu Mar 28 02:57:47 UTC 2013 - mchang@suse.com - -- package Secure Boot CA file as /usr/lib64/efi/grub.der which - could be used to verify signed image from build server -- add openSUSE-UEFI-CA-Certificate.crt, openSUSE Secure Boot CA -- add SLES-UEFI-CA-Certificate.crt, SUSE Linux Enterprise Secure - Boot CA - -------------------------------------------------------------------- -Mon Mar 25 17:37:59 UTC 2013 - dvaleev@suse.com - -- extraconfigure macro is not defined on ppc - -------------------------------------------------------------------- -Sat Mar 23 18:31:07 UTC 2013 - arvidjaar@gmail.com - -- corretly set chainloaded image device handle in secure boot mode (bnc#809038) - -------------------------------------------------------------------- -Wed Mar 13 11:30:52 UTC 2013 - mchang@suse.com - -- remove all compatible links in grub2-efi as now all concerned - utilities are fixed -- superseding grub2-efi by grub2-x86_64-efi and grub2-i386-efi on - x86_64 and ix86 respectively -- make grub2-x86_64-efi and grub2-i386-efi providing grub2-efi - capability to not break package dependency -- handle upgrade from 12.2 by preseving grubenv and custom.cfg to - new directory /boot/grub2, rename /boot/grub2-efi to - /boot/grub2-efi.rpmsave to avoid confusion. - -------------------------------------------------------------------- -Mon Mar 11 16:02:26 UTC 2013 - arvidjaar@gmail.com - -- move post scripts into corresponding subpackages to ensure they are - run after updated binaries are installed. Currently it may happen - that update-bootlader picks up old binaries. -- move requires for perl-Bootloader to target subpackages. Make sure - efi requires minimal version that supports /boot/grub2. -- add requires(post) to force order of installation: grub2 => grub2-arch - => grub2-efi -- split efi post in two parts. One that updates configuration and is part - of grub2-efiarch and second that migrates settings and is part of - grub2-efi. Only custom.cfg and grubenv may need migration. device.map - is not relevant for EFI and new grub.cfg had been created at this point. - -------------------------------------------------------------------- -Mon Mar 11 06:52:58 UTC 2013 - mchang@suse.com - -- add grub2-fix-tftp-endianness.patch from upstream (bnc#808582) -- add efinet and tftp to grub.efi (bnc#808582) - -------------------------------------------------------------------- -Thu Mar 7 15:39:50 UTC 2013 - seife+obs@b1-systems.com - -- convert spec file to UTF-8 - -------------------------------------------------------------------- -Thu Mar 7 08:12:57 UTC 2013 - mchang@suse.com - -- add lvm to grub.efi (bnc#807989) -- add loadenv to grub.efi (bnc#807992) - -------------------------------------------------------------------- -Mon Mar 4 16:48:32 UTC 2013 - arvidjaar@gmail.com - -- grub2-grub-mount-return-failure-if-FUSE-failed.patch - return error - if fuse_main failed (bnc#802983) - -------------------------------------------------------------------- -Mon Feb 25 13:31:31 UTC 2013 - fcrozat@suse.com - -- Fix build for SLES 11. - -------------------------------------------------------------------- -Tue Feb 19 15:38:04 UTC 2013 - duwe@suse.com - - Fix up bogus items from the previous merge: - - efi_libdir = _libdir = /usr/lib - - package /usr/lib/grub2 dir only once - - move grub.efi to /usr/lib/grub2/%{grubefiarch}/ - - create a symlink so that scripts can find it there. - -------------------------------------------------------------------- -Thu Feb 14 11:42:40 UTC 2013 - duwe@suse.com - -- merge internal+external BS changes into superset spec file, - remove obsolete dependencies -- merge SLES+openSUSE patches, restrict "grub-efi" to 12.2 -- add efidisk-ahci-workaround (bnc#794674) -- fix unquoted-string-in-class.patch (bnc#788322) - -------------------------------------------------------------------- -Fri Feb 8 01:58:22 UTC 2013 - mchang@suse.com - -- adapt to pesign-obs-integration changes - -------------------------------------------------------------------- -Thu Feb 7 10:38:42 UTC 2013 - mchang@suse.com - -- grub.efi signing on build server. - -------------------------------------------------------------------- -Thu Jan 31 16:18:56 UTC 2013 - duwe@suse.com - -- switch to out of source / subdir build - -------------------------------------------------------------------- -Wed Jan 30 07:29:29 UTC 2013 - mchang@suse.com - -- sync from SLE-11 SP3 to date -- set empty prefix to grub.efi for looking up in current directory -- grub2-cdpath.patch: fix the grub.cfg not found when booting from - optical disk -- put grub.efi in grub2's source module directory -- create links in system's efi directory to grub.efi -- arvidjaar: do not overwrite device path in grub2-cdpath.patch - -------------------------------------------------------------------- -Wed Jan 30 04:36:45 UTC 2013 - arvidjaar@gmail.com - -- remove obsolete reference to /boot/grub2-efi and /usr/sbin/grub2-efi - from grub2-once -- add GRUB_SAVEDFAULT description to /etc/default/grub - -------------------------------------------------------------------- -Tue Jan 29 02:42:28 UTC 2013 - mchang@suse.com - -- set empty prefix to grub.efi for looking up in current directory -- remove grubcd.efi, as grub.efi can now be used for cdrom booting - -------------------------------------------------------------------- -Mon Jan 28 08:05:52 CET 2013 - snwint@suse.de - -- add fat module to grubcd -- explicitly set empty prefix to get grub to set $prefix to the currrent - directory - -------------------------------------------------------------------- -Fri Jan 18 07:39:18 UTC 2013 - mchang@suse.com - -- ship a Secure Boot UEFI compatible bootloader (fate#314485) -- add grub2-secureboot-chainloader.patch, which expands the efi - chainloader to be able to verify images via shim lock protocol. - -------------------------------------------------------------------- -Fri Jan 18 06:24:57 UTC 2013 - mchang@suse.com - -- ship a Secure Boot UEFI compatible bootloader (fate#314485). -- update for cdrom boot support. -- grub2-cdpath.patch: fix the grub.cfg not found when booting from - optical disk. -- grubcd.efi: the efi image used for optial disk booting, with - reduced size and $prefix set to /EFI/BOOT. - -------------------------------------------------------------------- -Tue Jan 8 08:09:01 UTC 2013 - mchang@suse.com - -- add grub2-fix-unquoted-string-in-class.patch (bnc#788322) - -------------------------------------------------------------------- -Tue Jan 8 07:09:47 UTC 2013 - arvidjaar@gmail.com - -- add grub2-add-device-to-os_prober-linux-menuentry.patch (bnc#796919) - -------------------------------------------------------------------- -Sun Jan 6 18:54:54 UTC 2013 - arvidjaar@gmail.com - -- add patch grub2-fix-enumeration-of-extended-partition.patch to - fix enumeration of extended partitions with non-standard EBR (bnc#779534) - -------------------------------------------------------------------- -Fri Jan 4 10:29:58 UTC 2013 - arvidjaar@gmail.com - -- add support for chainloading another UEFI bootloader to - 30_os-prober (bnc#775610) - -------------------------------------------------------------------- -Fri Dec 21 04:18:06 UTC 2012 - mchang@suse.com - -- put 32-bit grub2 modules to /usr/lib/grub2 -- put 64-bit grub2 modules to /usr/lib64/grub2 (x86_64-efi) -- put grub.efi to /usr/lib64/efi(x86_64) or /usr/lib/efi(i586) - -------------------------------------------------------------------- -Tue Dec 18 03:43:38 UTC 2012 - mchang@suse.com - -- ship a Secure Boot UEFI compatible bootloader (fate#314485) -- add grub2-secureboot-chainloader.patch, which expands the efi - chainloader to be able to verify images via shim lock protocol. - -------------------------------------------------------------------- -Fri Nov 30 06:39:15 UTC 2012 - mchang@suse.com - -- replace %{sles_version} by %{suse_version} -- use correct product name - -------------------------------------------------------------------- -Mon Nov 26 08:26:10 UTC 2012 - mchang@suse.com - -- ship a Secure Boot UEFI compatible bootloader (fate#314485) -- added secureboot patches which introduces new linuxefi module - that is able to perform verifying signed images via exported - protocol from shim. The insmod command will not function if - secure boot enabled (as all modules should built in grub.efi - and signed). - - grub2-secureboot-add-linuxefi.patch - - grub2-secureboot-use-linuxefi-on-uefi.patch - - grub2-secureboot-no-insmod-on-sb.patch - - grub2-secureboot-provide-linuxefi-config.patch -- Makefile.core.am : support building linuxefi module -- Make grub.efi image that is with all relevant modules incorporated - and signed, it will be the second stage to the shim loader which - will verified it when secureboot enabled. -- Make grub.efi's path to align with shim loader's default loader - lookup path. -- The changes has been verified not affecting any factory instalation, - but will allow us to run & test secure boot setup manually with shim. - -------------------------------------------------------------------- -Thu Nov 22 07:01:31 UTC 2012 - mchang@suse.com - -- ship a Secure Boot UEFI compatible bootloader (fate#314485) -- In SLE-11 SP3, don't include any other architecture binaries - except EFI, so we split packages by architecture binaries to - meet the requirement. - - grub2 : common utilties and config etc - - grub2-efi : provide compatibilty to grub2-efi package - - grub2-i386-pc : binaries for x86 legacy pc firmware - - grub2-i386-efi : binaries for ia32 EFI firmware - - grub2-x86_64-efi : binaries for x86_64 firmware - - grub2-powerpc-ieee1275: binaries for powerpc open firmware - -------------------------------------------------------------------- -Tue Nov 20 16:14:50 UTC 2012 - arvidjaar@gmail.com - -- update grub2-quote-messages-in-grub.cfg.patch to use upstream commit - -------------------------------------------------------------------- -Mon Nov 19 16:40:25 UTC 2012 - arvidjaar@gmail.com - -- quote localized "Loading ..." messages in grub.cfg (bnc#790195) - -------------------------------------------------------------------- -Mon Nov 5 08:17:26 UTC 2012 - aj@suse.de - -- We really only need makeinfo, so require that one where it exists. - -------------------------------------------------------------------- -Thu Nov 1 08:10:12 UTC 2012 - mchang@suse.com - -- ship a Secure Boot UEFI compatible bootloader (fate#314485) -- Secure boot support in installer DVD (fate#314489) -- prime support for package on SLE-11 (SP3) - - remove buildrequire to libuse and ncurses 32-bit devel packages - as they are needed by grub-emu which we don't support - - remove buildrequire to freetype2-devel-32bit as it's not need - by grub2-mkfont and others - - buildrequire to xz instead of lzma - - buildrequire to texinfo instead of makeinfo - - remove buildrequire to autogen as it's not available in SLE-11 - - add Makefile.util.am Makefile.core.am generated by autogen - - run autoreconf -vi instead of ./autogen.sh - - For SLE-11 remove buildrequire to gnu-unifont as it's not - yet available. Also do not package pf fonts created from it. - - workaround SLE-11 patch utility not rename file for us - - add -fno-inline-functions-called-once to CFLAGS to fix build - error on gcc 4.3.x - - not require os-prober for SLE-11, as package not yet ready - -------------------------------------------------------------------- -Sat Oct 27 05:27:42 UTC 2012 - arvidjaar@gmail.com - -- grub2-efi now depends on exact grub2 version - -------------------------------------------------------------------- -Fri Oct 25 17:00:35 UTC 2012 - arvidjaar@gmail.com - -- build grub2-efi with standard "grub2" prefix (bnc#782891) - - remove use-grub2-efi-as-a-package-name.patch - - migrate settings from /boot/grub2-efi to /boot/grub2 in efi post - - provide some compatibility links grub2-efi-xxx for perl-Bootloader - - workaround for /boot/grub2-efi linkk and /boot/grub2/grub.cfg - missing on update from older versions - -------------------------------------------------------------------- -Thu Oct 25 05:56:59 UTC 2012 - mchang@suse.com - -- add grub2-fix-build-error-on-flex-2.5.37.patch - -------------------------------------------------------------------- -Thu Oct 18 16:10:02 UTC 2012 - arvidjaar@gmail.com - -- modify patch grub2-iterate-and-hook-for-extended-partition.patch to - ignore extended partitions other then primary (bnc#785341) - -------------------------------------------------------------------- -Wed Sep 26 08:04:48 UTC 2012 - mchang@suse.com - -- refresh grub2-fix-locale-en.mo.gz-not-found-error-message.patch - with the correct fix in upstream bugzilla #35880 by Colin Watson - (bnc#771393) - -------------------------------------------------------------------- -Fri Sep 21 07:37:53 UTC 2012 - mchang@suse.com - -- grub2-fix-locale-en.mo.gz-not-found-error-message.patch (bnc#771393) - -------------------------------------------------------------------- -Wed Sep 19 18:54:34 UTC 2012 - arvidjaar@gmail.com - -- add 20_memtest86+ (bnc#780622) - -------------------------------------------------------------------- -Tue Sep 18 09:26:29 UTC 2012 - mchang@suse.com - -- Fix un-bootable grub2 testing entry in grub's menu.lst (bnc#779370) -- Not add new grub2 testing entry if it's not found in menu.lst -- Update grub2 stuff and config if there's grub2 entry in menu.lst -- Check for current bootloader as update-bootloader acts on it - -------------------------------------------------------------------- -Thu Aug 30 08:00:54 UTC 2012 - mchang@suse.com - -- add grub2-fix-Grub2-with-SUSE-Xen-package-install.patch (bnc#774666) -- add grub2-pass-corret-root-for-nfsroot.patch (bnc#774548) - -------------------------------------------------------------------- -Mon Aug 20 06:27:23 UTC 2012 - mchang@suse.com - -- disable grub2-enable-theme-for-terminal-window.patch to use - default black background due to current background has poor - contrast to the font color (bnc#776244). - -------------------------------------------------------------------- -Fri Aug 10 19:31:40 UTC 2012 - jslaby@suse.de - -- rename grub2once to grub2-once - -------------------------------------------------------------------- -Wed Aug 1 08:01:41 UTC 2012 - mchang@suse.com - -- add grub2once (bnc#771587) -- add not-display-menu-when-boot-once.patch - -------------------------------------------------------------------- -Sat Jul 28 14:17:56 UTC 2012 - aj@suse.de - -- Fix build with missing gets declaration (glibc 2.16) - -------------------------------------------------------------------- -Fri Jul 27 13:22:24 UTC 2012 - tittiatcoke@gmail.com - -- Add grub2-enable-theme-for-terminal-window.patch (bnc#770107) - -------------------------------------------------------------------- -Thu Jul 19 11:03:37 UTC 2012 - mchang@suse.com - -- add grub2-fix-menu-in-xen-host-server.patch (bnc#757895) - -------------------------------------------------------------------- -Wed Jul 18 08:29:53 UTC 2012 - mchang@suse.com - -- add grub2-fix-error-terminal-gfxterm-isn-t-found.patch -- add grub2-fix-mo-not-copied-to-grubdir-locale.patch - -------------------------------------------------------------------- -Wed Jul 18 08:12:19 UTC 2012 - aj@suse.de - -- We only need makeinfo, not texinfo for building. - -------------------------------------------------------------------- -Tue Jul 17 21:12:26 CEST 2012 - jslaby@suse.de - -- fix build by adding texinfo to buildrequires. - -------------------------------------------------------------------- -Fri Jul 6 08:09:16 UTC 2012 - mchang@suse.com - -- grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch. We - don't run in sigle user mode for recovery, instead use different - set kernel command line options which could be specified by this - GRUB_CMDLINE_LINUX_RECOVERY setting. - -------------------------------------------------------------------- -Wed Jul 4 06:20:23 UTC 2012 - mchang@suse.com - -- add use-grub2-efi-as-a-package-name.patch (bnc#769916) - -------------------------------------------------------------------- -Fri Jun 29 10:02:08 UTC 2012 - dvaleev@suse.com - -- Add configuration support for serial terminal consoles. This will - set the maximum screen size so that text is not overwritten. - -------------------------------------------------------------------- -Fri Jun 29 09:51:59 UTC 2012 - dvaleev@suse.com - -- don't enable grub-emu-usb on ppc ppc641 - -------------------------------------------------------------------- -Thu Jun 28 09:33:26 CEST 2012 - jslaby@suse.de - -- update to 2.0 final - * see ChangeLog for changes - -------------------------------------------------------------------- -Mon Jun 25 11:10:27 UTC 2012 - adrian@suse.de - -- enable xz/lzma support for image file generation - -------------------------------------------------------------------- -Sun Jun 24 18:10:27 UTC 2012 - jslaby@suse.de - -- update to 2.0 beta6, a snapshot from today - * see ChangeLog for changes - -------------------------------------------------------------------- -Fri Jun 22 08:50:12 UTC 2012 - mchang@suse.com - -- do not package grub.cfg, as it's generated at runtime and the - presence of it would confuse pygrub (bnc#768063) - -------------------------------------------------------------------- -Wed May 16 06:38:05 UTC 2012 - mchang@suse.com - -- fix build error on 12.1 caused by autogen aborts because of - absence of guile package - -------------------------------------------------------------------- -Wed May 2 03:17:21 UTC 2012 - mchang@suse.com - -- grub2-automake-1-11-2.patch : fix grub2 build error on newer - autotools (automake >= 1.11.2) -- call ./autogen.sh - -------------------------------------------------------------------- -Thu Apr 19 11:28:44 UTC 2012 - mchang@suse.com - -- grub2-probe-disk-mountby.patch : fix grub2-probe fails on - probing mount-by devices under /dev/disk/by-(id|uuid|path). - (bnc#757746) - -------------------------------------------------------------------- -Thu Mar 29 07:08:38 UTC 2012 - mchang@suse.com - -- Add Requires to os-prober as script depends on it for probing - foreign os (bnc#753229) - -------------------------------------------------------------------- -Wed Mar 21 06:58:43 UTC 2012 - mchang@suse.com - -- Mark %config(noreplace) to /etc/default/grub (bnc#753246) - -------------------------------------------------------------------- -Fri Mar 16 09:21:40 UTC 2012 - aj@suse.de - -- Fix build with gcc 4.7 (needs -fno-strict-aliasing for zfs code). - -------------------------------------------------------------------- -Tue Mar 13 04:06:06 UTC 2012 - mchang@suse.com - -- Fix error in installation to extended partition (bnc#750897) - add grub2-iterate-and-hook-for-extended-partition.patch - add grub2-install-opt-skip-fs-probe.patch - -------------------------------------------------------------------- -Mon Mar 12 09:34:40 UTC 2012 - tittiatcoke@gmail.com - -- Added BuildRequires for gnu-unifont in order to create the - necessary fonts for a graphical boot menu. - -------------------------------------------------------------------- -Mon Feb 20 13:04:51 UTC 2012 - andrea.turrini@gmail.com - -- fixed typos in grub2.spec - -------------------------------------------------------------------- -Mon Jan 2 03:16:13 UTC 2012 - mchang@suse.com - -- platforms without efi should not specify exclusion of it - -------------------------------------------------------------------- -Thu Dec 29 02:31:23 UTC 2011 - mchang@suse.com - -- set --target=%{_target_plaform) explicitly to %configure in case - it wouldn't do that for us implicitly -- when making x86_64-efi image not use i386 target build and keep - use of x86_64. otherwise it would have error "invalid ELF header" - -------------------------------------------------------------------- -Fri Dec 2 16:31:14 UTC 2011 - coolo@suse.com - -- add automake as buildrequire to avoid implicit dependency - -------------------------------------------------------------------- -Mon Nov 28 09:40:44 CET 2011 - jslaby@suse.de - -- remove doubly packaged files -- remove INSTALL from docs -- handle duplicate bindir files - -------------------------------------------------------------------- -Mon Oct 31 13:08:21 CET 2011 - meissner@suse.de - -- make efi exclusion more complete - -------------------------------------------------------------------- -Thu Oct 27 08:16:58 UTC 2011 - aj@suse.de - -- efibootmgr only exists on x86-64 and ia64. - -------------------------------------------------------------------- -Tue Oct 25 08:38:19 UTC 2011 - aj@suse.de - -- Add requires from efi subpackage to main package (bnc#72596) - -------------------------------------------------------------------- -Mon Oct 24 13:11:39 CEST 2011 - jslaby@suse.de - -- update it and pl translations -- cleanup spec file - * don't package efi files to non-efi package - -------------------------------------------------------------------- -Thu Aug 25 14:46:04 UTC 2011 - aj@suse.de - -- Fix directory ownership. - -------------------------------------------------------------------- -Tue Aug 23 12:46:43 UTC 2011 - aj@suse.de - -- Build an efi subpackage [bnc#713595]. - -------------------------------------------------------------------- -Tue Aug 2 12:10:39 UTC 2011 - dvaleev@novell.com - -- enable ppc build -- patch unused-but-set-variable - -------------------------------------------------------------------- -Tue Jul 12 14:03:05 UTC 2011 - aj@suse.de - -- Create submenu for all besides primary Linux kernels. -- Only run preun section during package install but not during - upgrade. - -------------------------------------------------------------------- -Tue Jul 12 11:48:08 UTC 2011 - aj@suse.de - -- Update README.openSUSE - -------------------------------------------------------------------- -Tue May 31 10:42:29 CEST 2011 - jslaby@suse.de - -- update translations -- update to 1.99 final - * See NEWS file for changes - -------------------------------------------------------------------- -Sat May 7 12:33:43 CEST 2011 - jslaby@suse.de - -- fix build with gcc 4.6 -- build in parallel (fixed finally in 1.99) -- add translations from translations project -- update to 1.99-rc2 - * See NEWS file for changes - -------------------------------------------------------------------- -Wed Oct 27 16:57:13 CEST 2010 - jslaby@suse.de - -- fix vanishing of /boot/grub2/* if /boot/grub/device.map - doesn't exist - -------------------------------------------------------------------- -Mon Oct 25 12:39:11 UTC 2010 - jslaby@suse.de - -- add missing " in the default file; add "fi" to grub2-linux.patch - -------------------------------------------------------------------- -Mon Oct 11 22:29:27 CEST 2010 - jslaby@suse.de - -- repack gz to bz2 (0.5M saving) - -------------------------------------------------------------------- -Sat Oct 9 19:16:51 UTC 2010 - aj@suse.de - -- Do not output vmlinux if vmlinuz of same version exists. -- Update default grub file. - -------------------------------------------------------------------- -Sat Oct 9 13:58:31 UTC 2010 - aj@suse.de - -- Add patch grub-1.98-follow-dev-mapper-symlinks.patch from Fedora - for grub2-probe to detect lvm devices correctly - -------------------------------------------------------------------- -Sat Sep 11 23:55:54 CEST 2010 - jslaby@suse.de - -- add gettext "requires" - -------------------------------------------------------------------- -Sun Mar 14 12:11:53 UTC 2010 - aj@suse.de - -- Fix build on x86-64. - -------------------------------------------------------------------- -Fri Mar 12 20:39:25 UTC 2010 - aj@suse.de - -- Don't build parallel. -- Update to grub 1.98 including: - * Multiboot on EFI support. - * Saved default menu entry support, with new utilities `grub-reboot' and - `grub-set-default'. - * Encrypted password support, with a new utility `grub-mkpasswd-pbkdf2'. - * `grub-mkfloppy' removed; use `grub-mkrescue' to create floppy images. - ------------------------------------------------------------------- Fri Feb 12 08:21:10 UTC 2010 - aj@suse.de diff --git a/grub2.rpmlintrc b/grub2.rpmlintrc deleted file mode 100644 index de32ae2..0000000 --- a/grub2.rpmlintrc +++ /dev/null @@ -1,9 +0,0 @@ -addFilter("zero-length /boot/grub2/grub.cfg") -addFilter("non-etc-or-var-file-marked-as-conffile /boot/grub2/grub.cfg") -addFilter("non-conffile-in-etc /etc/bash_completion.d/grub") -addFilter("non-conffile-in-etc /etc/grub.d/README") -addFilter("statically-linked-binary .*/grub2/*/kernel.img") -# We need to supply unstripped files for grub -addFilter("unstripped-binary-or-object .*/grub2/*/.*.mod") -# TODO: s390 Experts: is this sensible?! -addFilter("s390x: W: executable-stack") diff --git a/grub2.spec b/grub2.spec index 0640b10..9e165f8 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,7 +1,7 @@ # -# spec file for package grub2 +# spec file for package grub2 (Version 1.97.2) # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -14,1109 +14,150 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# needssslcertforbuild + Name: grub2 -%ifarch x86_64 ppc64 -BuildRequires: gcc-32bit -BuildRequires: glibc-32bit -BuildRequires: glibc-devel-32bit -%else -BuildRequires: gcc -BuildRequires: glibc-devel -%endif -BuildRequires: automake -BuildRequires: bison -BuildRequires: dejavu-fonts -BuildRequires: device-mapper-devel -BuildRequires: fdupes -BuildRequires: flex -BuildRequires: freetype2-devel -BuildRequires: fuse-devel -%if 0%{?suse_version} >= 1140 -BuildRequires: gnu-unifont -%endif -BuildRequires: help2man -BuildRequires: xz -%if 0%{?suse_version} >= 1210 -BuildRequires: makeinfo -%else -BuildRequires: texinfo -%endif -BuildRequires: python -BuildRequires: xz-devel %ifarch x86_64 -%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110 -BuildRequires: openssl >= 0.9.8 -BuildRequires: pesign-obs-integration +BuildRequires: freetype2-devel-32bit gcc-32bit glibc-devel-32bit libncurses5-32bit libusb-1_0-devel-32bit ncurses-devel-32bit +%else +BuildRequires: freetype2-devel gcc glibc-devel libncurses5 libusb-1_0-devel ncurses-devel %endif -%endif -%if 0%{?suse_version} >= 1210 -# Package systemd services files grub2-once.service -BuildRequires: systemd-rpm-macros -%define has_systemd 1 -%endif -%if 0%{?suse_version} > 1320 -BuildRequires: update-bootloader-rpm-macros -%endif - -# Modules code is dynamically loaded and collected from a _fixed_ path. +BuildRequires: bison flex ruby +# Modules always contain just 32-bit code %define _libdir %{_exec_prefix}/lib - -# Build grub2-emu everywhere (it may be "required" by 'grub2-once') -%define emu 1 - -%ifarch ppc ppc64 ppc64le -%define grubcpu powerpc -%define platform ieee1275 -# emu does not build here yet... :-( -%define emu 0 -%endif - -%ifarch %{ix86} x86_64 -%define grubcpu i386 -%define platform pc -%endif - -%ifarch s390x -%define grubcpu s390x -%define platform emu -%endif - -%ifarch %{arm} -%define grubcpu arm -%define platform uboot -%endif - -%ifarch aarch64 -%define grubcpu arm64 -%define platform efi -%define only_efi 1 -%endif - -%define grubarch %{grubcpu}-%{platform} - -# build efi bootloader on some platforms only: -%if ! 0%{?efi:1} -%global efi %{ix86} x86_64 ia64 aarch64 %{arm} -%endif - -%ifarch %{efi} -%ifarch %{ix86} -%define grubefiarch i386-efi -%else -%ifarch aarch64 -%define grubefiarch arm64-efi -%else -%ifarch %{arm} -%define grubefiarch arm-efi -%else -%define grubefiarch %{_target_cpu}-efi -%endif -%endif -%endif -%endif - -%ifarch %{ix86} -%define grubxenarch i386-xen -%endif - +# 64-bit x86-64 machines use 32-bit boot loader +# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then) %ifarch x86_64 -%define grubxenarch x86_64-xen +%define _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu} %endif - -%if %{platform} == emu -# force %{emu} to 1, e.g. for s390 -%define emu 1 -%endif - -%if 0%{?suse_version} == 1110 -%define only_efi %{nil} -%define only_x86_64 %{nil} -%endif - -Version: 2.02~rc1 -Release: 0 +Version: 1.97.2 +Release: 1 Summary: Bootloader with support for Linux, Multiboot and more -License: GPL-3.0+ Group: System/Boot +License: GPLv3+ Url: http://www.gnu.org/software/grub/ -%define rev 20120622 -Source0: grub-%{version}.tar.xz +Source0: ftp://alpha.gnu.org/gnu/grub/grub-%{version}.tar.gz Source1: 90_persistent Source2: grub.default -Source4: grub2.rpmlintrc -# rsync -Lrtvz translationproject.org::tp/latest/grub/ po -Source5: translations-20140921.tar.xz -Source6: grub2-once -Source7: 20_memtest86+ -Source8: README.ibm3215 -Source10: openSUSE-UEFI-CA-Certificate.crt -Source11: SLES-UEFI-CA-Certificate.crt -Source12: grub2-snapper-plugin.sh -Source14: 80_suse_btrfs_snapshot -Source15: grub2-once.service -Source16: grub2-xen-pv-firmware.cfg -# required hook for systemd-sleep (bsc#941758) -Source17: grub2-systemd-sleep.sh -Source1000: PATCH_POLICY -Patch1: rename-grub-info-file-to-grub2.patch +Source3: README.openSUSE +Patch0: grub-1.95-grubdir.patch +Patch1: grub2-dlsym-v4.patch Patch2: grub2-linux.patch -Patch3: use-grub2-as-a-package-name.patch -Patch4: info-dir-entry.patch -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 -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 -Patch23: grub2-secureboot-no-insmod-on-sb.patch -Patch24: grub2-secureboot-provide-linuxefi-config.patch -Patch29: grub2-secureboot-chainloader.patch -Patch34: grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch -Patch35: grub2-linguas.sh-no-rsync.patch -Patch37: grub2-use-Unifont-for-starfield-theme-terminal.patch -Patch38: grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch -Patch39: grub2-s390x-02-kexec-module-added-to-emu.patch -Patch40: grub2-s390x-03-output-7-bit-ascii.patch -Patch41: grub2-s390x-04-grub2-install.patch -Patch42: grub2-s390x-05-grub2-mkconfig.patch -Patch43: grub2-use-rpmsort-for-version-sorting.patch -Patch53: grub2-getroot-treat-mdadm-ddf-as-simple-device.patch -Patch56: grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch -Patch58: grub2-xen-linux16.patch -Patch59: grub2-efi-disable-video-cirrus-and-bochus.patch -Patch60: grub2-editenv-add-warning-message.patch -Patch61: grub2-vbe-blacklist-preferred-1440x900x32.patch -Patch64: grub2-btrfs-workaround-grub2-once.patch -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 -Patch78: grub2-commands-introduce-read_file-subcommand.patch -Patch79: grub2-efi-chainload-harder.patch -Patch80: grub2-emu-4-all.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 -Patch103: grub2-btrfs-03-follow_default.patch -Patch104: grub2-btrfs-04-grub2-install.patch -Patch105: grub2-btrfs-05-grub2-mkconfig.patch -Patch106: grub2-btrfs-06-subvol-mount.patch -Patch107: grub2-btrfs-07-subvol-fallback.patch -Patch108: grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch -# Support EFI xen loader -Patch120: grub2-efi-xen-chainload.patch -Patch121: grub2-efi-chainloader-root.patch -Patch122: grub2-efi-xen-cmdline.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-Free-malloc-regions-on-exit.patch -# Linux root device related patches -Patch162: grub2-fix-multi-device-root-kernel-argument.patch -Patch163: grub2-zipl-setup-fix-btrfs-multipledev.patch -Patch164: grub2-suse-remove-linux-root-param.patch -# PPC64 LE support -Patch205: grub2-ppc64le-disable-video.patch -Patch207: grub2-ppc64le-memory-map.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 -Patch235: 0002-Add-Virtual-LAN-support.patch -Patch236: grub2-efi_gop-avoid-low-resolution.patch -Patch277: grub2-ppc64-cas-reboot-support.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 -Patch284: 0005-grub.texi-Add-net_bootp6-doument.patch -Patch285: 0006-bootp-Add-processing-DHCPACK-packet-from-HTTP-Boot.patch -Patch286: 0007-efinet-Setting-network-from-UEFI-device-path.patch -Patch287: 0008-efinet-Setting-DNS-server-from-UEFI-protocol.patch -# Fix GOP BLT support (FATE#322332) -Patch311: grub2-efi-gop-add-blt.patch - -Requires: gettext-runtime -%if 0%{?suse_version} >= 1140 -%ifnarch s390x -Recommends: os-prober -%endif -# xorriso not available using grub2-mkrescue (bnc#812681) -Recommends: libburnia-tools -Recommends: mtools -%endif -Requires(post): /sbin/install-info -Requires(preun):/sbin/install-info -%if ! 0%{?only_efi:1} -Requires: grub2-%{grubarch} = %{version}-%{release} -%endif - +PreReq: perl-Bootloader BuildRoot: %{_tmppath}/%{name}-%{version}-build - -%if 0%{?only_x86_64:1} -ExclusiveArch: x86_64 -%else -ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x aarch64 %{arm} -%endif +# TODO: ppc +ExclusiveArch: %{ix86} x86_64 %description -This is the second version of the GRUB (Grand Unified Bootloader), a -highly configurable and customizable bootloader with modular +This is the second version of the GRUB (Grand Unified Bootloader), +a highly configurable and customizable bootloader with modular architecture. It support rich scale of kernel formats, file systems, computer architectures and hardware devices. -This package includes user space utlities to manage GRUB on your system. +PLEASE NOTE: This is a development snapshot, and as such will not +replace grub if you install it, but will be merely added as another +kernel to your existing GRUB menu. Do not replace GRUB (grub package) +with it unless you know what are you doing. Refer to README.openSUSE +file that is part of this package's documentation for more information. -Authors: --------- - Gordon Matzigkeit - Yoshinori K. Okuji - Colin Watson - Colin D. Bennett - Vesa Jääskeläinen - Robert Millan - Carles Pina - -%package branding-upstream - -Summary: Upstream branding for GRUB2's graphical console -Group: System/Fhs -Requires: %{name} = %{version}-%{release} - -%description branding-upstream -Upstream branding for GRUB2's graphical console - -%if ! 0%{?only_efi:1} -%package %{grubarch} - -Summary: Bootloader with support for Linux, Multiboot and more -Group: System/Boot -Requires: %{name} = %{version}-%{release} -Requires(post): %{name} = %{version}-%{release} -%if 0%{?update_bootloader_requires:1} -%update_bootloader_requires -%else -Requires: perl-Bootloader -Requires(post): perl-Bootloader -%endif -%ifarch s390x -# required utilities by grub2-s390x-04-grub2-install.patch -# use 'showconsole' to determine console device. (bnc#876743) -Requires: /sbin/showconsole -# for /sbin/zipl used by grub2-zipl-setup -Requires: s390-tools -%endif -%ifarch ppc64 ppc64le -Requires: powerpc-utils -%endif - -%description %{grubarch} -The GRand Unified Bootloader (GRUB) is a highly configurable and customizable -bootloader with modular architecture. It supports rich variety of kernel formats, -file systems, computer architectures and hardware devices. This subpackage -provides support for %{platform} systems. - -%endif - -%ifarch %{efi} - -%package %{grubefiarch} - -Summary: Bootloader with support for Linux, Multiboot and more -Group: System/Boot -%ifarch ia64 x86_64 aarch64 -#Package is available on ia64, x86_64 and aarch64 only and not necessarily needed -Requires: efibootmgr -Requires(post): efibootmgr -%endif -# Also require efibootmgr on i586 Tumbleweed where it is available -%if 0%{?suse_version} > 1320 -%ifarch i586 -Requires: efibootmgr -Requires(post): efibootmgr -%endif -%endif -Requires: %{name} = %{version}-%{release} -Requires(post): %{name} = %{version}-%{release} -%if 0%{?update_bootloader_requires:1} -%update_bootloader_requires -%else -Requires: perl-Bootloader >= 0.706 -Requires(post): perl-Bootloader >= 0.706 -%endif -Provides: %{name}-efi = %{version}-%{release} -Obsoletes: %{name}-efi < %{version}-%{release} - -%description %{grubefiarch} -The GRand Unified Bootloader (GRUB) is a highly configurable and customizable -bootloader with modular architecture. It supports rich variety of kernel formats, -file systems, computer architectures and hardware devices. This subpackage -provides support for EFI systems. - -%endif - -%ifarch %{ix86} x86_64 - -%package %{grubxenarch} - -Summary: Bootloader with support for Linux, Multiboot and more -Group: System/Boot -Provides: %{name}-xen = %{version}-%{release} -Obsoletes: %{name}-xen < %{version}-%{release} - -%description %{grubxenarch} -The GRand Unified Bootloader (GRUB) is a highly configurable and customizable -bootloader with modular architecture. It supports rich variety of kernel formats, -file systems, computer architectures and hardware devices. This subpackage -provides support for XEN systems. - -%endif - -%package snapper-plugin - -Summary: Grub2's snapper plugin -Group: System/Fhs -Requires: %{name} = %{version}-%{release} -Requires: libxml2-tools -Supplements: packageand(snapper:grub2) -BuildArch: noarch - -%description snapper-plugin -Grub2's snapper plugin for advanced btrfs snapshot boot menu management - -%if 0%{?has_systemd:1} -%package systemd-sleep-plugin - -Summary: Grub2's systemd-sleep plugin -Group: System/Fhs -Requires: grub2 -Requires: util-linux -Supplements: packageand(systemd:grub2) -BuildArch: noarch - -%description systemd-sleep-plugin -Grub2's systemd-sleep plugin for directly booting hibernated kernel image in -swap partition while in resuming -%endif - %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 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch6 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch12 -p1 -%patch15 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 -%patch24 -p1 -%patch29 -p1 -%patch34 -p1 -%patch35 -p1 -%patch37 -p1 -%patch38 -p1 -%patch39 -p1 -%patch40 -p1 -%patch41 -p1 -%patch42 -p1 -%patch43 -p1 -%patch53 -p1 -%patch56 -p1 -%patch58 -p1 -%patch59 -p1 -%patch60 -p1 -%patch61 -p1 -%patch64 -p1 -%patch65 -p1 -%patch70 -p1 -%patch71 -p1 -%patch72 -p1 -%patch74 -p1 -%patch75 -p1 -%patch76 -p1 -%patch77 -p1 -%patch78 -p1 -%patch79 -p1 -%patch80 -p1 -%patch101 -p1 -%patch102 -p1 -%patch103 -p1 -%patch104 -p1 -%patch105 -p1 -%patch106 -p1 -%patch107 -p1 -%patch108 -p1 -%patch120 -p1 -%patch121 -p1 -%patch122 -p1 -%patch140 -p1 -%patch141 -p1 -%patch150 -p1 -%patch162 -p1 -%patch163 -p1 -%patch164 -p1 -%patch205 -p1 -%patch207 -p1 -%patch233 -p1 -%patch234 -p1 -%patch235 -p1 -%patch236 -p1 -%patch277 -p1 -%patch280 -p1 -%patch281 -p1 -%patch282 -p1 -%patch283 -p1 -%patch284 -p1 -%patch285 -p1 -%patch286 -p1 -%patch287 -p1 -%patch311 -p1 - -# 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 -%ifarch %{efi} -mkdir build-efi -%endif -%ifarch %{ix86} x86_64 -mkdir build-xen -%endif -%if %{emu} -mkdir build-emu -%endif +%setup -q -n grub-%{version} +%patch0 -p1 -b .grubdir +%patch1 -p1 -b .dlsym +%patch2 -p0 -b .linux +# README.openSUSE +cp %{SOURCE3} . %build -# autogen calls autoreconf -vi -./autogen.sh -# Not yet: -%define common_conf_options TARGET_LDFLAGS=-static --program-transform-name=s,grub,%{name}, -# This does NOT work on SLE11: -%define _configure ../configure - -# We don't want to let rpm override *FLAGS with default a.k.a bogus values. -CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once " -CXXFLAGS=" " -FFLAGS=" " -export CFLAGS CXXFLAGS FFLAGS - -%if %{emu} -cd build-emu -%define arch_specific --enable-device-mapper --disable-grub-mount -TFLAGS="-fPIC" - +sh autogen.sh # -static is needed so that autoconf script is able to link # test that looks for _start symbol on 64 bit platforms -../configure TARGET_LDFLAGS=$TFLAGS \ - --prefix=%{_prefix} \ - --sysconfdir=%{_sysconfdir} \ - --target=%{_target_platform} \ - --with-platform=emu \ - %{arch_specific} \ +%configure TARGET_LDFLAGS=-static \ + --with-platform=pc \ + --enable-grub-emu \ --program-transform-name=s,grub,%{name}, -make %{?_smp_mflags} -cd .. -if [ "%{platform}" = "emu" ]; then - rmdir build - mv build-emu build -fi -%endif - -%ifarch %{ix86} x86_64 -cd build-xen -../configure \ - TARGET_LDFLAGS=-static \ - --prefix=%{_prefix} \ - --sysconfdir=%{_sysconfdir} \ - --target=%{_target_platform} \ - --libdir=%{_libdir} \ - --with-platform=xen \ - --program-transform-name=s,grub,%{name}, -make %{?_smp_mflags} - -./grub-mkstandalone --grub-mkimage=./grub-mkimage -o grub.xen -O %{grubxenarch} -d grub-core/ "/boot/grub/grub.cfg=%{SOURCE16}" - -cd .. -%endif - -%ifarch %{efi} -cd build-efi -../configure \ - TARGET_LDFLAGS=-static \ - --prefix=%{_prefix} \ - --sysconfdir=%{_sysconfdir} \ - --target=%{_target_platform} \ - --libdir=%{_libdir} \ - --with-platform=efi \ - --program-transform-name=s,grub,%{name}, -make %{?_smp_mflags} - -#TODO: add efifwsetup module - -FS_MODULES="ext2 btrfs ext2 xfs jfs reiserfs" -CD_MODULES=" all_video boot cat chain configfile echo true \ - efinet font gfxmenu gfxterm gzio halt iso9660 \ - jpeg minicmd normal part_apple part_msdos part_gpt \ - password_pbkdf2 png reboot search search_fs_uuid \ - search_fs_file search_label sleep test video fat loadenv" -PXE_MODULES="efinet tftp http" -CRYPTO_MODULES="luks gcry_rijndael gcry_sha1 gcry_sha256" - -%ifarch x86_64 -CD_MODULES="${CD_MODULES} linuxefi" -%else -CD_MODULES="${CD_MODULES} linux" -%endif - -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} -#./grub-mkimage -O %{grubefiarch} -o grub.efi -d grub-core part_gpt hfsplus fat \ -# ext2 btrfs normal chain boot configfile linux appleldr minicmd \ -# loadbios reboot halt search font gfxterm - -%ifarch x86_64 -%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110 -if test -e %{_sourcedir}/_projectcert.crt ; then - prjsubject=$(openssl x509 -in %{_sourcedir}/_projectcert.crt -noout -subject_hash) - prjissuer=$(openssl x509 -in %{_sourcedir}/_projectcert.crt -noout -issuer_hash) - opensusesubject=$(openssl x509 -in %{SOURCE10} -noout -subject_hash) - slessubject=$(openssl x509 -in %{SOURCE11} -noout -subject_hash) - if test "$prjissuer" = "$opensusesubject" ; then - cert=%{SOURCE10} - fi - if test "$prjissuer" = "$slessubject" ; then - cert=%{SOURCE11} - fi - if test "$prjsubject" = "$prjissuer" ; then - cert=%{_sourcedir}/_projectcert.crt - fi -fi -if test -z "$cert" ; then - echo "cannot identify project, assuming openSUSE signing" - cert=%{SOURCE10} -fi - -openssl x509 -in $cert -outform DER -out grub.der -%endif -%endif - -cd .. -%endif - -%if ! 0%{?only_efi:1} -cd build - -# 64-bit x86-64 machines use 32-bit boot loader -# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then) -%ifarch x86_64 -%define _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu} -%endif - -%if %{platform} != "emu" -%define arch_specific --enable-device-mapper -TFLAGS="-static" - -# -static is needed so that autoconf script is able to link -# test that looks for _start symbol on 64 bit platforms -../configure TARGET_LDFLAGS=$TFLAGS \ - --prefix=%{_prefix} \ - --sysconfdir=%{_sysconfdir} \ - --target=%{_target_platform} \ - --with-platform=%{platform} \ - %{arch_specific} \ - --program-transform-name=s,grub,%{name}, -make %{?_smp_mflags} -%endif -cd .. -%endif +%__make %{?jobs:-j%jobs} %install - -%ifarch %{ix86} x86_64 -cd build-xen make DESTDIR=$RPM_BUILD_ROOT install -install -m 644 grub.xen $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubxenarch}/. -cd .. -%endif - -%ifarch %{efi} -cd build-efi -make DESTDIR=$RPM_BUILD_ROOT install - -install -m 644 grub.efi $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubefiarch}/. - -# Create grub.efi link to system efi directory -# This is for tools like kiwi not fiddling with the path -%if "%{grubefiarch}" == "x86_64-efi" -%define sysefidir %{_exec_prefix}/lib64/efi -%else -%define sysefidir %{_libdir}/efi -%endif -install -d $RPM_BUILD_ROOT%{sysefidir} -ln -sf ../../../%{_libdir}/%{name}/%{grubefiarch}/grub.efi $RPM_BUILD_ROOT%{sysefidir}/grub.efi - -%ifarch x86_64 -%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110 -export BRP_PESIGN_FILES="%{_libdir}/%{name}/%{grubefiarch}/grub.efi" -install -m 444 grub.der $RPM_BUILD_ROOT%{sysefidir}/ -%endif -%endif - -cd .. -%endif - -%if ! 0%{?only_efi:1} -cd build -make DESTDIR=$RPM_BUILD_ROOT install -cd .. -%endif - -if [ -d build-emu/grub-core ]; then - cd build-emu/grub-core - install -m 755 grub-emu $RPM_BUILD_ROOT%{_bindir}/%{name}-emu - install -m 755 grub-emu-lite $RPM_BUILD_ROOT%{_bindir}/%{name}-emu-lite - install -m 644 grub-emu.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}-emu.1 - cd ../.. -fi - -# *.module files are installed with executable bits due to the way grub2 build -# system works. Clear executable bits to not confuse find-debuginfo.sh -find $RPM_BUILD_ROOT%{_libdir}/%{name} \ - \( -name '*.module' -o -name '*.image' -o -name '*.exec' \) -print0 | \ - xargs --no-run-if-empty -0 chmod a-x - # Script that makes part of grub.cfg persist across updates install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/grub.d/ - -# Script to generate memtest86+ menu entry -install -m 755 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/grub.d/ - # Ghost config file install -d $RPM_BUILD_ROOT/boot/%{name} touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg - -# Remove devel files -rm $RPM_BUILD_ROOT/%{_libdir}/%{name}/*/*.h -%if 0%{?suse_version} >= 1140 -rm $RPM_BUILD_ROOT%{_datadir}/%{name}/*.h -%endif - +ln -s ../boot/%{name}/grub.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.cfg +# XXX: Remove for now, should be renamed to grub2.info +rm $RPM_BUILD_ROOT/%{_infodir}/grub.info* # Defaults install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub -install -m 755 -D %{SOURCE6} $RPM_BUILD_ROOT%{_sbindir}/grub2-once -install -m 755 -D %{SOURCE12} $RPM_BUILD_ROOT%{_libdir}/snapper/plugins/grub -install -m 755 -D %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/grub.d/80_suse_btrfs_snapshot -%if 0%{?has_systemd:1} -install -m 644 -D %{SOURCE15} $RPM_BUILD_ROOT%{_unitdir}/grub2-once.service -install -m 755 -D %{SOURCE17} $RPM_BUILD_ROOT%{_libdir}/systemd/system-sleep/grub2.sleep -%endif - -R=$RPM_BUILD_ROOT -%ifarch %{ix86} x86_64 -%else -rm -f $R%{_sysconfdir}/grub.d/20_memtest86+ -%endif - -%ifarch ppc ppc64 ppc64le -%else -rm -f $R%{_sysconfdir}/grub.d/20_ppc_terminfo -%endif - -%ifarch s390x -mv $R%{_sysconfdir}/{grub.d,default}/zipl2grub.conf.in -chmod 600 $R%{_sysconfdir}/default/zipl2grub.conf.in - -%define dracutlibdir %{_prefix}/lib/dracut -%define dracutgrubmoddir %{dracutlibdir}/modules.d/99grub2 -install -m 755 -d $R%{dracutgrubmoddir} -for f in module-setup.sh grub2.sh; do - mv $R%{_libdir}/%{name}/%{grubarch}/dracut-$f $R%{dracutgrubmoddir}/$f -done -rm -f $R%{_sysconfdir}/grub.d/30_os-prober - -perl -ni -e ' - sub END() { - print "\n# on s390x always:\nGRUB_DISABLE_OS_PROBER=true\n"; - } - if ( s{^#(GRUB_DISABLE_LINUX_RECOVERY)=\"?(true)\"?}{$1=$2} ) { - $_ .= "GRUB_DISABLE_RECOVERY=true\n"; - } - if ( s{^#?(GRUB_TERMINAL)=(console|gfxterm)}{$1=console} ) { - $_ .= "GRUB_GFXPAYLOAD_LINUX=text\n"; - } - if ( m{^# The resolution used on graphical} || - m{^# # note that you can use only modes} || - m{^# you can see them in real GRUB} || - m{^#?GRUB_GFXMODE=} ) { - next; - } - s{openSUSE}{SUSE Linux Enterprise Server} if (m{^GRUB_DISTRIBUTOR}); - print; -' $RPM_BUILD_ROOT%{_sysconfdir}/default/grub -%else -%endif - -%find_lang %{name} -%fdupes %buildroot%{_bindir} -%fdupes %buildroot%{_libdir} - -%pre -%service_add_pre grub2-once.service - -%post -%service_add_post grub2-once.service -/sbin/install-info %{_infodir}/grub-dev.info %{_infodir}/dir || : -/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || : - -%if ! 0%{?only_efi:1} - -%post %{grubarch} -%if 0%{?update_bootloader_check_type_reinit_post:1} -%update_bootloader_check_type_reinit_post grub2 -%else -# To check by current loader settings -if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then - . %{_sysconfdir}/sysconfig/bootloader +#%post +exec >/dev/null 2>&1 +# Create device.map or reuse one from GRUB Legacy +if [ -e /boot/grub/device.map ] ; then + cp -u /boot/grub/device.map /boot/%{name}/device.map 2>/dev/null || + %{name}-mkdevicemap + # Determine the partition with /boot + BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}')) + # Generate core.img, but don't let it be installed in boot sector + %{name}-install --grub-setup=/bin/true $BOOT_PARTITION + # Remove stale menu.lst entries + /sbin/update-bootloader --remove --image /boot/%{name}/core.img --name="GNU GRUB 2" + # Add core.img as multiboot kernel to GRUB Legacy menu + /sbin/update-bootloader --add --image /boot/%{name}/core.img --name="GNU GRUB 2" + /sbin/update-bootloader --refresh fi -# If the grub is the current loader, we'll handle the grub2 testing entry -if [ "x${LOADER_TYPE}" = "xgrub" ]; then - - exec >/dev/null 2>&1 - - # check if entry for grub2's core.img exists in the config - # if yes, we will correct obsoleted path and update grub2 stuff and config to make it work - # if no, do nothing - if [ -f /boot/grub/menu.lst ]; then - - # If grub config contains obsolete core.img path, remove and use the new one - if /usr/bin/grep -l "^\s*kernel\s*.*/boot/%{name}/core.img" /boot/grub/menu.lst; then - /sbin/update-bootloader --remove --image /boot/%{name}/core.img || true - /sbin/update-bootloader --add --image /boot/%{name}/i386-pc/core.img --name "GNU GRUB 2" || true - fi - - # Install grub2 stuff and config to make the grub2 testing entry to work with updated version - if /usr/bin/grep -l "^\s*kernel\s*.*/boot/%{name}/i386-pc/core.img" /boot/grub/menu.lst; then - # Determine the partition with /boot - BOOT_PARTITION=$(df -h /boot | sed -n '2s/[[:blank:]].*//p') - # Generate core.img, but don't let it be installed in boot sector - %{name}-install --no-bootsector $BOOT_PARTITION || true - # Create a working grub2 config, otherwise that entry is un-bootable - /usr/sbin/grub2-mkconfig -o /boot/%{name}/grub.cfg - fi - fi - -elif [ "x${LOADER_TYPE}" = "xgrub2" ]; then - - # It's enought to call update-bootloader to install grub2 and update it's config - # Use new --reinit, if not available use --refresh - # --reinit: install and update bootloader config - # --refresh: update bootloader config - /sbin/update-bootloader --reinit 2>&1 | grep -q 'Unknown option: reinit' && - /sbin/update-bootloader --refresh || true -fi -%endif - -%posttrans %{grubarch} -%{?update_bootloader_posttrans} - -%endif - -%ifarch %{efi} - -%post %{grubefiarch} -%if 0%{?update_bootloader_check_type_reinit_post:1} -%update_bootloader_check_type_reinit_post grub2-efi -%else -# To check by current loader settings -if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then - . %{_sysconfdir}/sysconfig/bootloader -fi - -if [ "x${LOADER_TYPE}" = "xgrub2-efi" ]; then - - if [ -d /boot/%{name}-efi ]; then - # Migrate settings to standard prefix /boot/grub2 - for i in custom.cfg grubenv; do - [ -f /boot/%{name}-efi/$i ] && cp -a /boot/%{name}-efi/$i /boot/%{name} || : - done - - fi - - # It's enough to call update-bootloader to install grub2 and update it's config - # Use new --reinit, if not available use --refresh - # --reinit: install and update bootloader config - # --refresh: update bootloader config - /sbin/update-bootloader --reinit 2>&1 | grep -q 'Unknown option: reinit' && - /sbin/update-bootloader --refresh || true -fi - -if [ -d /boot/%{name}-efi ]; then - mv /boot/%{name}-efi /boot/%{name}-efi.rpmsave -fi - -exit 0 -%endif - -%posttrans %{grubefiarch} -%{?update_bootloader_posttrans} - -%endif - %preun -%service_del_preun grub2-once.service -if [ $1 = 0 ]; then - /sbin/install-info --delete %{_infodir}/grub-dev.info %{_infodir}/dir || : - /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || : - -# We did not add core.img to grub1 menu.lst in new update-bootloader macro as what -# the old %post ever did, then the %preun counterpart which removed the added core.img -# entry from old %post can be skipped entirely if having new macro in use. -%if ! 0%{?update_bootloader_posttrans:1}%{?only_efi:1} - # To check by current loader settings - if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then - . %{_sysconfdir}/sysconfig/bootloader - fi - - if [ "x${LOADER_TYPE}" = "xgrub" ]; then - - exec >/dev/null 2>&1 - - if [ -f /boot/grub/menu.lst ]; then - - # Remove grub2 testing entry in menu.lst if has any - for i in /boot/%{name}/core.img /boot/%{name}/i386-pc/core.img; do - if /usr/bin/grep -l "^\s*kernel\s*.*$i" /boot/grub/menu.lst; then - /sbin/update-bootloader --remove --image "$i" || true - fi - done - fi - - # Cleanup config, to not confuse some tools determining bootloader in use - rm -f /boot/%{name}/grub.cfg - - # Cleanup installed files - # Unless grub2 provides grub2-uninstall, we don't remove any file because - # we have no idea what's been installed. (And a blind remove is dangerous - # to remove user's or other package's file accidently ..) - fi -%endif +exec >/dev/null +if [ -e /boot/%{name}/core.img ] ; then + /sbin/update-bootloader --remove --image /boot/%{name}/core.img --name="GNU GRUB 2" + /sbin/update-bootloader --refresh + ## XXX Ugly + rm -f /boot/%{name}/*.mod + rm -f /boot/%{name}/*.img + rm -f /boot/%{name}/*.lst + rm -f /boot/%{name}/device.map fi +#%triggerin -- kernel, kernel-PAE +#exec >/dev/null 2>&1 +## Generate grub.cfg +#%{name}-mkconfig +# +# +#%triggerun -- kernel, kernel-PAE +#exec >/dev/null 2>&1 +## Generate grub.cfg +#%{name}-mkconfig -%postun -%service_del_postun grub2-once.service - -%files -f %{name}.lang +%files %defattr(-,root,root,-) -%doc COPYING NEWS README -%doc THANKS TODO ChangeLog -%doc docs/autoiso.cfg docs/osdetect.cfg -%ifarch s390x -%doc README.ibm3215 -%endif -%dir /boot/%{name} -%ghost /boot/%{name}/grub.cfg -%{_sysconfdir}/bash_completion.d/grub -%config(noreplace) %{_sysconfdir}/default/grub -%dir %{_sysconfdir}/grub.d -%{_sysconfdir}/grub.d/README -%config %{_sysconfdir}/grub.d/00_header -%config %{_sysconfdir}/grub.d/10_linux -%config %{_sysconfdir}/grub.d/20_linux_xen -%config %{_sysconfdir}/grub.d/40_custom -%config %{_sysconfdir}/grub.d/41_custom -%config %{_sysconfdir}/grub.d/90_persistent -%config %{_sysconfdir}/grub.d/95_textmode +%{_libdir}/%{name} +%{_libdir}/grub/ +%{_sbindir}/%{name}-mkdevicemap %{_sbindir}/%{name}-install -%{_sbindir}/%{name}-mkconfig -%{_sbindir}/%{name}-once +%{_sbindir}/%{name}-emu %{_sbindir}/%{name}-probe -%{_sbindir}/%{name}-reboot -%{_sbindir}/%{name}-set-default -%{_bindir}/%{name}-editenv -%{_bindir}/%{name}-file -%{_bindir}/%{name}-fstest -%{_bindir}/%{name}-kbdcomp -%{_bindir}/%{name}-menulst2cfg -%{_bindir}/%{name}-mkfont +%{_sbindir}/%{name}-setup +%{_sbindir}/%{name}-mkconfig %{_bindir}/%{name}-mkimage -%{_bindir}/%{name}-mklayout -%{_bindir}/%{name}-mknetdir -%{_bindir}/%{name}-mkpasswd-pbkdf2 -%{_bindir}/%{name}-mkrelpath +%{_bindir}/%{name}-mkelfimage +%{_bindir}/%{name}-editenv +%{_bindir}/%{name}-fstest +%{_bindir}/%{name}-mkfont %{_bindir}/%{name}-mkrescue -%{_bindir}/%{name}-mkstandalone -%{_bindir}/%{name}-render-label -%{_bindir}/%{name}-script-check -%{_bindir}/%{name}-syslinux2cfg -%if 0%{?has_systemd:1} -%{_unitdir}/grub2-once.service -%endif -%dir %{_libdir}/%{name} -%dir %{_datadir}/%{name} -%dir %{_datadir}/%{name}/themes -%if 0%{?suse_version} >= 1140 -%{_datadir}/%{name}/*.pf2 -%endif -%{_datadir}/%{name}/grub-mkconfig_lib -%{_infodir}/grub-dev.info* -%{_infodir}/%{name}.info* -%{_mandir}/man1/%{name}-editenv.1.* -%{_mandir}/man1/%{name}-file.1.* -%{_mandir}/man1/%{name}-fstest.1.* -%{_mandir}/man1/%{name}-kbdcomp.1.* -%{_mandir}/man1/%{name}-menulst2cfg.1.* -%{_mandir}/man1/%{name}-mkfont.1.* -%{_mandir}/man1/%{name}-mkimage.1.* -%{_mandir}/man1/%{name}-mklayout.1.* -%{_mandir}/man1/%{name}-mknetdir.1.* -%{_mandir}/man1/%{name}-mkpasswd-pbkdf2.1.* -%{_mandir}/man1/%{name}-mkrelpath.1.* -%{_mandir}/man1/%{name}-mkrescue.1.* -%{_mandir}/man1/%{name}-mkstandalone.1.* -%{_mandir}/man1/%{name}-render-label.1.* -%{_mandir}/man1/%{name}-script-check.1.* -%{_mandir}/man1/%{name}-syslinux2cfg.1.* -%{_mandir}/man8/%{name}-install.8.* -%{_mandir}/man8/%{name}-mkconfig.8.* -%{_mandir}/man8/%{name}-probe.8.* -%{_mandir}/man8/%{name}-reboot.8.* -%{_mandir}/man8/%{name}-set-default.8.* -%if %{emu} -%{_bindir}/%{name}-emu* -%{_mandir}/man1/%{name}-emu.1.* -%endif -%ifnarch s390x -%config %{_sysconfdir}/grub.d/30_os-prober -%{_bindir}/%{name}-glue-efi -%{_bindir}/%{name}-mount -%{_sbindir}/%{name}-bios-setup -%{_sbindir}/%{name}-macbless -%{_sbindir}/%{name}-ofpathname -%{_sbindir}/%{name}-sparc64-setup -%{_mandir}/man1/%{name}-glue-efi.1.* -%{_mandir}/man1/%{name}-mount.1.* -%{_mandir}/man8/%{name}-bios-setup.8.* -%{_mandir}/man8/%{name}-macbless.8.* -%{_mandir}/man8/%{name}-ofpathname.8.* -%{_mandir}/man8/%{name}-sparc64-setup.8.* -%endif - -%files branding-upstream -%defattr(-,root,root,-) -%{_datadir}/%{name}/themes/starfield - -%if ! 0%{?only_efi:1} - -%files %{grubarch} -%defattr(-,root,root,-) -%ifarch %{ix86} x86_64 -%config %{_sysconfdir}/grub.d/20_memtest86+ -%endif -%dir %{_libdir}/%{name}/%{grubarch} -%ifarch ppc ppc64 ppc64le -%config %{_sysconfdir}/grub.d/20_ppc_terminfo -# This is intentionally "grub.chrp" and not "%{name}.chrp" -%{_libdir}/%{name}/%{grubarch}/grub.chrp -%{_libdir}/%{name}/%{grubarch}/bootinfo.txt -%endif -%ifnarch ppc ppc64 ppc64le s390x %{arm} -%{_libdir}/%{name}/%{grubarch}/*.image -%endif -%{_libdir}/%{name}/%{grubarch}/*.img -%{_libdir}/%{name}/%{grubarch}/*.lst -%{_libdir}/%{name}/%{grubarch}/*.mod -%{_libdir}/%{name}/%{grubarch}/*.module -%ifarch x86_64 -%{_libdir}/%{name}/%{grubarch}/efiemu*.o -%endif -%{_libdir}/%{name}/%{grubarch}/gdb_grub -%{_libdir}/%{name}/%{grubarch}/gmodule.pl -%{_libdir}/%{name}/%{grubarch}/kernel.exec -%{_libdir}/%{name}/%{grubarch}/modinfo.sh -%endif -%ifarch s390x -%{_sbindir}/%{name}-zipl-setup -%config(noreplace) %{_sysconfdir}/default/zipl2grub.conf.in -%{dracutlibdir} -%endif - -%ifarch %{efi} - -%files %{grubefiarch} -%defattr(-,root,root,-) -%dir %{_libdir}/%{name}/%{grubefiarch} -%{_libdir}/%{name}/%{grubefiarch}/grub.efi -%{_libdir}/%{name}/%{grubefiarch}/*.img -%{_libdir}/%{name}/%{grubefiarch}/*.lst -%{_libdir}/%{name}/%{grubefiarch}/*.mod -%{_libdir}/%{name}/%{grubefiarch}/*.module -%{_libdir}/%{name}/%{grubefiarch}/gdb_grub -%{_libdir}/%{name}/%{grubefiarch}/gmodule.pl -%{_libdir}/%{name}/%{grubefiarch}/kernel.exec -%{_libdir}/%{name}/%{grubefiarch}/modinfo.sh -%dir %{sysefidir} -%{sysefidir}/grub.efi - -%ifarch x86_64 -%if 0%{?suse_version} >= 1230 || 0%{?suse_version} == 1110 -%{sysefidir}/grub.der -%endif -%endif -%endif - -%files snapper-plugin -%defattr(-,root,root,-) -%dir %{_libdir}/snapper -%dir %{_libdir}/snapper/plugins -%config %{_sysconfdir}/grub.d/80_suse_btrfs_snapshot -%{_libdir}/snapper/plugins/grub - -%ifarch %{ix86} x86_64 -%files %{grubxenarch} -%dir %{_libdir}/%{name}/%{grubxenarch} -%{_libdir}/%{name}/%{grubxenarch}/* -%endif - -%if 0%{?has_systemd:1} -%files systemd-sleep-plugin -%defattr(-,root,root,-) -%dir %{_libdir}/systemd/system-sleep -%{_libdir}/systemd/system-sleep/grub2.sleep -%endif +%dir %{_sysconfdir}/grub.d +%config %{_sysconfdir}/grub.d/??_* +%{_sysconfdir}/grub.d/README +%{_sysconfdir}/%{name}.cfg +%config %{_sysconfdir}/default/grub +%dir /boot/%{name} +# Actually, this is replaced by update-grub from scriptlets, +# but it takes care of modified persistent part +%config(noreplace) /boot/%{name}/grub.cfg +%doc COPYING INSTALL NEWS README THANKS TODO ChangeLog README.openSUSE +#%exclude %{_mandir} +#%{_infodir}/%{name}.info* %changelog diff --git a/info-dir-entry.patch b/info-dir-entry.patch deleted file mode 100644 index 4a9a9af..0000000 --- a/info-dir-entry.patch +++ /dev/null @@ -1,29 +0,0 @@ -Index: grub-2.02~beta3/docs/grub.texi -=================================================================== ---- grub-2.02~beta3.orig/docs/grub.texi -+++ grub-2.02~beta3/docs/grub.texi -@@ -32,15 +32,15 @@ Invariant Sections. - - @dircategory Kernel - @direntry --* GRUB: (grub). The GRand Unified Bootloader --* grub-install: (grub)Invoking grub-install. Install GRUB on your drive --* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration --* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2. --* grub-mkrelpath: (grub)Invoking grub-mkrelpath. --* grub-mkrescue: (grub)Invoking grub-mkrescue. Make a GRUB rescue image --* grub-mount: (grub)Invoking grub-mount. Mount a file system using GRUB --* grub-probe: (grub)Invoking grub-probe. Probe device information --* grub-script-check: (grub)Invoking grub-script-check. -+* GRUB2: (grub2). The GRand Unified Bootloader -+* grub2-install: (grub2)Invoking grub-install. Install GRUB on your drive -+* grub2-mkconfig: (grub2)Invoking grub-mkconfig. Generate GRUB configuration -+* grub2-mkpasswd-pbkdf2: (grub2)Invoking grub-mkpasswd-pbkdf2. -+* grub2-mkrelpath: (grub2)Invoking grub-mkrelpath. -+* grub2-mkrescue: (grub2)Invoking grub-mkrescue. Make a GRUB rescue image -+* grub2-mount: (grub2)Invoking grub-mount. Mount a file system using GRUB -+* grub2-probe: (grub2)Invoking grub-probe. Probe device information -+* grub2-script-check: (grub2)Invoking grub-script-check. - @end direntry - - @setchapternewpage odd diff --git a/not-display-menu-when-boot-once.patch b/not-display-menu-when-boot-once.patch deleted file mode 100644 index c264c19..0000000 --- a/not-display-menu-when-boot-once.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 78270522e8b8c0674941e0752c245dd8468e5bf8 Mon Sep 17 00:00:00 2001 -From: Michael Chang -Date: Wed, 1 Aug 2012 15:46:34 +0800 -Subject: [PATCH] not display menu when boot once - -References: bnc#771587 -Patch-Mainline: no - -We should prevent the menu from being displayed if boot once is -specified. This is in order to compliant with Grub1's behavior -and is better than current as it's not make any sense to bother -user to make decision when decision has been made. ---- - util/grub.d/00_header.in | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -Index: grub-2.02~beta2/util/grub.d/00_header.in -=================================================================== ---- grub-2.02~beta2.orig/util/grub.d/00_header.in -+++ grub-2.02~beta2/util/grub.d/00_header.in -@@ -304,7 +304,9 @@ make_timeout () - style="menu" - fi - cat << EOF --if [ x\$feature_timeout_style = xy ] ; then -+if [ x\${boot_once} = xtrue ]; then -+ set timeout=0 -+elif [ x\$feature_timeout_style = xy ] ; then - set timeout_style=${style} - set timeout=${timeout} - EOF diff --git a/openSUSE-UEFI-CA-Certificate.crt b/openSUSE-UEFI-CA-Certificate.crt deleted file mode 100644 index eb49085..0000000 --- a/openSUSE-UEFI-CA-Certificate.crt +++ /dev/null @@ -1,26 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEdDCCA1ygAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgTEgMB4GA1UEAwwXb3Bl -blNVU0UgU2VjdXJlIEJvb3QgQ0ExCzAJBgNVBAYTAkRFMRIwEAYDVQQHDAlOdXJl -bWJlcmcxGTAXBgNVBAoMEG9wZW5TVVNFIFByb2plY3QxITAfBgkqhkiG9w0BCQEW -EmJ1aWxkQG9wZW5zdXNlLm9yZzAeFw0xMzA4MjYxNjEyMDdaFw0zNTA3MjIxNjEy -MDdaMIGBMSAwHgYDVQQDDBdvcGVuU1VTRSBTZWN1cmUgQm9vdCBDQTELMAkGA1UE -BhMCREUxEjAQBgNVBAcMCU51cmVtYmVyZzEZMBcGA1UECgwQb3BlblNVU0UgUHJv -amVjdDEhMB8GCSqGSIb3DQEJARYSYnVpbGRAb3BlbnN1c2Uub3JnMIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3t9hknqk/oPRfTtoDrGn8E6Sk/xHPnAt -Tojcmp76M7Sm2w4jwQ2owdVlBIQE/zpIGE85MuTKTvkEnp8PzSBdYaunANil/yt/ -vuhHwy9bAsi73o4a6UbThu//iJmQ6xCJuIs/PqgHxlV6btNf/IM8PRbtJsUTc5Kx -cB4ilcgAbCV2RvGi2dCwmGgPpy2xDWeJypRK6hLFkVV2f2x6LvkYiZ/49CRD1TVq -ywAOLu1L4l0J2BuXcJmeWm+mgaidqVh2fWlxgtO6OpZDm/DaFcZO6cgVuenLx+Rx -zuoQG2vEKnABqVK0F94AUs995P0PTQMYspAo1G/Erla8NmBJRotrCwIDAQABo4H0 -MIHxMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFGhCYA3iLExHfpW+I9/qlRPl -lxdiMIGuBgNVHSMEgaYwgaOAFGhCYA3iLExHfpW+I9/qlRPllxdioYGHpIGEMIGB -MSAwHgYDVQQDDBdvcGVuU1VTRSBTZWN1cmUgQm9vdCBDQTELMAkGA1UEBhMCREUx -EjAQBgNVBAcMCU51cmVtYmVyZzEZMBcGA1UECgwQb3BlblNVU0UgUHJvamVjdDEh -MB8GCSqGSIb3DQEJARYSYnVpbGRAb3BlbnN1c2Uub3JnggEBMA4GA1UdDwEB/wQE -AwIBhjANBgkqhkiG9w0BAQsFAAOCAQEAiqOJwo7Z+YIL8zPO6RkXF6NlgM0zrgZR -Vim2OId79J38KI6q4FMSDjpgxwbYOmF2O3cI9JSkjHxHOpnYhJsXzCBiLuJ25MY2 -DSbpLlM1Cvs6NZNFw5OCwQvzCOlXH1k3qdBsafto6n87r9P3WSeO1MeWc/QMCvc+ -5K9sjMd6bwl59EEf428R+z5ssaB75JK3yvky9d7DsHN947OCXc3sYdz+DD7Gteds -LV2Sc//tqmqpm2aeXjptcLAxwM7fLyEQaAyH83egMzEKDxX27jKIxZpTcc0NGqEo -idC/9lasSzs2BisBxevl3HKDPZSsKIMT+8FdJ5wT9jJf9h9Ktz5Tig== ------END CERTIFICATE----- diff --git a/ready b/ready new file mode 100644 index 0000000..473a0f4 diff --git a/rename-grub-info-file-to-grub2.patch b/rename-grub-info-file-to-grub2.patch deleted file mode 100644 index 634e8e4..0000000 --- a/rename-grub-info-file-to-grub2.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 031abf80020b2fa75850d6e09f4489b687a5cb19 Mon Sep 17 00:00:00 2001 -From: Jiri Slaby -Date: Sun, 24 Jun 2012 15:40:40 +0200 -Subject: [PATCH] rename grub info file to grub2 - -Signed-off-by: Jiri Slaby - -From: Andrey Borzenkov -Do not rename file here. quilt does not support it and creates the -whole file if patch needs refreshing. It means that to regenerate two -files - Makefile.core.am and Makefile.util.am - it may be necessary to -manually rename it. ---- - -Index: grub-2.02~beta3/docs/Makefile.am -=================================================================== ---- grub-2.02~beta3.orig/docs/Makefile.am 2016-02-28 19:19:14.788874638 +0300 -+++ grub-2.02~beta3/docs/Makefile.am 2016-02-28 19:19:14.780874638 +0300 -@@ -1,7 +1,7 @@ - AUTOMAKE_OPTIONS = subdir-objects - - # AM_MAKEINFOFLAGS = --no-split --no-validate --info_TEXINFOS = grub.texi grub-dev.texi -+info_TEXINFOS = grub2.texi grub-dev.texi - grub_TEXINFOS = fdl.texi - - EXTRA_DIST = font_char_metrics.png font_char_metrics.txt -Index: grub-2.02~beta3/docs/grub.texi -=================================================================== ---- grub-2.02~beta3.orig/docs/grub.texi 2016-02-28 19:19:14.788874638 +0300 -+++ grub-2.02~beta3/docs/grub.texi 2016-02-28 19:19:14.784874638 +0300 -@@ -1,7 +1,7 @@ - \input texinfo - @c -*-texinfo-*- - @c %**start of header --@setfilename grub.info -+@setfilename grub2.info - @include version.texi - @settitle GNU GRUB Manual @value{VERSION} - @c Unify all our little indices for now. diff --git a/translations-20140921.tar.xz b/translations-20140921.tar.xz deleted file mode 100644 index 5700810..0000000 --- a/translations-20140921.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:36885e7f4039a2634a0abeca7f8ab631c32abc5977119eb33c06c752fb3cecc5 -size 516764 diff --git a/use-grub2-as-a-package-name.patch b/use-grub2-as-a-package-name.patch deleted file mode 100644 index 890714f..0000000 --- a/use-grub2-as-a-package-name.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 3729b131ef1dcaa043242e8074418249695d381b Mon Sep 17 00:00:00 2001 -From: Jiri Slaby -Date: Sun, 24 Jun 2012 20:51:52 +0200 -Subject: [PATCH] use grub2 as a package name - -This will ease all of the renaming of directories and all the pkgdata -hacks. - -Signed-off-by: Jiri Slaby ---- - configure | 24 ++++++++++++------------ - configure.ac | 2 +- - 2 files changed, 13 insertions(+), 13 deletions(-) - -Index: grub-2.02~rc1/configure.ac -=================================================================== ---- grub-2.02~rc1.orig/configure.ac -+++ grub-2.02~rc1/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~rc1],[bug-grub@gnu.org]) -+AC_INIT([GRUB2],[2.02~rc1],[bug-grub@gnu.org]) - - AC_CONFIG_AUX_DIR([build-aux]) -