Extend automated tests to qemu-mips.

* Makefile.am: reorganise tests and enable qemu-mips.
	* configure.ac (COND_mipseb), (COND_mipsel): New conditions.
	* grub-core/tests/boot/linux.init-mips.S: New file.
	* tests/partmap_test.in: Handle ata0 disks.
	* tests/util/grub-shell.in: Handle qemu-mips. Make defaults work on
	non-pc i386.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-06 12:36:33 +02:00
parent 070038f843
commit 37ba07ebaf
6 changed files with 345 additions and 185 deletions

View file

@ -1,3 +1,14 @@
2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
Extend automated tests to qemu-mips.
* Makefile.am: reorganise tests and enable qemu-mips.
* configure.ac (COND_mipseb), (COND_mipsel): New conditions.
* grub-core/tests/boot/linux.init-mips.S: New file.
* tests/partmap_test.in: Handle ata0 disks.
* tests/util/grub-shell.in: Handle qemu-mips. Make defaults work on
non-pc i386.
2012-06-06 Vladimir Serbinenko <phcoder@gmail.com> 2012-06-06 Vladimir Serbinenko <phcoder@gmail.com>
* Makefile.util.def (grub-mkrescue) Anable on mips_qemu_mips and * Makefile.util.def (grub-mkrescue) Anable on mips_qemu_mips and

View file

@ -126,38 +126,31 @@ pkgdata_DATA += grub-mkconfig_lib
if COND_i386_coreboot if COND_i386_coreboot
BOOTTARGET=coreboot
QEMU32=qemu-system-i386 QEMU32=qemu-system-i386
endif endif
if COND_i386_multiboot if COND_i386_multiboot
BOOTTARGET=cd
QEMU32=qemu-system-i386 QEMU32=qemu-system-i386
endif endif
if COND_i386_ieee1275 if COND_i386_ieee1275
BOOTTARGET=cd
QEMU32=qemu-system-i386 QEMU32=qemu-system-i386
endif endif
if COND_i386_qemu if COND_i386_qemu
BOOTTARGET=qemu
QEMU32=qemu-system-i386 QEMU32=qemu-system-i386
endif endif
if COND_i386_pc if COND_i386_pc
BOOTTARGET=cd
QEMU32=qemu-system-i386 QEMU32=qemu-system-i386
endif endif
if COND_i386_efi if COND_i386_efi
QEMU32=qemu-system-i386 QEMU32=qemu-system-i386
BOOTTARGET=cd
endif endif
if COND_x86_64_efi if COND_x86_64_efi
QEMU32=qemu-system-x86_64 QEMU32=qemu-system-x86_64
BOOTTARGET=cd
endif endif
linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S
@ -166,6 +159,12 @@ linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S
linux.init.i386: $(srcdir)/grub-core/tests/boot/linux.init-i386.S linux.init.i386: $(srcdir)/grub-core/tests/boot/linux.init-i386.S
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.mips: $(srcdir)/grub-core/tests/boot/linux.init-mips.S
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.mipsel: $(srcdir)/grub-core/tests/boot/linux.init-mips.S
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
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
@ -208,6 +207,12 @@ knetbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S
kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S
$(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux-initramfs.mips: linux.init.mips 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.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
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
@ -244,98 +249,110 @@ kfreebsd-mfsroot.i386.gz: kfreebsd-mfsroot.i386.img
gzip < $< > $@ gzip < $< > $@
bootcheck-kfreebsd-i386: kfreebsd-mfsroot.i386.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.i386 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell bootcheck-kfreebsd-i386: kfreebsd-mfsroot.i386.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.i386 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
kfreebsd-mfsroot.x86_64.gz: kfreebsd-mfsroot.x86_64.img kfreebsd-mfsroot.x86_64.gz: kfreebsd-mfsroot.x86_64.img
gzip < $< > $@ gzip < $< > $@
bootcheck-kfreebsd-x86_64: kfreebsd-mfsroot.x86_64.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell bootcheck-kfreebsd-x86_64: kfreebsd-mfsroot.x86_64.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img
gzip < $< > $@ gzip < $< > $@
bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img
gzip < $< > $@ gzip < $< > $@
bootcheck-knetbsd-x86_64: knetbsd.miniroot-image.x86_64.gz $(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell bootcheck-knetbsd-x86_64: knetbsd.miniroot-image.x86_64.gz $(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-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-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --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-opts="$(GRUB_QEMU_OPTS)" --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
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --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
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-opts="$(GRUB_QEMU_OPTS)" --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
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-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --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-opts="$(GRUB_QEMU_OPTS)" --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
bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-multiboot: multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg grub-shell bootcheck-multiboot: multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-multiboot2: multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg grub-shell bootcheck-multiboot2: multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg grub-shell bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg grub-shell bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
BOOTCHECKS= if COND_i386_efi
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
endif
if COND_x86_64_efi
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
endif
if COND_i386_multiboot
# Freebsd crashes because memory at 0-0x1000 is occupied and requires ACPI
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
endif
if COND_i386_coreboot
# 64-bit NetBSD crashes because memory at 0-0x1000 is occupied
# Freebsd crashes because memory at 0-0x1000 is occupied and requires ACPI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64
endif
if COND_i386_qemu
# Freebsd crashes because memory at 0-0x1000 is occupied and requires ACPI
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
endif
if COND_i386_pc if COND_i386_pc
#pc chainloader by definition is only for i386-pc #pc chainloader by definition is only for i386-pc
BOOTCHECKS += bootcheck-pc-chainloader
#ntldr and bootmgr require BIOS. #ntldr and bootmgr require BIOS.
BOOTCHECKS += bootcheck-ntldr
#legacy protocol makes early BIOS calls. #legacy protocol makes early BIOS calls.
BOOTCHECKS += bootcheck-linux16-i386 bootcheck-linux16-x86_64 # NetBSD crashes early on non-BIOS
# Crashes early on non-BIOS 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-knetbsd-i386
endif endif
if !COND_i386_coreboot if COND_mipsel
# Crashes because memory at 0-0x1000 is occupied BOOTCHECKS = bootcheck-linux-mipsel
BOOTCHECKS += bootcheck-knetbsd-x86_64
# Likewise and require ACPI.
if !COND_i386_multiboot
if !COND_i386_qemu
BOOTCHECKS += bootcheck-kfreebsd-x86_64
BOOTCHECKS += bootcheck-kfreebsd-i386
endif endif
if COND_mipseb
BOOTCHECKS = bootcheck-linux-mips
endif endif
endif
BOOTCHECKS += bootcheck-kfreebsd-aout
#BOOTCHECKS += bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64
BOOTCHECKS += bootcheck-multiboot bootcheck-multiboot2
BOOTCHECKS += bootcheck-linux-i386 bootcheck-linux-x86_64
EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg
.PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \ .PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \
bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \ bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \
bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \
bootcheck-linux-mips
# Randomly generated # Randomly generated
SUCCESSFUL_BOOT_STRING=3e49994fd5d82b7c9298d672d774080d SUCCESSFUL_BOOT_STRING=3e49994fd5d82b7c9298d672d774080d

View file

@ -1113,6 +1113,8 @@ 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_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_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]) AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])

View file

@ -0,0 +1,58 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 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/>.
*/
#define SYSCALL_WRITE 4004
#define SYSCALL_RESET 4088
#define SYSCALL_EXIT 4001
#define STDOUT 1
#define SHUTDOWN_MAGIC1 0xfee1dead
#define SHUTDOWN_MAGIC2 0x28121969
#define SHUTDOWN_MAGIC3 0x4321fedc
.text
.global start, _start, __start
__start:
_start:
start:
/* write. */
li $v0, SYSCALL_WRITE
li $a0, STDOUT
lui $a1, %hi(message)
addiu $a1, %lo(message)
lui $a2, %hi(messageend)
addiu $a2, %lo(messageend)
subu $a2, $a2, $a1
syscall
/* shutdown. */
li $v0, SYSCALL_RESET
li $a0, SHUTDOWN_MAGIC1
li $a1, SHUTDOWN_MAGIC2
li $a2, SHUTDOWN_MAGIC3
syscall
/* exit(1). Shouldn't be reached. */
li $v0, SYSCALL_EXIT
li $a0, 1
syscall
.data
message:
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
messageend:

View file

@ -19,6 +19,8 @@ set -e
parted=parted parted=parted
grubshell=@builddir@/grub-shell grubshell=@builddir@/grub-shell
. "@builddir@/grub-core/modinfo.sh"
create_disk_image () { create_disk_image () {
name="$1" name="$1"
size=$2 size=$2
@ -30,10 +32,10 @@ check_output () {
outfile=$1 outfile=$1
shift shift
for disk in $@; do for dsk in $@; do
if ! grep "($disk)" ${outfile} >/dev/null if ! grep "($dsk)" "${outfile}" >/dev/null
then then
echo "($disk): disk/partiton not found" echo "($dsk): disk/partiton not found"
exit 1 exit 1
fi fi
done done
@ -42,19 +44,27 @@ check_output () {
list_parts () { list_parts () {
mod=$1; mod=$1;
shift; shift;
imgfile=$1 imgfile="$1"
shift shift
outfile=$1 outfile="$1"
shift shift
echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" \ echo ls | "${grubshell}" --qemu-opts="-hda ${imgfile}" \
--modules=$mod | tr -d "\n\r" > ${outfile} --modules=$mod | tr -d "\n\r" > "${outfile}"
cat ${outfile} cat "${outfile}"
echo echo
} }
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 mips-qemu_mips | mipsel-qemu_mips | i386-qemu | i386-multiboot | i386-coreboot)
disk=ata0
;;
*)
disk=hd0
;;
esac
imgfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
# #
# MSDOS partition types # MSDOS partition types
@ -63,64 +73,64 @@ outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
echo "Checking MSDOS partition types..." echo "Checking MSDOS partition types..."
# 0 primary # 0 primary
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel msdos ${parted} -a none -s "${imgfile}" mklabel msdos
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 check_output "${outfile}" $disk
# 1 primary # 1 primary
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 check_output "${outfile}" $disk $disk,msdos1
# 2 primary # 2 primary
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos2 check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2
# 3 primary # 3 primary
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos2 hd0,msdos3 check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3
# 4 primary # 4 primary
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart primary 20M 30M mkpart primary 30M 40M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos2 hd0,msdos3 hd0,msdos4 check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3 $disk,msdos4
# 1 primary, 1 extended # 1 primary, 1 extended
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100%
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 check_output "${outfile}" $disk $disk,msdos1
# 1 primary, 1 extended, 1 logical # 1 primary, 1 extended, 1 logical
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5
# 1 primary, 1 extended, 2 logical # 1 primary, 1 extended, 2 logical
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6
# 1 primary, 1 extended, 3 logical # 1 primary, 1 extended, 3 logical
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7 check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6 $disk,msdos7
# 1 primary, 1 extended, 4 logical # 1 primary, 1 extended, 4 logical
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M mkpart logical 50M 60M ${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M mkpart extended 20M 100% mkpart logical 20M 30M mkpart logical 30M 40M mkpart logical 40M 50M mkpart logical 50M 60M
list_parts part_msdos ${imgfile} ${outfile} list_parts part_msdos "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7 hd0,msdos8 check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6 $disk,msdos7 $disk,msdos8
# #
@ -130,46 +140,46 @@ check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7 hd0,msdo
echo "Checking GPT partition types..." echo "Checking GPT partition types..."
# 0 parts # 0 parts
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel gpt ${parted} -a none -s "${imgfile}" mklabel gpt
list_parts part_gpt ${imgfile} ${outfile} list_parts part_gpt "${imgfile}" "${outfile}"
check_output ${outfile} hd0 check_output "${outfile}" $disk
# 1 parts # 1 parts
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M
list_parts part_gpt ${imgfile} ${outfile} list_parts part_gpt "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,gpt1 check_output "${outfile}" $disk $disk,gpt1
# 2 parts # 2 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M
list_parts part_gpt ${imgfile} ${outfile} list_parts part_gpt "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2
# 3 parts # 3 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M
list_parts part_gpt ${imgfile} ${outfile} list_parts part_gpt "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3
# 4 parts # 4 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 4 20M 30M mkpart 5 30M 40M ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 4 20M 30M mkpart 5 30M 40M
list_parts part_gpt ${imgfile} ${outfile} list_parts part_gpt "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4
# 5 parts # 5 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M
list_parts part_gpt ${imgfile} ${outfile} list_parts part_gpt "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5 check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4 $disk,gpt5
# 6 parts # 6 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M mkpart 6 50M 60M ${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M mkpart 3 20M 30M mkpart 4 30M 40M mkpart 5 40M 50M mkpart 6 50M 60M
list_parts part_gpt ${imgfile} ${outfile} list_parts part_gpt "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5 hd0,gpt6 check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4 $disk,gpt5 $disk,gpt6
# #
@ -181,46 +191,46 @@ check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5 hd0,gpt
echo "Checking SUN partition types..." echo "Checking SUN partition types..."
# 0 parts # 0 parts
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel sun ${parted} -a none -s "${imgfile}" mklabel sun
list_parts part_sun ${imgfile} ${outfile} list_parts part_sun "${imgfile}" "${outfile}"
check_output ${outfile} hd0 check_output "${outfile}" $disk
# 1 parts # 1 parts
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M
list_parts part_sun ${imgfile} ${outfile} list_parts part_sun "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,sun1 check_output "${outfile}" $disk $disk,sun1
# 2 parts # 2 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M
list_parts part_sun ${imgfile} ${outfile} list_parts part_sun "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 check_output "${outfile}" $disk $disk,sun1 $disk,sun2
# 3 parts # 3 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M
list_parts part_sun ${imgfile} ${outfile} list_parts part_sun "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4
# 4 parts # 4 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M
list_parts part_sun ${imgfile} ${outfile} list_parts part_sun "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5
# 5 parts # 5 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M
list_parts part_sun ${imgfile} ${outfile} list_parts part_sun "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6 check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6
# 6 parts # 6 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M mkpart 50M 60M ${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M mkpart 30M 40M mkpart 40M 50M mkpart 50M 60M
list_parts part_sun ${imgfile} ${outfile} list_parts part_sun "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6 hd0,sun7 check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6 $disk,sun7
# #
@ -234,43 +244,43 @@ check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6 hd0,sun
echo "Checking APPLE partition types..." echo "Checking APPLE partition types..."
# 0 parts # 0 parts
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel mac ${parted} -a none -s "${imgfile}" mklabel mac
list_parts part_apple ${imgfile} ${outfile} list_parts part_apple "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 check_output "${outfile}" $disk $disk,apple1 $disk,apple2
# 1 parts # 1 parts
create_disk_image ${imgfile} 64 create_disk_image "${imgfile}" 64
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M
list_parts part_apple ${imgfile} ${outfile} list_parts part_apple "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple3 check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3
# 2 parts # 2 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M
list_parts part_apple ${imgfile} ${outfile} list_parts part_apple "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple3 hd0,apple4 check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3 $disk,apple4
# 3 parts # 3 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M
list_parts part_apple ${imgfile} ${outfile} list_parts part_apple "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5
# 4 parts # 4 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M
list_parts part_apple ${imgfile} ${outfile} list_parts part_apple "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6 check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6
# 5 parts # 5 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M
list_parts part_apple ${imgfile} ${outfile} list_parts part_apple "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6 hd0,apple7 check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7
# 6 parts # 6 parts
create_disk_image ${imgfile} 128 create_disk_image "${imgfile}" 128
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M mkpart f 50M 60M ${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M mkpart c 20M 30M mkpart d 30M 40M mkpart e 40M 50M mkpart f 50M 60M
list_parts part_apple ${imgfile} ${outfile} list_parts part_apple "${imgfile}" "${outfile}"
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6 hd0,apple7 hd0,apple8 check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7 $disk,apple8

View file

@ -54,8 +54,59 @@ Report bugs to <bug-grub@gnu.org>.
EOF EOF
} }
boot=hd . "${builddir}/grub-core/modinfo.sh"
qemu=qemu-system-i386 qemuopts=
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
mips-qemu_mips)
boot=mips_qemu
qemu=qemu-system-mips
qemuopts="-M mips"
console=vga_text
;;
mipsel-qemu_mips)
boot=mipsel_qemu
qemu=qemu-system-mipsel
qemuopts="-M mips"
console=vga_text
;;
i386-coreboot)
boot=coreboot
qemu=qemu-system-i386
console=vga_text
;;
i386-multiboot)
boot=cd
qemu=qemu-system-i386
console=vga_text;;
i386-ieee1275)
boot=cd
qemu=qemu-system-i386
console=console;;
i386-qemu)
boot=qemu
qemu=qemu-system-i386
console=vga_text;;
i386-pc)
boot=cd
qemu=qemu-system-i386
console=console;;
i386-efi)
qemu=qemu-system-i386
boot=cd
console=console;;
x86_64-efi)
qemu=qemu-system-x86_64
boot=cd
console=console;;
*)
boot=hd
qemu=qemu-system-i386
console=console;;
esac
# Check the arguments. # Check the arguments.
for option in "$@"; do for option in "$@"; do
@ -85,6 +136,8 @@ for option in "$@"; do
elif [ "$dev" = "net" ] ; then boot=net; elif [ "$dev" = "net" ] ; then boot=net;
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" = "mipsel_qemu" ] ; then boot=mips_qemu;
else else
echo "Unrecognized boot method \`$dev'" 1>&2 echo "Unrecognized boot method \`$dev'" 1>&2
usage usage
@ -132,7 +185,7 @@ 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 terminal_output $console
halt halt
EOF EOF
@ -161,6 +214,16 @@ if [ x$boot = xqemu ]; then
device=cdrom device=cdrom
fi fi
if [ x$boot = xmipsel_qemu ]; then
bootdev="-kernel ${rom_directory}/mipsel-qemu_mips.elf"
device=cdrom
fi
if [ x$boot = xmips_qemu ]; then
bootdev="-kernel ${rom_directory}/mips-qemu_mips.elf"
device=cdrom
fi
if [ x$boot = xcoreboot ]; then if [ x$boot = xcoreboot ]; then
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
cp "${GRUB_COREBOOT_ROM}" "${imgfile}" cp "${GRUB_COREBOOT_ROM}" "${imgfile}"
@ -174,7 +237,6 @@ if [ x$boot = xnet ]; then
pkgdatadir="@builddir@" sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" pkgdatadir="@builddir@" sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir"
cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" cp "${cfgfile}" "$netdir/boot/grub/grub.cfg"
cp "${source}" "$netdir/boot/grub/testcase.cfg" cp "${source}" "$netdir/boot/grub/testcase.cfg"
. "${builddir}/grub-core/modinfo.sh"
"${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.0" -net nic | cat | tr -d "\r" "${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.0" -net nic | cat | tr -d "\r"
else else
"${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r" "${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r"