]> TLD Linux GIT Repositories - packages/grub2.git/commitdiff
- added options to enable unrestricted boot
authorMarcin Krol <hawk@tld-linux.org>
Tue, 4 Sep 2018 11:18:47 +0000 (11:18 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Tue, 4 Sep 2018 11:18:47 +0000 (11:18 +0000)
- GCC 8 fixes

gcc8.patch [new file with mode: 0644]
grub.sysconfig
grub2.spec
restricted.patch [new file with mode: 0644]

diff --git a/gcc8.patch b/gcc8.patch
new file mode 100644 (file)
index 0000000..a3915c8
--- /dev/null
@@ -0,0 +1,36 @@
+diff -ur grub-2.02.orig/grub-core/fs/btrfs.c grub-2.02/grub-core/fs/btrfs.c
+--- grub-2.02.orig/grub-core/fs/btrfs.c        2017-04-24 09:16:00.000000000 +0000
++++ grub-2.02/grub-core/fs/btrfs.c     2018-09-04 11:11:43.199082290 +0000
+@@ -175,7 +175,7 @@
+ {
+   grub_int64_t sec;
+   grub_uint32_t nanosec;
+-} __attribute__ ((aligned (4)));
++} GRUB_PACKED;
+ struct grub_btrfs_inode
+ {
+diff -ur grub-2.02.orig/include/grub/efiemu/runtime.h grub-2.02/include/grub/efiemu/runtime.h
+--- grub-2.02.orig/include/grub/efiemu/runtime.h       2015-05-21 15:50:29.000000000 +0000
++++ grub-2.02/include/grub/efiemu/runtime.h    2018-09-04 11:13:30.211081085 +0000
+@@ -29,7 +29,7 @@
+ struct efi_variable
+ {
+-  grub_efi_guid_t guid;
++  grub_efi_packed_guid_t guid;
+   grub_uint32_t namelen;
+   grub_uint32_t size;
+   grub_efi_uint32_t attributes;
+diff -ur grub-2.02.orig/include/grub/gpt_partition.h grub-2.02/include/grub/gpt_partition.h
+--- grub-2.02.orig/include/grub/gpt_partition.h        2015-05-21 15:50:29.000000000 +0000
++++ grub-2.02/include/grub/gpt_partition.h     2018-09-04 11:14:00.554080743 +0000
+@@ -28,7 +28,7 @@
+   grub_uint16_t data2;
+   grub_uint16_t data3;
+   grub_uint8_t data4[8];
+-} __attribute__ ((aligned(8)));
++} GRUB_PACKED;
+ typedef struct grub_gpt_part_type grub_gpt_part_type_t;
+ #define GRUB_GPT_PARTITION_TYPE_EMPTY \
index 0402e1dee1254ac457db55055da4af103d4db738..ba0af18e03558dc4fc71151449be6ddac2de5db3 100644 (file)
@@ -51,3 +51,6 @@ GRUB_DISABLE_SUBMENU="y"
 
 # Uncomment to get a beep at grub start
 #GRUB_INIT_TUNE="480 440 1"
+
+# Disable restricted boot
+GRUB_RESTRICTED="false"
index a66ca9029af9ccbb7155f3f58910d96edf02ed0d..851a6306d089a2d4aa8acb03a882bcde6a55ffe8 100644 (file)
@@ -38,7 +38,7 @@ Summary(pl.UTF-8):    GRUB2 - bootloader dla x86
 Summary(pt_BR.UTF-8):  Gerenciador de inicializaĆ§Ć£o GRUB2
 Name:          grub2
 Version:       2.02
-Release:       2
+Release:       3
 License:       GPL v2
 Group:         Base
 Source0:       ftp://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz
@@ -61,6 +61,8 @@ Patch11:      initrd-search.patch
 Patch12:       %{name}-cfg.patch
 Patch13:       efi-net-fix.patch
 Patch14:       blscfg.patch
+Patch15:       restricted.patch
+Patch16:       gcc8.patch
 URL:           http://www.gnu.org/software/grub/
 BuildRequires: autoconf >= 2.53
 BuildRequires: automake >= 1:1.11.1-1
@@ -282,6 +284,8 @@ Motyw starfield dla GRUB-a.
 %patch12 -p1
 %patch13 -p1
 %patch14 -p1
+%patch15 -p1
+%patch16 -p1
 
 # we don't have C.utf-8 and need an UTF-8 locale for build
 sed -i -e 's/LC_ALL=C.UTF-8/LC_ALL=en_US.utf-8/g' po/Makefile* po/Rules*
diff --git a/restricted.patch b/restricted.patch
new file mode 100644 (file)
index 0000000..f5324df
--- /dev/null
@@ -0,0 +1,111 @@
+diff -ur grub-2.02.orig/util/grub.d/10_linux.in grub-2.02/util/grub.d/10_linux.in
+--- grub-2.02.orig/util/grub.d/10_linux.in     2018-09-04 10:42:04.656102314 +0000
++++ grub-2.02/util/grub.d/10_linux.in  2018-09-04 11:00:55.728089580 +0000
+@@ -28,6 +28,12 @@
+ CLASS="--class gnu-linux --class gnu --class os"
++if [ "x${GRUB_RESTRICTED}" = "xtrue" ] ; then
++  GRUB_UNRESTRICTED_OPTION=""
++else
++  GRUB_UNRESTRICTED_OPTION="--unrestricted"
++fi
++
+ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
+   OS="$(. /etc/os-release ; echo "$NAME $VERSION")"
+ else
+@@ -92,9 +98,9 @@
+         title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
+         grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
+       fi
+-      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
++      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+   else
+-      echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
++      echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+   fi      
+   if [ x$type != xrecovery ] ; then
+       save_default_entry | grub_add_tab
+diff -ur grub-2.02.orig/util/grub.d/30_os-prober.in grub-2.02/util/grub.d/30_os-prober.in
+--- grub-2.02.orig/util/grub.d/30_os-prober.in 2018-09-04 10:42:04.649102314 +0000
++++ grub-2.02/util/grub.d/30_os-prober.in      2018-09-04 11:01:57.024088889 +0000
+@@ -30,6 +30,12 @@
+   exit 0
+ fi
++if [ "x${GRUB_RESTRICTED}" = "xtrue" ] ; then
++  GRUB_UNRESTRICTED_OPTION=""
++else
++  GRUB_UNRESTRICTED_OPTION="--unrestricted"
++fi
++
+ if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then
+   # missing os-prober and/or linux-boot-prober
+   exit 0
+@@ -52,7 +58,7 @@
+     # TRANSLATORS: it refers on the OS residing on device %s
+     onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
+         cat << EOF
+-menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")'  {
++menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")'  {
+ EOF
+       save_default_entry | grub_add_tab
+       prepare_grub_to_access_device ${DEVICE} | grub_add_tab
+@@ -148,7 +154,7 @@
+         onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
+       cat << EOF
+-menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
++menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
+ EOF
+       save_default_entry | grub_add_tab
+       prepare_grub_to_access_device ${DEVICE} | grub_add_tab
+@@ -180,7 +186,7 @@
+       DEVICE=${DEVICE%@*}
+       onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
+       cat << EOF
+-menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
++menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
+ EOF
+       save_default_entry | sed -e "s/^/\t/"
+       prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+@@ -236,7 +242,7 @@
+       if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
+             cat << EOF
+-menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
++menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
+ EOF
+           save_default_entry | grub_add_tab
+           printf '%s\n' "${prepare_boot_cache}"
+@@ -256,7 +262,7 @@
+       fi
+       title="${LLABEL} $onstr"
+         cat << EOF
+-      menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
++      menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
+ EOF
+       save_default_entry | sed -e "s/^/$grub_tab$grub_tab/"
+       printf '%s\n' "${prepare_boot_cache}" | grub_add_tab
+@@ -293,7 +299,7 @@
+     hurd)
+       onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
+       cat << EOF
+-menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
++menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os ${GRUB_UNRESTRICTED_OPTION} \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
+ EOF
+       save_default_entry | grub_add_tab
+       prepare_grub_to_access_device ${DEVICE} | grub_add_tab
+diff -ur grub-2.02.orig/util/grub-mkconfig.in grub-2.02/util/grub-mkconfig.in
+--- grub-2.02.orig/util/grub-mkconfig.in       2018-09-04 10:42:04.650102314 +0000
++++ grub-2.02/util/grub-mkconfig.in    2018-09-04 10:50:40.159096510 +0000
+@@ -243,7 +243,8 @@
+   GRUB_ENABLE_CRYPTODISK \
+   GRUB_BADRAM \
+   GRUB_OS_PROBER_SKIP_LIST \
+-  GRUB_DISABLE_SUBMENU
++  GRUB_DISABLE_SUBMENU \
++  GRUB_RESTRICTED
+ if test "x${grub_cfg}" != "x"; then
+   rm -f "${grub_cfg}.new"