From 874c4add0aa91b4d5d5a6665790c95d9f8757d81 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sat, 20 Apr 2013 17:57:06 +0000 Subject: [PATCH 1/1] - grub2 from PLD --- ...parate-DNS-queries-for-ipv4-and-ipv6.patch | 230 +++++++ add-GRUB-DISABLE-SUBMENU-option.patch | 114 ++++ add-X-option-to-printf-functions.patch | 58 ++ add-vlan-tag-support.patch | 185 ++++++ choose-preferred-initrd.patch | 50 ++ dhcp-client-id-and-uuid-options-added.patch | 121 ++++ fix-http-crash.patch | 28 + grub-custom.cfg | 11 + grub-garbage.patch | 11 + grub-lvmdevice.patch | 24 + grub-mkconfig-diagnostics.patch | 212 +++++++ grub.sysconfig | 51 ++ grub2-awk.patch | 12 + grub2-fonts_path.patch | 12 + grub2-gets.patch | 11 + grub2-tftp_fix.patch | 36 ++ grub2.spec | 575 ++++++++++++++++++ ignore-kernel-symlinks.patch | 12 + just-say-linux.patch | 45 ++ pld-mkconfigdir.patch | 24 + pld-sysconfdir.patch | 41 ++ posix.patch | 9 + ppc.patch | 27 + ...for-specific-config-file-for-netboot.patch | 205 +++++++ sort-version.patch | 29 + update-grub | 26 + update-grub.8 | 18 + 27 files changed, 2177 insertions(+) create mode 100644 Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch create mode 100644 add-GRUB-DISABLE-SUBMENU-option.patch create mode 100644 add-X-option-to-printf-functions.patch create mode 100644 add-vlan-tag-support.patch create mode 100644 choose-preferred-initrd.patch create mode 100644 dhcp-client-id-and-uuid-options-added.patch create mode 100644 fix-http-crash.patch create mode 100644 grub-custom.cfg create mode 100644 grub-garbage.patch create mode 100644 grub-lvmdevice.patch create mode 100644 grub-mkconfig-diagnostics.patch create mode 100644 grub.sysconfig create mode 100644 grub2-awk.patch create mode 100644 grub2-fonts_path.patch create mode 100644 grub2-gets.patch create mode 100644 grub2-tftp_fix.patch create mode 100644 grub2.spec create mode 100644 ignore-kernel-symlinks.patch create mode 100644 just-say-linux.patch create mode 100644 pld-mkconfigdir.patch create mode 100644 pld-sysconfdir.patch create mode 100644 posix.patch create mode 100644 ppc.patch create mode 100644 search-for-specific-config-file-for-netboot.patch create mode 100644 sort-version.patch create mode 100644 update-grub create mode 100644 update-grub.8 diff --git a/Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch b/Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch new file mode 100644 index 0000000..953f2bd --- /dev/null +++ b/Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch @@ -0,0 +1,230 @@ +From 3e00d82827f80461f9fe6da37acd84235c08e5a5 Mon Sep 17 00:00:00 2001 +From: Gustavo Luiz Duarte +Date: Fri, 28 Sep 2012 19:42:07 -0400 +Subject: [PATCH] Issue separate DNS queries for ipv4 and ipv6 + +Adding multiple questions on a single DNS query is not supportted by +most DNS servers. This patch issues two separate DNS queries +sequentially for ipv4 and then for ipv6. + +There are 4 possible config options: + DNS_OPTION_IPV4: issue only one ipv4 query + DNS_OPTION_IPV6: issue only one ipv6 query + DNS_OPTION_PREFER_IPV4: issue the ipv4 query first and fallback to ipv6 + DNS_OPTION_PREFER_IPV6: issue the ipv6 query first and fallback to ipv4 +However, there is no code yet to set such config option. The default is +DNS_OPTION_PREFER_IPV4. + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=860829 +--- + grub-core/net/dns.c | 99 ++++++++++++++++++++++++++++++++++++----------------- + include/grub/net.h | 9 +++++ + 2 files changed, 76 insertions(+), 32 deletions(-) + +diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c +index 3381ea7..725725c 100644 +--- a/grub-core/net/dns.c ++++ b/grub-core/net/dns.c +@@ -34,6 +34,14 @@ struct dns_cache_element + #define DNS_CACHE_SIZE 1021 + #define DNS_HASH_BASE 423 + ++typedef enum grub_dns_qtype_id ++ { ++ GRUB_DNS_QTYPE_A = 1, ++ GRUB_DNS_QTYPE_AAAA = 28 ++ } grub_dns_qtype_id_t; ++ ++static grub_dns_option_t dns_type_option = DNS_OPTION_PREFER_IPV4; ++ + static struct dns_cache_element dns_cache[DNS_CACHE_SIZE]; + static struct grub_net_network_level_address *dns_servers; + static grub_size_t dns_nservers, dns_servers_alloc; +@@ -410,13 +418,13 @@ recv_hook (grub_net_udp_socket_t sock __attribute__ ((unused)), + return GRUB_ERR_NONE; + } + +-grub_err_t +-grub_net_dns_lookup (const char *name, ++static grub_err_t ++grub_net_dns_lookup_qtype (const char *name, + const struct grub_net_network_level_address *servers, + grub_size_t n_servers, + grub_size_t *naddresses, + struct grub_net_network_level_address **addresses, +- int cache) ++ int cache, grub_dns_qtype_id_t qtype) + { + grub_size_t send_servers = 0; + grub_size_t i, j; +@@ -471,8 +479,7 @@ grub_net_dns_lookup (const char *name, + + GRUB_NET_MAX_LINK_HEADER_SIZE + + GRUB_NET_UDP_HEADER_SIZE + + sizeof (struct dns_header) +- + grub_strlen (name) + 2 + 4 +- + 2 + 4); ++ + grub_strlen (name) + 2 + 4); + if (!nb) + { + grub_free (data.name); +@@ -482,7 +489,7 @@ grub_net_dns_lookup (const char *name, + + GRUB_NET_MAX_LINK_HEADER_SIZE + + GRUB_NET_UDP_HEADER_SIZE); + grub_netbuff_put (nb, sizeof (struct dns_header) +- + grub_strlen (name) + 2 + 4 + 2 + 4); ++ + grub_strlen (name) + 2 + 4); + head = (struct dns_header *) nb->data; + optr = (grub_uint8_t *) (head + 1); + for (iptr = name; *iptr; ) +@@ -509,18 +516,7 @@ grub_net_dns_lookup (const char *name, + + /* Type: A. */ + *optr++ = 0; +- *optr++ = 1; +- +- /* Class. */ +- *optr++ = 0; +- *optr++ = 1; +- +- /* Compressed name. */ +- *optr++ = 0xc0; +- *optr++ = 0x0c; +- /* Type: AAAA. */ +- *optr++ = 0; +- *optr++ = 28; ++ *optr++ = qtype; + + /* Class. */ + *optr++ = 0; +@@ -529,7 +525,7 @@ grub_net_dns_lookup (const char *name, + head->id = data.id; + head->flags = FLAGS_RD; + head->ra_z_r_code = 0; +- head->qdcount = grub_cpu_to_be16_compile_time (2); ++ head->qdcount = grub_cpu_to_be16_compile_time (1); + head->ancount = grub_cpu_to_be16_compile_time (0); + head->nscount = grub_cpu_to_be16_compile_time (0); + head->arcount = grub_cpu_to_be16_compile_time (0); +@@ -587,16 +583,47 @@ grub_net_dns_lookup (const char *name, + if (*data.naddresses) + return GRUB_ERR_NONE; + if (data.dns_err) +- return grub_error (GRUB_ERR_NET_NO_DOMAIN, +- N_("no DNS record found")); +- ++ { ++ grub_dprintf ("dns", "%s. QTYPE: %u QNAME: %s\n", ++ N_("no DNS record found"), qtype, name); ++ return GRUB_ERR_NET_NO_DOMAIN; ++ } + if (err) + { + grub_errno = err; + return err; + } +- return grub_error (GRUB_ERR_TIMEOUT, +- N_("no DNS reply received")); ++ grub_dprintf ("dns", "%s. QTYPE: %u QNAME: %s\n", ++ N_("no DNS reply received"), qtype, name); ++ return GRUB_ERR_TIMEOUT; ++} ++ ++grub_err_t ++grub_net_dns_lookup (const char *name, ++ const struct grub_net_network_level_address *servers, ++ grub_size_t n_servers, ++ grub_size_t *naddresses, ++ struct grub_net_network_level_address **addresses, ++ int cache) ++{ ++ if (dns_type_option == DNS_OPTION_IPV6 || dns_type_option == DNS_OPTION_PREFER_IPV6) ++ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses, ++ addresses, cache, GRUB_DNS_QTYPE_AAAA); ++ else ++ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses, ++ addresses, cache, GRUB_DNS_QTYPE_A); ++ if (!*naddresses) ++ { ++ if (dns_type_option == DNS_OPTION_PREFER_IPV4) ++ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses, ++ addresses, cache, GRUB_DNS_QTYPE_AAAA); ++ else if (dns_type_option == DNS_OPTION_PREFER_IPV6) ++ grub_net_dns_lookup_qtype (name, servers, n_servers, naddresses, ++ addresses, cache, GRUB_DNS_QTYPE_A); ++ } ++ if (!*naddresses) ++ return GRUB_ERR_NET_NO_DOMAIN; ++ return GRUB_ERR_NONE; + } + + static grub_err_t +@@ -604,22 +631,28 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)), + int argc, char **args) + { + grub_err_t err; +- grub_size_t naddresses, i; ++ struct grub_net_network_level_address cmd_server; ++ struct grub_net_network_level_address *servers; ++ grub_size_t nservers, i, naddresses = 0; + struct grub_net_network_level_address *addresses = 0; + if (argc != 2 && argc != 1) + return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected")); + if (argc == 2) + { +- struct grub_net_network_level_address server; +- err = grub_net_resolve_address (args[1], &server); ++ err = grub_net_resolve_address (args[1], &cmd_server); + if (err) + return err; +- err = grub_net_dns_lookup (args[0], &server, 1, &naddresses, +- &addresses, 0); ++ servers = &cmd_server; ++ nservers = 1; + } + else +- err = grub_net_dns_lookup (args[0], dns_servers, dns_nservers, &naddresses, +- &addresses, 0); ++ { ++ servers = dns_servers; ++ nservers = dns_nservers; ++ } ++ ++ grub_net_dns_lookup (args[0], servers, nservers, &naddresses, ++ &addresses, 0); + + for (i = 0; i < naddresses; i++) + { +@@ -628,7 +661,9 @@ grub_cmd_nslookup (struct grub_command *cmd __attribute__ ((unused)), + grub_printf ("%s\n", buf); + } + grub_free (addresses); +- return GRUB_ERR_NONE; ++ if (naddresses) ++ return GRUB_ERR_NONE; ++ return grub_error (GRUB_ERR_NET_NO_DOMAIN, N_("no DNS record found")); + } + + static grub_err_t +diff --git a/include/grub/net.h b/include/grub/net.h +index 3877451..a7e5b2c 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -505,6 +505,15 @@ grub_err_t + grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf, + const grub_net_network_level_address_t *proto_addr, + grub_net_link_level_address_t *hw_addr); ++ ++typedef enum ++ { ++ DNS_OPTION_IPV4, ++ DNS_OPTION_IPV6, ++ DNS_OPTION_PREFER_IPV4, ++ DNS_OPTION_PREFER_IPV6 ++ } grub_dns_option_t; ++ + grub_err_t + grub_net_dns_lookup (const char *name, + const struct grub_net_network_level_address *servers, +-- +1.7.11.4 + diff --git a/add-GRUB-DISABLE-SUBMENU-option.patch b/add-GRUB-DISABLE-SUBMENU-option.patch new file mode 100644 index 0000000..54f733d --- /dev/null +++ b/add-GRUB-DISABLE-SUBMENU-option.patch @@ -0,0 +1,114 @@ +From 81e46875469ae8b2a803e6457784801a0a7a7963 Mon Sep 17 00:00:00 2001 +From: Prarit Bhargava +Date: Thu, 7 Feb 2013 11:53:41 -0500 +Subject: [PATCH] add GRUB_DISABLE_SUBMENU option + +This patch adds the ability to disable the grub2 submenus from +/etc/default/grub + +To disable the submenus + +echo 'GRUB_DISABLE_SUBMENU="true"' >> /etc/default/grub + + +--- + util/grub-mkconfig.in | 3 ++- + util/grub.d/10_linux.in | 24 ++++++++++++++---------- + 2 files changed, 16 insertions(+), 11 deletions(-) + +diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in +index 516be86..354eb43 100644 +--- a/util/grub-mkconfig.in ++++ b/util/grub-mkconfig.in +@@ -216,7 +216,8 @@ export GRUB_DEFAULT \ + GRUB_INIT_TUNE \ + GRUB_SAVEDEFAULT \ + GRUB_ENABLE_CRYPTODISK \ +- GRUB_BADRAM ++ GRUB_BADRAM \ ++ GRUB_DISABLE_SUBMENU + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index e2b8ab3..9427a39 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -240,17 +240,19 @@ while [ "x$list" != "x" ] ; do + linux_root_device_thisversion=${GRUB_DEVICE} + fi + +- if [ "x$is_first_entry" = xtrue ]; then +- linux_entry "${OS}" "${version}" simple \ +- "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" ++ if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then ++ if [ "x$is_first_entry" = xtrue ]; then ++ linux_entry "${OS}" "${version}" simple \ ++ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + +- submenu_indentation="\t" ++ submenu_indentation="\t" + +- if [ -z "$boot_device_id" ]; then +- boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" ++ if [ -z "$boot_device_id" ]; then ++ 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' {" + 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' {" + fi + + linux_entry "${OS}" "${version}" advanced \ +@@ -266,8 +268,10 @@ done + + # If at least one kernel was found, then we need to + # add a closing '}' for the submenu command. +-if [ x"$is_first_entry" != xtrue ]; then +- echo '}' ++if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then ++ if [ x"$is_first_entry" != xtrue ]; then ++ echo '}' ++ fi + fi + + echo "$title_correction_code" +--- grub-2.00/util/grub.d/20_linux_xen.in~ 2013-04-15 00:03:09.162253769 +0200 ++++ grub-2.00/util/grub.d/20_linux_xen.in 2013-04-15 00:18:49.254774567 +0200 +@@ -232,7 +232,8 @@ + linux_root_device_thisversion=${GRUB_DEVICE} + fi + +- if [ "x$is_first_entry" = xtrue ]; then ++ if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then ++ if [ "x$is_first_entry" = xtrue ]; then + linux_entry "${OS}" "${version}" "${xen_version}" simple \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" + +@@ -243,9 +244,10 @@ + fi + # TRANSLATORS: %s is replaced with an OS name + echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" +- echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" ++ echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" ++ fi ++ is_first_entry=false + fi +- is_first_entry=false + + linux_entry "${OS}" "${version}" "${xen_version}" advanced \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" +@@ -256,8 +258,10 @@ + + list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` + done +- if [ x"$is_first_entry" != xtrue ]; then ++ if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then ++ if [ x"$is_first_entry" != xtrue ]; then + echo ' }' ++ fi + fi + xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '` + done diff --git a/add-X-option-to-printf-functions.patch b/add-X-option-to-printf-functions.patch new file mode 100644 index 0000000..63d7b79 --- /dev/null +++ b/add-X-option-to-printf-functions.patch @@ -0,0 +1,58 @@ +From 80f81f233bf74aac740d7a299d075ea46c9c7bd4 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Tue, 27 Nov 2012 16:58:39 -0200 +Subject: [PATCH 1/3] Add %X option to printf functions. + +--- + grub-core/kern/misc.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c +index 95d4624..8ac087a 100644 +--- a/grub-core/kern/misc.c ++++ b/grub-core/kern/misc.c +@@ -596,7 +596,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r) + static char * + grub_lltoa (char *str, int c, unsigned long long n) + { +- unsigned base = (c == 'x') ? 16 : 10; ++ unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10; + char *p; + + if ((long long) n < 0 && c == 'd') +@@ -611,7 +611,7 @@ grub_lltoa (char *str, int c, unsigned long long n) + do + { + unsigned d = (unsigned) (n & 0xf); +- *p++ = (d > 9) ? d + 'a' - 10 : d + '0'; ++ *p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0'; + } + while (n >>= 4); + else +@@ -702,6 +702,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a + { + case 'p': + case 'x': ++ case 'X': + case 'u': + case 'd': + case 'c': +@@ -777,6 +778,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a + switch (c) + { + case 'x': ++ case 'X': + case 'u': + case 'd': + if (longlongfmt) +@@ -918,6 +920,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0, va_list a + longlongfmt |= (sizeof (void *) == sizeof (long long)); + /* Fall through. */ + case 'x': ++ case 'X': + case 'u': + unsig = 1; + /* Fall through. */ +-- +1.7.10.4 + diff --git a/add-vlan-tag-support.patch b/add-vlan-tag-support.patch new file mode 100644 index 0000000..be01c58 --- /dev/null +++ b/add-vlan-tag-support.patch @@ -0,0 +1,185 @@ +From 5573f16fd05c1f8f310f2ead176b52ed6d4a08ec Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Tue, 30 Oct 2012 15:19:39 -0200 +Subject: [PATCH] Add vlan-tag 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 + +This patch should fix this bugzilla: +https://bugzilla.redhat.com/show_bug.cgi?id=871563 +--- + grub-core/kern/ieee1275/init.c | 1 + + grub-core/kern/ieee1275/openfw.c | 30 +++++++++++++++++++++++++++ + grub-core/net/ethernet.c | 42 +++++++++++++++++++++++++++++++++++--- + include/grub/ieee1275/ieee1275.h | 1 + + include/grub/net.h | 2 ++ + 5 files changed, 73 insertions(+), 3 deletions(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 5c45947..209cf8a 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -102,6 +102,7 @@ grub_machine_get_bootlocation (char **device, char **path) + char *dev, *canon; + char *ptr; + dev = grub_ieee1275_get_aliasdevname (bootpath); ++ grub_ieee1275_parse_net_options (bootpath); + canon = grub_ieee1275_canonicalise_devname (dev); + ptr = canon + grub_strlen (canon) - 1; + while (ptr > canon && (*ptr == ',' || *ptr == ':')) +diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c +index c2b1bdf..9fdfafa 100644 +--- a/grub-core/kern/ieee1275/openfw.c ++++ b/grub-core/kern/ieee1275/openfw.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + enum grub_ieee1275_parse_type + { +@@ -413,6 +414,35 @@ fail: + return ret; + } + ++int ++grub_ieee1275_parse_net_options (const char *path) ++{ ++ char *comma; ++ char *args; ++ char *option = 0; ++ ++ args = grub_ieee1275_get_devargs (path); ++ if (!args) ++ /* There is no option. */ ++ return -1; ++ ++ do ++ { ++ comma = grub_strchr (args, ','); ++ if (! comma) ++ option = grub_strdup (args); ++ else ++ option = grub_strndup (args, (grub_size_t)(comma - args)); ++ args = comma + 1; ++ ++ if (! grub_strncmp(option, "vtag", 4)) ++ grub_env_set ("vlan-tag", option + grub_strlen("vtag=")); ++ ++ } while (comma); ++ ++ return 0; ++} ++ + char * + grub_ieee1275_get_device_type (const char *path) + { +diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c +index b38e2c8..5e45d46 100644 +--- a/grub-core/net/ethernet.c ++++ b/grub-core/net/ethernet.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -56,10 +57,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, + { + struct etherhdr *eth; + grub_err_t err; ++ grub_uint32_t vlantag = 0; ++ 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)); ++ const char *vlantag_text = grub_env_get ("vlan-tag"); ++ if (vlantag_text != 0) { ++ etherhdr_size += 4; ++ vlantag = grub_strtoul (vlantag_text, 0, 16); ++ } ++ ++ err = grub_netbuff_push (nb, etherhdr_size); + if (err) + return err; + eth = (struct etherhdr *) nb->data; +@@ -76,6 +86,19 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf, + return err; + inf->card->opened = 1; + } ++ ++ /* Check if a vlan-tag is needed. */ ++ if (vlantag != 0) ++ { ++ /* 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 +113,23 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb, + 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_identifier = 0; ++ grub_memcpy (&vlantag_identifier, nb->data + etherhdr_size - 2, 2); ++ ++ /* Check if a vlan-tag is present. */ ++ if (vlantag_identifier == VLANTAG_IDENTIFIER) ++ { ++ 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; + +diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h +index 416a544..a8cf093 100644 +--- a/include/grub/ieee1275/ieee1275.h ++++ b/include/grub/ieee1275/ieee1275.h +@@ -210,5 +210,6 @@ char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path); + char *EXPORT_FUNC(grub_ieee1275_get_aliasdevname) (const char *path); + char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path); + char *EXPORT_FUNC(grub_ieee1275_get_device_type) (const char *path); ++int EXPORT_FUNC(grub_ieee1275_parse_net_options) (const char *path); + + #endif /* ! GRUB_IEEE1275_HEADER */ +diff --git a/include/grub/net.h b/include/grub/net.h +index a7e5b2c..f4fec17 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -532,4 +532,6 @@ extern char *grub_net_default_server; + #define GRUB_NET_TRIES 40 + #define GRUB_NET_INTERVAL 400 + ++#define VLANTAG_IDENTIFIER 0x8100 ++ + #endif /* ! GRUB_NET_HEADER */ +-- +1.7.10.4 + diff --git a/choose-preferred-initrd.patch b/choose-preferred-initrd.patch new file mode 100644 index 0000000..f84e380 --- /dev/null +++ b/choose-preferred-initrd.patch @@ -0,0 +1,50 @@ +--- grub-2.00/util/grub-mkconfig.in~ 2013-04-15 00:03:09.162253769 +0200 ++++ grub-2.00/util/grub-mkconfig.in 2013-04-15 01:39:22.112705322 +0200 +@@ -233,7 +233,8 @@ + GRUB_SAVEDEFAULT \ + GRUB_ENABLE_CRYPTODISK \ + GRUB_BADRAM \ +- GRUB_DISABLE_SUBMENU ++ GRUB_DISABLE_SUBMENU \ ++ GRUB_PREFER_DRACUT + + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" +--- grub-2.00/util/grub.d/10_linux.in~ 2013-04-15 00:03:09.162253769 +0200 ++++ grub-2.00/util/grub.d/10_linux.in 2013-04-15 01:38:26.992181771 +0200 +@@ -191,10 +191,12 @@ + linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + + initrd= +- for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ +- "initrd-${version}" "initramfs-${version}.img" \ +- "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ +- "initrd-${alt_version}" "initramfs-${alt_version}.img" \ ++ if [ x"${GRUB_PREFER_DRACUT}" != "xtrue" ]; then ++ initrd_search_list="initrd.img-${version} initrd-${version}.img initrd-${version}.gz initrd-${version} initramfs-${version}.img initrd.img-${alt_version} initrd-${alt_version}.img initrd-${alt_version} initramfs-${alt_version}.img" ++ else ++ initrd_search_list="initramfs-${version}.img initrd.img-${version} initrd-${version}.img initrd-${version}.gz initrd-${version} initramfs-${alt_version}.img initrd.img-${alt_version} initrd-${alt_version}.img initrd-${alt_version}" ++ fi ++ for i in $initrd_search_list \ + "initramfs-genkernel-${version}" \ + "initramfs-genkernel-${alt_version}" \ + "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ +--- grub-2.00/util/grub.d/20_linux_xen.in~ 2013-04-15 11:47:30.852286811 +0200 ++++ grub-2.00/util/grub.d/20_linux_xen.in 2013-04-15 11:49:05.606550816 +0200 +@@ -212,10 +212,12 @@ + linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + + initrd= +- for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \ +- "initrd-${version}" "initramfs-${version}.img" \ +- "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ +- "initrd-${alt_version}" "initramfs-${alt_version}.img" \ ++ if [ x"${GRUB_PREFER_DRACUT}" != "xtrue" ]; then ++ initrd_search_list="initrd.img-${version} initrd-${version}.img initrd-${version}.gz initrd-${version} initramfs-${version}.img initrd.img-${alt_version} initrd-${alt_version}.img initrd-${alt_version} initramfs-${alt_version}.img" ++ else ++ initrd_search_list="initramfs-${version}.img initrd.img-${version} initrd-${version}.img initrd-${version}.gz initrd-${version} initramfs-${alt_version}.img initrd.img-${alt_version} initrd-${alt_version}.img initrd-${alt_version}" ++ fi ++ for i in $initrd_search_list \ + "initramfs-genkernel-${version}" \ + "initramfs-genkernel-${alt_version}" \ + "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ diff --git a/dhcp-client-id-and-uuid-options-added.patch b/dhcp-client-id-and-uuid-options-added.patch new file mode 100644 index 0000000..c573936 --- /dev/null +++ b/dhcp-client-id-and-uuid-options-added.patch @@ -0,0 +1,121 @@ +From d63a0b7fd665fae1dd34d3e86127b93dd87b8114 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Tue, 27 Nov 2012 17:18:53 -0200 +Subject: [PATCH 2/3] DHCP client ID and UUID options added. + +--- + grub-core/net/bootp.c | 56 +++++++++++++++++++++++++++++++++++++++++-------- + include/grub/net.h | 2 ++ + 2 files changed, 49 insertions(+), 9 deletions(-) + +diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c +index bc07d53..3b4130d 100644 +--- a/grub-core/net/bootp.c ++++ b/grub-core/net/bootp.c +@@ -51,6 +51,14 @@ set_env_limn_ro (const char *intername, const char *suffix, + grub_register_variable_hook (varname, 0, grub_env_write_readonly); + } + ++static char ++hexdigit (grub_uint8_t val) ++{ ++ if (val < 10) ++ return val + '0'; ++ return val + 'a' - 10; ++} ++ + static void + parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask) + { +@@ -81,6 +89,9 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask) + + taglength = *ptr++; + ++ grub_dprintf("net", "DHCP option %u (0x%02x) found with length %u.\n", ++ tagtype, tagtype, taglength); ++ + switch (tagtype) + { + case GRUB_NET_BOOTP_NETMASK: +@@ -121,7 +132,9 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask) + grub_net_add_dns_server (&s); + ptr += 4; + } +- } ++ /* Skip adittional increment */ ++ continue; ++ } + break; + case GRUB_NET_BOOTP_HOSTNAME: + set_env_limn_ro (name, "hostname", (char *) ptr, taglength); +@@ -139,6 +152,39 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask) + set_env_limn_ro (name, "extensionspath", (char *) ptr, taglength); + break; + ++ case GRUB_NET_BOOTP_CLIENT_ID: ++ set_env_limn_ro (name, "clientid", (char *) ptr, taglength); ++ break; ++ ++ case GRUB_NET_BOOTP_CLIENT_UUID: ++ { ++ if (taglength != 17) ++ break; ++ ++ /* The format is 9cfe245e-d0c8-bd45-a79f-54ea5fbd3d97 */ ++ ++ ptr += 1; ++ taglength -= 1; ++ ++ char *val = grub_malloc (2 * taglength + 4 + 1); ++ int i = 0; ++ int j = 0; ++ for (i = 0; i < taglength; i++) ++ { ++ val[2 * i + j] = hexdigit (ptr[i] >> 4); ++ val[2 * i + 1 + j] = hexdigit (ptr[i] & 0xf); ++ ++ if ((i == 3) || (i == 5) || (i == 7) || (i == 9)) ++ { ++ j++; ++ val[2 * i + 1+ j] = '-'; ++ } ++ } ++ ++ set_env_limn_ro (name, "clientuuid", (char *) val, 2 * taglength + 4); ++ } ++ break; ++ + /* If you need any other options please contact GRUB + developpement team. */ + } +@@ -299,14 +345,6 @@ grub_net_process_dhcp (struct grub_net_buff *nb, + } + } + +-static char +-hexdigit (grub_uint8_t val) +-{ +- if (val < 10) +- return val + '0'; +- return val + 'a' - 10; +-} +- + static grub_err_t + grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), + int argc, char **args) +diff --git a/include/grub/net.h b/include/grub/net.h +index a7e5b2c..45348dd 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -423,6 +423,8 @@ enum + GRUB_NET_BOOTP_DOMAIN = 0x0f, + GRUB_NET_BOOTP_ROOT_PATH = 0x11, + GRUB_NET_BOOTP_EXTENSIONS_PATH = 0x12, ++ GRUB_NET_BOOTP_CLIENT_ID = 0x3d, ++ GRUB_NET_BOOTP_CLIENT_UUID = 0x61, + GRUB_NET_BOOTP_END = 0xff + }; + +-- +1.7.10.4 + diff --git a/fix-http-crash.patch b/fix-http-crash.patch new file mode 100644 index 0000000..ac110c3 --- /dev/null +++ b/fix-http-crash.patch @@ -0,0 +1,28 @@ +From 4414df5e72937b0bb1c4a0bb66cd1132ec2a5720 Mon Sep 17 00:00:00 2001 +From: Gustavo Luiz Duarte +Date: Tue, 25 Sep 2012 18:40:55 -0400 +Subject: [PATCH] Fix crash on http + +Don't free file->data on receiving FIN flag since it is used all over without +checking. http_close() will be called later to free that memory. +https://bugzilla.redhat.com/show_bug.cgi?id=860834 +--- + grub-core/net/http.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/net/http.c b/grub-core/net/http.c +index a7542d1..a5f6f31 100644 +--- a/grub-core/net/http.c ++++ b/grub-core/net/http.c +@@ -386,7 +386,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial) + + data->sock = grub_net_tcp_open (file->device->net->server, + HTTP_PORT, http_receive, +- http_err, http_err, ++ http_err, NULL, + file); + if (!data->sock) + { +-- +1.7.11.4 + diff --git a/grub-custom.cfg b/grub-custom.cfg new file mode 100644 index 0000000..078483f --- /dev/null +++ b/grub-custom.cfg @@ -0,0 +1,11 @@ +# Custom settings that go directly to /boot/grub/grub.cfg + +# This file provides an easy way to add custom menu entries. +# Simply type the menu entries you want to add after this comment. + +set menu_color_normal=yellow/blue +set menu_color_highlight=blue/cyan + +# This colorset is nice too: +#set menu_color_normal=light-blue/black +#set menu_color_highlight=light-cyan/blue diff --git a/grub-garbage.patch b/grub-garbage.patch new file mode 100644 index 0000000..2b6636f --- /dev/null +++ b/grub-garbage.patch @@ -0,0 +1,11 @@ +diff -dur grub-2.00.orig/util/grub-mkconfig_lib.in grub-2.00/util/grub-mkconfig_lib.in +--- grub-2.00.orig/util/grub-mkconfig_lib.in 2012-06-27 17:27:53.000000000 +0200 ++++ grub-2.00/util/grub-mkconfig_lib.in 2012-10-27 14:55:58.226216374 +0200 +@@ -178,6 +178,7 @@ + case "$1" in + *.dpkg-*) return 1 ;; # debian dpkg + *.rpmsave|*.rpmnew) return 1 ;; ++ *.bak|*~|.*.swp) return 1 ;; # backup and swap files from editors + README*|*/README*) return 1 ;; # documentation + esac + else diff --git a/grub-lvmdevice.patch b/grub-lvmdevice.patch new file mode 100644 index 0000000..53324ec --- /dev/null +++ b/grub-lvmdevice.patch @@ -0,0 +1,24 @@ +--- grub-1.97.1/util/grub-mkconfig.in~ 2009-11-17 17:02:16.626243372 +0200 ++++ grub-1.97.1/util/grub-mkconfig.in 2009-11-17 17:02:08.346050859 +0200 +@@ -120,6 +120,21 @@ + + # Device containing our userland. Typically used for root= parameter. + GRUB_DEVICE="`${grub_probe} --target=device /`" ++ ++# Rewrite to sane LVM node (Code from PLD Linux geninitrd): ++# /dev/mapper/sys-rootfs -> /dev/sys/rootfs ++# /dev/mapper/blodnatt-blah--bleh -> /dev/blodnatt/blah-bleh ++# /dev/mapper/vg--meaw-root -> /dev/vg-meaw/root ++case "$GRUB_DEVICE" in ++/dev/mapper/*-*) ++ # change "--" to / (as "/" is impossible in LV name) ++ local dev=$(awk -vdev="${GRUB_DEVICE#/dev/mapper/}" 'BEGIN{gsub(/--/, "/", dev); print dev}') ++ local VG=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[1]); print v[1]}') ++ local LV=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[2]); print v[2]}') ++ GRUB_DEVICE=/dev/$VG/$LV ++;; ++esac ++ + GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true + + # Device containing our /boot partition. Usually the same as GRUB_DEVICE. diff --git a/grub-mkconfig-diagnostics.patch b/grub-mkconfig-diagnostics.patch new file mode 100644 index 0000000..6f2ab81 --- /dev/null +++ b/grub-mkconfig-diagnostics.patch @@ -0,0 +1,212 @@ +diff -dur grub-2.00.orig/util/grub-mkconfig.in grub-2.00/util/grub-mkconfig.in +--- grub-2.00.orig/util/grub-mkconfig.in 2012-10-27 15:05:15.000000000 +0200 ++++ grub-2.00/util/grub-mkconfig.in 2012-10-27 15:14:32.787243346 +0200 +@@ -221,11 +236,16 @@ + if test "x${grub_cfg}" != "x"; then + rm -f "${grub_cfg}.new" + oldumask=$(umask); umask 077 ++ # open fd &3 for diagnostic messages ++ exec 3>&1 + exec > "${grub_cfg}.new" + umask $oldumask ++else ++ # open fd &3 for diagnostic messages ++ exec 3>&2 + fi +-gettext "Generating grub.cfg ..." >&2 +-echo >&2 ++gettext "Generating grub.cfg ..." >&3 ++echo >&3 + + cat << EOF + # +@@ -259,12 +279,15 @@ + gettext_printf "Syntax errors are detected in generated GRUB config file. + Ensure that there are no errors in /etc/sysconfig/grub + and /etc/grub.d/* files or please file a bug report with +-%s file attached." "${grub_cfg}.new" >&2 ++%s file attached." "${grub_cfg}.new" >&3 + else + # none of the children aborted with error, install the new grub.cfg + mv -f ${grub_cfg}.new ${grub_cfg} + fi + fi + +-gettext "done" >&2 +-echo >&2 ++gettext "done" >&3 ++echo >&3 ++ ++# close diagnostic stream ++exec 3>&- +diff -dur grub-2.00.orig/util/grub.d/00_header.in grub-2.00/util/grub.d/00_header.in +--- grub-2.00.orig/util/grub.d/00_header.in 2012-05-04 01:04:39.000000000 +0200 ++++ grub-2.00/util/grub.d/00_header.in 2012-10-27 15:16:00.665356307 +0200 +@@ -219,7 +219,7 @@ + if [ "x$gfxterm" = x1 ]; then + if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \ + && is_path_readable_by_grub "$GRUB_THEME"; then +- gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2 ++ gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&3 + + prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` + cat << EOF +@@ -255,12 +255,12 @@ + EOF + elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \ + && is_path_readable_by_grub "$GRUB_BACKGROUND"; then +- gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2 ++ gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&3 + case "$GRUB_BACKGROUND" in + *.png) reader=png ;; + *.tga) reader=tga ;; + *.jpg|*.jpeg) reader=jpeg ;; +- *) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;; ++ *) gettext "Unsupported image format" >&3; echo >&3; exit 1 ;; + esac + prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` + cat << EOF +diff -dur grub-2.00.orig/util/grub.d/10_hurd.in grub-2.00/util/grub.d/10_hurd.in +--- grub-2.00.orig/util/grub.d/10_hurd.in 2012-03-04 21:10:04.000000000 +0100 ++++ grub-2.00/util/grub.d/10_hurd.in 2012-10-27 15:16:00.665356307 +0200 +@@ -45,8 +45,8 @@ + basename=`basename $i` + dirname=`dirname $i` + rel_dirname=`make_system_path_relative_to_its_root $dirname` +- gettext_printf "Found GNU Mach: %s" "$i" >&2 +- echo >&2 ++ gettext_printf "Found GNU Mach: %s" "$i" >&3 ++ echo >&3 + kernels="${kernels} ${rel_dirname}/${basename}" + at_least_one=true + fi +@@ -60,8 +60,8 @@ + + for i in /hurd/${hurd_fs}.static /hurd/exec ; do + if test -e "$i" ; then +- gettext_printf "Found Hurd module: %s" "$i" >&2 +- echo >&2 ++ gettext_printf "Found Hurd module: %s" "$i" >&3 ++ echo >&3 + at_least_one=true + else + all_of_them=false +@@ -74,8 +74,8 @@ + fi + + if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else +- gettext "Some Hurd stuff found, but not enough to boot." >&2 +- echo >&2 ++ gettext "Some Hurd stuff found, but not enough to boot." >&3 ++ echo >&3 + exit 1 + fi + +diff -dur grub-2.00.orig/util/grub.d/10_kfreebsd.in grub-2.00/util/grub.d/10_kfreebsd.in +--- grub-2.00.orig/util/grub.d/10_kfreebsd.in 2012-03-04 22:02:30.000000000 +0100 ++++ grub-2.00/util/grub.d/10_kfreebsd.in 2012-10-27 15:16:00.668689695 +0200 +@@ -158,7 +158,7 @@ + + while [ "x$list" != "x" ] ; do + kfreebsd=`version_find_latest $list` +- gettext_printf "Found kernel of FreeBSD: %s\n" "$kfreebsd" >&2 ++ gettext_printf "Found kernel of FreeBSD: %s\n" "$kfreebsd" >&3 + basename=`basename $kfreebsd` + dirname=`dirname $kfreebsd` + rel_dirname=`make_system_path_relative_to_its_root $dirname` +@@ -207,7 +207,7 @@ + fi + done + if test -n "${module_dir}" ; then +- gettext_printf "Found kernel module directory: %s\n" "${module_dir}" >&2 ++ gettext_printf "Found kernel module directory: %s\n" "${module_dir}" >&3 + module_dir_rel=$(make_system_path_relative_to_its_root $module_dir) + fi + +diff -dur grub-2.00.orig/util/grub.d/10_linux.in grub-2.00/util/grub.d/10_linux.in +--- grub-2.00.orig/util/grub.d/10_linux.in 2012-10-27 15:05:15.000000000 +0200 ++++ grub-2.00/util/grub.d/10_linux.in 2012-10-27 15:16:00.668689695 +0200 +@@ -182,7 +182,7 @@ + is_first_entry=true + while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` +- gettext_printf "Found linux image: %s\n" "$linux" >&2 ++ gettext_printf "Found linux image: %s\n" "$linux" >&3 + basename=`basename $linux` + dirname=`dirname $linux` + rel_dirname=`make_system_path_relative_to_its_root $dirname` +@@ -220,7 +220,7 @@ + fi + + if test -n "${initrd}" ; then +- gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 ++ gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&3 + elif test -z "${initramfs}" ; then + # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's + # no initrd or builtin initramfs, it can't work here. +diff -dur grub-2.00.orig/util/grub.d/10_netbsd.in grub-2.00/util/grub.d/10_netbsd.in +--- grub-2.00.orig/util/grub.d/10_netbsd.in 2012-03-04 20:47:35.000000000 +0100 ++++ grub-2.00/util/grub.d/10_netbsd.in 2012-10-27 15:16:00.668689695 +0200 +@@ -155,7 +155,7 @@ + continue + fi + +- gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2 ++ gettext_printf "Found NetBSD kernel: %s\n" "$k" >&3 + + if [ "x$is_first_entry" = xtrue ]; then + netbsd_entry "knetbsd" "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}" +diff -dur grub-2.00.orig/util/grub.d/10_windows.in grub-2.00/util/grub.d/10_windows.in +--- grub-2.00.orig/util/grub.d/10_windows.in 2012-03-04 22:11:43.000000000 +0100 ++++ grub-2.00/util/grub.d/10_windows.in 2012-10-27 15:16:00.668689695 +0200 +@@ -82,7 +82,7 @@ + # Get boot device. + dev=`${grub_probe} -t device "$dir" 2>/dev/null` || continue + +- gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&2 ++ gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&3 + cat << EOF + menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(grub_get_device_id "${dev}")' { + EOF +diff -dur grub-2.00.orig/util/grub.d/20_linux_xen.in grub-2.00/util/grub.d/20_linux_xen.in +--- grub-2.00.orig/util/grub.d/20_linux_xen.in 2012-06-03 21:57:42.000000000 +0200 ++++ grub-2.00/util/grub.d/20_linux_xen.in 2012-10-27 15:16:00.672023083 +0200 +@@ -203,7 +203,7 @@ + fi + while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` +- gettext_printf "Found linux image: %s\n" "$linux" >&2 ++ gettext_printf "Found linux image: %s\n" "$linux" >&3 + basename=`basename $linux` + dirname=`dirname $linux` + rel_dirname=`make_system_path_relative_to_its_root $dirname` +@@ -226,7 +226,7 @@ + fi + done + if test -n "${initrd}" ; then +- gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 ++ gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&3 + else + # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. + linux_root_device_thisversion=${GRUB_DEVICE} +diff -dur grub-2.00.orig/util/grub.d/30_os-prober.in grub-2.00/util/grub.d/30_os-prober.in +--- grub-2.00.orig/util/grub.d/30_os-prober.in 2012-03-04 21:52:03.000000000 +0100 ++++ grub-2.00/util/grub.d/30_os-prober.in 2012-10-27 15:16:00.675356471 +0200 +@@ -117,7 +117,7 @@ + LONGNAME="${LABEL}" + fi + +- gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2 ++ gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&3 + + case ${BOOT} in + chain) +@@ -267,7 +267,7 @@ + *) + echo -n " " + # TRANSLATORS: %s is replaced by OS name. +- gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2 ++ gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&3 + ;; + esac + done diff --git a/grub.sysconfig b/grub.sysconfig new file mode 100644 index 0000000..6d0d599 --- /dev/null +++ b/grub.sysconfig @@ -0,0 +1,51 @@ +# Configuration file for grub. +# +# If you change this file, run 'update-grub' afterwards to update /boot/grub/grub.cfg. +# +# To enable auto generation of /boot/grub/grub.conf on kernel package +# install, UPDATE_GRUB must be set to "yes". +#UPDATE_GRUB=yes + +# Default entry to boot. Numeric value starting with 0. +# Use special value 'saved' to stick with last booted entry. used with GRUB_SAVEDEFAULT +GRUB_DEFAULT=0 + +# save_default_entry +#GRUB_SAVEDEFAULT=true + +GRUB_TIMEOUT=15 + +# Unless `GRUB_DISABLE_RECOVERY' is set to `true', two menu entries +# will be generated for each Linux kernel: one default entry and one +# entry for recovery mode. This option lists command-line arguments +# to add only to the default menu entry, after those listed in +# `GRUB_CMDLINE_LINUX'. +GRUB_CMDLINE_LINUX_DEFAULT="quiet panic=120" + +# Command-line arguments to add to menu entries for the Linux kernel. +GRUB_CMDLINE_LINUX="" + +# Set to 'console' 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 + +# Disable GRUB to pass "root=UUID=xxx" parameter to Linux +#GRUB_DISABLE_LINUX_UUID=true + +# Disable generation of recovery mode menu entries +GRUB_DISABLE_RECOVERY="true" + +# Disable creating "advanced" submenus, just use flat list +GRUB_DISABLE_SUBMENU="true" + +# Control which initial ramdisk should grub-mkconfig prefer when searching +# default is initrd-*.gz created by geninitrd, uncomment to make it prefer +# initramfs-*.img created by dracut +#GRUB_PREFER_DRACUT="true" + +# Uncomment to get a beep at grub start +#GRUB_INIT_TUNE="480 440 1" diff --git a/grub2-awk.patch b/grub2-awk.patch new file mode 100644 index 0000000..162fa5c --- /dev/null +++ b/grub2-awk.patch @@ -0,0 +1,12 @@ +diff -dur grub-2.00.orig/grub-core/Makefile.am grub-2.00/grub-core/Makefile.am +--- grub-2.00.orig/grub-core/Makefile.am 2012-06-26 01:56:55.000000000 +0200 ++++ grub-2.00/grub-core/Makefile.am 2012-10-27 15:19:54.321231750 +0200 +@@ -349,7 +349,7 @@ + + # generate global module dependencies list + moddep.lst: syminfo.lst genmoddep.awk video.lst +- cat $< | sort | awk -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1) ++ cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1) + platform_DATA += moddep.lst + CLEANFILES += config.log syminfo.lst moddep.lst + diff --git a/grub2-fonts_path.patch b/grub2-fonts_path.patch new file mode 100644 index 0000000..bb91b08 --- /dev/null +++ b/grub2-fonts_path.patch @@ -0,0 +1,12 @@ +diff -dur -x '*~' grub-2.00.orig/configure.ac grub-2.00/configure.ac +--- grub-2.00.orig/configure.ac 2012-10-28 09:47:24.000000000 +0100 ++++ grub-2.00/configure.ac 2012-10-28 09:48:06.438240771 +0100 +@@ -940,7 +940,7 @@ + + if test x"$starfield_excuse" = x; then + for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do +- for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do ++ for dir in . /usr/share/fonts/TTF /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do + if test -f "$dir/DejaVuSans.$ext"; then + DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext" + break 2 diff --git a/grub2-gets.patch b/grub2-gets.patch new file mode 100644 index 0000000..d74b1a7 --- /dev/null +++ b/grub2-gets.patch @@ -0,0 +1,11 @@ +diff -dur grub-2.00.orig/grub-core/gnulib/stdio.in.h grub-2.00/grub-core/gnulib/stdio.in.h +--- grub-2.00.orig/grub-core/gnulib/stdio.in.h 2010-12-01 15:45:43.000000000 +0100 ++++ grub-2.00/grub-core/gnulib/stdio.in.h 2012-10-27 15:43:17.539201562 +0200 +@@ -141,7 +141,6 @@ + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ + #undef gets +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); + + #if @GNULIB_FOPEN@ + # if @REPLACE_FOPEN@ diff --git a/grub2-tftp_fix.patch b/grub2-tftp_fix.patch new file mode 100644 index 0000000..397a0d7 --- /dev/null +++ b/grub2-tftp_fix.patch @@ -0,0 +1,36 @@ +http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4548 + +diff -dur grub-2.00.orig/ChangeLog grub-2.00/ChangeLog +--- grub-2.00.orig/ChangeLog 2012-06-28 02:06:26.000000000 +0200 ++++ grub-2.00/ChangeLog 2012-10-28 10:52:48.619830487 +0100 +@@ -1,3 +1,9 @@ ++2012-07-02 Vladimir Serbinenko ++ ++ * grub-core/net/tftp.c (ack): Fix endianness problem. ++ (tftp_receive): Likewise. ++ Reported by: Michael Davidsaver. ++ + 2012-06-27 Vladimir Serbinenko + + * configure.ac: Bump version to 2.00. +diff -dur grub-2.00.orig/grub-core/net/tftp.c grub-2.00/grub-core/net/tftp.c +--- grub-2.00.orig/grub-core/net/tftp.c 2012-06-22 17:42:07.000000000 +0200 ++++ grub-2.00/grub-core/net/tftp.c 2012-10-28 10:52:11.463407895 +0100 +@@ -143,7 +143,7 @@ + + tftph_ack = (struct tftphdr *) nb_ack.data; + tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK); +- tftph_ack->u.ack.block = block; ++ tftph_ack->u.ack.block = grub_cpu_to_be16 (block); + + err = grub_net_send_udp_packet (data->sock, &nb_ack); + if (err) +@@ -225,7 +225,7 @@ + grub_priority_queue_pop (data->pq); + + if (file->device->net->packs.count < 50) +- err = ack (data, tftph->u.data.block); ++ err = ack (data, data->block + 1); + else + { + file->device->net->stall = 1; diff --git a/grub2.spec b/grub2.spec new file mode 100644 index 0000000..577fdb8 --- /dev/null +++ b/grub2.spec @@ -0,0 +1,575 @@ +# TODO +# - reap out which in probe scripts and drop R: which +# - subpackages? e.g. modules and utils +# - check where is that locale path: /boot/grub/locale and fix it or change it +# - grubemu notes +# --enable-grub-emu-usb conflicts with --enable-grub-emu-pci, emu-pci seems experimental +# - to build and install the `grub-emu' debugging utility we need to re-run build with --target=emu +# - put grub-emu to subpackage if it is fixed +# +# Conditional build: +%bcond_with grubemu # build grub-emu debugging utility +%bcond_without efiemu # build efiemu runtimes +%bcond_without pc # do not build for PC BIOS platform +%bcond_without efi # do not build for EFI platform + +%ifnarch %{ix86} %{x8664} +%undefine with_pc +%endif +%ifnarch %{ix86} %{x8664} ia64 +%undefine with_efi +%endif + +%ifnarch %{x8664} +# non-x86_64 arch doesn't support this +%undefine with_efiemu +%endif + +# the 'most natural' platform should go last +%ifarch %{ix86} %{x8664} ia64 +%define platforms %{?with_efi:efi} %{?with_pc:pc} +%endif +%ifarch ppc ppc64 sparc64 +%define platforms ieee1275 +%endif +%ifarch mips +%define platforms arc +%endif +%ifarch mipsel +%define platforms loongson +%endif + +Summary: GRand Unified Bootloader +Summary(de.UTF-8): GRUB2 - ein Bootloader für x86 und ppc +Summary(hu.UTF-8): GRUB2 - rendszerbetöltő x86 és ppc gépekhez +Summary(pl.UTF-8): GRUB2 - bootloader dla x86 i ppc +Summary(pt_BR.UTF-8): Gerenciador de inicialização GRUB2 +Name: grub2 +Version: 2.00 +Release: 2 +License: GPL v2 +Group: Base +Source0: http://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz +# Source0-md5: a1043102fbc7bcedbf53e7ee3d17ab91 +Source1: update-grub +Source2: update-grub.8 +Source3: grub.sysconfig +Source4: grub-custom.cfg +Patch1: pld-sysconfdir.patch +Patch2: grub-garbage.patch +Patch3: grub-lvmdevice.patch +Patch4: pld-mkconfigdir.patch +Patch5: grub-mkconfig-diagnostics.patch +Patch6: ppc.patch +Patch7: %{name}-awk.patch +Patch8: posix.patch +Patch9: %{name}-gets.patch +Patch10: %{name}-fonts_path.patch +Patch11: %{name}-tftp_fix.patch +Patch12: add-vlan-tag-support.patch +Patch13: just-say-linux.patch +Patch14: add-GRUB-DISABLE-SUBMENU-option.patch +Patch15: add-X-option-to-printf-functions.patch +Patch16: dhcp-client-id-and-uuid-options-added.patch +Patch17: fix-http-crash.patch +Patch18: Issue-separate-DNS-queries-for-ipv4-and-ipv6.patch +Patch19: search-for-specific-config-file-for-netboot.patch +Patch20: ignore-kernel-symlinks.patch +Patch21: choose-preferred-initrd.patch +URL: http://www.gnu.org/software/grub/ +BuildRequires: autoconf >= 2.53 +BuildRequires: automake >= 1:1.11.1-1 +BuildRequires: bison +BuildRequires: device-mapper-devel +BuildRequires: flex >= 2.5.35 +BuildRequires: fonts-TTF-DejaVu +BuildRequires: freetype-devel >= 2 +BuildRequires: gawk +BuildRequires: gettext-devel +BuildRequires: glibc-static +BuildRequires: help2man +BuildRequires: libfuse-devel +BuildRequires: libtool +BuildRequires: ncurses-devel +BuildRequires: rpm >= 4.4.9-56 +BuildRequires: rpmbuild(macros) >= 1.213 +BuildRequires: sed >= 4.0 +BuildRequires: tar >= 1:1.22 +BuildRequires: texinfo +BuildRequires: xz +BuildRequires: xz-devel +%ifarch %{x8664} +BuildRequires: /usr/lib/libc.so +%if "%{pld_release}" == "ac" +BuildRequires: libgcc32 +%else +BuildRequires: gcc-multilib +%endif +%endif +Requires: %{name}-platform = %{version}-%{release} +Requires: which +%ifarch %{ix86} %{x8664} +Suggests: %{name}-platform-pc +%endif +Suggests: cdrkit-mkisofs +Suggests: os-prober +Provides: bootloader +Conflicts: grub +ExclusiveArch: %{ix86} %{x8664} ia64 mips mipsel ppc ppc64 sparc64 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%define _sbindir /sbin +%define _bindir %{_sbindir} +%define _libdir /lib +%define _datadir %{_libdir} +%define _libexecdir %{_libdir}/grub +%define _grubdir /boot/grub +%define _localedir /usr/share/locale + +# part of grub code is not relocable (these are not Linux libs) +# stack protector also breaks non-Linux binaries +# any kind of forced optimizations makes grub2 unreliable (random +# reboots and hangs on boot menu screen) +%define filterout_c -fPIC -O. +%undefine _ssp_cflags +%undefine _fortify_cflags + +%description +GRUB is a GPLed bootloader intended to unify bootloading across x86 +operating systems. In addition to loading the Linux and *BSD kernels, +it implements the Multiboot standard, which allows for flexible +loading of multiple boot images (needed for modular kernels such as +the GNU Hurd). + +GRUB 2 is derived from PUPA which was a research project to +investigate the next generation of GRUB. GRUB 2 has been rewritten +from scratch to clean up everything for modularity and portability. + +GRUB 2 targets at the following goals: +- Scripting support, such as conditionals, loops, variables and + functions. +- Graphical interface. +- Dynamic loading of modules in order to extend itself at the run time + rather than at the build time. +- Portability for various architectures. +- Internationalization. This includes support for non-ASCII character + code, message catalogs like gettext, fonts, graphics console, and so + on. +- Real memory management, to make GNU GRUB more extensible. +- Modular, hierarchical, object-oriented framework for file systems, + files, devices, drives, terminals, commands, partition tables and OS + loaders. +- Cross-platform installation which allows for installing GRUB from a + different architecture. +- Rescue mode saves unbootable cases. Stage 1.5 was eliminated. +- Fix design mistakes in GRUB Legacy, which could not be solved for + backward-compatibility, such as the way of numbering partitions. + +%description -l de.UTF-8 +GRUB (GRand Unified Boot-loader) ist ein Bootloader, der oft auf +Rechnern eingesetzt wird, auf denen das freie Betriebssystem Linux +läuft. GRUB löst den betagten LILO (Linux-Loader) ab. + +GRUB wurde innerhalb des GNU Hurd-Projektes als Boot-Loader entwickelt +und wird unter der GPL vertrieben. Aufgrund seiner höheren +Flexibilität verdrängt GRUB in vielen Linux-Distributionen den +traditionellen Boot-Loader LILO. + +%description -l hu.UTF-8 +GRUB egy GPL liszenszű rendszerbetöltő. Linux és *BSD kernelek +betöltése mellett támogatja a Multiboot standard-ot, amely lehetővé +teszi boot képek betöltését (moduláris kerneleknek kell, mint pl. a +GNU Hurd). + +GRUB2 céljai a következők: +- szkriptelés támogatása, úgymint feltételek, ciklusok, változók, + függvények. +- grafikus felület +- modulok dinamikus betöltése futási időben +- hordozhatóság több architektúrára +- többnyelvűség: nem-ASCII karakterek támogatása, üzenetkatalógusok, + mint gettext, betűtípusok, grafikus konzolon, és így tovább +- valós memória kezelés, amellyel még bővíthetőbbé tehetjük +- moduláris, hierarchikus, objektum-orientált keretrendszer + fájlrendszerekhez, fájlokhoz, eszközökhöz, meghajtókhoz, + terminálokhoz, parancsokhoz, partíciós táblákhoz és OS betöltőkhöz + +%description -l es.UTF-8 +Éste es GRUB - Grand Unified Boot Loader - un administrador de +inicialización capaz de entrar en la mayoría de los sistemas +operacionales libres - Linux, FreeBSD, NetBSD, GNU Mach, etc. como +también en la mayoría de los sistemas operacionales comerciales para +PC. + +El administrador GRUB puede ser una buena alternativa a LILO, para +usuarios conmás experiencia y que deseen obtener más recursos de su +cargador de inicialización (boot loader). + +%description -l pl.UTF-8 +GRUB jest bootloaderem na licencji GNU GPL, mającym na celu unifikację +procesu bootowania na systemach x86. Potrafi nie tylko ładować jądra +Linuksa i *BSD: posiada również implementację standardu Multiboot, +który pozwala na elastyczne ładowanie wielu obrazów bootowalnych +(czego wymagają modułowe jądra, takie jak GNU Hurd). + +%description -l pt_BR.UTF-8 +Esse é o GRUB - Grand Unified Boot Loader - um gerenciador de boot +capaz de entrar na maioria dos sistemas operacionais livres - Linux, +FreeBSD, NetBSD, GNU Mach, etc. assim como na maioria dos sistemas +operacionais comerciais para PC. + +O GRUB pode ser uma boa alternativa ao LILO, para usuários mais +avançados e que querem mais recursos de seu boot loader. + +%package -n bash-completion-%{name} +Summary: bash-completion for GRUB +Summary(pl.UTF-8): Bashowe uzupełnianie nazw dla GRUB-a +Group: Applications/Shells +Requires: bash-completion + +%description -n bash-completion-%{name} +This package provides bash-completion for GRUB. + +%description -n bash-completion-%{name} -l pl.UTF-8 +Pakiet ten dostarcza bashowe uzupełnianie nazw dla GRUB-a. + +%package platform-pc +Summary: PC BIOS platform support for GRUB +Summary(pl.UTF-8): Obsługa platformy PC BIOS dla GRUB-a +Group: Base +Provides: %{name}-platform = %{version}-%{release} + +%description platform-pc +PC BIOS platform support for GRUB. + +%description platform-pc -l pl.UTF-8 +Obsługa platformy PC BIOS dla GRUB-a. + +%package platform-efi +Summary: (U)EFI platform support for GRUB +Summary(pl.UTF-8): Obsługa platformy (U)EFI dla GRUB-a +Group: Base +Suggests: efibootmgr +Provides: %{name}-platform = %{version}-%{release} + +%description platform-efi +(U)EFI platform support for GRUB. + +%description platform-efi -l pl.UTF-8 +Obsługa platformy (U)EFI dla GRUB-a. + +%package mkfont +Summary: GRUB font files converter +Summary(pl.UTF-8): Konwerter plików fontów GRUB-a +Group: Base + +%description mkfont +Converts common font file formats into PF2. + +%description mkfont -l pl.UTF-8 +Program do konwersji popularnych formatów plików fontów do PF2. + +%package theme-starfield +Summary: starfield theme for GRUB +Summary(pl.UTF-8): Motyw starfield dla GRUB-a +Group: Base + +%description theme-starfield +starfield theme for GRUB. + +%description theme-starfield -l pl.UTF-8 +Motyw starfield dla GRUB-a. + +%prep +%setup -q -n grub-%{version} +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 + +%build +# if gold is used then grub doesn't even boot +# https://savannah.gnu.org/bugs/?34539 +# http://sourceware.org/bugzilla/show_bug.cgi?id=14196 +install -d our-ld +ln -s /usr/bin/ld.bfd our-ld/ld +export PATH=$(pwd)/our-ld:$PATH + +cp -f /usr/share/automake/config.sub . +%{__libtoolize} +%{__aclocal} -I m4 +%{__autoheader} +echo timestamp > stamp-h.in +%{__autoconf} +%{__automake} + +for platform in %{platforms} ; do + install -d build-${platform} + cd build-${platform} + + if [ "$platform" != "efi" ] ; then + platform_opts="--enable-efiemu%{!?with_efiemu:=no}" + else + platform_opts="" + fi + + ln -s ../configure . + # mawk stalls at ./genmoddep.awk, so force gawk + AWK=gawk \ + %configure \ + --with-platform=${platform} \ + --disable-werror \ + %if %{with grubemu} + --enable-grub-emu-usb \ + --enable-grub-emu-sdl \ + --enable-grub-emu-pci \ + %endif + $platform_opts \ + TARGET_LDFLAGS=-static + + %{__make} + cd .. +done + +%install +rm -rf $RPM_BUILD_ROOT + +for platform in %{platforms} ; do + cd build-${platform} + %{__make} install \ + pkgdatadir=%{_libexecdir} \ + pkglibdir=%{_libexecdir} \ + DESTDIR=$RPM_BUILD_ROOT + cd .. +done + +# not in Th (?) +%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/de@hebrew +%{__rm} -r $RPM_BUILD_ROOT%{_localedir}/en@{arabic,cyrillic,greek,hebrew,piglatin} + +%find_lang grub + +# this must be after 'make install' +install -d $RPM_BUILD_ROOT%{_libexecdir}/locale + +install -d $RPM_BUILD_ROOT%{_grubdir} +cp -p docs/grub.cfg $RPM_BUILD_ROOT%{_grubdir} + +# grub.d/41_custom +cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_grubdir}/custom.cfg +%{__rm} $RPM_BUILD_ROOT/lib/grub.d/40_custom + +install -p %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/update-grub +cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8/update-grub.8 + +install -d $RPM_BUILD_ROOT/etc/sysconfig +cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/grub + +# rm -f, because it sometimes exists, sometimes not, depending which texlive you have installed +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +# platform specific, unnecessarily always installed +%ifnarch %{ix86} %{x8664} +%{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-bios-setup,%{_mandir}/man8/grub-bios-setup.8} +%endif +%ifnarch sparc64 +%{__rm} $RPM_BUILD_ROOT{%{_sbindir}/grub-sparc64-setup,%{_mandir}/man8/grub-sparc64-setup.8} +%endif + +# core.img - bootable image generated by grub-mkimage(1) via grub-install(1) +touch $RPM_BUILD_ROOT%{_grubdir}/core.img +touch $RPM_BUILD_ROOT%{_grubdir}/device.map + +# needs to be exactly 1KiB +# but we're ghosting it. so whom are we kidding here? :P (maybe %config it in future?) +dd bs=1024 if=/dev/zero count=1 of=$RPM_BUILD_ROOT%{_grubdir}/grubenv + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p %{_sbindir}/postshell +-/usr/sbin/fix-info-dir -c %{_infodir} + +%postun -p %{_sbindir}/postshell +-/usr/sbin/fix-info-dir -c %{_infodir} + +%triggerpostun -- %{name} < 2.00-2 +# Note this trigger on version upgrade needed only for upgrade from +# old grub2 packages which contained modules in /boot/grub +# or were built with optimizations enabled +# don't do anything on --downgrade +if [ $1 -le 1 ]; then + exit 0 +fi +echo "Grub was upgraded, trying to setup it to boot sector" +/sbin/grub-install '(hd0)' || : + +%triggerpostun -- %{name} < 1.99-7.3 +# migrate /etc/grub.d/custom.cfg.rpmsave -> /boot/grub/custom.cfg +if [ -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave ]; then + cp -f %{_grubdir}/custom.cfg{,.rpmnew} + mv -f %{_sysconfdir}/grub.d/custom.cfg.rpmsave %{_grubdir}/custom.cfg +fi + +%files -f grub.lang +%defattr(644,root,root,755) +%doc AUTHORS ChangeLog NEWS README THANKS TODO +%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/grub +%attr(755,root,root) %{_sbindir}/grub-editenv +%attr(755,root,root) %{_sbindir}/grub-fstest +%attr(755,root,root) %{_sbindir}/grub-kbdcomp +%attr(755,root,root) %{_sbindir}/grub-install +%attr(755,root,root) %{_sbindir}/grub-menulst2cfg +%attr(755,root,root) %{_sbindir}/grub-mkconfig +%attr(755,root,root) %{_sbindir}/grub-mklayout +%attr(755,root,root) %{_sbindir}/grub-mknetdir +%attr(755,root,root) %{_sbindir}/grub-mkpasswd-pbkdf2 +%attr(755,root,root) %{_sbindir}/grub-mkrelpath +%attr(755,root,root) %{_sbindir}/grub-mkrescue +%attr(755,root,root) %{_sbindir}/grub-mkstandalone +%attr(755,root,root) %{_sbindir}/grub-mount +%attr(755,root,root) %{_sbindir}/grub-ofpathname +%attr(755,root,root) %{_sbindir}/grub-reboot +%attr(755,root,root) %{_sbindir}/grub-script-check +%attr(755,root,root) %{_sbindir}/grub-set-default +%attr(755,root,root) %{_sbindir}/update-grub +%ifarch %{ix86} %{x8664} +%attr(755,root,root) %{_sbindir}/grub-bios-setup +%{_mandir}/man8/grub-bios-setup.8* +%endif +%ifarch %{ix86} %{x8664} +%attr(755,root,root) %{_sbindir}/grub-mkimage +%{_mandir}/man1/grub-mkimage.1* +%else +%attr(755,root,root) %{_sbindir}/grub-probe +%{_mandir}/man8/grub-probe.8* +%endif +%ifarch sparc64 +%attr(755,root,root) %{_sbindir}/grub-sparc64-setup +%{_mandir}/man8/grub-sparc64-setup.8* +%endif +%{_mandir}/man1/grub-editenv.1* +%{_mandir}/man1/grub-fstest.1* +%{_mandir}/man1/grub-kbdcomp.1* +%{_mandir}/man1/grub-menulst2cfg.1* +%{_mandir}/man1/grub-mklayout.1* +%{_mandir}/man1/grub-mkpasswd-pbkdf2.1* +%{_mandir}/man1/grub-mkrelpath.1* +%{_mandir}/man1/grub-mkrescue.1* +%{_mandir}/man1/grub-mkstandalone.1* +%{_mandir}/man1/grub-mount.1* +%{_mandir}/man1/grub-script-check.1* +%{_mandir}/man8/grub-install.8* +%{_mandir}/man8/grub-mkconfig.8* +%{_mandir}/man8/grub-mknetdir.8* +%{_mandir}/man8/grub-ofpathname.8* +%{_mandir}/man8/grub-reboot.8* +%{_mandir}/man8/grub-set-default.8* +%{_mandir}/man8/update-grub.8* +%if %{with grubemu} +%attr(755,root,root) %{_sbindir}/grub-emu +%{_mandir}/man8/grub-emu.8* +%endif +%{_libexecdir}/grub-mkconfig_lib + +%dir %{_grubdir} +%dir %{_libexecdir} +# XXX: check this locale dir location and if it is neccesaary to exist on /boot + +%dir %{_libexecdir}/locale +%config(noreplace) %verify(not md5 mtime size) %{_grubdir}/grub.cfg +%config(noreplace) %verify(not md5 mtime size) %{_grubdir}/custom.cfg + +# generated by grub at runtime +%ghost %{_grubdir}/device.map +%ghost %{_grubdir}/core.img +%ghost %{_grubdir}/grubenv + +%dir /lib/grub.d +%doc /lib/grub.d/README +%attr(755,root,root) /lib/grub.d/00_header +%attr(755,root,root) /lib/grub.d/10_linux +%attr(755,root,root) /lib/grub.d/20_linux_xen +%attr(755,root,root) /lib/grub.d/30_os-prober +%attr(755,root,root) /lib/grub.d/41_custom + +%ifarch %{ix86} %{x8664} +%attr(755,root,root) %{_sbindir}/grub-probe +%{_mandir}/man8/grub-probe.8* +%endif + +%{_infodir}/grub*.info* + +%dir %{_datadir}/grub/themes + +%if %{with pc} +%files platform-pc +%defattr(644,root,root,755) +%dir %{_libexecdir}/*-pc +%{_libexecdir}/*-pc/modinfo.sh +%{_libexecdir}/*-pc/*.exec +%{_libexecdir}/*-pc/*.image +%{_libexecdir}/*-pc/*.lst +%{_libexecdir}/*-pc/*.mod +%{_libexecdir}/*-pc/*.module +%{_libexecdir}/*-pc/lzma_decompress.img +%{_libexecdir}/*-pc/config.h +%{_libexecdir}/*-pc/gdb_grub +%{_libexecdir}/*-pc/gmodule.pl +%if %{with efiemu} +%{_libexecdir}/*-pc/efiemu*.o +%endif +%{_libexecdir}/*-pc/kernel.img +%ifarch %{ix86} %{x8664} sparc sparc64 +%{_libexecdir}/*-pc/boot.img +%{_libexecdir}/*-pc/cdboot.img +%{_libexecdir}/*-pc/diskboot.img +%{_libexecdir}/*-pc/lnxboot.img +%{_libexecdir}/*-pc/pxeboot.img +%endif +%endif + +%if %{with efi} +%files platform-efi +%defattr(644,root,root,755) +%dir %{_libexecdir}/*-efi +%{_libexecdir}/*-efi/modinfo.sh +%{_libexecdir}/*-efi/*.exec +%{_libexecdir}/*-efi/*.lst +%{_libexecdir}/*-efi/*.mod +%{_libexecdir}/*-efi/*.module +%{_libexecdir}/*-efi/config.h +%{_libexecdir}/*-efi/gdb_grub +%{_libexecdir}/*-efi/gmodule.pl +%{_libexecdir}/*-efi/kernel.img +%endif + +%files mkfont +%defattr(644,root,root,755) +%attr(755,root,root) %{_sbindir}/grub-mkfont +%{_mandir}/man1/grub-mkfont.1* + +%files theme-starfield +%defattr(644,root,root,755) +%{_datadir}/grub/themes/starfield + +%files -n bash-completion-%{name} +%defattr(644,root,root,755) +/etc/bash_completion.d/grub diff --git a/ignore-kernel-symlinks.patch b/ignore-kernel-symlinks.patch new file mode 100644 index 0000000..f854139 --- /dev/null +++ b/ignore-kernel-symlinks.patch @@ -0,0 +1,12 @@ +--- grub-2.00/util/grub-mkconfig_lib.in~ 2013-04-15 00:03:09.102253190 +0200 ++++ grub-2.00/util/grub-mkconfig_lib.in 2013-04-15 00:54:39.189605003 +0200 +@@ -174,6 +174,9 @@ + + grub_file_is_not_garbage () + { ++ if test -L "$1" ; then ++ return 1 ++ fi + if test -f "$1" ; then + case "$1" in + *.dpkg-*) return 1 ;; # debian dpkg diff --git a/just-say-linux.patch b/just-say-linux.patch new file mode 100644 index 0000000..6cce32b --- /dev/null +++ b/just-say-linux.patch @@ -0,0 +1,45 @@ +From d4bd41f972c6e22b86c773cbba2a1e14f400a8be Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 14 Mar 2011 14:27:42 -0400 +Subject: [PATCH] Don't say "GNU/Linux" in generated menus. + +--- + util/grub.d/10_linux.in | 4 ++-- + util/grub.d/20_linux_xen.in | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index a09c3e6..0b0df78 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -29,9 +29,9 @@ export TEXTDOMAINDIR=@localedir@ + CLASS="--class gnu-linux --class gnu --class os" + + if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then +- OS=GNU/Linux ++ OS="$(. /etc/os-release ; echo "$NAME $VERSION")" + else +- OS="${GRUB_DISTRIBUTOR} GNU/Linux" ++ OS="${GRUB_DISTRIBUTOR}" + CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" + fi + +diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in +index ee49cd9..10422b0 100644 +--- a/util/grub.d/20_linux_xen.in ++++ b/util/grub.d/20_linux_xen.in +@@ -29,9 +29,9 @@ export TEXTDOMAINDIR=@localedir@ + CLASS="--class gnu-linux --class gnu --class os --class xen" + + if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then +- OS=GNU/Linux ++ OS="$(. /etc/os-release ; echo "$NAME $VERSION")" + else +- OS="${GRUB_DISTRIBUTOR} GNU/Linux" ++ OS="${GRUB_DISTRIBUTOR}" + CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" + fi + +-- +1.7.4 + diff --git a/pld-mkconfigdir.patch b/pld-mkconfigdir.patch new file mode 100644 index 0000000..5d6943e --- /dev/null +++ b/pld-mkconfigdir.patch @@ -0,0 +1,24 @@ +diff -dur grub-2.00.orig/conf/Makefile.common grub-2.00/conf/Makefile.common +--- grub-2.00.orig/conf/Makefile.common 2012-10-27 15:05:15.000000000 +0200 ++++ grub-2.00/conf/Makefile.common 2012-10-27 15:06:09.135719113 +0200 +@@ -98,7 +98,7 @@ + + # Other variables + +-grubconfdir = $(sysconfdir)/grub.d ++grubconfdir = /lib/grub.d + platformdir = $(pkglibdir)/$(target_cpu)-$(platform) + starfielddir = $(pkgdatadir)/themes/starfield + +diff -dur grub-2.00.orig/util/grub-mkconfig.in grub-2.00/util/grub-mkconfig.in +--- grub-2.00.orig/util/grub-mkconfig.in 2012-10-27 15:05:15.000000000 +0200 ++++ grub-2.00/util/grub-mkconfig.in 2012-10-27 15:06:40.696227008 +0200 +@@ -35,7 +35,7 @@ + pkgdatadir="${datadir}/@PACKAGE@" + fi + grub_cfg="" +-grub_mkconfig_dir="${sysconfdir}"/grub.d ++grub_mkconfig_dir=/lib/grub.d + + self=`basename $0` + diff --git a/pld-sysconfdir.patch b/pld-sysconfdir.patch new file mode 100644 index 0000000..f53f128 --- /dev/null +++ b/pld-sysconfdir.patch @@ -0,0 +1,41 @@ +diff -dur grub-2.00.orig/util/grub-mkconfig.in grub-2.00/util/grub-mkconfig.in +--- grub-2.00.orig/util/grub-mkconfig.in 2012-04-05 19:41:07.000000000 +0200 ++++ grub-2.00/util/grub-mkconfig.in 2012-10-27 14:53:33.483981202 +0200 +@@ -140,8 +140,8 @@ + # choosing Hurd filesystem module. + GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`" + +-if test -f ${sysconfdir}/default/grub ; then +- . ${sysconfdir}/default/grub ++if test -f ${sysconfdir}/sysconfig/grub ; then ++ . ${sysconfdir}/sysconfig/grub + fi + + # XXX: should this be deprecated at some point? +@@ -232,7 +232,7 @@ + # DO NOT EDIT THIS FILE + # + # It is automatically generated by $self using templates +-# from ${grub_mkconfig_dir} and settings from ${sysconfdir}/default/grub ++# from ${grub_mkconfig_dir} and settings from ${sysconfdir}/sysconfig/grub + # + EOF + +@@ -257,7 +257,7 @@ + if ! ${grub_script_check} ${grub_cfg}.new; then + # TRANSLATORS: %s is replaced by filename + gettext_printf "Syntax errors are detected in generated GRUB config file. +-Ensure that there are no errors in /etc/default/grub ++Ensure that there are no errors in /etc/sysconfig/grub + and /etc/grub.d/* files or please file a bug report with + %s file attached." "${grub_cfg}.new" >&2 + else +diff -dur grub-2.00.orig/util/grub.d/README grub-2.00/util/grub.d/README +--- grub-2.00.orig/util/grub.d/README 2010-12-01 15:45:43.000000000 +0100 ++++ grub-2.00/util/grub.d/README 2012-10-27 14:52:54.046709588 +0200 +@@ -8,4 +8,4 @@ + The number namespace in-between is configurable by system installer and/or + administrator. For example, you can add an entry to boot another OS as + 01_otheros, 11_otheros, etc, depending on the position you want it to occupy in +-the menu; and then adjust the default setting via /etc/default/grub. ++the menu; and then adjust the default setting via /etc/sysconfig/grub. diff --git a/posix.patch b/posix.patch new file mode 100644 index 0000000..18ab55a --- /dev/null +++ b/posix.patch @@ -0,0 +1,9 @@ +--- grub-1.99/util/grub-mkconfig.in.wiget 2011-10-13 17:43:32.333505299 +0200 ++++ grub-1.99/util/grub-mkconfig.in 2011-10-13 17:43:45.513070998 +0200 +@@ -1,5 +1,6 @@ + #! /bin/sh + set -e ++set -o posix + + # Generate grub.cfg by inspecting /boot contents. + # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. diff --git a/ppc.patch b/ppc.patch new file mode 100644 index 0000000..fde494c --- /dev/null +++ b/ppc.patch @@ -0,0 +1,27 @@ +disable -m32 on ppc (gcc 3.3.6 does not like it) + +revert 'returns_twice' attribute for grub_setjmp. +http://repo.or.cz/w/grub2.git/commitdiff/2c7825edcb18e9d0680a953f1475ef2caf6b0f0f + +--- grub-1.98/configure.ac~ 2010-03-06 20:51:37.000000000 +0000 ++++ grub-1.98/configure.ac 2010-07-19 13:59:46.468351205 +0000 +@@ -114,7 +114,7 @@ + esac + + case "$target_cpu" in +- i386 | powerpc) target_m32=1 ;; ++ i386) target_m32=1 ;; + x86_64 | sparc64) target_m64=1 ;; + esac + +--- grub-1.98/include/grub/powerpc/setjmp.h~ 2010-03-06 20:51:37.000000000 +0000 ++++ grub-1.98/include/grub/powerpc/setjmp.h 2010-07-19 16:37:03.616853413 +0000 +@@ -21,7 +21,7 @@ + + typedef unsigned long grub_jmp_buf[20]; + +-int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice)); ++int grub_setjmp (grub_jmp_buf env); + void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); + + #endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/search-for-specific-config-file-for-netboot.patch b/search-for-specific-config-file-for-netboot.patch new file mode 100644 index 0000000..33e3793 --- /dev/null +++ b/search-for-specific-config-file-for-netboot.patch @@ -0,0 +1,205 @@ +From 38d458ddd69cb7dd6e7f58f9e9f3197c6b6184f3 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Tue, 27 Nov 2012 17:22:07 -0200 +Subject: [PATCH 3/3] Search for specific config file for netboot + +This patch implements a search for a specific configuration when the config +file is on a remoteserver. It uses the following order: + 1) DHCP client UUID option. + 2) MAC address (in lower case hexadecimal with dash separators); + 3) IP (in upper case hexadecimal) or IPv6; + 4) The original grub.cfg file. + +This procedure is similar to what is used by pxelinux and yaboot: +http://www.syslinux.org/wiki/index.php/PXELINUX#config + +This should close the bugzilla: +https://bugzilla.redhat.com/show_bug.cgi?id=873406 +--- + grub-core/net/net.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++ + grub-core/normal/main.c | 18 ++++++-- + include/grub/net.h | 3 ++ + 3 files changed, 135 insertions(+), 4 deletions(-) + +diff --git a/grub-core/net/net.c b/grub-core/net/net.c +index 01c5d32..49c32c5 100644 +--- a/grub-core/net/net.c ++++ b/grub-core/net/net.c +@@ -1548,6 +1548,124 @@ grub_net_restore_hw (void) + return GRUB_ERR_NONE; + } + ++grub_err_t ++grub_net_search_configfile (char *config) ++{ ++ grub_size_t config_len; ++ char *suffix; ++ ++ auto int search_through (grub_size_t num_tries, grub_size_t slice_size); ++ int search_through (grub_size_t num_tries, grub_size_t slice_size) ++ { ++ while (num_tries-- > 0) ++ { ++ grub_dprintf ("net", "probe %s\n", config); ++ ++ grub_file_t file; ++ file = grub_file_open (config); ++ ++ if (file) ++ { ++ grub_file_close (file); ++ grub_dprintf ("net", "found!\n"); ++ return 0; ++ } ++ else ++ { ++ if (grub_errno == GRUB_ERR_IO) ++ grub_errno = GRUB_ERR_NONE; ++ } ++ ++ if (grub_strlen (suffix) < slice_size) ++ break; ++ ++ config[grub_strlen (config) - slice_size] = '\0'; ++ } ++ ++ return 1; ++ } ++ ++ config_len = grub_strlen (config); ++ config[config_len] = '-'; ++ suffix = config + config_len + 1; ++ ++ struct grub_net_network_level_interface *inf; ++ FOR_NET_NETWORK_LEVEL_INTERFACES (inf) ++ { ++ /* By the Client UUID. */ ++ ++ char client_uuid_var[sizeof ("net_") + grub_strlen (inf->name) + ++ sizeof ("_clientuuid") + 1]; ++ grub_snprintf (client_uuid_var, sizeof (client_uuid_var), ++ "net_%s_clientuuid", inf->name); ++ ++ const char *client_uuid; ++ client_uuid = grub_env_get (client_uuid_var); ++ ++ if (client_uuid) ++ { ++ grub_strcpy (suffix, client_uuid); ++ if (search_through (1, 0) == 0) return GRUB_ERR_NONE; ++ } ++ ++ /* By the MAC address. */ ++ ++ /* Add ethernet type */ ++ grub_strcpy (suffix, "01-"); ++ ++ grub_net_hwaddr_to_str (&inf->hwaddress, suffix + 3); ++ ++ char *ptr; ++ for (ptr = suffix; *ptr; ptr++) ++ if (*ptr == ':') ++ *ptr = '-'; ++ ++ if (search_through (1, 0) == 0) return GRUB_ERR_NONE; ++ ++ /* By IP address */ ++ ++ switch ((&inf->address)->type) ++ { ++ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4: ++ { ++ grub_uint32_t n = grub_be_to_cpu32 ((&inf->address)->ipv4); ++ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%02X%02X%02X%02X", \ ++ ((n >> 24) & 0xff), ((n >> 16) & 0xff), \ ++ ((n >> 8) & 0xff), ((n >> 0) & 0xff)); ++ ++ if (search_through (8, 1) == 0) return GRUB_ERR_NONE; ++ break; ++ } ++ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6: ++ { ++ char buf[GRUB_NET_MAX_STR_ADDR_LEN]; ++ struct grub_net_network_level_address base; ++ base.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6; ++ grub_memcpy (&base.ipv6, ((&inf->address)->ipv6), 16); ++ grub_net_addr_to_str (&base, buf); ++ ++ for (ptr = buf; *ptr; ptr++) ++ if (*ptr == ':') ++ *ptr = '-'; ++ ++ grub_snprintf (suffix, GRUB_NET_MAX_STR_ADDR_LEN, "%s", buf); ++ if (search_through (1, 0) == 0) return GRUB_ERR_NONE; ++ break; ++ } ++ case GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV: ++ return grub_error (GRUB_ERR_BUG, "shouldn't reach here"); ++ default: ++ return grub_error (GRUB_ERR_BUG, ++ "unsupported address type %d", (&inf->address)->type); ++ } ++ } ++ ++ /* Remove the remaining minus sign at the end. */ ++ config[config_len] = '\0'; ++ ++ return GRUB_ERR_NONE; ++} ++ + static struct grub_preboot *fini_hnd; + + static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; +diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c +index aa0b3e5..cc519a5 100644 +--- a/grub-core/normal/main.c ++++ b/grub-core/normal/main.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + GRUB_MOD_LICENSE ("GPLv3+"); + +@@ -379,10 +380,19 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), + + prefix = grub_env_get ("prefix"); + if (prefix) +- { +- config = grub_xasprintf ("%s/grub.cfg", prefix); +- if (! config) +- goto quit; ++ { ++ grub_size_t config_len; ++ config_len = grub_strlen (prefix) + ++ sizeof ("/grub.cfg-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"); ++ config = grub_malloc (config_len); ++ ++ if (! config) ++ goto quit; ++ ++ grub_snprintf (config, config_len, "%s/grub.cfg", prefix); ++ ++ if (grub_strncmp (prefix + 1, "tftp", sizeof ("tftp") - 1) == 0) ++ grub_net_search_configfile (config); + + grub_enter_normal_mode (config); + grub_free (config); +diff --git a/include/grub/net.h b/include/grub/net.h +index 45348dd..09b8d56 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -534,6 +534,9 @@ extern char *grub_net_default_server; + #define GRUB_NET_TRIES 40 + #define GRUB_NET_INTERVAL 400 + + #define VLANTAG_IDENTIFIER 0x8100 + ++grub_err_t ++grub_net_search_configfile (char *config); ++ + #endif /* ! GRUB_NET_HEADER */ +-- +1.7.10.4 + diff --git a/sort-version.patch b/sort-version.patch new file mode 100644 index 0000000..a0ed155 --- /dev/null +++ b/sort-version.patch @@ -0,0 +1,29 @@ +grub-mkconfig does not get it right when sorting "recent kernel first": + +sort kernel versions correctly: + +Wrong: + echo 'Loading Linux 3.0.8-1 ...' + echo 'Loading Linux 3.0.4-2 ...' + echo 'Loading Linux 3.0.13-1 ...' + echo 'Loading Linux 3.0.12-2 ...' + echo 'Loading Linux 2.6.38.8-1 ...' + +Correct: + echo 'Loading Linux 3.0.13-1 ...' + echo 'Loading Linux 3.0.12-2 ...' + echo 'Loading Linux 3.0.8-1 ...' + echo 'Loading Linux 3.0.4-2 ...' + echo 'Loading Linux 2.6.38.8-1 ...' + +--- grub-1.99/util/grub-mkconfig_lib.in~ 2012-01-12 00:47:28.626740879 +0200 ++++ grub-1.99/util/grub-mkconfig_lib.in 2012-01-12 00:53:49.554292436 +0200 +@@ -165,7 +165,7 @@ + a="$b" + b="$c" + fi +- if (echo "$a" ; echo "$b") | sort -n | head -n 1 | grep -qx "$b" ; then ++ if (echo "$a" ; echo "$b") | sort -V | head -n 1 | grep -qx "$b" ; then + return 0 + else + return 1 diff --git a/update-grub b/update-grub new file mode 100644 index 0000000..87c23b2 --- /dev/null +++ b/update-grub @@ -0,0 +1,26 @@ +#!/bin/sh +# Setup locale from system config, +# otherwise it would be inherited from running terminal + +if [ -f /etc/sysconfig/i18n ]; then + . /etc/sysconfig/i18n + + [ "$LANG" ] && export LANG || unset LANG + [ "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS + [ "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE + [ "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE + [ "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION || unset LC_IDENTIFICATION + [ "$LC_MEASUREMENT" ] && export LC_MEASUREMENT || unset LC_MEASUREMENT + [ "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES + [ "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY + [ "$LC_NAME" ] && export LC_NAME || unset LC_NAME + [ "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC + [ "$LC_PAPER" ] && export LC_PAPER || unset LC_PAPER + [ "$LC_TELEPHONE" ] && export LC_TELEPHONE || unset LC_TELEPHONE + [ "$LC_TIME" ] && export LC_TIME || unset LC_TIME + [ "$LC_ALL" ] && export LC_ALL || unset LC_ALL + [ "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE + [ "$LINGUAS" ] && export LINGUAS || unset LINGUAS +fi + +exec grub-mkconfig -o /boot/grub/grub.cfg "$@" diff --git a/update-grub.8 b/update-grub.8 new file mode 100644 index 0000000..fd621b2 --- /dev/null +++ b/update-grub.8 @@ -0,0 +1,18 @@ +.\" Copyright 2009 Felix Zielcke +.\" Licensed under GPL3+ +.TH UPDATE-GRUB "8" "November 2012" +.SH NAME +update-grub \- stub for grub-mkconfig +.SH SYNOPSIS +.B update-grub +.SH DESCRIPTION +.B update-grub +is a stub for running +.B grub-mkconfig -o /boot/grub/grub.cfg +to generate a grub2 config file. +.SH ENVIRONMENT +locale is initialized from the system +.B /etc/sysconfig/i18n +file. +.SH "SEE ALSO" +.BR grub-mkconfig (8) -- 2.46.0