All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Arch Linux specific grub-mkconfig fixes
@ 2013-12-09 19:11 Keshav Padram Amburay
  2013-12-09 19:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Keshav Padram Amburay @ 2013-12-09 19:11 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 1149 bytes --]

Hi,

This patch has been used in Arch Linux's GRUB(2) package for quite some
time (ever since the release of grub 2.00).

The main feature that distinguishes Arch Linux from other distros is that
its kernel and initramfs (core/linux pkg) are always installed at
/boot/vmlinuz-linux and /boot/initramfs-linux.img and this path does not
contain the actual kernel version info and therefore does not change with
kernel updates, unlike other distros.

Also Arch Linux includes a secondary (fallback) initramfs image
at /boot/initramfs-linux-fallback.img which contains modules, that are
excluded by autodetect hook in the normal initramfs image
at /boot/initramfs-linux.img . Thus if the user is unable to boot
using /boot/initramfs-linux.img, he/she may be able to boot
using /boot/initramfs-linux-fallback.img . Arch Linux and its derivatives
use this kind of fallback initramfs setup. This patch also adds detection
of this fallback initramfs image.

I have attached the patch instead of sending this via git-send-mail,
because 1) I haven't setup git-send-mail, and 2) Mail program seems to
screw up the line indentation.

With Best Regards,

Keshav

[-- Attachment #1.2: Type: text/html, Size: 1382 bytes --]

[-- Attachment #2: Add-Arch-Linux-specific-grub-mkconfig-fixes.patch --]
[-- Type: text/x-patch, Size: 5238 bytes --]

From 009ecc71a0b397faed8fafb3c4d62e96d0d86a8a Mon Sep 17 00:00:00 2001
From: Keshav Padram Amburay <the.ridikulus.rat@gmail.com>
Date: Wed, 6 Nov 2013 21:49:40 +0530
Subject: [PATCH] Add Arch Linux specific grub-mkconfig fixes

Patch modified based on ideas from Felix aka fstirlitz,
given at https://bugs.archlinux.org/task/37904?getfile=11257
---
 util/grub-mkconfig.in     |  2 ++
 util/grub-mkconfig_lib.in |  3 +++
 util/grub.d/00_header.in  |  8 ++++++++
 util/grub.d/10_linux.in   | 27 ++++++++++++++++++++++++---
 4 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 3390ba9..c416489 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -218,6 +218,8 @@ export GRUB_DEFAULT \
   GRUB_THEME \
   GRUB_GFXPAYLOAD_LINUX \
   GRUB_DISABLE_OS_PROBER \
+  GRUB_COLOR_NORMAL \
+  GRUB_COLOR_HIGHLIGHT \
   GRUB_INIT_TUNE \
   GRUB_SAVEDEFAULT \
   GRUB_ENABLE_CRYPTODISK \
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index a9cf7fc..7eb8950 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -245,6 +245,9 @@ version_test_gt ()
     *.old:*.old) ;;
     *.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
     *:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
+    *-lts:*-lts) ;;
+    *-lts:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/-lts$//'`" ; version_test_gt_cmp=gt ;;
+    *:*-lts) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/-lts$//'`" ; version_test_gt_cmp=ge ;;
   esac
   version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
   return "$?"
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
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 00d1931..f403585 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -81,6 +81,8 @@ linux_entry ()
       case $type in
 	  recovery)
 	      title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
+	  fallback)
+	      title="$(gettext_printf "%s, with Linux %s (fallback initramfs)" "${os}" "${version}")" ;;
 	  *)
 	      title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
       esac
@@ -94,7 +96,7 @@ linux_entry ()
   else
       echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
   fi      
-  if [ x$type != xrecovery ] ; then
+  if [ x$type != xrecovery ] && [ x$type != xfallback ] ; then
       save_default_entry | grub_add_tab
   fi
 
@@ -126,7 +128,8 @@ linux_entry ()
     fi
     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
   fi
-  message="$(gettext_printf "Loading Linux %s ..." ${version})"
+
+  message="$(gettext_printf "Loading Linux %s ..." "${version}")"
   sed "s/^/$submenu_indentation/" << EOF
 	echo	'$(echo "$message" | grub_quote)'
 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
@@ -185,6 +188,12 @@ while [ "x$list" != "x" ] ; do
   linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
   initrd=
+
+  if echo "${basename}" | grep -q 'vmlinuz-linux' ; then
+    version="`echo "${basename}" | sed -e 's,vmlinuz-linux-,,g'` kernel"
+    initramfs_arch="`echo "${basename}" | sed -e 's,vmlinuz,initramfs,g'`"
+  fi
+
   for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
 	   "initrd-${version}" "initramfs-${version}.img" \
 	   "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
@@ -192,7 +201,8 @@ while [ "x$list" != "x" ] ; do
 	   "initramfs-genkernel-${version}" \
 	   "initramfs-genkernel-${alt_version}" \
 	   "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
-	   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
+	   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
+	   "${initramfs_arch}.img" ; do
     if test -e "${dirname}/${i}" ; then
       initrd="$i"
       break
@@ -236,6 +246,17 @@ while [ "x$list" != "x" ] ; do
 
   linux_entry "${OS}" "${version}" advanced \
               "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+
+  for i in "${initramfs_arch}-fallback.img" "initramfs-${version}-fallback.img" ; do
+    if test -e "${dirname}/${i}" ; then
+      initrd="${i}"
+      gettext_printf "Found initrd fallback image: %s\n" "${dirname}/${initrd}" >&2
+      linux_entry "${OS}" "${version}" fallback \
+                  "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+      break
+    fi
+  done
+
   if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
     linux_entry "${OS}" "${version}" recovery \
                 "single ${GRUB_CMDLINE_LINUX}"
-- 
1.8.5.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Arch Linux specific grub-mkconfig fixes
  2013-12-09 19:11 [PATCH] Arch Linux specific grub-mkconfig fixes Keshav Padram Amburay
@ 2013-12-09 19:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-12-09 19:49   ` Keshav Padram Amburay
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-12-09 19:17 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1852 bytes --]

This patch clearly doesn't have right attributions, not split according
to functional changes and some of parts were already discussed.  As-is
patch is unacceptable, the biggest problem being the lack of right
attribution. E.g. some parts are apparently by WIP patch by Alexander
Kurtz yet he's never mentioned at all.
Please never ever send patches to GRUB under wrong authorship acknowledges.
On 09.12.2013 20:11, Keshav Padram Amburay wrote:
> Hi,
> 
> This patch has been used in Arch Linux's GRUB(2) package for quite some
> time (ever since the release of grub 2.00). 
> 
> The main feature that distinguishes Arch Linux from other distros is
> that its kernel and initramfs (core/linux pkg) are always installed at
> /boot/vmlinuz-linux and /boot/initramfs-linux.img and this path does not
> contain the actual kernel version info and therefore does not change
> with kernel updates, unlike other distros.
> 
> Also Arch Linux includes a secondary (fallback) initramfs image
> at /boot/initramfs-linux-fallback.img which contains modules, that are
> excluded by autodetect hook in the normal initramfs image
> at /boot/initramfs-linux.img . Thus if the user is unable to boot
> using /boot/initramfs-linux.img, he/she may be able to boot
> using /boot/initramfs-linux-fallback.img . Arch Linux and its
> derivatives use this kind of fallback initramfs setup. This patch also
> adds detection of this fallback initramfs image.
> 
> I have attached the patch instead of sending this via git-send-mail,
> because 1) I haven't setup git-send-mail, and 2) Mail program seems to
> screw up the line indentation.
> 
> With Best Regards,
> 
> Keshav
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Arch Linux specific grub-mkconfig fixes
  2013-12-09 19:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-12-09 19:49   ` Keshav Padram Amburay
  0 siblings, 0 replies; 3+ messages in thread
From: Keshav Padram Amburay @ 2013-12-09 19:49 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 2679 bytes --]

On Tue, Dec 10, 2013 at 12:47 AM, Vladimir 'φ-coder/phcoder' Serbinenko <
phcoder@gmail.com> wrote:

> This patch clearly doesn't have right attributions, not split according
> to functional changes and some of parts were already discussed.  As-is
> patch is unacceptable, the biggest problem being the lack of right
> attribution. E.g. some parts are apparently by WIP patch by Alexander
> Kurtz yet he's never mentioned at all.
> Please never ever send patches to GRUB under wrong authorship acknowledges.
>

I was not aware of WIP patch by Alexander Kurtz with respect to the
GRUB_COLOR_* changes.

Regarding the code adding detection of Arch Linux kernel and initramfs
files by grub-mkconfig, it is difficult to find out via the current Arch
Linux SVN based repo structure as to who was the original author of this
patch, and who all have contributed changes to it (apart from me, Tobias
Powalowski and Ronald Van Haren), so for now I withdraw this patch. Sorry
for the mistake.

On 09.12.2013 20:11, Keshav Padram Amburay wrote:
> > Hi,
> >
> > This patch has been used in Arch Linux's GRUB(2) package for quite some
> > time (ever since the release of grub 2.00).
> >
> > The main feature that distinguishes Arch Linux from other distros is
> > that its kernel and initramfs (core/linux pkg) are always installed at
> > /boot/vmlinuz-linux and /boot/initramfs-linux.img and this path does not
> > contain the actual kernel version info and therefore does not change
> > with kernel updates, unlike other distros.
> >
> > Also Arch Linux includes a secondary (fallback) initramfs image
> > at /boot/initramfs-linux-fallback.img which contains modules, that are
> > excluded by autodetect hook in the normal initramfs image
> > at /boot/initramfs-linux.img . Thus if the user is unable to boot
> > using /boot/initramfs-linux.img, he/she may be able to boot
> > using /boot/initramfs-linux-fallback.img . Arch Linux and its
> > derivatives use this kind of fallback initramfs setup. This patch also
> > adds detection of this fallback initramfs image.
> >
> > I have attached the patch instead of sending this via git-send-mail,
> > because 1) I haven't setup git-send-mail, and 2) Mail program seems to
> > screw up the line indentation.
> >
> > With Best Regards,
> >
> > Keshav
> >
> >
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > https://lists.gnu.org/mailman/listinfo/grub-devel
> >
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
>

[-- Attachment #2: Type: text/html, Size: 3765 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-09 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09 19:11 [PATCH] Arch Linux specific grub-mkconfig fixes Keshav Padram Amburay
2013-12-09 19:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-09 19:49   ` Keshav Padram Amburay

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.