]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
merge mainline into sgi
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 15 May 2011 00:23:36 +0000 (02:23 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 15 May 2011 00:23:36 +0000 (02:23 +0200)
15 files changed:
1  2 
conf/Makefile.common
configure.ac
gentpl.py
grub-core/Makefile.am
grub-core/Makefile.core.def
grub-core/kern/mips/loongson/init.c
grub-core/kern/mips/startup.S
grub-core/loader/mips/linux.c
include/grub/mips/loongson.h
include/grub/mips/loongson/kernel.h
include/grub/mips/loongson/memory.h
include/grub/mips/loongson/time.h
include/grub/offsets.h
util/grub-install.in
util/grub-mkimage.c

index 13963d5f3b962c08b9a51449a0db95b351fd807c,77b84c11294e1cfefe0aaf79db1cbedf1fbd48d5..751188b26160c528ec8b4769fc5e260ea37bfb79
@@@ -25,9 -25,10 +25,9 @@@ endi
  if COND_i386_ieee1275
    CFLAGS_PLATFORM += -mrtd -mregparm=3
  endif
- if COND_mips_yeeloong
+ if COND_mips_loongson
    CFLAGS_PLATFORM += -mexplicit-relocs
    CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
 -  CCASFLAGS_PLATFORM = -march=mips3
  endif
  if COND_mips
    CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
diff --cc configure.ac
index 28c13b5117b380b7774e17275474c8079882f326,50049b5e8bd01db3787e03ef31f74062bbca7011..9c086f4df5c12ebc7354fca3f5355a5e77e7ad47
@@@ -123,8 -123,9 +123,10 @@@ case "$target_cpu"-"$platform" i
    powerpc-ieee1275) ;;
    sparc64-ieee1275) ;;
    mips-qemu-mips) ;;
-   mips-yeeloong) ;;
+   mips-yeeloong) platform=loongson ;;
+   mips-fuloong) platform=loongson ;;
+   mips-loongson) ;;
 +  mips-arc) ;;
    *-emu) ;;
    *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
  esac
@@@ -157,9 -158,8 +159,9 @@@ case "$platform" i
    qemu)               machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
    pc)         machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
    emu)                machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
-   yeeloong)   machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
+   loongson)   machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
    qemu-mips)  machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
 +  mips-arc)   machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_ARC=1 -DGRUB_MACHINE_ARC=1" ;;
  esac
  case "$target_cpu" in
    mips)       machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
@@@ -952,9 -952,8 +954,9 @@@ AM_CONDITIONAL([COND_i386_ieee1275], [t
  AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
  AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
  AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
- AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong])
+ AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmips -a x$platform = xloongson])
  AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
 +AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
  AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
  AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
  AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
diff --cc gentpl.py
index c8d81cfbaab379337c2647dfb311af85c466bb60,17c6abfd8791bc3d928946530b1393185d00d71e..375bb0747019ad3b5df5f25e35be30a8a8a4dd4e
+++ b/gentpl.py
@@@ -6,8 -6,8 +6,8 @@@
  
  GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
                     "i386_multiboot", "i386_ieee1275", "x86_64_efi",
-                    "mips_yeeloong", "sparc64_ieee1275",
+                    "mips_loongson", "sparc64_ieee1275",
 -                   "powerpc_ieee1275" ]
 +                   "powerpc_ieee1275", "mips_arc" ]
  
  GROUPS = {}
  
@@@ -17,7 -17,7 +17,7 @@@ GROUPS["common"]   = GRUB_PLATFORMS[:
  GROUPS["i386"]     = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
  GROUPS["x86_64"]   = [ "x86_64_efi" ]
  GROUPS["x86"]      = GROUPS["i386"] + GROUPS["x86_64"]
- GROUPS["mips"]     = [ "mips_yeeloong", "mips_arc" ]
 -GROUPS["mips"]     = [ "mips_loongson" ]
++GROUPS["mips"]     = [ "mips_loongson", "mips_arc" ]
  GROUPS["sparc64"]  = [ "sparc64_ieee1275" ]
  GROUPS["powerpc"]  = [ "powerpc_ieee1275" ]
  
@@@ -29,8 -29,8 +29,8 @@@ GROUPS["ieee1275"]   = [ "i386_ieee1275
  GROUPS["noemu"]   = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
  
  # Groups based on hardware features
- GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
- GROUPS["pci"]      = GROUPS["x86"] + ["mips_yeeloong"]
+ GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
 -GROUPS["pci"]      = GROUPS["x86"] + GROUPS["mips"]
++GROUPS["pci"]      = GROUPS["x86"] + ["mips_loongson"]
  GROUPS["usb"]      = GROUPS["pci"]
  
  # If gfxterm is main output console integrate it into kernel
@@@ -39,7 -39,7 +39,7 @@@ GROUPS["videomodules"]   = GRUB_PLATFOR
  for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
  
  # Similar for terminfo
- GROUPS["terminfoinkernel"] = ["mips_yeeloong", "mips_arc"] + GROUPS["ieee1275"];
 -GROUPS["terminfoinkernel"] = ["mips_loongson"] + GROUPS["ieee1275"];
++GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc"] + GROUPS["ieee1275"];
  GROUPS["terminfomodule"]   = GRUB_PLATFORMS[:];
  for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
  
index 234bd3ee81e631c8c8c0ca6122075a456f1182b5,3b1611db27f98a15a95eabeb98a1dbaee93b2526..9a804507be990d574c70fe9f36a30d0cc4e56a04
@@@ -125,17 -125,9 +125,17 @@@ KERNEL_HEADER_FILES += $(top_srcdir)/in
  KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
  endif
  
- if COND_mips_yeeloong
 +if COND_mips
 +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
 +endif
 +
 +if COND_mips_arc
 +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
 +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h
 +endif
 +
+ if COND_mips_loongson
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
  KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
  KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
index e27d375c47c14e04540fd99742dae4da77e09b4b,a75c0f7382b894e54f4151891d9a714c057c31c6..0d56ff19b15dd0d05a580df81993d4950014fe20
@@@ -32,12 -32,11 +32,12 @@@ kernel = 
    i386_coreboot_ldflags    = '-Wl,-Ttext=0x8200';
    i386_multiboot_ldflags   = '-Wl,-Ttext=0x8200';
    i386_ieee1275_ldflags    = '-Wl,-Ttext=0x10000';
-   mips_yeeloong_ldflags    = '-Wl,-Ttext,0x80200000';
+   mips_loongson_ldflags    = '-Wl,-Ttext,0x80200000';
    powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
    sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
 +  mips_arc_ldflags    = '-Wl,-Ttext,0x8a000000';
  
-   mips_yeeloong_cppflags = '-DUSE_ASCII_FAILBACK';
+   mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
    i386_qemu_cppflags     = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
    emu_cflags = '$(CFLAGS_GNULIB)';
    emu_cppflags = '$(CPPFLAGS_GNULIB)';
  
    i386_ieee1275 = kern/ieee1275/init.c;
  
-   mips_yeeloong = term/ns8250.c;
-   mips_yeeloong = bus/bonito.c;
-   mips_yeeloong = bus/cs5536.c;
-   mips_yeeloong = bus/pci.c;
-   mips_yeeloong = kern/mips/yeeloong/init.c;
-   mips_yeeloong = term/at_keyboard.c;
-   mips_yeeloong = term/serial.c;
-   mips_yeeloong = video/sm712.c;
 +  mips = kern/mips/cache.S;
 +  mips = kern/mips/dl.c;
 +  mips = kern/mips/init.c;
 +
 +  mips_arc = kern/mips/arc/init.c;
 +  mips_arc = term/arc/console.c;
 +  mips_arc = disk/arc/arcdisk.c;
 +
 -  mips_loongson = kern/mips/cache.S;
 -  mips_loongson = kern/mips/dl.c;
 -  mips_loongson = kern/mips/init.c;
+   mips_loongson = term/ns8250.c;
+   mips_loongson = bus/bonito.c;
+   mips_loongson = bus/cs5536.c;
+   mips_loongson = bus/pci.c;
+   mips_loongson = kern/mips/loongson/init.c;
+   mips_loongson = term/at_keyboard.c;
+   mips_loongson = term/serial.c;
+   mips_loongson = video/sm712.c;
+   mips_loongson = video/sis315pro.c;
    extra_dist = video/sm712_init.c;
-   mips_yeeloong = commands/keylayouts.c;
+   mips_loongson = commands/keylayouts.c;
  
    powerpc_ieee1275 = kern/ieee1275/init.c;
    powerpc_ieee1275 = kern/powerpc/cache.S;
index 426e7eabb9ca307103a6eef8e7a7633a34c5c9e0,acc3a17c7fe013a0f290f8d3ff308db21d006fa8..f0f5c587456e70fca021d3595fdbb63b67d7bf47
  #include <grub/cs5536.h>
  #include <grub/term.h>
  #include <grub/machine/ec.h>
 +#include <grub/cpu/memory.h>
  
  extern void grub_video_sm712_init (void);
+ extern void grub_video_sis315pro_init (void);
  extern void grub_video_init (void);
  extern void grub_bitmap_init (void);
  extern void grub_font_init (void);
index 48bf253de757ff889fd6e15f4f479cf8d506d5e6,624ceb6d0d84b90ce1d3db720fa131cb50f551ff..ac7ed317588e6890a571d0f44cd2b65a25259960
@@@ -50,11 -51,11 +51,11 @@@ VARIABLE(grub_prefix
         */
  
        . = _start + GRUB_KERNEL_MACHINE_PREFIX_END
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
 +VARIABLE (grub_arch_cpuclock)
 +      .long 0
+ #ifdef GRUB_MACHINE_MIPS_LOONGSON
  VARIABLE (grub_arch_busclock)
        .long 0
 -VARIABLE (grub_arch_cpuclock)
 -      .long 0
  VARIABLE (grub_arch_memsize)
        .long 0
  VARIABLE (grub_arch_highmemsize)
index 0b95bd3c2dbcf3aecd073d46f9b0fff659f55013,193ea9681e279d740348a40289f5b66b2aa58e45..b0b69eae6008e6692db26bba1d5ff3b3b36247f3
  GRUB_MOD_LICENSE ("GPLv3+");
  
  /* For frequencies.  */
 -#include <grub/pci.h>
  #include <grub/machine/time.h>
  
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
+ #ifdef GRUB_MACHINE_MIPS_LOONGSON
 -#include <grub/machine/kernel.h>
 +#include <grub/pci.h>
  
- /* This can be detected on runtime from PMON, but:
-      a) it wouldn't work when GRUB is the firmware
-    and
-      b) for now we only support Yeeloong anyway.  */
- #define LOONGSON_MACHTYPE "machtype=lemote-yeeloong-2f-8.9inches"
+ const char loongson_machtypes[][60] =
+   {
+     [GRUB_ARCH_MACHINE_YEELOONG] = "machtype=lemote-yeeloong-2f-8.9inches",
+     [GRUB_ARCH_MACHINE_FULOONG]  = "machtype=lemote-fuloong-2f-unknown"
+   };
  #endif
  
  static grub_dl_t my_mod;
@@@ -54,10 -54,7 +53,10 @@@ static struct grub_relocator *relocator
  static grub_uint8_t *playground;
  static grub_addr_t target_addr, entry_addr;
  static int linux_argc;
 -static grub_off_t argv_off, envp_off;
 +static grub_off_t argv_off;
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
 +static grub_off_t envp_off;
 +#endif
  static grub_off_t rd_addr_arg_off, rd_size_arg_off;
  static int initrd_loaded = 0;
  
@@@ -70,12 -67,7 +69,12 @@@ grub_linux_boot (void
    state.gpr[1] = entry_addr;
    state.gpr[4] = linux_argc;
    state.gpr[5] = target_addr + argv_off;
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
    state.gpr[6] = target_addr + envp_off;
 +#else
 +  state.gpr[6] = 0;
 +#endif
 +  state.gpr[7] = 0;
    state.jumpreg = 1;
    grub_relocator32_boot (relocator, state);
  
@@@ -210,13 -202,9 +209,13 @@@ grub_cmd_linux (grub_command_t cmd __at
    int i;
    int size;
    void *extra = NULL;
 -  grub_uint32_t *linux_argv, *linux_envp;
 -  char *linux_args, *linux_envs;
 +  grub_uint32_t *linux_argv;
 +  char *linux_args;
    grub_err_t err;
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
 +  char *linux_envs;
 +  grub_uint32_t *linux_envp;
 +#endif
  
    if (argc == 0)
      return grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
  
    extra = linux_args;
  
- #ifdef GRUB_MACHINE_MIPS_YEELOONG
++#ifdef GRUB_MACHINE_MIPS_LOONGSON
    linux_envp = extra;
    envp_off = (grub_uint8_t *) linux_envp - (grub_uint8_t *) playground;
    linux_envs = (char *) (linux_envp + 5);
Simple merge
index 0000000000000000000000000000000000000000,857b37a154e9900d04381f980fe4b0f28e88f022..612221ed257302de105df0ebbb6068a969ada439
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,36 +1,34 @@@
 -void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
 -void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
 -
+ /*
+  *  GRUB  --  GRand Unified Bootloader
+  *  Copyright (C) 2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+  *
+  *  GRUB is free software: you can redistribute it and/or modify
+  *  it under the terms of the GNU General Public License as published by
+  *  the Free Software Foundation, either version 3 of the License, or
+  *  (at your option) any later version.
+  *
+  *  GRUB is distributed in the hope that it will be useful,
+  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  *  GNU General Public License for more details.
+  *
+  *  You should have received a copy of the GNU General Public License
+  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ #ifndef GRUB_KERNEL_MACHINE_HEADER
+ #define GRUB_KERNEL_MACHINE_HEADER    1
+ #include <grub/symbol.h>
++#include <grub/cpu/kernel.h>
+ #define GRUB_ARCH_MACHINE_YEELOONG 0
+ #define GRUB_ARCH_MACHINE_FULOONG 1
+ #ifndef ASM_FILE
+ extern grub_uint32_t EXPORT_VAR (grub_arch_machine);
+ #endif
+ #endif /* ! GRUB_KERNEL_MACHINE_HEADER */
Simple merge
Simple merge
index d71e7deae092f4d98af905dbdcc41717cbc3ea89,0be305c273fa075bac33b2c614418845e35cdab5..d17f4a89c3618e926d2507ce4df7737a4243f407
  #define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
  #define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
  
- #define GRUB_KERNEL_MIPS_YEELOONG_LINK_ADDR         0x80200000
+ #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ADDR         0x80200000
  
- #define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN  32
+ #define GRUB_KERNEL_MIPS_LOONGSON_LINK_ALIGN  32
  
- #define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE          0x8
- #define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE        0xc
+ #define GRUB_KERNEL_MIPS_LOONGSON_COMPRESSED_SIZE          0x8
+ #define GRUB_KERNEL_MIPS_LOONGSON_UNCOMPRESSED_SIZE        0xc
  
- #define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE   0x08
- #define GRUB_KERNEL_MIPS_YEELOONG_PREFIX              0x0c
- #define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END          0x54
+ #define GRUB_KERNEL_MIPS_LOONGSON_TOTAL_MODULE_SIZE   0x08
+ #define GRUB_KERNEL_MIPS_LOONGSON_PREFIX              0x0c
+ #define GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END          0x54
  
 +#define GRUB_KERNEL_MIPS_ARC_LINK_ADDR         0x8a000000
 +
 +#define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN  32
 +
 +#define GRUB_KERNEL_MIPS_ARC_COMPRESSED_SIZE          0x8
 +#define GRUB_KERNEL_MIPS_ARC_UNCOMPRESSED_SIZE        0xc
 +
 +#define GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE        0x08
 +#define GRUB_KERNEL_MIPS_ARC_PREFIX           0x0c
 +#define GRUB_KERNEL_MIPS_ARC_PREFIX_END               0x54
 +
  /* The offset of GRUB_PREFIX.  */
  #define GRUB_KERNEL_I386_EFI_PREFIX           0x8
  
  
  #define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
  
- #define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
+ #define GRUB_KERNEL_MIPS_LOONGSON_MOD_ALIGN 0x1
 +#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
  
  /* Minimal gap between _end and the start of the modules.  It's a hack
     for PowerMac to prevent "CLAIM failed" error.  The real fix is to
Simple merge
index 259d78bebdad97c4ab21839d1f5087f41dfe2a46,b65a3e3d50f0a3b3f1eefdaac89675ae8926def3..fe112c26a5616321ba80f2ac0990f9fa5e10ce2e
@@@ -64,8 -65,8 +65,8 @@@ struct image_target_des
    enum {
      IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
      IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
-     IMAGE_YEELOONG_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
-     IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC
+     IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
 -    IMAGE_FULOONG_FLASH, IMAGE_I386_PC_PXE
++    IMAGE_FULOONG_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC
    } id;
    enum
      {
@@@ -355,27 -392,6 +392,28 @@@ struct image_target_desc image_targets[
        .install_bsd_part = TARGET_NO_FIELD,
        .link_addr = GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR
      },
-       .name = "mips-arc",
 +    {
++      .dirname = "mips-arc",
++      .names = {"mips-arc", NULL},
 +      .voidp_sizeof = 4,
 +      .bigendian = 1,
 +      .id = IMAGE_MIPS_ARC, 
 +      .flags = PLATFORM_FLAGS_DECOMPRESSORS,
 +      .prefix = GRUB_KERNEL_MIPS_ARC_PREFIX,
 +      .prefix_end = GRUB_KERNEL_MIPS_ARC_PREFIX_END,
 +      .raw_size = 0,
 +      .total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE,
 +      .compressed_size = TARGET_NO_FIELD,
 +      .kernel_image_size = TARGET_NO_FIELD,
 +      .section_align = 1,
 +      .vaddr_offset = 0,
 +      .install_dos_part = TARGET_NO_FIELD,
 +      .install_bsd_part = TARGET_NO_FIELD,
 +      .link_addr = GRUB_KERNEL_MIPS_ARC_LINK_ADDR,
 +      .elf_target = EM_MIPS,
 +      .link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN,
 +      .default_compression = COMPRESSION_NONE
 +    },
    };
  
  #define grub_target_to_host32(x) (grub_target_to_host32_real (image_target, (x)))
@@@ -1238,77 -1273,7 +1295,77 @@@ generate_image (const char *dir, char *
        core_size = rom_size;
      }
      break;
-     case IMAGE_YEELOONG_ELF:
 +    case IMAGE_MIPS_ARC:
 +      {
 +      char *ecoff_img;
 +      struct ecoff_header {
 +        grub_uint16_t magic;
 +        grub_uint16_t nsec;
 +        grub_uint32_t time;
 +        grub_uint32_t syms;
 +        grub_uint32_t nsyms;
 +        grub_uint16_t opt;
 +        grub_uint16_t flags;
 +        grub_uint16_t magic2;
 +        grub_uint16_t version;
 +        grub_uint32_t textsize;
 +        grub_uint32_t datasize;
 +        grub_uint32_t bsssize;
 +        grub_uint32_t entry;
 +        grub_uint32_t text_start;
 +        grub_uint32_t data_start;
 +        grub_uint32_t bss_start;
 +        grub_uint32_t gprmask;
 +        grub_uint32_t cprmask[4];
 +        grub_uint32_t gp_value;
 +      };
 +      struct ecoff_section
 +      {
 +        char name[8];
 +        grub_uint32_t paddr;
 +        grub_uint32_t vaddr;
 +        grub_uint32_t size;
 +        grub_uint32_t file_offset;
 +        grub_uint32_t reloc;
 +        grub_uint32_t gp;
 +        grub_uint16_t nreloc;
 +        grub_uint16_t ngp;
 +        grub_uint32_t flags;
 +      };
 +      struct ecoff_header *head;
 +      struct ecoff_section *section;
 +      grub_uint32_t target_addr;
 +      size_t program_size;
 +
 +      program_size = ALIGN_ADDR (core_size);
 +      target_addr = image_target->link_addr - ALIGN_UP(program_size, 1048576)
 +        - (1 << 20);
 +
 +      ecoff_img = xmalloc (program_size + sizeof (*head) + sizeof (*section));
 +      grub_memset (ecoff_img, 0, program_size + sizeof (*head) + sizeof (*section));
 +      head = (void *) ecoff_img;
 +      section = (void *) (head + 1);
 +      head->magic = grub_host_to_target16 (0x160);
 +      head->nsec = grub_host_to_target16 (1);
 +      head->time = grub_host_to_target32 (0);
 +      head->opt = grub_host_to_target16 (0x38);
 +      head->flags = grub_host_to_target16 (0x207);
 +      head->magic2 = grub_host_to_target16 (0x107);
 +      head->textsize = grub_host_to_target32 (program_size);
 +      head->entry = grub_host_to_target32 (target_addr);
 +      head->text_start = grub_host_to_target32 (target_addr);
 +      head->data_start = grub_host_to_target32 (target_addr + program_size);
 +      grub_memcpy (section->name, ".text", sizeof (".text") - 1); 
 +      section->vaddr = grub_host_to_target32 (target_addr);
 +      section->size = grub_host_to_target32 (program_size);
 +      section->file_offset = grub_host_to_target32 (sizeof (*head) + sizeof (*section));
 +      memcpy (section + 1, core_img, core_size);
 +      free (core_img);
 +      core_img = ecoff_img;
 +      core_size = program_size + sizeof (*head) + sizeof (*section);
 +      }
 +      break;
+     case IMAGE_LOONGSON_ELF:
      case IMAGE_PPC:
      case IMAGE_COREBOOT:
      case IMAGE_I386_IEEE1275: