Enable mipsel-arc.

parent b04b5990
2013-04-25 Vladimir Serbinenko <phcoder@gmail.com>
Enable mipsel-arc.
2013-04-25 Vladimir Serbinenko <phcoder@gmail.com>
Add serial on ARC platform.
......@@ -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])
......
......@@ -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;
......
......@@ -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)
......
......@@ -19,7 +19,11 @@
#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
......
......@@ -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
......@@ -125,7 +125,11 @@
#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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment