Add loongson tests.

* tests/util/grub-shell.in: Handle loongson.
	* tests/partmap_test.in: Add loongson to the list of platform using ATA
	drivers.
	* grub-core/tests/boot/linux.init-mips.S (SHUTDOWN_MAGIC3) [REBOOT]:
	Reboot instead of shutdown if REBOOT is defined.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-15 19:42:25 +02:00
parent 0321415e86
commit eac49cffc8
5 changed files with 55 additions and 8 deletions

View file

@ -1,3 +1,13 @@
2012-06-15 Vladimir Serbinenko <phcoder@gmail.com>
Add loongson tests.
* tests/util/grub-shell.in: Handle loongson.
* tests/partmap_test.in: Add loongson to the list of platform using ATA
drivers.
* grub-core/tests/boot/linux.init-mips.S (SHUTDOWN_MAGIC3) [REBOOT]:
Reboot instead of shutdown if REBOOT is defined.
2012-06-15 Vladimir Serbinenko <phcoder@gmail.com> 2012-06-15 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/mips/loongson/reboot.c (grub_reboot): Use 32-bit * grub-core/lib/mips/loongson/reboot.c (grub_reboot): Use 32-bit

View file

@ -168,6 +168,9 @@ linux.init.ppc: $(srcdir)/grub-core/tests/boot/linux.init-ppc.S
linux.init.mipsel: $(srcdir)/grub-core/tests/boot/linux.init-mips.S linux.init.mipsel: $(srcdir)/grub-core/tests/boot/linux.init-mips.S
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.loongson: $(srcdir)/grub-core/tests/boot/linux.init-mips.S
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -DREBOOT=1
multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include $(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
@ -219,6 +222,9 @@ linux-initramfs.ppc: linux.init.ppc Makefile
linux-initramfs.mipsel: linux.init.mipsel Makefile linux-initramfs.mipsel: linux.init.mipsel Makefile
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
linux-initramfs.loongson: linux.init.loongson Makefile
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
linux-initramfs.i386: linux.init.i386 Makefile linux-initramfs.i386: linux.init.i386 Makefile
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
@ -288,13 +294,16 @@ bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-mips: linux-initramfs.mips $(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-mips: linux-initramfs.mips $(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-mips --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-ppc: linux-initramfs.ppc $(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-ppc: linux-initramfs.ppc $(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-ppc --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-mipsel: linux-initramfs.mipsel $(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-mipsel: linux-initramfs.mipsel $(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-mipsel --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-loongson: linux-initramfs.loongson $(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux16-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux16-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
@ -349,12 +358,20 @@ if COND_i386_pc
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386 bootcheck-pc-chainloader bootcheck-ntldr bootcheck-linux16-i386 bootcheck-linux16-x86_64 bootcheck-knetbsd-i386 BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386 bootcheck-pc-chainloader bootcheck-ntldr bootcheck-linux16-i386 bootcheck-linux16-x86_64 bootcheck-knetbsd-i386
endif endif
if COND_mips_loongson
BOOTCHECKS = bootcheck-linux-loongson
endif
if COND_mipsel if COND_mipsel
if COND_mips_qemu_mips
BOOTCHECKS = bootcheck-linux-mipsel BOOTCHECKS = bootcheck-linux-mipsel
endif endif
endif
if COND_mipseb if COND_mipseb
if COND_mips_qemu_mips
BOOTCHECKS = bootcheck-linux-mips BOOTCHECKS = bootcheck-linux-mips
endif endif
endif
if COND_powerpc_ieee1275 if COND_powerpc_ieee1275
BOOTCHECKS = bootcheck-linux-ppc BOOTCHECKS = bootcheck-linux-ppc

View file

@ -23,8 +23,11 @@
#define STDOUT 1 #define STDOUT 1
#define SHUTDOWN_MAGIC1 0xfee1dead #define SHUTDOWN_MAGIC1 0xfee1dead
#define SHUTDOWN_MAGIC2 0x28121969 #define SHUTDOWN_MAGIC2 0x28121969
#ifdef REBOOT
#define SHUTDOWN_MAGIC3 0x01234567
#else
#define SHUTDOWN_MAGIC3 0x4321fedc #define SHUTDOWN_MAGIC3 0x4321fedc
#endif
.text .text
.global start, _start, __start .global start, _start, __start
__start: __start:

View file

@ -56,7 +56,7 @@ list_parts () {
} }
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot) mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot | mipsel-loongson)
disk=ata0 disk=ata0
;; ;;
powerpc-ieee1275) powerpc-ieee1275)

View file

@ -61,6 +61,7 @@ EOF
qemuopts="${GRUB_QEMU_OPTS}" qemuopts="${GRUB_QEMU_OPTS}"
serial_port=com0 serial_port=com0
serial_null= serial_null=
hald_cmd=halt
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
powerpc-ieee1275) powerpc-ieee1275)
boot=cd boot=cd
@ -82,6 +83,14 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
qemuopts="$qemuopts -M mips" qemuopts="$qemuopts -M mips"
console=vga_text console=vga_text
;; ;;
mipsel-loongson)
boot=mipsel_fulong2e
qemu=qemu-system-mips64el
qemuopts="$qemuopts -no-reboot -M fulong2e"
console=
halt_cmd=reboot
trim=1
;;
i386-coreboot) i386-coreboot)
boot=coreboot boot=coreboot
qemu=qemu-system-i386 qemu=qemu-system-i386
@ -157,7 +166,8 @@ for option in "$@"; do
elif [ "$dev" = "qemu" ] ; then boot=qemu; elif [ "$dev" = "qemu" ] ; then boot=qemu;
elif [ "$dev" = "coreboot" ] ; then boot=coreboot; elif [ "$dev" = "coreboot" ] ; then boot=coreboot;
elif [ "$dev" = "mips_qemu" ] ; then boot=mips_qemu; elif [ "$dev" = "mips_qemu" ] ; then boot=mips_qemu;
elif [ "$dev" = "mipsel_qemu" ] ; then boot=mips_qemu; elif [ "$dev" = "mipsel_qemu" ] ; then boot=mipsel_qemu;
elif [ "$dev" = "mipsel_fulong2e" ] ; then boot=mipsel_fulong2e;
else else
echo "Unrecognized boot method \`$dev'" 1>&2 echo "Unrecognized boot method \`$dev'" 1>&2
usage usage
@ -211,9 +221,11 @@ done
cat <<EOF >>${cfgfile} cat <<EOF >>${cfgfile}
source /boot/grub/testcase.cfg source /boot/grub/testcase.cfg
# Stop serial output to suppress "ACPI shutdown failed" error. # Stop serial output to suppress "ACPI shutdown failed" error.
terminal_output $console
halt
EOF EOF
if [ x$console != x ]; then
echo "terminal_output $console" >>${cfgfile}
fi
echo "$halt_cmd" >>${cfgfile}
isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
if [ x$boot != xnet ]; then if [ x$boot != xnet ]; then
@ -245,6 +257,11 @@ if [ x$boot = xmipsel_qemu ]; then
device=cdrom device=cdrom
fi fi
if [ x$boot = xmipsel_fulong2e ]; then
bootdev="-kernel ${rom_directory}/mipsel-loongson.elf -append machtype=lemote-fuloong-2e"
device=cdrom
fi
if [ x$boot = xmips_qemu ]; then if [ x$boot = xmips_qemu ]; then
bootdev="-kernel ${rom_directory}/mips-qemu_mips.elf" bootdev="-kernel ${rom_directory}/mips-qemu_mips.elf"
device=cdrom device=cdrom