Make a couple of commands be built differently.

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-07-12 11:06:40 -04:00
parent 3e6c63597b
commit ebe16ceeab
3 changed files with 215 additions and 11 deletions

View file

@ -1,28 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From a0bf57e044141d5807759da2da67a71d2f7f4f42 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 12 Jul 2018 11:00:45 -0400
Subject: [PATCH] Don't build the fdt command.
Subject: [PATCH] Don't build the fdt command
Don't build the fdt command separately but *do* build it into the arm64 kernel.
Trying to avoid all variants of:
cat syminfo.lst | sort | gawk -f ../../grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
grub_fdt_install in linux is not defined
grub_fdt_load in linux is not defined
grub_fdt_unload in linux is not defined
grub_fdt_install in xen_boot is not defined
grub_fdt_load in xen_boot is not defined
grub_fdt_unload in xen_boot is not defined
Don't build the fdt command separately but *do* build it into the arm64 kernel.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 3 +++
1 file changed, 3 insertions(+)
grub-core/Makefile.core.def | 15 ++++++++++++---
grub-core/kern/efi/fdt.c | 43 -------------------------------------------
grub-core/loader/efi/fdt.c | 22 ++++++++++++++++++++++
include/grub/efi/efi.h | 4 ----
4 files changed, 34 insertions(+), 50 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 9039a6f73a3..aabe53262f0 100644
index 9039a6f73a3..ff6fa4bd000 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -246,6 +246,7 @@ kernel = {
@@ -242,10 +242,8 @@ kernel = {
arm_efi = kern/arm/efi/init.c;
arm_efi = kern/arm/efi/misc.c;
- arm_efi = kern/efi/fdt.c;
arm64_efi = kern/arm64/efi/init.c;
arm64_efi = kern/efi/fdt.c;
+ arm64_efi = loader/efi/fdt.c;
- arm64_efi = kern/efi/fdt.c;
i386_pc = kern/i386/pc/init.c;
i386_pc = kern/i386/pc/mmap.c;
@@ -1729,12 +1730,14 @@ module = {
@@ -1701,11 +1699,17 @@ module = {
enable = i386_pc;
};
+/*
module = {
name = xen_boot;
arm64 = loader/arm64/xen_boot.c;
+
+ fdt = lib/fdt.c;
+ fdt = loader/efi/fdt.c;
+
enable = arm64;
};
+*/
module = {
name = linux;
@@ -1721,7 +1725,9 @@ module = {
arm = loader/arm/linux.c;
arm64 = loader/arm64/linux.c;
emu = loader/emu/linux.c;
+
fdt = lib/fdt.c;
+ fdt = loader/efi/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
@@ -1729,12 +1735,14 @@ module = {
efi = loader/efi/linux.c;
};
@ -37,3 +82,110 @@ index 9039a6f73a3..aabe53262f0 100644
module = {
name = xnu;
@@ -1795,7 +1803,8 @@ module = {
i386_coreboot = lib/LzmaDec.c;
enable = i386_pc;
enable = i386_coreboot;
- enable = efi;
+ enable = i386_efi;
+ enable = x86_64_efi;
};
module = {
diff --git a/grub-core/kern/efi/fdt.c b/grub-core/kern/efi/fdt.c
deleted file mode 100644
index 30100c61c14..00000000000
--- a/grub-core/kern/efi/fdt.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* fdt.c - EFI Flattened Device Tree interaction */
-/*
- * GRUB -- GRand Unified Bootloader
- * Copyright (C) 2006,2007 Free Software Foundation, Inc.
- *
- * GRUB is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GRUB is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/efi/efi.h>
-#include <grub/mm.h>
-
-void *
-grub_efi_get_firmware_fdt (void)
-{
- grub_efi_configuration_table_t *tables;
- grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
- void *firmware_fdt = NULL;
- unsigned int i;
-
- /* Look for FDT in UEFI config tables. */
- tables = grub_efi_system_table->configuration_table;
-
- for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
- if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
- {
- firmware_fdt = tables[i].vendor_table;
- grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
- break;
- }
-
- return firmware_fdt;
-}
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
index a4c6e803645..55c09a19939 100644
--- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c
@@ -35,6 +35,28 @@ static void *fdt;
sizeof (FDT_ADDR_CELLS_STRING) + \
sizeof (FDT_SIZE_CELLS_STRING))
+static void *
+grub_efi_get_firmware_fdt (void)
+{
+ grub_efi_configuration_table_t *tables;
+ grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
+ void *firmware_fdt = NULL;
+ unsigned int i;
+
+ /* Look for FDT in UEFI config tables. */
+ tables = grub_efi_system_table->configuration_table;
+
+ for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
+ if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
+ {
+ firmware_fdt = tables[i].vendor_table;
+ grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
+ break;
+ }
+
+ return firmware_fdt;
+}
+
void *
grub_fdt_load (grub_size_t additional_size)
{
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 29b4dbac1e4..f54828aaeae 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -123,10 +123,6 @@ extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
char **device,
char **path);
-#if defined(__arm__) || defined(__aarch64__)
-void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
-#endif
-
grub_addr_t grub_efi_section_addr (const char *section);
void grub_efi_mm_init (void);

52
Makefile Normal file
View file

@ -0,0 +1,52 @@
#
# Makefile
# Peter Jones, 2018-07-11 02:39
#
define get-config
$(shell git config --local --get "grub2.$(1)")
endef
FEDVER ?= $(call get-config, rebase.fedora-version)
ifeq ($(FEDVER),)
override FEDVER = 29
endif
ARCH ?=
ifneq ($(ARCH),)
override ARCH := $(foreach x,$(ARCH), --arch-override=$(x))
endif
# this is wacky because just using wildcard gets the list from before clean
# happens.
SOURCES ?= $(shell ls *.src.rpm)
all:
push :
git push
clean :
@rm -vf *.src.rpm
srpm : clean
fedpkg srpm
scratch: srpm
koji build --scratch ${ARCH} f${FEDVER} $(SOURCES)
release:
fedpkg build --target f${FEDVER} ${ARCH}
rebase:
./do-rebase --nocommit --nobumpspec f${FEDVER} ${REPO}
rpmspec:
rpmspec -D "_sourcedir $(shell pwd)" -P grub2.spec
local prep mockbuild compile :
fedpkg $@
.PHONY: all push srpm scratch release rebase rpmspec local prep mockbuild compile clean
# vim:ft=make

View file

@ -86,7 +86,7 @@
%ifarch aarch64 %{arm}
%global efi_modules " "
%else
%global efi_modules " backtrace usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug "
%global efi_modules " backtrace chain usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug "
%endif
%ifarch aarch64 %{arm}
@ -339,7 +339,7 @@ done \
%define do_efi_build_images() \
GRUB_MODULES=" all_video boot blscfg btrfs \\\
cat chain configfile \\\
cat configfile \\\
echo efi_netfs efifwsetup efinet ext2 \\\
fat font gfxmenu gfxterm gzio \\\
halt hfsplus http iso9660 jpeg \\\