Make qemu-mips compile again. Still no grub-mkimage support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-14 17:37:11 +01:00
parent 4fbf185232
commit f440c33fd2
15 changed files with 110 additions and 23 deletions

View file

@ -122,7 +122,7 @@ case "$target_cpu"-"$platform" in
i386-qemu) ;;
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
mips-qemu-mips) ;;
mips-qemu_mips) ;;
mips-yeeloong) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
@ -157,7 +157,7 @@ case "$platform" in
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" ;;
qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;;
esac
case "$target_cpu" in
mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;

View file

@ -6,7 +6,7 @@
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
"mips_yeeloong", "sparc64_ieee1275",
"mips_yeeloong", "mips_qemu_mips", "sparc64_ieee1275",
"powerpc_ieee1275" ]
GROUPS = {}
@ -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" ]
GROUPS["mips"] = [ "mips_yeeloong", "mips_qemu_mips" ]
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
@ -29,8 +29,8 @@ GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_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"] + GROUPS["mips"]
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong", "mips_qemu_mips" ]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
GROUPS["pci"] = GROUPS["x86"] + ["mips_yeeloong"]
GROUPS["usb"] = GROUPS["pci"]
# If gfxterm is main output console integrate it into kernel

View file

@ -145,6 +145,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
endif
if COND_mips_qemu_mips
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
endif
if COND_powerpc_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h

View file

@ -48,7 +48,7 @@ kernel = {
i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
i386_coreboot_startup = kern/i386/coreboot/startup.S;
i386_multiboot_startup = kern/i386/coreboot/startup.S;
mips_yeeloong_startup = kern/mips/startup.S;
mips_startup = kern/mips/startup.S;
sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
@ -82,6 +82,7 @@ kernel = {
i386_coreboot = kern/generic/rtc_get_time_ms.c;
i386_multiboot = kern/generic/rtc_get_time_ms.c;
mips_yeeloong = kern/generic/rtc_get_time_ms.c;
mips_qemu_mips = kern/generic/rtc_get_time_ms.c;
ieee1275 = disk/ieee1275/ofdisk.c;
ieee1275 = kern/ieee1275/cmain.c;
@ -140,10 +141,11 @@ kernel = {
mips_yeeloong = bus/bonito.c;
mips_yeeloong = bus/cs5536.c;
mips_yeeloong = bus/pci.c;
mips_yeeloong = kern/mips/cache.S;
mips_yeeloong = kern/mips/dl.c;
mips_yeeloong = kern/mips/init.c;
mips = kern/mips/cache.S;
mips = kern/mips/dl.c;
mips = kern/mips/init.c;
mips_yeeloong = kern/mips/yeeloong/init.c;
mips_qemu_mips = kern/mips/qemu-mips/init.c;
mips_yeeloong = term/at_keyboard.c;
mips_yeeloong = term/serial.c;
mips_yeeloong = video/sm712.c;
@ -1229,7 +1231,7 @@ module = {
mips_yeeloong = mmap/mips/yeeloong/uppermem.c;
enable = x86;
enable = mips_yeeloong;
enable = mips;
};
module = {

View file

@ -1,3 +1,6 @@
/* Qemu doesn't emulate caches. Oh boy. */
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
move $t2, $a0
addu $t3, $a0, $a1
srl $t2, $t2, 5
@ -21,3 +24,4 @@
bne $t1, $zero, 2b
addiu $t0, $t0, 0x1
sync
#endif

View file

@ -6,9 +6,8 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/time.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/cpu/kernel.h>
#include <grub/memory.h>
#define RAMSIZE (*(grub_uint32_t *) ((16 << 20) - 264))

View file

@ -29,8 +29,10 @@
#include <grub/i18n.h>
/* For frequencies. */
#ifdef GRUB_MACHINE_MIPS_YEELOONG
#include <grub/pci.h>
#include <grub/machine/time.h>
#endif
#ifdef GRUB_MACHINE_MIPS_YEELOONG
/* This can be detected on runtime from PMON, but:
@ -314,6 +316,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
linux_envp = extra;
envp_off = (grub_uint8_t *) linux_envp - (grub_uint8_t *) playground;
linux_envs = (char *) (linux_envp + 5);
#ifdef GRUB_MACHINE_MIPS_YEELOONG
grub_snprintf (linux_envs, sizeof ("memsize=XXXXXXXXXXXXXXXXXXXX"),
"memsize=%lld",
(unsigned long long) grub_mmap_get_lower () >> 20);
@ -338,8 +341,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
+ target_addr;
linux_envs += ALIGN_UP (grub_strlen (linux_envs) + 1, 4);
linux_envp[4] = 0;
#else
linux_envp[0] = 0;
#endif
grub_loader_set (grub_linux_boot, grub_linux_unload, 1);
initrd_loaded = 0;

View file

@ -671,6 +671,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
}
#if defined (__i386) || defined (__x86_64__) || defined (GRUB_MACHINE_MIPS_YEELOONG)
{
struct multiboot_tag_basic_meminfo *tag
= (struct multiboot_tag_basic_meminfo *) ptrorig;
@ -682,6 +683,7 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
tag->mem_upper = grub_mmap_get_upper () / 1024;
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
}
#endif
if (bootdev_set)
{

View file

@ -0,0 +1,28 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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_CPU_CMOS_H
#define GRUB_CPU_CMOS_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#define GRUB_CMOS_ADDR_REG 0xb4000070
#define GRUB_CMOS_DATA_REG 0xb4000071
#endif /* GRUB_CPU_CMOS_H */

View file

@ -20,7 +20,6 @@
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/cpu/kernel.h>
#ifndef ASM_FILE

View file

@ -28,11 +28,37 @@
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x80f00000
#define GRUB_MACHINE_MEMORY_USABLE 0x81000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#define GRUB_MACHINE_MEMORY_MAX_TYPE 1
/* This one is special: it's used internally but is never reported
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 2
#define GRUB_MACHINE_MEMORY_RESERVED GRUB_MACHINE_MEMORY_HOLE
#ifndef ASM_FILE
typedef grub_addr_t grub_phys_addr_t;
static inline grub_phys_addr_t
grub_vtop (void *a)
{
return ((grub_phys_addr_t) a) & 0x1fffffff;
}
static inline void *
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
{
return (void *) (a | 0x80000000);
}
static inline void
grub_unmap_memory (void *a __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
@ -47,6 +73,7 @@ grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
#endif
#endif

View file

@ -104,12 +104,26 @@
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
#define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE 0xc
#define GRUB_KERNEL_MIPS_COMPRESSED_SIZE 0x8
#define GRUB_KERNEL_MIPS_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_YEELOONG_COMPRESSED_SIZE GRUB_KERNEL_MIPS_COMPRESSED_SIZE
#define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE GRUB_KERNEL_MIPS_UNCOMPRESSED_SIZE
#define GRUB_KERNEL_MIPS_QEMU_MIPS_COMPRESSED_SIZE GRUB_KERNEL_MIPS_COMPRESSED_SIZE
#define GRUB_KERNEL_MIPS_QEMU_MIPS_UNCOMPRESSED_SIZE GRUB_KERNEL_MIPS_UNCOMPRESSED_SIZE
#define GRUB_KERNEL_MIPS_TOTAL_MODULE_SIZE 0x08
#define GRUB_KERNEL_MIPS_PREFIX 0x0c
#define GRUB_KERNEL_MIPS_PREFIX_END 0x54
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE GRUB_KERNEL_MIPS_TOTAL_MODULE_SIZE
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX GRUB_KERNEL_MIPS_PREFIX
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END GRUB_KERNEL_MIPS_PREFIX_END
#define GRUB_KERNEL_MIPS_QEMU_MIPS_TOTAL_MODULE_SIZE GRUB_KERNEL_MIPS_TOTAL_MODULE_SIZE
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX GRUB_KERNEL_MIPS_PREFIX
#define GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END GRUB_KERNEL_MIPS_PREFIX_END
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
@ -144,7 +158,9 @@
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
#define GRUB_KERNEL_MIPS_MOD_ALIGN 0x1
#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN GRUB_KERNEL_MIPS_MOD_ALIGN
#define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN GRUB_KERNEL_MIPS_MOD_ALIGN
/* 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