]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Enable mipsel-arc.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 25 Apr 2013 20:42:35 +0000 (22:42 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 25 Apr 2013 20:42:35 +0000 (22:42 +0200)
ChangeLog
configure.ac
grub-core/Makefile.core.def
grub-core/disk/arc/arcdisk.c
include/grub/mips/arc/memory.h
include/grub/offsets.h
tests/grub_cmd_date.in
tests/partmap_test.in
tests/util/grub-shell.in
util/grub-mkimage.c
util/grub-mkrescue.in

index 7f2c4dd752f40bea466d8556ea487bda76616d8d..0bc5cc4d6e4cb532e9f65d5513e4ec010243df93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-25  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Enable mipsel-arc.
+
 2013-04-25  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Add serial on ARC platform.
index ca180c6bd9e713a8f4bab0fc6e6c6552bc1112bc..4af1a03769e8d53d45d2de60fd1f03528dbd07d6 100644 (file)
@@ -145,6 +145,7 @@ case "$target_cpu"-"$platform" in
   mips-qemu_mips) ;;
   mips-qemu-mips) platform=qemu_mips;;
   mips-arc) ;;
+  mipsel-arc) ;;
   mipsel-qemu_mips) ;;
   mipsel-qemu-mips) platform=qemu_mips;;
   mipsel-yeeloong) platform=loongson ;;
@@ -198,6 +199,23 @@ else
    machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1"
 fi
 
+case "${target_cpu}-$platform" in
+     mips-arc)
+        TARGET_LINK_ADDR=0x88200000
+        TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
+       ;;
+     mipsel-arc)
+        TARGET_LINK_ADDR=0x80700000
+       TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
+       ;;
+     mips*-qemu_mips | mips-loongson)
+        TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
+       ;;
+esac
+
+AC_SUBST(TARGET_LINK_ADDR)
+AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
+
 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
 
 AC_SUBST(host_cpu)
@@ -1146,7 +1164,7 @@ AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform =
 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")"  -a x$platform = xqemu_mips])
-AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
+AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")"  -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 -o x$target_cpu = xmipsel])
index cdef5b40f8690def7b37bc101b758fa4707c0ab8..ad912a6485c6a2b3cb5ea6f7c303d081c49d2a62 100644 (file)
@@ -73,7 +73,7 @@ kernel = {
   mips_loongson_ldflags    = '-Wl,-Ttext,0x80200000';
   powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
   sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
-  mips_arc_ldflags    = '-Wl,-Ttext,0x88200000';
+  mips_arc_ldflags    = '-Wl,-Ttext,$(TARGET_LINK_ADDR)';
   mips_qemu_mips_ldflags    = '-Wl,-Ttext,0x80200000';
 
   mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
@@ -370,9 +370,7 @@ image = {
   cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1';
 
   objcopyflags = '-O binary';
-  mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
-  mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
-  mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000';
+  mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
   ldadd = '-lgcc';
   cflags = '-Wno-unreachable-code -static-libgcc';
   enable = mips;
@@ -386,9 +384,7 @@ image = {
   cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
 
   objcopyflags = '-O binary';
-  mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
-  mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
-  mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x88100000';
+  mips_ldflags = '-static-libgcc -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
   ldadd = '-lgcc';
   cflags = '-static-libgcc';
   enable = mips;
index 9aefb7c3f6227b6569c402e954d5082985af033f..0cc1993e5fdf3dcd7a417cb55a15acb11a48d70a 100644 (file)
@@ -113,7 +113,11 @@ grub_arcdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
   return grub_arc_iterate_devs (grub_arcdisk_iterate_iter, &ctx, 1);
 }
 
+#ifdef GRUB_CPU_MIPSEL
+#define RAW_SUFFIX "partition(0)"
+#else
 #define RAW_SUFFIX "partition(10)"
+#endif
 
 static grub_err_t
 reopen (const char *name, int writable)
index 68b425f75af9c0f537bb3e47dc85f0f78e9da909..77bb03d3e4f767adfc36fd4a5f0fd405d3982003 100644 (file)
 #ifndef GRUB_MEMORY_MACHINE_HEADER
 #define GRUB_MEMORY_MACHINE_HEADER     1
 
+#ifdef GRUB_CPU_MIPSEL
+#define GRUB_MACHINE_MEMORY_STACK_HIGH       0x806ffff0
+#else
 #define GRUB_MACHINE_MEMORY_STACK_HIGH       0x881ffff0
+#endif
 
 #ifndef ASM_FILE
 
index 1e673d522746de1b27939f8e0343f18f7308ca02..c5ef79f7ad288fe02753f790a5f913074df22cbf 100644 (file)
@@ -81,7 +81,7 @@
 #define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE   0x08
 
 #define GRUB_KERNEL_MIPS_ARC_LINK_ADDR         0x88200000
-
+#define GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR         0x80700000
 #define GRUB_KERNEL_MIPS_ARC_LINK_ALIGN  32
 
 #define GRUB_DECOMPRESSOR_MIPS_ARC_COMPRESSED_SIZE          0x8
 
 #define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
 #define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
+#if defined (GRUB_MACHINE_ARC) && defined (GRUB_CPU_MIPSEL)
+#define GRUB_MACHINE_LINK_ADDR GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR
+#else
 #define GRUB_MACHINE_LINK_ADDR GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _LINK_ADDR)
+#endif
 
 #define GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _COMPRESSED_SIZE)
 #define GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_DECOMPRESSOR_, GRUB_MACHINE, _UNCOMPRESSED_SIZE)
index 76436a016c87f2f543bc21bb6e079cf9bd64bf51..effc82a2111177b69fc0eb219b68bcb0d3d205f0 100644 (file)
@@ -4,7 +4,8 @@ set -e
 . "@builddir@/grub-core/modinfo.sh"
 
 # OpenBIOS on sparc64 doesn't implement RTC
-if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
+# mipsel-arc QEMU emulated RTC doesn't play well with firmware
+if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = mipsel-arc ]; then
     exit 0
 fi
 
index 0dea98a37e15dd5420ae2a4bf661e3278d9cabb8..ee23f7f456b95c0215d19569b1abfdd081766433 100644 (file)
@@ -81,6 +81,10 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     mips-arc)
        # ARC firmware has bugs which prevent it from accessing hard disk w/o dvh disklabel.
        exit 0 ;;
+    mipsel-arc)
+       disk=arc/scsi0/disk0/rdisk0
+       qemudisk=hda
+       ;;
     *)
        disk=hd0
        qemudisk=hda
index b051669d641db2fd43da910a22cf1f15671b76ab..ccea33266cf0bb96516b4aa77fef33932ab36f90 100644 (file)
@@ -92,6 +92,15 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
        console=console
        trim=1
        ;;
+    mipsel-arc)
+       boot=cd
+       qemu=qemu-system-mips64el
+       qemuopts="$qemuopts -M magnum -no-reboot"
+       serial_port=arc/multi0/serial0
+       console=console
+       halt_cmd=reboot
+       trim=1
+       ;;
     mipsel-qemu_mips)
        boot=mipsel_qemu
        qemu=qemu-system-mipsel
index 41f795aabadc7d38c3d2760198fbff2b1d64d211..7edf77a3ffd61e5cfbdbea5574a90071d4022be5 100644 (file)
@@ -399,6 +399,24 @@ struct image_target_desc image_targets[] =
       .link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN,
       .default_compression = COMPRESSION_NONE
     },
+    {
+      .dirname = "mipsel-arc",
+      .names = {"mipsel-arc", NULL},
+      .voidp_sizeof = 4,
+      .bigendian = 0,
+      .id = IMAGE_MIPS_ARC, 
+      .flags = PLATFORM_FLAGS_DECOMPRESSORS,
+      .total_module_size = GRUB_KERNEL_MIPS_ARC_TOTAL_MODULE_SIZE,
+      .decompressor_compressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_COMPRESSED_SIZE,
+      .decompressor_uncompressed_size = GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_SIZE,
+      .decompressor_uncompressed_addr = GRUB_DECOMPRESSOR_MIPS_LOONGSON_UNCOMPRESSED_ADDR,
+      .section_align = 1,
+      .vaddr_offset = 0,
+      .link_addr = GRUB_KERNEL_MIPSEL_ARC_LINK_ADDR,
+      .elf_target = EM_MIPS,
+      .link_align = GRUB_KERNEL_MIPS_ARC_LINK_ALIGN,
+      .default_compression = COMPRESSION_NONE
+    },
     {
       .dirname = "mipsel-qemu_mips",
       .names = { "mipsel-qemu_mips-elf", NULL },
@@ -1530,11 +1548,14 @@ generate_image (const char *dir, const char *prefix,
        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->magic = image_target->bigendian ? grub_host_to_target16 (0x160)
+         : grub_host_to_target16 (0x166);
        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->flags = image_target->bigendian
+         ? grub_host_to_target16 (0x207)
+         : grub_host_to_target16 (0x103);
        head->magic2 = grub_host_to_target16 (0x107);
        head->textsize = grub_host_to_target32 (program_size);
        head->entry = grub_host_to_target32 (target_addr);
@@ -1544,6 +1565,11 @@ generate_image (const char *dir, const char *prefix,
        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));
+       if (!image_target->bigendian)
+         {
+           section->paddr = grub_host_to_target32 (0xaa60);
+           section->flags = grub_host_to_target32 (0x20);
+         }
        memcpy (section + 1, core_img, core_size);
        free (core_img);
        core_img = ecoff_img;
index 78d4bec795ce45b835eac07069d5487ed8c3703d..51e75e8a7ab4a84e65abeeb9ec255e37a3e8e91c 100644 (file)
@@ -46,6 +46,7 @@ efi64_dir="${libdir}/@PACKAGE@/x86_64-efi"
 ia64_dir="${libdir}/@PACKAGE@/ia64-efi"
 sparc64_dir="${libdir}/@PACKAGE@/sparc64-ieee1275"
 arcs_dir="${libdir}/@PACKAGE@/mips-arc"
+arc_dir="${libdir}/@PACKAGE@/mipsel-arc"
 ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275"
 rom_directory=
 override_dir=
@@ -325,6 +326,9 @@ if [ "${override_dir}" = "" ] ; then
     if test -e "${arcs_dir}" ; then
         process_input_dir "${arcs_dir}" mips-arc
     fi
+    if test -e "${arc_dir}" ; then
+        process_input_dir "${arc_dir}" mipsel-arc
+    fi
 else
     . "${override_dir}"/modinfo.sh
     process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
@@ -342,6 +346,7 @@ else
     i386_ieee1275_dir=
     sparc64_dir=
     arcs_dir=
+    arc_dir=
     case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
         i386-multiboot) multiboot_dir="${override_dir}" ;;
         i386-coreboot) coreboot_dir="${override_dir}" ;;
@@ -356,6 +361,7 @@ else
        powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;;
        sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;;
        mips-arc) arcs_dir="${override_dir}"; system_area=arcs ;;
+       mipsel-arc) arc_dir="${override_dir}" ;;
        i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;;
     esac
 fi
@@ -491,6 +497,8 @@ if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ] && [ "$system_area" = arc
    grub_mkisofs_arguments="${grub_mkisofs_arguments} -mips-boot /boot/grub/mips-arc/sashARCS -mips-boot /boot/grub/mips-arc/sash -mips-boot /boot/grub/mips-arc/grub"
 fi
 
+make_image "${arc_dir}" mipsel-arc "${iso9660_dir}/boot/grub/arc.exe" ""
+
 make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "pata"
 if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then
     cp "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf"