Nuevo: grub-custom
This commit is contained in:
parent
f0369f5310
commit
7a64fd603c
9 changed files with 681 additions and 0 deletions
21
Plantillas/grub-custom/files/grub.default
Normal file
21
Plantillas/grub-custom/files/grub.default
Normal file
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# Configuration file for GRUB.
|
||||
#
|
||||
GRUB_DEFAULT=0
|
||||
#GRUB_HIDDEN_TIMEOUT=0
|
||||
#GRUB_HIDDEN_TIMEOUT_QUIET=false
|
||||
GRUB_TIMEOUT=5
|
||||
GRUB_DISTRIBUTOR="Void"
|
||||
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4"
|
||||
# Uncomment to use basic console
|
||||
#GRUB_TERMINAL_INPUT="console"
|
||||
# Uncomment to disable graphical terminal
|
||||
#GRUB_TERMINAL_OUTPUT=console
|
||||
#GRUB_BACKGROUND=/usr/share/void-artwork/splash.png
|
||||
#GRUB_GFXMODE=1920x1080x32
|
||||
#GRUB_DISABLE_LINUX_UUID=true
|
||||
#GRUB_DISABLE_RECOVERY=true
|
||||
# Uncomment and set to the desired menu colors. Used by normal and wallpaper
|
||||
# modes only. Entries specified as foreground/background.
|
||||
#GRUB_COLOR_NORMAL="light-blue/black"
|
||||
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
|
19
Plantillas/grub-custom/files/kernel.d/grub.post
Normal file
19
Plantillas/grub-custom/files/kernel.d/grub.post
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Kernel hook for GRUB 2.
|
||||
#
|
||||
# Arguments passed to this script: $1 pkgname, $2 version.
|
||||
#
|
||||
PKGNAME="$1"
|
||||
VERSION="$2"
|
||||
|
||||
export ZPOOL_VDEV_NAME_PATH=YES
|
||||
|
||||
if command -v grub-mkconfig >/dev/null 2>&1; then
|
||||
if [ -d $ROOTDIR/boot/grub ]; then
|
||||
grub-mkconfig -o $ROOTDIR/boot/grub/grub.cfg
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,32 @@
|
|||
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
||||
index f8cbb8d..f271608 100644
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -246,6 +246,8 @@ export GRUB_DEFAULT \
|
||||
GRUB_BACKGROUND \
|
||||
GRUB_THEME \
|
||||
GRUB_GFXPAYLOAD_LINUX \
|
||||
+ GRUB_COLOR_NORMAL \
|
||||
+ GRUB_COLOR_HIGHLIGHT \
|
||||
GRUB_INIT_TUNE \
|
||||
GRUB_SAVEDEFAULT \
|
||||
GRUB_ENABLE_CRYPTODISK \
|
||||
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
|
||||
index d2e7252..8259f45 100644
|
||||
--- a/util/grub.d/00_header.in
|
||||
+++ b/util/grub.d/00_header.in
|
||||
@@ -125,6 +125,14 @@ cat <<EOF
|
||||
|
||||
EOF
|
||||
|
||||
+if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then
|
||||
+ cat << EOF
|
||||
+set menu_color_normal=$GRUB_COLOR_NORMAL
|
||||
+set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
|
||||
+
|
||||
+EOF
|
||||
+fi
|
||||
+
|
||||
serial=0;
|
||||
gfxterm=0;
|
||||
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
|
|
@ -0,0 +1,71 @@
|
|||
From 04aa0aa735f4bfa2d7a4f6593745fbe1d7fa0d0a Mon Sep 17 00:00:00 2001
|
||||
From: Ian Campbell <ijc@hellion.org.uk>
|
||||
Date: Sat, 6 Sep 2014 12:20:12 +0100
|
||||
Subject: grub-install: Install PV Xen binaries into the upstream specified
|
||||
path
|
||||
|
||||
Upstream have defined a specification for where guests ought to place their
|
||||
xenpv grub binaries in order to facilitate chainloading from a stage 1 grub
|
||||
loaded from dom0.
|
||||
|
||||
http://xenbits.xen.org/docs/unstable-staging/misc/x86-xenpv-bootloader.html
|
||||
|
||||
The spec calls for installation into /boot/xen/pvboot-i386.elf or
|
||||
/boot/xen/pvboot-x86_64.elf.
|
||||
|
||||
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
|
||||
|
||||
Bug-Debian: https://bugs.debian.org/762307
|
||||
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2014-10/msg00041.html
|
||||
Last-Update: 2014-10-24
|
||||
|
||||
Patch-Name: grub-install-pvxen-paths.patch
|
||||
|
||||
---
|
||||
v2: Respect bootdir, create /boot/xen as needed.
|
||||
---
|
||||
util/grub-install.c | 24 ++++++++++++++++++++++--
|
||||
1 file changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index b82c14d41..caadada98 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -1962,6 +1962,28 @@ main (int argc, char *argv[])
|
||||
}
|
||||
break;
|
||||
|
||||
+ case GRUB_INSTALL_PLATFORM_I386_XEN:
|
||||
+ {
|
||||
+ char *path = grub_util_path_concat (2, bootdir, "xen");
|
||||
+ char *dst = grub_util_path_concat (2, path, "pvboot-i386.elf");
|
||||
+ grub_install_mkdir_p (path);
|
||||
+ grub_install_copy_file (imgfile, dst, 1);
|
||||
+ free (dst);
|
||||
+ free (path);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_INSTALL_PLATFORM_X86_64_XEN:
|
||||
+ {
|
||||
+ char *path = grub_util_path_concat (2, bootdir, "xen");
|
||||
+ char *dst = grub_util_path_concat (2, path, "pvboot-x86_64.elf");
|
||||
+ grub_install_mkdir_p (path);
|
||||
+ grub_install_copy_file (imgfile, dst, 1);
|
||||
+ free (dst);
|
||||
+ free (path);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
|
||||
case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
|
||||
case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
|
||||
@@ -1971,8 +1971,6 @@ main (int argc, char *argv[])
|
||||
case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
|
||||
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
|
||||
case GRUB_INSTALL_PLATFORM_I386_QEMU:
|
||||
- case GRUB_INSTALL_PLATFORM_I386_XEN:
|
||||
- case GRUB_INSTALL_PLATFORM_X86_64_XEN:
|
||||
case GRUB_INSTALL_PLATFORM_I386_XEN_PVH:
|
||||
grub_util_warn ("%s",
|
||||
_("WARNING: no platform-specific install was performed"));
|
32
Plantillas/grub-custom/patches/ieee1275-clear-reset.patch
Normal file
32
Plantillas/grub-custom/patches/ieee1275-clear-reset.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
From 54b741317568867fc4ad801a65397d05f3ea0f59 Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
|
||||
Date: Thu, 25 Sep 2014 18:41:29 -0300
|
||||
Subject: Include a text attribute reset in the clear command for ppc
|
||||
|
||||
Always clear text attribute for clear command in order to avoid problems
|
||||
after it boots.
|
||||
|
||||
* grub-core/term/terminfo.c: Add escape for text attribute reset
|
||||
|
||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1295255
|
||||
Origin: other, https://lists.gnu.org/archive/html/grub-devel/2014-09/msg00076.html
|
||||
Last-Update: 2014-09-26
|
||||
|
||||
Patch-Name: ieee1275-clear-reset.patch
|
||||
---
|
||||
grub-core/term/terminfo.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
|
||||
index f0d3e3deb..7cb7909c8 100644
|
||||
--- a/grub-core/term/terminfo.c
|
||||
+++ b/grub-core/term/terminfo.c
|
||||
@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,
|
||||
/* Clear the screen. Using serial console, screen(1) only recognizes the
|
||||
* ANSI escape sequence. Using video console, Apple Open Firmware
|
||||
* (version 3.1.1) only recognizes the literal ^L. So use both. */
|
||||
- data->cls = grub_strdup ("\e[2J");
|
||||
+ data->cls = grub_strdup ("\e[2J\e[m");
|
||||
data->reverse_video_on = grub_strdup ("\e[7m");
|
||||
data->reverse_video_off = grub_strdup ("\e[m");
|
||||
if (grub_strcmp ("ieee1275", str) == 0)
|
220
Plantillas/grub-custom/patches/install_powerpc_machtypes.patch
Normal file
220
Plantillas/grub-custom/patches/install_powerpc_machtypes.patch
Normal file
|
@ -0,0 +1,220 @@
|
|||
From 35118b5023b0d9b4e3ad82f6e15fb696ad8e2a10 Mon Sep 17 00:00:00 2001
|
||||
From: Colin Watson <cjwatson@debian.org>
|
||||
Date: Tue, 28 Jan 2014 14:40:02 +0000
|
||||
Subject: Port yaboot logic for various powerpc machine types
|
||||
|
||||
Some powerpc machines require not updating the NVRAM. This can be handled
|
||||
by existing grub-install command-line options, but it's friendlier to detect
|
||||
this automatically.
|
||||
|
||||
On chrp_ibm machines, use the nvram utility rather than nvsetenv. (This
|
||||
is possibly suitable for other machines too, but that needs to be
|
||||
verified.)
|
||||
|
||||
Forwarded: no
|
||||
Last-Update: 2014-10-15
|
||||
|
||||
Patch-Name: install_powerpc_machtypes.patch
|
||||
---
|
||||
grub-core/osdep/basic/platform.c | 5 +++
|
||||
grub-core/osdep/linux/platform.c | 72 ++++++++++++++++++++++++++++++
|
||||
grub-core/osdep/unix/platform.c | 28 +++++++++---
|
||||
grub-core/osdep/windows/platform.c | 6 +++
|
||||
include/grub/util/install.h | 3 ++
|
||||
util/grub-install.c | 11 +++++
|
||||
6 files changed, 119 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grub-core/osdep/basic/platform.c b/grub-core/osdep/basic/platform.c
|
||||
index 4b5502aeb..2ab907976 100644
|
||||
--- a/grub-core/osdep/basic/platform.c
|
||||
+++ b/grub-core/osdep/basic/platform.c
|
||||
@@ -30,3 +30,8 @@ grub_install_get_default_x86_platform (void)
|
||||
return "i386-pc";
|
||||
}
|
||||
|
||||
+const char *
|
||||
+grub_install_get_default_powerpc_machtype (void)
|
||||
+{
|
||||
+ return "generic";
|
||||
+}
|
||||
diff --git a/grub-core/osdep/linux/platform.c b/grub-core/osdep/linux/platform.c
|
||||
index 35f1bcc0e..9805c36d4 100644
|
||||
--- a/grub-core/osdep/linux/platform.c
|
||||
+++ b/grub-core/osdep/linux/platform.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <grub/emu/misc.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
+#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/utsname.h>
|
||||
@@ -154,3 +154,74 @@ grub_install_get_default_x86_platform (void)
|
||||
grub_util_info ("... not found");
|
||||
return "i386-pc";
|
||||
}
|
||||
+
|
||||
+const char *
|
||||
+grub_install_get_default_powerpc_machtype (void)
|
||||
+{
|
||||
+ FILE *fp;
|
||||
+ char *buf = NULL;
|
||||
+ size_t len = 0;
|
||||
+ const char *machtype = "generic";
|
||||
+
|
||||
+ fp = grub_util_fopen ("/proc/cpuinfo", "r");
|
||||
+ if (! fp)
|
||||
+ return machtype;
|
||||
+
|
||||
+ while (getline (&buf, &len, fp) > 0)
|
||||
+ {
|
||||
+ if (strncmp (buf, "pmac-generation",
|
||||
+ sizeof ("pmac-generation") - 1) == 0)
|
||||
+ {
|
||||
+ if (strstr (buf, "NewWorld"))
|
||||
+ {
|
||||
+ machtype = "pmac_newworld";
|
||||
+ break;
|
||||
+ }
|
||||
+ if (strstr (buf, "OldWorld"))
|
||||
+ {
|
||||
+ machtype = "pmac_oldworld";
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strncmp (buf, "motherboard", sizeof ("motherboard") - 1) == 0 &&
|
||||
+ strstr (buf, "AAPL"))
|
||||
+ {
|
||||
+ machtype = "pmac_oldworld";
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (strncmp (buf, "machine", sizeof ("machine") - 1) == 0 &&
|
||||
+ strstr (buf, "CHRP IBM"))
|
||||
+ {
|
||||
+ if (strstr (buf, "qemu"))
|
||||
+ {
|
||||
+ machtype = "chrp_ibm_qemu";
|
||||
+ break;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ machtype = "chrp_ibm";
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strncmp (buf, "platform", sizeof ("platform") - 1) == 0)
|
||||
+ {
|
||||
+ if (strstr (buf, "Maple"))
|
||||
+ {
|
||||
+ machtype = "maple";
|
||||
+ break;
|
||||
+ }
|
||||
+ if (strstr (buf, "Cell"))
|
||||
+ {
|
||||
+ machtype = "cell";
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ free (buf);
|
||||
+ fclose (fp);
|
||||
+ return machtype;
|
||||
+}
|
||||
diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c
|
||||
index a3fcfcaca..28cb37e15 100644
|
||||
--- a/grub-core/osdep/unix/platform.c
|
||||
+++ b/grub-core/osdep/unix/platform.c
|
||||
@@ -218,13 +218,29 @@ grub_install_register_ieee1275 (int is_prep, const char *install_device,
|
||||
else
|
||||
boot_device = get_ofpathname (install_device);
|
||||
|
||||
- if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device",
|
||||
- boot_device, NULL }))
|
||||
+ if (strcmp (grub_install_get_default_powerpc_machtype (), "chrp_ibm") == 0)
|
||||
{
|
||||
- char *cmd = xasprintf ("setenv boot-device %s", boot_device);
|
||||
- grub_util_error (_("`nvsetenv' failed. \nYou will have to set `boot-device' variable manually. At the IEEE1275 prompt, type:\n %s\n"),
|
||||
- cmd);
|
||||
- free (cmd);
|
||||
+ char *arg = xasprintf ("boot-device=%s", boot_device);
|
||||
+ if (grub_util_exec ((const char * []){ "nvram",
|
||||
+ "--update-config", arg, NULL }))
|
||||
+ {
|
||||
+ char *cmd = xasprintf ("setenv boot-device %s", boot_device);
|
||||
+ grub_util_error (_("`nvram' failed. \nYou will have to set `boot-device' variable manually. At the IEEE1275 prompt, type:\n %s\n"),
|
||||
+ cmd);
|
||||
+ free (cmd);
|
||||
+ }
|
||||
+ free (arg);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device",
|
||||
+ boot_device, NULL }))
|
||||
+ {
|
||||
+ char *cmd = xasprintf ("setenv boot-device %s", boot_device);
|
||||
+ grub_util_error (_("`nvsetenv' failed. \nYou will have to set `boot-device' variable manually. At the IEEE1275 prompt, type:\n %s\n"),
|
||||
+ cmd);
|
||||
+ free (cmd);
|
||||
+ }
|
||||
}
|
||||
|
||||
free (boot_device);
|
||||
diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c
|
||||
index 912269191..c30025b13 100644
|
||||
--- a/grub-core/osdep/windows/platform.c
|
||||
+++ b/grub-core/osdep/windows/platform.c
|
||||
@@ -128,6 +128,12 @@ grub_install_get_default_x86_platform (void)
|
||||
return "i386-efi";
|
||||
}
|
||||
|
||||
+const char *
|
||||
+grub_install_get_default_powerpc_machtype (void)
|
||||
+{
|
||||
+ return "generic";
|
||||
+}
|
||||
+
|
||||
static void *
|
||||
get_efi_variable (const wchar_t *varname, ssize_t *len)
|
||||
{
|
||||
diff --git a/include/grub/util/install.h b/include/grub/util/install.h
|
||||
index 5ca4811cd..9f517a1bb 100644
|
||||
--- a/include/grub/util/install.h
|
||||
+++ b/include/grub/util/install.h
|
||||
@@ -223,6 +223,9 @@ grub_install_get_default_arm_platform (void);
|
||||
const char *
|
||||
grub_install_get_default_x86_platform (void);
|
||||
|
||||
+const char *
|
||||
+grub_install_get_default_powerpc_machtype (void);
|
||||
+
|
||||
int
|
||||
grub_install_register_efi (grub_device_t efidir_grub_dev,
|
||||
const char *efifile_path,
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index e1a0202da..70b22eec4 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -1179,7 +1179,18 @@ main (int argc, char *argv[])
|
||||
|
||||
if (platform == GRUB_INSTALL_PLATFORM_POWERPC_IEEE1275)
|
||||
{
|
||||
+ const char *machtype = grub_install_get_default_powerpc_machtype ();
|
||||
int is_guess = 0;
|
||||
+
|
||||
+ if (strcmp (machtype, "pmac_oldworld") == 0)
|
||||
+ update_nvram = 0;
|
||||
+ else if (strcmp (machtype, "cell") == 0)
|
||||
+ update_nvram = 0;
|
||||
+ else if (strcmp (machtype, "generic") == 0)
|
||||
+ update_nvram = 0;
|
||||
+ else if (strcmp (machtype, "chrp_ibm_qemu") == 0)
|
||||
+ update_nvram = 0;
|
||||
+
|
||||
if (!macppcdir)
|
||||
{
|
||||
char *d;
|
16
Plantillas/grub-custom/patches/os-prober-osx86.patch
Normal file
16
Plantillas/grub-custom/patches/os-prober-osx86.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
Patches OS X detection out of os-prober hook on non-x86 architectures. The
|
||||
menu entries generated for those are invalid for non-x86 Mac stuff.
|
||||
--- a/util/grub.d/30_os-prober.in
|
||||
+++ b/util/grub.d/30_os-prober.in
|
||||
@@ -45,6 +45,11 @@ if [ -z "${OSPROBED}" ] ; then
|
||||
fi
|
||||
|
||||
osx_entry() {
|
||||
+ # GRUB won't load OS X outside of x86, no entry
|
||||
+ case "x`uname -m`" in
|
||||
+ xi?86|xx86_64) ;;
|
||||
+ *) return ;;
|
||||
+ esac
|
||||
if [ x$2 = x32 ]; then
|
||||
# TRANSLATORS: it refers to kernel architecture (32-bit)
|
||||
bitstr="$(gettext "(32-bit)")"
|
52
Plantillas/grub-custom/patches/ppc64el-disable-vsx.patch
Normal file
52
Plantillas/grub-custom/patches/ppc64el-disable-vsx.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From efc381a55124b12fc74ed8117283f11367c9372a Mon Sep 17 00:00:00 2001
|
||||
From: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
|
||||
Date: Thu, 25 Sep 2014 19:33:39 -0300
|
||||
Subject: Disable VSX instruction
|
||||
|
||||
VSX bit is enabled by default for Power7 and Power8 CPU models,
|
||||
so we need to disable them in order to avoid instruction exceptions.
|
||||
Kernel will activate it when necessary.
|
||||
|
||||
* grub-core/kern/powerpc/ieee1275/startup.S: Disable VSX.
|
||||
|
||||
Also-By: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
||||
Also-By: Colin Watson <cjwatson@debian.org>
|
||||
|
||||
Origin: other, https://lists.gnu.org/archive/html/grub-devel/2014-09/msg00078.html
|
||||
Last-Update: 2015-01-27
|
||||
|
||||
Patch-Name: ppc64el-disable-vsx.patch
|
||||
---
|
||||
grub-core/kern/powerpc/ieee1275/startup.S | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/grub-core/kern/powerpc/ieee1275/startup.S b/grub-core/kern/powerpc/ieee1275/startup.S
|
||||
index 21c884b43..de9a9601a 100644
|
||||
--- a/grub-core/kern/powerpc/ieee1275/startup.S
|
||||
+++ b/grub-core/kern/powerpc/ieee1275/startup.S
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
+#define MSR_VSX 0x80
|
||||
+
|
||||
.extern __bss_start
|
||||
.extern _end
|
||||
|
||||
@@ -28,6 +30,16 @@
|
||||
.globl start, _start
|
||||
start:
|
||||
_start:
|
||||
+ _start:
|
||||
+
|
||||
+ /* Disable VSX instruction */
|
||||
+ mfmsr 0
|
||||
+ oris 0,0,MSR_VSX
|
||||
+ /* The "VSX Available" bit is in the lower half of the MSR, so we
|
||||
+ don't need mtmsrd, which in any case won't work in 32-bit mode. */
|
||||
+ mtmsr 0
|
||||
+ isync
|
||||
+
|
||||
li 2, 0
|
||||
li 13, 0
|
||||
|
218
Plantillas/grub-custom/template
Normal file
218
Plantillas/grub-custom/template
Normal file
|
@ -0,0 +1,218 @@
|
|||
# Template file for 'grub'
|
||||
pkgname=grub
|
||||
version=2.06
|
||||
revision=2
|
||||
hostmakedepends="python3 pkg-config flex freetype-devel font-unifont-bdf help2man"
|
||||
makedepends="libusb-compat-devel ncurses-devel freetype-devel
|
||||
liblzma-devel device-mapper-devel fuse-devel"
|
||||
#depends="os-prober"
|
||||
conf_files="/etc/default/grub /etc/grub.d/*"
|
||||
short_desc="GRand Unified Bootloader 2"
|
||||
maintainer="Orphaned <orphan@voidlinux.org>"
|
||||
license="GPL-3.0-or-later"
|
||||
homepage="https://www.gnu.org/software/grub/"
|
||||
distfiles="${GNU_SITE}/grub/grub-${version}.tar.xz"
|
||||
checksum=b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1
|
||||
|
||||
archs="i686* x86_64* aarch64* ppc ppc-musl ppc64*"
|
||||
nopie=yes
|
||||
|
||||
subpackages="grub-utils"
|
||||
# _SUPPLEMENTARY_BUILDS is a list of <TARGET>-<PLATFORN> version of grub to build
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
x86_64*)
|
||||
_NATIVE_PLATFORM=pc
|
||||
_SUPPLEMENTARY_BUILDS="i386-efi x86_64-efi i386-coreboot x86_64-xen"
|
||||
subpackages+=" grub-i386-efi grub-x86_64-efi grub-i386-coreboot grub-xen"
|
||||
;;
|
||||
i686*)
|
||||
CFLAGS="-D_FILE_OFFSET_BITS=64"
|
||||
hostmakedepends+=" cross-x86_64-linux-musl"
|
||||
configure_args+=" ac_cv_sizeof_off_t=8"
|
||||
_NATIVE_PLATFORM=pc
|
||||
_SUPPLEMENTARY_BUILDS="i386-efi x86_64-efi i386-coreboot i386-xen"
|
||||
subpackages+=" grub-i386-efi grub-x86_64-efi grub-i386-coreboot grub-xen"
|
||||
;;
|
||||
aarch64*)
|
||||
_NATIVE_PLATFORM=efi
|
||||
subpackages+=" grub-arm64-efi"
|
||||
;;
|
||||
ppc*)
|
||||
_NATIVE_PLATFORM=ieee1275
|
||||
subpackages+=" grub-powerpc-ieee1275"
|
||||
;;
|
||||
esac
|
||||
|
||||
do_configure() {
|
||||
# workaround for https://savannah.gnu.org/bugs/?60458
|
||||
# some more info: https://www.linuxquestions.org/questions/showthread.php?p=6257712
|
||||
# grub 2.06 reboots immediately when compiled with -O2,
|
||||
# only affects legacy BIOS
|
||||
export CFLAGS="${CFLAGS/-O2/-Os}"
|
||||
export CXXFLAGS="${CXXFLAGS/-O2/-Os}"
|
||||
|
||||
unset CC AS LD RANLIB CPP
|
||||
local freestanding_cflags="-fno-stack-protector"
|
||||
|
||||
# building with altivec generates broken grub core
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
ppc*) freestanding_cflags+=" -mno-altivec" ;;
|
||||
esac
|
||||
CFLAGS+=" $freestanding_cflags"
|
||||
|
||||
configure_args+=" --enable-device-mapper --enable-cache-stats --enable-nls
|
||||
--enable-grub-mkfont --enable-grub-mount --disable-werror
|
||||
--sbindir=/usr/bin"
|
||||
|
||||
# build tools
|
||||
msg_normal "Configuring grub tools...\n"
|
||||
mkdir $wrksrc/build
|
||||
cd $wrksrc/build
|
||||
../configure --host=${XBPS_TARGET_MACHINE} ${configure_args} \
|
||||
${_NATIVE_PLATFORM:+--with-platform=${_NATIVE_PLATFORM}}
|
||||
|
||||
for _SUPP_BUILD in ${_SUPPLEMENTARY_BUILDS}; do
|
||||
_TARGET=${_SUPP_BUILD%%-*}
|
||||
_PLATFORM=${_SUPP_BUILD##*-}
|
||||
msg_normal "Configuring ${_TARGET} ${_PLATFORM} grub...\n"
|
||||
mkdir $wrksrc/${_PLATFORM}_${_TARGET}_build
|
||||
cd $wrksrc/${_PLATFORM}_${_TARGET}_build
|
||||
if [ "$_TARGET" = x86_64 ] &&
|
||||
[ "${XBPS_TARGET_MACHINE%-musl}" = i686 ]; then
|
||||
_TARGET=x86_64-linux-musl
|
||||
fi
|
||||
CFLAGS="$freestanding_cflags" \
|
||||
../configure --host=${XBPS_TARGET_MACHINE} \
|
||||
--target=${_TARGET} \
|
||||
--with-platform=${_PLATFORM} ${configure_args} \
|
||||
--disable-efiemu \
|
||||
--libdir=/usr/lib
|
||||
done
|
||||
}
|
||||
|
||||
do_build() {
|
||||
# XXX remove the strip wrapper
|
||||
rm ${XBPS_WRAPPERDIR}/strip
|
||||
|
||||
msg_normal "Building grub tools...\n"
|
||||
cd $wrksrc/build
|
||||
make ${makejobs}
|
||||
|
||||
for _SUPP_BUILD in ${_SUPPLEMENTARY_BUILDS}; do
|
||||
_TARGET=${_SUPP_BUILD%%-*}
|
||||
_PLATFORM=${_SUPP_BUILD##*-}
|
||||
msg_normal "Building ${_TARGET} ${_PLATFORM} grub...\n"
|
||||
cd $wrksrc/${_PLATFORM}_${_TARGET}_build
|
||||
make ${makejobs}
|
||||
done
|
||||
}
|
||||
|
||||
do_install() {
|
||||
# XXX remove the strip wrapper
|
||||
rm ${XBPS_WRAPPERDIR}/strip
|
||||
|
||||
for _SUPP_BUILD in ${_SUPPLEMENTARY_BUILDS}; do
|
||||
_TARGET=${_SUPP_BUILD%%-*}
|
||||
_GRUB_TARGET=${_TARGET}
|
||||
case "${_GRUB_TARGET}" in
|
||||
aarch64*)
|
||||
_GRUB_TARGET=arm64
|
||||
;;
|
||||
esac
|
||||
_PLATFORM=${_SUPP_BUILD##*-}
|
||||
cd $wrksrc/${_PLATFORM}_${_TARGET}_build
|
||||
make DESTDIR=$DESTDIR/${_PLATFORM}_${_TARGET} install
|
||||
# Remove non-platform specific files
|
||||
rm -rf ${DESTDIR}/${_PLATFORM}_${_TARGET}/{boot,etc,usr/{share,bin}}
|
||||
rm -f ${DESTDIR}/${_PLATFORM}_${_TARGET}/usr/lib/grub/${_GRUB_TARGET}-${_PLATFORM}/${_GRUB_TARGET}-*
|
||||
rm -f ${DESTDIR}/${_PLATFORM}_${_TARGET}/usr/lib/grub/${_GRUB_TARGET}-${_PLATFORM}/*.{module,image}
|
||||
cp -r ${DESTDIR}/${_PLATFORM}_${_TARGET}/* ${DESTDIR}
|
||||
rm -rf ${DESTDIR}/${_PLATFORM}_${_TARGET}
|
||||
done
|
||||
|
||||
cd $wrksrc/build
|
||||
make DESTDIR=$DESTDIR install
|
||||
|
||||
# Required to compress info files.
|
||||
vmkdir usr/share/info
|
||||
touch -f ${DESTDIR}/usr/share/info/dir
|
||||
|
||||
vinstall ${FILESDIR}/grub.default 644 etc/default grub
|
||||
# Kernel hooks.
|
||||
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
|
||||
etc/kernel.d/post-install 50-grub
|
||||
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
|
||||
etc/kernel.d/post-remove 50-grub
|
||||
|
||||
# update-grub for noobs.
|
||||
printf "#!/bin/sh\ngrub-mkconfig -o /boot/grub/grub.cfg\nexit \$?\n" >> \
|
||||
${DESTDIR}/usr/bin/update-grub
|
||||
chmod 755 ${DESTDIR}/usr/bin/update-grub
|
||||
|
||||
vmkdir usr/share/bash-completion/completions
|
||||
mv ${DESTDIR}/etc/bash_completion.d/grub \
|
||||
${DESTDIR}/usr/share/bash-completion/completions
|
||||
|
||||
# Remove useless tools
|
||||
rm ${DESTDIR}/usr/bin/grub-ofpathname
|
||||
rm ${DESTDIR}/usr/bin/grub-sparc64-setup
|
||||
}
|
||||
|
||||
grub-utils_package() {
|
||||
short_desc+=" - additional utilities"
|
||||
depends="grub>=${version}"
|
||||
pkg_install() {
|
||||
vmove usr/bin/grub-menulst2cfg
|
||||
vmove usr/bin/grub-fstest
|
||||
vmove usr/bin/grub-mkfont
|
||||
}
|
||||
}
|
||||
grub-x86_64-efi_package() {
|
||||
depends="grub>=$version dosfstools efibootmgr"
|
||||
short_desc+=" - x86_64 EFI support"
|
||||
pkg_install() {
|
||||
vmove usr/lib/grub/x86_64-efi
|
||||
}
|
||||
}
|
||||
grub-i386-efi_package() {
|
||||
depends="grub>=$version dosfstools efibootmgr"
|
||||
short_desc+=" - i386 EFI support"
|
||||
pkg_install() {
|
||||
vmove usr/lib/grub/i386-efi
|
||||
}
|
||||
}
|
||||
grub-i386-coreboot_package() {
|
||||
depends="grub>=$version"
|
||||
short_desc+=" - i386 coreboot support"
|
||||
pkg_install() {
|
||||
vmove usr/lib/grub/i386-coreboot
|
||||
}
|
||||
}
|
||||
grub-xen_package() {
|
||||
depends="grub>=$version"
|
||||
short_desc+=" - Xen PV support"
|
||||
pkg_install() {
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
x86_64*)
|
||||
vmove usr/lib/grub/x86_64-xen
|
||||
;;
|
||||
i686*)
|
||||
vmove usr/lib/grub/i386-xen
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
grub-arm64-efi_package() {
|
||||
depends="grub>=$version dosfstools efibootmgr"
|
||||
short_desc+=" - arm64 EFI support"
|
||||
pkg_install() {
|
||||
vmove usr/lib/grub/arm64-efi
|
||||
}
|
||||
}
|
||||
grub-powerpc-ieee1275_package() {
|
||||
depends="grub>=$version powerpc-utils"
|
||||
short_desc+=" - powerpc Open Firmware support"
|
||||
pkg_install() {
|
||||
vmove usr/lib/grub/powerpc-ieee1275
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue