grub2/grub2-s390x-01-Changes-made-and-files-added-in-order-to-allow-s390x.patch
Michael Chang 8ee92f5194 Accepting request 1105405 from home:michael-chang:grub:2.12rc1
- Implement NV index mode for TPM 2.0 key protector
  0001-protectors-Implement-NV-index.patch
- Fall back to passphrase mode when the key protector fails to
  unlock the disk
  0002-cryptodisk-Fallback-to-passphrase.patch
- Wipe out the cached key cleanly
  0003-cryptodisk-wipe-out-the-cached-keys-from-protectors.patch
- Make diskfiler to look up cryptodisk devices first
  0004-diskfilter-look-up-cryptodisk-devices-first.patch

- Version bump to 2.12~rc1
  * Added:
    - grub-2.12~rc1.tar.xz
  * Removed:
    - grub-2.06.tar.xz
  * Patch dropped merged by new version:
    - grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch
    - grub2-s390x-02-kexec-module-added-to-emu.patch
    - grub2-efi-chainloader-root.patch
    - grub2-Fix-incorrect-netmask-on-ppc64.patch
    - 0001-osdep-Introduce-include-grub-osdep-major.h-and-use-i.patch
    - 0002-osdep-linux-hostdisk-Use-stat-instead-of-udevadm-for.patch
    - 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch
    - grub2-s390x-10-keep-network-at-kexec.patch
    - 0001-Fix-build-error-in-binutils-2.36.patch
    - 0001-emu-fix-executable-stack-marking.patch
    - 0046-squash-verifiers-Move-verifiers-API-to-kernel-image.patch
    - 0001-30_uefi-firmware-fix-printf-format-with-null-byte.patch
    - 0001-tpm-Pass-unknown-error-as-non-fatal-but-debug-print-.patch
    - 0001-Filter-out-POSIX-locale-for-translation.patch

OBS-URL: https://build.opensuse.org/request/show/1105405
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=458
2023-08-24 03:25:56 +00:00

297 lines
9.1 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
--- a/grub-core/kern/emu/cache_s.S
+++ b/grub-core/kern/emu/cache_s.S
@@ -15,6 +15,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
--- a/grub-core/kern/emu/lite.c
+++ b/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
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -230,7 +230,7 @@
const Elf_Shdr *s;
grub_size_t tsize = 0, talign = 1;
#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && \
- !defined (__loongarch__)
+ !defined (__loongarch__) && !defined (__s390x__)
grub_size_t tramp;
grub_size_t got;
grub_err_t err;
@@ -247,7 +247,7 @@
}
#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && \
- !defined (__loongarch__)
+ !defined (__loongarch__) && !defined (__s390x__)
err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got);
if (err)
return err;
@@ -311,7 +311,7 @@
}
}
#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv) && \
- !defined (__loongarch__)
+ !defined (__loongarch__) && !defined (__s390x__)
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
mod->tramp = ptr;
mod->trampptr = ptr;
--- /dev/null
+++ b/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;
+}
--- /dev/null
+++ b/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
--- a/grub-core/lib/setjmp.S
+++ b/grub-core/lib/setjmp.S
@@ -23,6 +23,8 @@
#include "./loongarch64/setjmp.S"
#elif defined(__riscv)
#include "./riscv/setjmp.S"
+#elif defined(__s390x__)
+#include "./s390x/setjmp.S"
#else
#error "Unknown target cpu type"
#endif
--- a/include/grub/cache.h
+++ b/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)))
--- /dev/null
+++ b/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 */
--- /dev/null
+++ b/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 */
--- /dev/null
+++ b/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 */
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -407,6 +407,9 @@
extra_dist = kern/i386/realmode.S;
extra_dist = boot/i386/pc/lzma_decode.S;
extra_dist = kern/mips/cache_flush.S;
+
+ extra_dist = kern/s390x/dl.c;
+ extra_dist = lib/s390x/setjmp.S;
};
program = {