Package: src:grub2 Version: 2.02~beta2-20 With this patch, grub2 can be built on mips64el. Can you review it ?
-- YunQiang Su
diff -Nru grub2-2.02~beta2/debian/control grub2-2.02~beta2/debian/control --- grub2-2.02~beta2/debian/control 2015-01-03 20:21:00.000000000 +0800 +++ grub2-2.02~beta2/debian/control 2015-01-19 17:58:02.000000000 +0800 @@ -89,7 +89,7 @@ # Not Architecture: any because this package contains some things which are # only built when there is a real platform (e.g. grub-install), and the rest # of the package is not very useful in a utilities-only build. -Architecture: any-i386 any-amd64 any-powerpc any-ppc64 any-ppc64el any-sparc any-sparc64 any-mipsel any-ia64 any-arm any-arm64 +Architecture: any-i386 any-amd64 any-powerpc any-ppc64 any-ppc64el any-sparc any-sparc64 any-mipsel any-mips64el any-mips64el any-ia64 any-arm any-arm64 Depends: grub-common (= ${binary:Version}), dpkg (>= 1.15.4) | install-info, ${shlibs:Depends}, ${misc:Depends} Replaces: grub, grub-legacy, grub-common (<< 1.99-1), grub-pc (<< 2.00-4), grub-ieee1275 (<< 2.00-4), grub-efi (<< 1.99-1), grub-coreboot (<< 2.00-4), grub-linuxbios (<< 1.99-1), grub-efi-ia32 (<< 2.00-4), grub-efi-amd64 (<< 2.00-4), grub-efi-ia64 (<< 2.00-4), grub-ieee1275 (<< 2.00-4), grub-yeeloong (<< 2.00-4) Conflicts: grub (<< 0.97-54), grub-legacy, ${legacy-doc-conflicts} @@ -652,7 +652,7 @@ guest (i.e. PV-GRUB) to be present in the control domain filesystem. Package: grub-yeeloong-bin -Architecture: any-mipsel +Architecture: any-mipsel any-mips64el Depends: ${shlibs:Depends}, ${misc:Depends}, grub-common (= ${binary:Version}) Replaces: grub-common (<< 1.98+20100617-2), grub-yeeloong (<< 1.99-1) Multi-Arch: foreign @@ -673,7 +673,7 @@ Package: grub-yeeloong-dbg Section: debug -Architecture: any-mipsel +Architecture: any-mipsel any-mips64el Depends: ${misc:Depends}, grub-yeeloong-bin (= ${binary:Version}), grub-common (= ${binary:Version}) Multi-Arch: foreign Description: GRand Unified Bootloader, version 2 (Yeeloong debug files) @@ -681,7 +681,7 @@ need these if you are trying to debug GRUB using its GDB stub. Package: grub-yeeloong -Architecture: any-mipsel +Architecture: any-mipsel any-mips64el Depends: ${shlibs:Depends}, ${misc:Depends}, grub2-common (= ${binary:Version}), grub-yeeloong-bin (= ${binary:Version}), ucf Replaces: grub-common (<< 1.98+20100617-2) Multi-Arch: foreign @@ -701,7 +701,7 @@ Package: grub-theme-starfield # Could be Architecture: any, but in practice this package is useless in a # utilities-only build. -Architecture: any-i386 any-amd64 any-powerpc any-ppc64 any-ppc64el any-sparc any-sparc64 any-mipsel any-ia64 any-arm any-arm64 +Architecture: any-i386 any-amd64 any-powerpc any-ppc64 any-ppc64el any-sparc any-sparc64 any-mipsel any-mips64el any-ia64 any-arm any-arm64 Depends: ${misc:Depends}, grub-common (= ${binary:Version}) Multi-Arch: foreign Description: GRand Unified Bootloader, version 2 (starfield theme) diff -Nru grub2-2.02~beta2/debian/patches/mips32.diff grub2-2.02~beta2/debian/patches/mips32.diff --- grub2-2.02~beta2/debian/patches/mips32.diff 1970-01-01 08:00:00.000000000 +0800 +++ grub2-2.02~beta2/debian/patches/mips32.diff 2015-01-19 17:58:02.000000000 +0800 @@ -0,0 +1,104 @@ +Index: grub2-2.02~beta2/configure.ac +=================================================================== +--- grub2-2.02~beta2.orig/configure.ac 2015-01-15 02:03:29.000000000 +0800 ++++ grub2-2.02~beta2/configure.ac 2015-01-15 02:12:50.793920793 +0800 +@@ -85,17 +85,23 @@ + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" + ++m32_option="-m32" ++m64_option="-m64" + case "$target_cpu" in + i[[3456]]86) target_cpu=i386 ;; + amd64) target_cpu=x86_64 ;; + sparc) target_cpu=sparc64 ;; +- mipsel|mips64el) ++ mipsel|mips64el|mipsn32el) + target_cpu=mipsel; + machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; ++ m32_option="-mabi=32" ++ m64_option="-mabi=64" + ;; +- mips|mips64) ++ mips|mips64|mipsn32) + target_cpu=mips; + machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"; ++ m32_option="-mabi=32" ++ m64_option="-mabi=64" + ;; + arm*) + target_cpu=arm; +@@ -179,7 +185,7 @@ + + if test x$platform != xemu ; then + case "$target_cpu" in +- i386 | powerpc) target_m32=1 ;; ++ i386 | powerpc | mips | mipsel) target_m32=1 ;; + x86_64 | sparc64) target_m64=1 ;; + esac + fi +@@ -352,8 +358,8 @@ + unset ac_cv_c_bigendian + + if test x"$target_cpu-$platform" = xsparc64-emu ; then +- CFLAGS="$CFLAGS -m64" +- HOST_CFLAGS="$HOST_CFLAGS -m64" ++ CFLAGS="$CFLAGS $m64_option" ++ HOST_CFLAGS="$HOST_CFLAGS $m64_option" + fi + + AC_C_BIGENDIAN +@@ -586,19 +592,19 @@ + + if test "x$target_m32" = x1; then + # Force 32-bit mode. +- TARGET_CFLAGS="$TARGET_CFLAGS -m32" +- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" +- TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32" +- TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" ++ TARGET_CFLAGS="$TARGET_CFLAGS $m32_option" ++ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $m32_option" ++ TARGET_CPPFLAGS="$TARGET_CPPFLAGS $m32_option" ++ TARGET_LDFLAGS="$TARGET_LDFLAGS $m32_option" + TARGET_MODULE_FORMAT="elf32" + fi + + if test "x$target_m64" = x1; then + # Force 64-bit mode. +- TARGET_CFLAGS="$TARGET_CFLAGS -m64" +- TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" +- TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64" +- TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" ++ TARGET_CFLAGS="$TARGET_CFLAGS $m64_option" ++ TARGET_CCASFLAGS="$TARGET_CCASFLAGS $m64_option" ++ TARGET_CPPFLAGS="$TARGET_CPPFLAGS $m64_option" ++ TARGET_LDFLAGS="$TARGET_LDFLAGS $m64_option" + TARGET_MODULE_FORMAT="elf64" + fi + +@@ -721,21 +727,21 @@ + fi + if test x"$efiemu_excuse" = x ; then + AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ +- CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone" ++ CFLAGS="$m64_option -nostdlib -O2 -mcmodel=large -mno-red-zone" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_efiemu=yes], + [grub_cv_cc_efiemu=no]) + ]) + if test x$grub_cv_cc_efiemu = xno; then +- efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" ++ efiemu_excuse="cannot compile with $m64_option -mcmodel=large -mno-red-zone -nostdlib" + fi + fi + if test x"$efiemu_excuse" = x ; then + AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [ + grub_cv_target_cc_efiemu64_link_format=unknown + for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do +- CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone" +- LDFLAGS="-m64 -Wl,$format -nostdlib -static" ++ CFLAGS="$m64_option -nostdlib -O2 -mcmodel=large -mno-red-zone" ++ LDFLAGS="$m64_option -Wl,$format -nostdlib -static" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + asm (".globl start; start:"); + asm (".globl _start; _start:"); diff -Nru grub2-2.02~beta2/debian/patches/series grub2-2.02~beta2/debian/patches/series --- grub2-2.02~beta2/debian/patches/series 2015-01-03 20:21:00.000000000 +0800 +++ grub2-2.02~beta2/debian/patches/series 2015-01-19 17:58:02.000000000 +0800 @@ -64,3 +64,4 @@ insmod-xzio-and-lzopio-on-xen.patch grub-install-extra-removable.patch mkconfig_other_inits.patch +mips32.diff diff -Nru grub2-2.02~beta2/debian/rules grub2-2.02~beta2/debian/rules --- grub2-2.02~beta2/debian/rules 2015-01-03 20:21:00.000000000 +0800 +++ grub2-2.02~beta2/debian/rules 2015-01-19 17:58:02.000000000 +0800 @@ -48,6 +48,10 @@ COMMON_PLATFORM := ieee1275 else ifeq (mipsel,$(DEB_HOST_ARCH_CPU)) COMMON_PLATFORM := yeeloong +else ifeq (mips64el,$(DEB_HOST_ARCH_CPU)) +COMMON_PLATFORM := yeeloong +else ifeq (mipsn32el,$(DEB_HOST_ARCH_CPU)) +COMMON_PLATFORM := yeeloong else ifeq (ia64,$(DEB_HOST_ARCH_CPU)) COMMON_PLATFORM := efi-ia64 else ifeq (arm,$(DEB_HOST_ARCH_CPU))