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

@ -19,6 +19,8 @@ set -e
parted=parted
grubshell=@builddir@/grub-shell
. "@builddir@/grub-core/modinfo.sh"
create_disk_image () {
name="$1"
size=$2
@ -30,10 +32,10 @@ check_output () {
outfile=$1
shift
for disk in $@; do
if ! grep "($disk)" ${outfile} >/dev/null
for dsk in $@; do
if ! grep "($dsk)" "${outfile}" >/dev/null
then
echo "($disk): disk/partiton not found"
echo "($dsk): disk/partiton not found"
exit 1
fi
done
@ -42,19 +44,27 @@ check_output () {
list_parts () {
mod=$1;
shift;
imgfile=$1
imgfile="$1"
shift
outfile=$1
outfile="$1"
shift
echo ls | ${grubshell} --boot=cd --qemu-opts="-hda ${imgfile}" \
--modules=$mod | tr -d "\n\r" > ${outfile}
cat ${outfile}
echo ls | "${grubshell}" --qemu-opts="-hda ${imgfile}" \
--modules=$mod | tr -d "\n\r" > "${outfile}"
cat "${outfile}"
echo
}
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
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
@ -63,64 +73,64 @@ outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
echo "Checking MSDOS partition types..."
# 0 primary
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel msdos
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel msdos
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk
# 1 primary
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,msdos1
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1
# 2 primary
create_disk_image ${imgfile} 128
${parted} -a none -s ${imgfile} mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos2
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel msdos mkpart primary 0 10M mkpart primary 10M 20M
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2
# 3 primary
create_disk_image ${imgfile} 128
${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}
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos2 hd0,msdos3
create_disk_image "${imgfile}" 128
${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}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3
# 4 primary
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
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos2 hd0,msdos3 hd0,msdos4
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
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos2 $disk,msdos3 $disk,msdos4
# 1 primary, 1 extended
create_disk_image ${imgfile} 128
${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}
check_output ${outfile} hd0 hd0,msdos1
create_disk_image "${imgfile}" 128
${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}"
check_output "${outfile}" $disk $disk,msdos1
# 1 primary, 1 extended, 1 logical
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
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5
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
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5
# 1 primary, 1 extended, 2 logical
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
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6
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
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6
# 1 primary, 1 extended, 3 logical
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
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7
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
list_parts part_msdos "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,msdos1 $disk,msdos5 $disk,msdos6 $disk,msdos7
# 1 primary, 1 extended, 4 logical
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
list_parts part_msdos ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,msdos1 hd0,msdos5 hd0,msdos6 hd0,msdos7 hd0,msdos8
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
list_parts part_msdos "${imgfile}" "${outfile}"
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..."
# 0 parts
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel gpt
list_parts part_gpt ${imgfile} ${outfile}
check_output ${outfile} hd0
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel gpt
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk
# 1 parts
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M
list_parts part_gpt ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,gpt1
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1
# 2 parts
create_disk_image ${imgfile} 128
${parted} -a none -s ${imgfile} mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M
list_parts part_gpt ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel gpt mkpart 1 0 10M mkpart 2 10M 20M
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2
# 3 parts
create_disk_image ${imgfile} 128
${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}
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3
create_disk_image "${imgfile}" 128
${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}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3
# 4 parts
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
list_parts part_gpt ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4
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
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4
# 5 parts
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
list_parts part_gpt ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5
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
list_parts part_gpt "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,gpt1 $disk,gpt2 $disk,gpt3 $disk,gpt4 $disk,gpt5
# 6 parts
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
list_parts part_gpt ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,gpt1 hd0,gpt2 hd0,gpt3 hd0,gpt4 hd0,gpt5 hd0,gpt6
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
list_parts part_gpt "${imgfile}" "${outfile}"
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..."
# 0 parts
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel sun
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel sun
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk
# 1 parts
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,sun1
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1
# 2 parts
create_disk_image ${imgfile} 128
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,sun1 hd0,sun2
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2
# 3 parts
create_disk_image ${imgfile} 128
${parted} -a none -s ${imgfile} mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel sun mkpart 0 10M mkpart 10M 20M mkpart 20M 30M
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4
# 4 parts
create_disk_image ${imgfile} 128
${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}
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5
create_disk_image "${imgfile}" 128
${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}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5
# 5 parts
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
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6
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
list_parts part_sun "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,sun1 $disk,sun2 $disk,sun4 $disk,sun5 $disk,sun6
# 6 parts
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
list_parts part_sun ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,sun1 hd0,sun2 hd0,sun4 hd0,sun5 hd0,sun6 hd0,sun7
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
list_parts part_sun "${imgfile}" "${outfile}"
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..."
# 0 parts
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel mac
list_parts part_apple ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel mac
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2
# 1 parts
create_disk_image ${imgfile} 64
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M
list_parts part_apple ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple3
create_disk_image "${imgfile}" 64
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3
# 2 parts
create_disk_image ${imgfile} 128
${parted} -a none -s ${imgfile} mklabel mac mkpart a 1M 10M mkpart b 10M 20M
list_parts part_apple ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple3 hd0,apple4
create_disk_image "${imgfile}" 128
${parted} -a none -s "${imgfile}" mklabel mac mkpart a 1M 10M mkpart b 10M 20M
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple3 $disk,apple4
# 3 parts
create_disk_image ${imgfile} 128
${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}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5
create_disk_image "${imgfile}" 128
${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}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5
# 4 parts
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
list_parts part_apple ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6
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
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6
# 5 parts
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
list_parts part_apple ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6 hd0,apple7
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
list_parts part_apple "${imgfile}" "${outfile}"
check_output "${outfile}" $disk $disk,apple1 $disk,apple2 $disk,apple4 $disk,apple5 $disk,apple6 $disk,apple7
# 6 parts
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
list_parts part_apple ${imgfile} ${outfile}
check_output ${outfile} hd0 hd0,apple1 hd0,apple2 hd0,apple4 hd0,apple5 hd0,apple6 hd0,apple7 hd0,apple8
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
list_parts part_apple "${imgfile}" "${outfile}"
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
}
boot=hd
qemu=qemu-system-i386
. "${builddir}/grub-core/modinfo.sh"
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.
for option in "$@"; do
@ -85,6 +136,8 @@ for option in "$@"; do
elif [ "$dev" = "net" ] ; then boot=net;
elif [ "$dev" = "qemu" ] ; then boot=qemu;
elif [ "$dev" = "coreboot" ] ; then boot=coreboot;
elif [ "$dev" = "mips_qemu" ] ; then boot=mips_qemu;
elif [ "$dev" = "mipsel_qemu" ] ; then boot=mips_qemu;
else
echo "Unrecognized boot method \`$dev'" 1>&2
usage
@ -132,7 +185,7 @@ done
cat <<EOF >>${cfgfile}
source /boot/grub/testcase.cfg
# Stop serial output to suppress "ACPI shutdown failed" error.
terminal_output console
terminal_output $console
halt
EOF
@ -161,6 +214,16 @@ if [ x$boot = xqemu ]; then
device=cdrom
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
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
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"
cp "${cfgfile}" "$netdir/boot/grub/grub.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"
else
"${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r"