Bug#740740: grub-install does not detect mipsel-loongson correctly

Matt Kraai kraai at ftbfs.org
Tue Mar 4 17:30:23 UTC 2014


On Tue, Mar 04, 2014 at 03:54:50PM +0000, Colin Watson wrote:
> On Tue, Mar 04, 2014 at 07:41:22AM -0800, Matt Kraai wrote:
> > When I try to install Debian on a Lemote Yeeloong, GRUB installation
> > fails with the following error message:
> > 
> > > source_dir doesn't exist. Please specify --target or --directory
> > 
> > grub-install uses the output of "uname -m" to determine what to set
> > target to.  "uname -m" outputs mips64, so target is set to mips-arc,
> > but /usr/lib/grub/mips-arc does not exist.  If I pass
> > "--target=mipsel-loongson", grub-install succeeds.
> 
> Thanks.  I think this is fixed in experimental with the grub-install
> rewrite in C, as it now uses #if defined (__MIPSEL__) - could you
> confirm?

It appears to have worked.  When I upgraded to it, it output:

> Installing for mipsel-loongson platform.
> grub-install: warning: WARNING: no platform-specific install was performed.
> Installation finished. No error reported.


> If we need to fix this in 2.00, could you suggest a more accurate check
> that's about at the level of uname -m (i.e. no dpkg --print-architecture
> etc.)?

The output of "lscpu", from util-linux, contains either:

> Byte Order:            Little Endian

or

> Byte Order:            Big Endian

so how about the following patch?

Index: grub/util/grub-install.in
===================================================================
--- grub.orig/util/grub-install.in	2014-03-04 08:38:05.892401086 -0800
+++ grub/util/grub-install.in	2014-03-04 08:43:53.800673123 -0800
@@ -289,10 +289,12 @@
 		target="powerpc-ieee1275";;
 	    x"sparc"*)
 		target="sparc64-ieee1275";;
-	    x"mips"*"el")
-		target="mipsel-loongson";;
 	    x"mips"*)
-		target="mips-arc";;
+		if lscpu | grep -qx 'Byte Order: *Little Endian'; then
+		    target="mipsel-loongson";;
+		else
+		    target="mips-arc";;
+		fi
 	    x"ia64"*)
 		target="ia64-efi";;
 	    x"x86_64"* | x"amd64"*)

-- 
Matt



More information about the Pkg-grub-devel mailing list