From: Marcin Krol Date: Sun, 22 Dec 2013 20:11:23 +0000 (+0000) Subject: - PLD merge X-Git-Url: https://git.tld-linux.org/?p=packages%2Fgrub2.git;a=commitdiff_plain;h=71dd2aed5bb2b72c2d2d58235936d03ceec35757 - PLD merge --- diff --git a/grub.sysconfig b/grub.sysconfig index 870007a..9102811 100644 --- a/grub.sysconfig +++ b/grub.sysconfig @@ -20,7 +20,8 @@ GRUB_TIMEOUT=15 # 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" +# To disable IPv6 in kernel, append: ipv6.disable=1 +GRUB_CMDLINE_LINUX_DEFAULT="panic=120 quiet" # Command-line arguments to add to menu entries for the Linux kernel. GRUB_CMDLINE_LINUX="" diff --git a/grub2-efinet_fix.patch b/grub2-efinet_fix.patch new file mode 100644 index 0000000..06cb593 --- /dev/null +++ b/grub2-efinet_fix.patch @@ -0,0 +1,65 @@ +commit c5898eb4505dcd5f367048d33ec5ea9ed40dfdeb (HEAD, tmp) +Author: Vladimir 'phcoder' Serbinenko +Date: Sun Mar 17 13:33:16 2013 +0100 + + Resend a packet if we got the wrong buffer in status. + + (cherry picked from commit 2f1071d57ec026a7f271b1bfe302d14e86673c0f) + +diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c +index 28f2db2..2b344d6 100644 +--- a/grub-core/net/drivers/efi/efinet.c ++++ b/grub-core/net/drivers/efi/efinet.c +@@ -37,7 +37,6 @@ send_card_buffer (struct grub_net_card *dev, + grub_efi_status_t st; + grub_efi_simple_network_t *net = dev->efi_net; + grub_uint64_t limit_time = grub_get_time_ms () + 4000; +- grub_size_t len; + + if (dev->txbusy) + while (1) +@@ -52,17 +51,26 @@ send_card_buffer (struct grub_net_card *dev, + dev->txbusy = 0; + break; + } ++ if (txbuf) ++ { ++ st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size, ++ dev->txbuf, NULL, NULL, NULL); ++ if (st != GRUB_EFI_SUCCESS) ++ return grub_error (GRUB_ERR_IO, ++ N_("couldn't send network packet")); ++ } + if (limit_time < grub_get_time_ms ()) +- return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet")); ++ return grub_error (GRUB_ERR_TIMEOUT, ++ N_("couldn't send network packet")); + } + +- len = (pack->tail - pack->data); +- if (len > dev->mtu) +- len = dev->mtu; ++ dev->last_pkt_size = (pack->tail - pack->data); ++ if (dev->last_pkt_size > dev->mtu) ++ dev->last_pkt_size = dev->mtu; + +- grub_memcpy (dev->txbuf, pack->data, len); ++ grub_memcpy (dev->txbuf, pack->data, dev->last_pkt_size); + +- st = efi_call_7 (net->transmit, net, 0, len, ++ st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size, + dev->txbuf, NULL, NULL, NULL); + if (st != GRUB_EFI_SUCCESS) + return grub_error (GRUB_ERR_IO, N_("couldn't send network packet")); +diff --git a/include/grub/net.h b/include/grub/net.h +index 3877451..1bd7af2 100644 +--- a/include/grub/net.h ++++ b/include/grub/net.h +@@ -139,6 +139,7 @@ struct grub_net_card + { + struct grub_efi_simple_network *efi_net; + grub_efi_handle_t efi_handle; ++ grub_size_t last_pkt_size; + }; + #endif + void *data; diff --git a/grub2-freetype_include.patch b/grub2-freetype_include.patch new file mode 100644 index 0000000..185ce70 --- /dev/null +++ b/grub2-freetype_include.patch @@ -0,0 +1,12 @@ +diff -dur grub-2.00.orig/util/grub-mkfont.c grub-2.00/util/grub-mkfont.c +--- grub-2.00.orig/util/grub-mkfont.c 2012-03-10 13:17:57.000000000 +0100 ++++ grub-2.00/util/grub-mkfont.c 2013-11-30 12:42:43.623031541 +0100 +@@ -39,7 +39,7 @@ + #include FT_FREETYPE_H + #include FT_TRUETYPE_TAGS_H + #include FT_TRUETYPE_TABLES_H +-#include ++#include FT_SYNTHESIS_H + + #undef __FTERRORS_H__ + #define FT_ERROR_START_LIST const char *ft_errmsgs[] = { diff --git a/grub2-generated_files.patch b/grub2-generated_files.patch new file mode 100644 index 0000000..f1a40ad --- /dev/null +++ b/grub2-generated_files.patch @@ -0,0 +1,44 @@ +diff -dur -x '*~' grub-2.00.orig/grub-core/Makefile.core.def grub-2.00/grub-core/Makefile.core.def +--- grub-2.00.orig/grub-core/Makefile.core.def 2013-12-10 13:20:26.000000000 +0100 ++++ grub-2.00/grub-core/Makefile.core.def 2013-12-10 13:23:01.000000000 +0100 +@@ -1848,3 +1848,4 @@ + enable = i386; + }; + ++#include Makefile.gcry.def +diff -dur -x '*~' grub-2.00.orig/grub-core/Makefile.in grub-2.00/grub-core/Makefile.in +--- grub-2.00.orig/grub-core/Makefile.in 2012-06-26 14:12:27.000000000 +0200 ++++ grub-2.00/grub-core/Makefile.in 2013-12-10 13:22:48.000000000 +0100 +@@ -70505,7 +70505,7 @@ + .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am + $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl + if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi +- autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) ++ autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ + + # gentrigtables +--- grub-2.00.orig/conf/Makefile.common 2013-12-10 13:20:26.000000000 +0100 ++++ grub-2.00/conf/Makefile.common 2013-12-10 13:44:26.000000000 +0100 +@@ -174,5 +174,5 @@ + .PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am + $(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl + if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi +- autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) ++ autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ +--- grub-2.00.orig/configure.ac 2013-12-10 13:32:13.000000000 +0100 ++++ grub-2.00/configure.ac 2013-12-10 13:32:19.000000000 +0100 +@@ -1169,6 +1169,11 @@ + AC_CONFIG_FILES([util/bash-completion.d/Makefile]) + AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) + AC_CONFIG_FILES([config.h]) ++AC_CONFIG_FILES([grub-core/gdb_grub]) ++AC_CONFIG_FILES([grub-core/genmod.sh]) ++AC_CONFIG_FILES([grub-core/gensyminfo.sh]) ++AC_CONFIG_FILES([grub-core/gmodule.pl]) ++AC_CONFIG_FILES([grub-core/modinfo.sh]) + + AC_OUTPUT + [ + diff --git a/grub2-linuxefi.patch b/grub2-linuxefi.patch new file mode 100644 index 0000000..73a72a0 --- /dev/null +++ b/grub2-linuxefi.patch @@ -0,0 +1,482 @@ +From 9f8104db535a8d2f9ef42824669431bdd86b3fe8 Mon Sep 17 00:00:00 2001 +From: Matthew Garrett +Date: Tue, 10 Jul 2012 11:58:52 -0400 +Subject: [PATCH 446/482] Add support for linuxefi + +--- + 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(+) + create mode 100644 grub-core/loader/i386/efi/linux.c + +diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def +index bb62dce..def6606 100644 +--- a/grub-core/Makefile.core.def ++++ b/grub-core/Makefile.core.def +@@ -1534,6 +1534,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; +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index 77c9384..025d665 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -47,6 +47,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, +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +new file mode 100644 +index 0000000..b79e632 +--- /dev/null ++++ b/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)initrd_mem, BYTES_TO_PAGES(params->ramdisk_size)); ++ if (linux_cmdline) ++ grub_efi_free_pages((grub_efi_physical_address_t)linux_cmdline, BYTES_TO_PAGES(params->cmdline_size + 1)); ++ if (kernel_mem) ++ grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size)); ++ if (params) ++ grub_efi_free_pages((grub_efi_physical_address_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_uint64_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)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; ++ } ++ ++ 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_uint64_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_uint64_t) kernel_mem; ++ } ++ ++ 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)linux_cmdline, BYTES_TO_PAGES(lh.cmdline_size + 1)); ++ ++ if (kernel_mem && !loaded) ++ grub_efi_free_pages((grub_efi_physical_address_t)kernel_mem, BYTES_TO_PAGES(kernel_size)); ++ ++ if (params && !loaded) ++ grub_efi_free_pages((grub_efi_physical_address_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); ++} +diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h +index 489cf9e..9370fd5 100644 +--- a/include/grub/efi/efi.h ++++ b/include/grub/efi/efi.h +@@ -40,6 +40,9 @@ void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds); + 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 +diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h +index 9d064c8..c29c5af 100644 +--- a/include/grub/i386/linux.h ++++ b/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; + } __attribute__ ((packed)); + + /* Boot parameters for Linux based on 2.6.12. This is used by the setup +-- +1.8.2.1 + diff --git a/grub2-tftp_fix.patch b/grub2-tftp_fix.patch deleted file mode 100644 index 397a0d7..0000000 --- a/grub2-tftp_fix.patch +++ /dev/null @@ -1,36 +0,0 @@ -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-tftp_fixes.patch b/grub2-tftp_fixes.patch new file mode 100644 index 0000000..3846463 --- /dev/null +++ b/grub2-tftp_fixes.patch @@ -0,0 +1,144 @@ +From 1ff55c8030ed529b17b02993877ac4803e7aa449 Mon Sep 17 00:00:00 2001 +From: Vladimir 'phcoder' Serbinenko +Date: Mon, 2 Jul 2012 11:22:50 +0200 +Subject: [PATCH 1/3] * grub-core/net/tftp.c (ack): Fix endianness problem. + (tftp_receive): Likewise. Reported by: Michael Davidsaver. + +(cherry picked from commit a706f4cc6bddd03e67a66620101209c471177b53) +--- + grub-core/net/tftp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index 9c70efb..d0f39ea 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -143,7 +143,7 @@ ack (tftp_data_t data, grub_uint16_t block) + + 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 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + 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; +-- +1.8.2 + + +From 412928c729fff75cf53914cd4acac88c5e229397 Mon Sep 17 00:00:00 2001 +From: Avik Sil +Date: Wed, 14 Aug 2013 20:32:42 -0300 +Subject: [PATCH 2/3] * grub-core/net/tftp.c: Send tftp ack packet before + closing the socket. + +(cherry picked from commit 369508b3cb0a84c0118ee32adef923109ad187dc) +--- + grub-core/net/tftp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index d0f39ea..b9d9549 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -243,6 +243,8 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + data->block++; + if (size < data->block_size) + { ++ if (data->ack_sent < data->block) ++ ack (data, data->block); + file->device->net->eof = 1; + file->device->net->stall = 1; + grub_net_udp_close (data->sock); +-- +1.8.2 + + +From e944f5bb19bb7f07ca065df75979ba3067306ae1 Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Sat, 26 Oct 2013 12:48:49 +0200 +Subject: [PATCH 3/3] * grub-core/net/tftp.c: Retransmit ack when + rereceiving old packet. Try to handle more than 0xFFFF packets. + +(cherry picked from commit cf8d6bbd9eb2f5c6cbb0b6e437466c77fc7b6e9b) +--- + grub-core/net/tftp.c | 26 +++++++++++++++++--------- + 1 file changed, 17 insertions(+), 9 deletions(-) + +diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c +index b9d9549..97217d2 100644 +--- a/grub-core/net/tftp.c ++++ b/grub-core/net/tftp.c +@@ -102,7 +102,7 @@ typedef struct tftp_data + grub_uint64_t file_size; + grub_uint64_t block; + grub_uint32_t block_size; +- grub_uint32_t ack_sent; ++ grub_uint64_t ack_sent; + int have_oack; + struct grub_error_saved save_err; + grub_net_udp_socket_t sock; +@@ -110,6 +110,17 @@ typedef struct tftp_data + } *tftp_data_t; + + static int ++cmp_block (grub_uint16_t a, grub_uint16_t b) ++{ ++ grub_int16_t i = (grub_int16_t) (a - b); ++ if (i > 0) ++ return +1; ++ if (i < 0) ++ return -1; ++ return 0; ++} ++ ++static int + cmp (const void *a__, const void *b__) + { + struct grub_net_buff *a_ = *(struct grub_net_buff **) a__; +@@ -117,15 +128,11 @@ cmp (const void *a__, const void *b__) + struct tftphdr *a = (struct tftphdr *) a_->data; + struct tftphdr *b = (struct tftphdr *) b_->data; + /* We want the first elements to be on top. */ +- if (grub_be_to_cpu16 (a->u.data.block) < grub_be_to_cpu16 (b->u.data.block)) +- return +1; +- if (grub_be_to_cpu16 (a->u.data.block) > grub_be_to_cpu16 (b->u.data.block)) +- return -1; +- return 0; ++ return -cmp_block (grub_be_to_cpu16 (a->u.data.block), grub_be_to_cpu16 (b->u.data.block)); + } + + static grub_err_t +-ack (tftp_data_t data, grub_uint16_t block) ++ack (tftp_data_t data, grub_uint64_t block) + { + struct tftphdr *tftph_ack; + grub_uint8_t nbdata[512]; +@@ -213,12 +220,13 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)), + return GRUB_ERR_NONE; + nb_top = *nb_top_p; + tftph = (struct tftphdr *) nb_top->data; +- if (grub_be_to_cpu16 (tftph->u.data.block) >= data->block + 1) ++ if (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) >= 0) + break; ++ ack (data, grub_be_to_cpu16 (tftph->u.data.block)); + grub_netbuff_free (nb_top); + grub_priority_queue_pop (data->pq); + } +- if (grub_be_to_cpu16 (tftph->u.data.block) == data->block + 1) ++ while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0) + { + unsigned size; + +-- +1.8.2 + diff --git a/grub2.spec b/grub2.spec index f12e11e..41370a7 100644 --- a/grub2.spec +++ b/grub2.spec @@ -46,7 +46,7 @@ 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: 5 +Release: 6 License: GPL v2 Group: Base Source0: http://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz @@ -65,7 +65,7 @@ Patch7: %{name}-awk.patch Patch8: posix.patch Patch9: %{name}-gets.patch Patch10: %{name}-fonts_path.patch -Patch11: %{name}-tftp_fix.patch +Patch11: %{name}-tftp_fixes.patch Patch12: add-vlan-tag-support.patch Patch13: just-say-linux.patch Patch14: add-GRUB-DISABLE-SUBMENU-option.patch @@ -76,8 +76,14 @@ 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 +Patch22: %{name}-cfg.patch +Patch23: %{name}-freetype_include.patch +Patch24: %{name}-efinet_fix.patch +Patch25: %{name}-linuxefi.patch +Patch26: %{name}-generated_files.patch URL: http://www.gnu.org/software/grub/ BuildRequires: autoconf >= 2.53 +BuildRequires: autogen BuildRequires: automake >= 1:1.11.1-1 BuildRequires: bison BuildRequires: device-mapper-devel @@ -304,6 +310,11 @@ Motyw starfield dla GRUB-a. %patch19 -p1 %patch20 -p1 %patch21 -p1 +%patch22 -p0 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 %build # if gold is used then grub doesn't even boot