grub-2.02_beta2-KERNEL_GLOBS.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From 43e3295aaad5278a1e53c5282e2660b72cd76d28 Mon Sep 17 00:00:00 2001
  2. From: "Robin H. Johnson" <robbat2@gentoo.org>
  3. Date: Tue, 29 Dec 2015 15:29:14 -0800
  4. Subject: [PATCH] GRUB_LINUX_KERNEL_GLOBS: configurable kernel selection
  5. * util/grub.d/10_linux.in: Implement GRUB_LINUX_KERNEL_GLOBS
  6. * docs/grub.texi: Document GRUB_LINUX_KERNEL_GLOBS
  7. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
  8. ---
  9. docs/grub.texi | 5 +++++
  10. util/grub.d/10_linux.in | 21 +++++++++++----------
  11. 2 files changed, 16 insertions(+), 10 deletions(-)
  12. diff --git a/docs/grub.texi b/docs/grub.texi
  13. index 9a25a0b..d1129ec 100644
  14. --- a/docs/grub.texi
  15. +++ b/docs/grub.texi
  16. @@ -1490,6 +1490,11 @@ This option may be set to a list of GRUB module names separated by spaces.
  17. Each module will be loaded as early as possible, at the start of
  18. @file{grub.cfg}.
  19. +@item GRUB_LINUX_KERNEL_GLOBS
  20. +This option may be set to override the list of path globs used to find Linux
  21. +kernels. The defaults vary by architecture, and generally include both
  22. +@file{/boot} and @file{/}.
  23. +
  24. @end table
  25. The following options are still accepted for compatibility with existing
  26. diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
  27. index 859b608..e5ac11d 100644
  28. --- a/util/grub.d/10_linux.in
  29. +++ b/util/grub.d/10_linux.in
  30. @@ -145,18 +145,19 @@ EOF
  31. }
  32. machine=`uname -m`
  33. -case "x$machine" in
  34. +globs="$GRUB_LINUX_KERNEL_GLOBS"
  35. +[ -z "$globs" ] && case "x$machine" in
  36. xi?86 | xx86_64)
  37. - list=
  38. - for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
  39. - if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
  40. - done ;;
  41. - *)
  42. - list=
  43. - for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
  44. - if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
  45. - done ;;
  46. + globs="/boot/vmlinuz-* /vmlinuz-* /boot/kernel-*"
  47. + ;;
  48. + *)
  49. + globs="/boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-*"
  50. + ;;
  51. esac
  52. +list=
  53. +for i in ${globs} ; do
  54. + if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
  55. +done
  56. case "$machine" in
  57. i?86) GENKERNEL_ARCH="x86" ;;
  58. --
  59. 2.3.0