On 04/11/2012 11:52 AM, Mike Gilbert wrote:
> 2012/4/11 Vladimir 'φ-coder/phcoder' Serbinenko <phco...@gmail.com>:
>> On 11.04.2012 04:56, Mike Gilbert wrote:
>>> On 04/07/2012 05:54 PM, Mike Gilbert wrote:
>>>> Secondly, genkernel looks for the "real_root" kernel command line option
>>>> to determine the root filesystem. This is a holdover from the days when
>>>> we used true initrd images and we needed to use root=/dev/ram0.
>>>>
>>> It was brought to my attention that genkernel's initramfs code will in
>>> fact utilize "root" if "real_root" is unset. This part of my previous
>>> patch is therefore pointless.
>>>
>>> I have attached a revised patch containing only the changes necessary to
>>> detect a genkernel initramfs image.
>>>
>> pushd/popd isn't POSIX so we can't use it in our scripts. Also I don't
>> feel like glob expansion is the right thing to use here. Why not infer
>> the architecture from uname ?
> 
> That should also work. Here's the logic that genkernel uses to populate ARCH:
> 
> ARCH=`uname -m`
> case "${ARCH}" in
>       i?86)
>               ARCH="x86"
>               ;;
>       mips|mips64)
>               ARCH="mips"
>               ;;
>       arm*)
>               ARCH=arm
>               ;;
>       *)
>               ;;
> esac
> 
> I'm thinking it would be a good idea to rename ARCH to something like
> GENKERNEL_ARCH. We should also let the user override this in
> /etc/default/grub.
> 
> Does that sound ok?

I have modified my patch to implement what I describe above.
=== modified file 'ChangeLog'
--- ChangeLog	2012-04-07 18:11:04 +0000
+++ ChangeLog	2012-04-11 19:51:47 +0000
@@ -1,3 +1,7 @@
+2012-04-11  Mike Gilbert  <flop...@gentoo.org>
+
+	* util/grub.d/10_linux.in: Fix detection of genkernel initramfs.
+
 2012-04-07  Vladimir Serbinenko  <phco...@gmail.com>
 
 	* grub-core/normal/charset.c (grub_ucs4_to_utf8): Return number of

=== modified file 'util/grub.d/10_linux.in'
--- util/grub.d/10_linux.in	2012-03-10 14:21:25 +0000
+++ util/grub.d/10_linux.in	2012-04-11 19:26:45 +0000
@@ -150,7 +150,8 @@
 EOF
 }
 
-case x`uname -m` in
+machine=`uname -m`
+case "x$machine" in
     xi?86 | xx86_64)
 	list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
                   if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
@@ -161,6 +162,15 @@
 	     done` ;;
 esac
 
+if test "x${GENKERNEL_ARCH-unset}" = xunset; then
+  case "$machine" in
+    i?86) GENKERNEL_ARCH="x86" ;;
+    mips|mips64) GENKERNEL_ARCH="mips" ;;
+    arm*) GENKERNEL_ARCH="arm" ;;
+    *) GENKERNEL_ARCH="$machine" ;;
+  esac
+fi
+
 prepare_boot_cache=
 prepare_root_cache=
 boot_device_id=
@@ -186,8 +196,8 @@
 	   "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}"; do
+	   "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
+	   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
     if test -e "${dirname}/${i}" ; then
       initrd="$i"
       break

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to