From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1SOM1u-00039p-0S for mharc-grub-devel@gnu.org; Sun, 29 Apr 2012 00:46:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOM1q-00038u-MW for grub-devel@gnu.org; Sun, 29 Apr 2012 00:46:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SOM1o-00046m-GM for grub-devel@gnu.org; Sun, 29 Apr 2012 00:46:34 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:33978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOM1o-00046Y-7B for grub-devel@gnu.org; Sun, 29 Apr 2012 00:46:32 -0400 Received: from [192.168.0.4] (d14-69-47-19.try.wideopenwest.com [69.14.19.47]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: floppym) by smtp.gentoo.org (Postfix) with ESMTPSA id B9AFC1B4003; Sun, 29 Apr 2012 04:46:28 +0000 (UTC) Message-ID: <4F9CC7A0.3090406@gentoo.org> Date: Sun, 29 Apr 2012 00:46:24 -0400 From: Mike Gilbert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120422 Thunderbird/11.0.1 MIME-Version: 1.0 To: The development of GNU GRUB Subject: [PATCH] Increase flexibility of kernel naming, allow non-versioned kernels. X-Enigmail-Version: 1.4 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig0A32961564B18480C20ABFFD" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 140.211.166.183 Cc: Robin Johnson X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Apr 2012 04:46:36 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0A32961564B18480C20ABFFD Content-Type: multipart/mixed; boundary="------------010000030300010407060400" This is a multi-part message in MIME format. --------------010000030300010407060400 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I am relaying a patch by Robin Johnson, one of the core infrastructure staff at Gentoo Linux. In the process of building some Gentoo servers utilizing GRUB 2, he has made some changes to 10_linux that should make grub-mkconfig "out of the box" for additional users. I did a little work to clean up the indentation and wrote a proper changelog. Credit should go to him. Here is his description: Increase flexibility of kernel naming, allow non-versioned kernels. The block that tried to find the kernels was getting unweidly long, as was not easily customizable by users or distributors. Refactor to introduce a new= variable, GRUB_KERNEL_GLOB, that allows complete control over the naming used to search for kernel binaries. Add 'bzImage' to the list of default names to support more distribution naming variants. Adjust the default set of globs to look for unversioned kernels before versioned kernels, to find symlinked kernel names. Also apply similar logic to to initramfs. Signed-off-by: Robin H. Johnson -- Take 2: Added initramfs logic. --------------010000030300010407060400 Content-Type: text/x-patch; name="grub-2.00-kernel-naming-flexibility.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="grub-2.00-kernel-naming-flexibility.patch" Increase flexibility of kernel naming, allow non-versioned kernels. The block that tried to find the kernels was getting unweidly long, as wa= s not easily customizable by users or distributors. Refactor to introduce a new= variable, GRUB_KERNEL_GLOB, that allows complete control over the naming = used to search for kernel binaries. Add 'bzImage' to the list of default names to support more distribution n= aming variants. Adjust the default set of globs to look for unversioned kernels before versioned kernels, to find symlinked kernel names. Also apply similar logic to to initramfs. Signed-off-by: Robin H. Johnson -- Take 2: Added initramfs logic. =3D=3D=3D modified file 'ChangeLog' --- ChangeLog 2012-04-26 18:51:06 +0000 +++ ChangeLog 2012-04-29 04:29:01 +0000 @@ -1,3 +1,19 @@ +2102-04-29 Robin H. Johnson + + Increase flexibility of kernel naming, allow non-versioned kernels. + + Introduce GRUB_KERNEL_GLOB variable to allow customization by + distrubutions or users. + + * docs/grub.texi: Document GRUB_KERNEL_GLOB variable. + * util/grub-mkconfig.in: Export GRUB_KERNEL_GLOB variable. + * util/grub.d/10_linux.in: Refactor kernel detection to utilize + GRUB_KERNEL_GLOB variable. Add bzImage to the list of default names to + support more distribution naming variants. Adjust the default set of + globs to look for unversioned kernels before versioned kernels, to + find symlinked kernel names. Apply similar logic to initramfs and + config file detection. + 2012-04-26 Vladimir Serbinenko =20 * grub-core/term/ieee1275/console.c (grub_console_dimensions): Use 80x2= 4 =3D=3D=3D modified file 'docs/grub.texi' --- docs/grub.texi 2012-03-27 23:37:00 +0000 +++ docs/grub.texi 2012-04-29 03:25:10 +0000 @@ -1288,6 +1288,10 @@ Each module will be loaded as early as possible, at the start of @file{grub.cfg}. =20 +@item GRUB_KERNEL_GLOB +This is a space-seperated list of globs to evaluate while looking for th= e names +of your kernel binaries. Default is platform-specific. + @end table =20 For more detailed customisation of @command{grub-mkconfig}'s output, you= may =3D=3D=3D modified file 'util/grub-mkconfig.in' --- util/grub-mkconfig.in 2012-04-07 17:49:25 +0000 +++ util/grub-mkconfig.in 2012-04-29 03:25:10 +0000 @@ -216,7 +216,8 @@ GRUB_INIT_TUNE \ GRUB_SAVEDEFAULT \ GRUB_ENABLE_CRYPTODISK \ - GRUB_BADRAM + GRUB_BADRAM \ + GRUB_KERNEL_GLOB =20 if test "x${grub_cfg}" !=3D "x"; then rm -f "${grub_cfg}.new" =3D=3D=3D modified file 'util/grub.d/10_linux.in' --- util/grub.d/10_linux.in 2012-04-18 21:25:21 +0000 +++ util/grub.d/10_linux.in 2012-04-29 04:16:51 +0000 @@ -151,16 +151,17 @@ } =20 machine=3D`uname -m` -case "x$machine" in - xi?86 | xx86_64) - list=3D`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do - if grub_file_is_not_garbage "$i" ; then echo -n "$i " = ; fi - done` ;; - *)=20 - list=3D`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* = /boot/kernel-* ; do - if grub_file_is_not_garbage "$i" ; then echo -n "$i " = ; fi - done` ;; -esac +if [ "x$GRUB_KERNEL_GLOB" =3D "x" ]; then + case "x$machine" in + xi?86 | xx86_64) GRUB_KERNEL_GLOB=3D"/boot/vmlinuz /vmlinuz /boo= t/kernel /boot/bzImage" ;; + *) GRUB_KERNEL_GLOB=3D"/boot/vmlinuz /boot/vmlinux /boot/kernel = /boot/bzImage /vmlinuz /vmlinux" ;; + esac + list=3D"$GRUB_KERNEL_GLOB" + for l in $list ; do list=3D"${list} ${l}-*" ; done +else + list=3D"$GRUB_KERNEL_GLOB" +fi +list=3D$(eval "for i in ${list} ; do if grub_file_is_not_garbage \"\$i\"= ; then echo -n \"\$i \" ; fi ; done") =20 case "$machine" in i?86) GENKERNEL_ARCH=3D"x86" ;; @@ -187,18 +188,27 @@ dirname=3D`dirname $linux` rel_dirname=3D`make_system_path_relative_to_its_root $dirname` version=3D`echo $basename | sed -e "s,^[^0-9]*-,,g"` + [ "x$version" =3D=3D "x$basename" ] && version=3D alt_version=3D`echo $version | sed -e "s,\.old$,,g"` linux_root_device_thisversion=3D"${LINUX_ROOT_DEVICE}" =20 initrd=3D - for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${ver= sion}.gz" \ - "initrd-${version}" "initramfs-${version}.img" \ - "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ - "initrd-${alt_version}" "initramfs-${alt_version}.img" \ - "initramfs-genkernel-${version}" \ - "initramfs-genkernel-${alt_version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do + set -- + if [ "x$version" =3D "x" ]; then + set -- "initrd.img" "initrd.gz" "initrd" "initramfs.img" "initramf= s" \ + "initramfs-genkernel" "initramfs-genkernel-${GENKERNEL_ARCH}" + fi + set -- "$@" \ + "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.g= z" \ + "initrd-${version}" "initramfs-${version}.img" \ + "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ + "initrd-${alt_version}" "initramfs-${alt_version}.img" \ + "initramfs-${version}" "initramfs-${alt_version}" \ + "initramfs-genkernel-${version}" \ + "initramfs-genkernel-${alt_version}" \ + "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ + "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" + for i in "$@" ; do if test -e "${dirname}/${i}" ; then initrd=3D"$i" break @@ -206,12 +216,20 @@ done =20 config=3D - for i in "${dirname}/config-${version}" "${dirname}/config-${alt_versi= on}" "/etc/kernels/kernel-config-${version}" ; do + set -- + if [ "x$version" =3D "x" ]; then + set -- "${dirname}/config" + fi + set -- "$@" "${dirname}/config-${version}" \ + "${dirname}/config-${alt_version}" \ + "/etc/kernels/kernel-config-${version}" + for i in "$@"; do if test -e "${i}" ; then config=3D"${i}" break fi done + set -- =20 initramfs=3D if test -n "${config}" ; then --------------010000030300010407060400-- --------------enig0A32961564B18480C20ABFFD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iF4EAREIAAYFAk+cx6EACgkQC77qH+pIQ6Q9+wD+MWshZqhDP4h62onNABNA1n/E JBhfxeFLZO9vH4rjocMA/1jI5T6y3AXNsi3Ir8BV5n9Eijs86cDj3QKiET62c7aj =rnIy -----END PGP SIGNATURE----- --------------enig0A32961564B18480C20ABFFD--