grub2/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch
Michael Chang 62e3547e57 Accepting request 741033 from home:michael-chang:devel
- Version bump to 2.04
  * removed
    - translations-20170427.tar.xz
  * grub2.spec
    - Make signed grub-tpm.efi specific to x86_64-efi build, the platform
      currently shipped with tpm module from upstream codebase
    - Add shim_lock to signed grub.efi in x86_64-efi build
    - x86_64: linuxefi now depends on linux, both will verify kernel via
      shim_lock
    - Remove translation tarball and po file hacks as it's been included in
      upstream tarball
  * rediff
    - grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch
    - grub2-commands-introduce-read_file-subcommand.patch
    - grub2-secureboot-add-linuxefi.patch
    - 0001-add-support-for-UEFI-network-protocols.patch
    - grub2-efi-HP-workaround.patch
    - grub2-secureboot-install-signed-grub.patch
    - grub2-linux.patch
    - use-grub2-as-a-package-name.patch
    - grub2-pass-corret-root-for-nfsroot.patch
    - grub2-secureboot-use-linuxefi-on-uefi.patch
    - grub2-secureboot-no-insmod-on-sb.patch
    - grub2-secureboot-provide-linuxefi-config.patch
    - grub2-secureboot-chainloader.patch
    - grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch
    - grub2-s390x-02-kexec-module-added-to-emu.patch
    - grub2-s390x-04-grub2-install.patch
    - grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch
    - grub2-efi-chainloader-root.patch

OBS-URL: https://build.opensuse.org/request/show/741033
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=340
2019-10-18 10:18:53 +00:00

305 lines
10 KiB
Diff

From f38ada424e7d991a0121253ba1abc430b86a990b Mon Sep 17 00:00:00 2001
From: John Jolly <jjolly@suse.de>
Date: Wed, 22 Jan 2014 01:18:10 -0700
Subject: [PATCH 1/3] - Changes made and files added in order to allow s390x
build
---
grub-core/kern/emu/cache_s.S | 1 +
grub-core/kern/emu/lite.c | 2 ++
grub-core/kern/s390x/dl.c | 37 +++++++++++++++++++++++++++++++++++
grub-core/lib/s390x/setjmp.S | 46 ++++++++++++++++++++++++++++++++++++++++++++
grub-core/lib/setjmp.S | 2 ++
include/grub/cache.h | 2 +-
include/grub/s390x/setjmp.h | 29 ++++++++++++++++++++++++++++
include/grub/s390x/time.h | 27 ++++++++++++++++++++++++++
include/grub/s390x/types.h | 32 ++++++++++++++++++++++++++++++
9 files changed, 177 insertions(+), 1 deletion(-)
create mode 100644 grub-core/kern/s390x/dl.c
create mode 100644 grub-core/lib/s390x/setjmp.S
create mode 100644 include/grub/s390x/setjmp.h
create mode 100644 include/grub/s390x/time.h
create mode 100644 include/grub/s390x/types.h
Index: grub-2.04~rc1/grub-core/kern/emu/cache_s.S
===================================================================
--- grub-2.04~rc1.orig/grub-core/kern/emu/cache_s.S
+++ grub-2.04~rc1/grub-core/kern/emu/cache_s.S
@@ -10,6 +10,7 @@
#include "../powerpc/cache.S"
#elif defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
defined(__mips__) || defined(__riscv)
+#elif defined(__s390x__)
#else
#error "No target cpu type is defined"
#endif
Index: grub-2.04~rc1/grub-core/kern/emu/lite.c
===================================================================
--- grub-2.04~rc1.orig/grub-core/kern/emu/lite.c
+++ grub-2.04~rc1/grub-core/kern/emu/lite.c
@@ -26,6 +26,8 @@
#include "../arm64/dl.c"
#elif defined(__riscv)
#include "../riscv/dl.c"
+#elif defined(__s390x__)
+#include "../s390x/dl.c"
#else
#error "No target cpu type is defined"
#endif
Index: grub-2.04~rc1/grub-core/kern/dl.c
===================================================================
--- grub-2.04~rc1.orig/grub-core/kern/dl.c
+++ grub-2.04~rc1/grub-core/kern/dl.c
@@ -229,7 +229,7 @@ grub_dl_load_segments (grub_dl_t mod, co
unsigned i;
const Elf_Shdr *s;
grub_size_t tsize = 0, talign = 1;
-#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv)
+#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && !defined (__s390x__)
grub_size_t tramp;
grub_size_t got;
grub_err_t err;
@@ -245,7 +245,7 @@ grub_dl_load_segments (grub_dl_t mod, co
talign = s->sh_addralign;
}
-#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv)
+#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && !defined (__s390x__)
err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got);
if (err)
return err;
@@ -308,7 +308,7 @@ grub_dl_load_segments (grub_dl_t mod, co
mod->segment = seg;
}
}
-#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv)
+#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && !defined (__s390x__)
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
mod->tramp = ptr;
mod->trampptr = ptr;
Index: grub-2.04~rc1/grub-core/kern/s390x/dl.c
===================================================================
--- /dev/null
+++ grub-2.04~rc1/grub-core/kern/s390x/dl.c
@@ -0,0 +1,40 @@
+/* dl.c - arch-dependent part of loadable module support */
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2004,2005,2007,2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/dl.h>
+
+/* Check if EHDR is a valid ELF header. */
+grub_err_t
+grub_arch_dl_check_header (void *ehdr)
+{
+ (void)(ehdr);
+ return GRUB_ERR_BUG;
+}
+
+/* Relocate symbols. */
+grub_err_t
+grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
+ Elf_Shdr *s, grub_dl_segment_t seg)
+{
+ (void)(mod);
+ (void)(ehdr);
+ (void)(s);
+ (void)(seg);
+ return GRUB_ERR_BUG;
+}
Index: grub-2.04~rc1/grub-core/lib/s390x/setjmp.S
===================================================================
--- /dev/null
+++ grub-2.04~rc1/grub-core/lib/s390x/setjmp.S
@@ -0,0 +1,46 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/symbol.h>
+#include <grub/dl.h>
+
+ .file "setjmp.S"
+
+GRUB_MOD_LICENSE "GPLv3+"
+
+ .text
+
+/*
+ * int grub_setjmp (grub_jmp_buf env)
+ */
+FUNCTION(grub_setjmp)
+ stmg %r11,%r15,0(%r2)
+ lghi %r2,0
+ br %r14
+
+/*
+ * int grub_longjmp (grub_jmp_buf env, int val)
+ */
+FUNCTION(grub_longjmp)
+ chi %r3,0
+ jne .L2
+ lghi %r3,1
+.L2:
+ lmg %r11,%r15,0(%r2)
+ lgr %r2,%r3
+ br %r14
Index: grub-2.04~rc1/grub-core/lib/setjmp.S
===================================================================
--- grub-2.04~rc1.orig/grub-core/lib/setjmp.S
+++ grub-2.04~rc1/grub-core/lib/setjmp.S
@@ -17,6 +17,8 @@
#include "./arm64/setjmp.S"
#elif defined(__riscv)
#include "./riscv/setjmp.S"
+#elif defined(__s390x__)
+#include "./s390x/setjmp.S"
#else
#error "Unknown target cpu type"
#endif
Index: grub-2.04~rc1/include/grub/cache.h
===================================================================
--- grub-2.04~rc1.orig/include/grub/cache.h
+++ grub-2.04~rc1/include/grub/cache.h
@@ -23,7 +23,7 @@
#include <grub/symbol.h>
#include <grub/types.h>
-#if defined (__i386__) || defined (__x86_64__)
+#if defined (__i386__) || defined (__x86_64__) || defined (__s390x__)
static inline void
grub_arch_sync_caches (void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
Index: grub-2.04~rc1/include/grub/s390x/setjmp.h
===================================================================
--- /dev/null
+++ grub-2.04~rc1/include/grub/s390x/setjmp.h
@@ -0,0 +1,29 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2004,2006,2007,2009 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_SETJMP_CPU_HEADER
+#define GRUB_SETJMP_CPU_HEADER 1
+
+#include <grub/types.h>
+
+typedef grub_uint64_t grub_jmp_buf[5];
+
+int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice));
+void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
+
+#endif /* ! GRUB_SETJMP_CPU_HEADER */
Index: grub-2.04~rc1/include/grub/s390x/time.h
===================================================================
--- /dev/null
+++ grub-2.04~rc1/include/grub/s390x/time.h
@@ -0,0 +1,27 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2007 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KERNEL_CPU_TIME_HEADER
+#define KERNEL_CPU_TIME_HEADER 1
+
+static __inline void
+grub_cpu_idle (void)
+{
+}
+
+#endif /* ! KERNEL_CPU_TIME_HEADER */
Index: grub-2.04~rc1/include/grub/s390x/types.h
===================================================================
--- /dev/null
+++ grub-2.04~rc1/include/grub/s390x/types.h
@@ -0,0 +1,32 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2004,2006,2007 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_TYPES_CPU_HEADER
+#define GRUB_TYPES_CPU_HEADER 1
+
+/* The size of void *. */
+#define GRUB_TARGET_SIZEOF_VOID_P 8
+
+/* The size of long. */
+#define GRUB_TARGET_SIZEOF_LONG 8
+
+/* s390x is big-endian. */
+#define GRUB_TARGET_WORDS_BIGENDIAN 1
+
+
+#endif /* ! GRUB_TYPES_CPU_HEADER */