kOpenBSD bootcheck
This commit is contained in:
parent
dcc953eecb
commit
0f6a963e9b
4 changed files with 59 additions and 6 deletions
16
Makefile.am
16
Makefile.am
|
@ -144,8 +144,11 @@ kfreebsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kfreebsd.init-x86_64.S
|
|||
kfreebsd.init.i386: $(srcdir)/grub-core/tests/boot/kfreebsd.init-i386.S
|
||||
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@
|
||||
|
||||
knetbsd.init.i386: $(srcdir)/grub-core/tests/boot/knetbsd.init-i386.S
|
||||
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
knetbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S
|
||||
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DTARGET_NETBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
kopenbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S
|
||||
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DTARGET_OPENBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
knetbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/knetbsd.init-x86_64.S
|
||||
$(TARGET_CC) -o $@ $< -m64 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
@ -162,8 +165,8 @@ kfreebsd-mfsroot.i386.img: kfreebsd.init.i386 Makefile
|
|||
knetbsd.image.i386: knetbsd.init.i386 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt
|
||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
|
||||
kopenbsd.image.i386: kopenbsd.init.i386
|
||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||
kopenbsd.image.i386: kopenbsd.init.i386 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt
|
||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
|
||||
|
||||
knetbsd.miniroot-image.i386.img: knetbsd.image.i386 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386
|
||||
$(OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386 $@
|
||||
|
@ -195,7 +198,10 @@ knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img
|
|||
gzip < $< > $@
|
||||
|
||||
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=qemu-system-i386 --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)" --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
|
||||
|
||||
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
|
||||
|
||||
knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img
|
||||
gzip < $< > $@
|
||||
|
|
|
@ -16,18 +16,29 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef TARGET_NETBSD
|
||||
#define SYSCALL_RESET 208
|
||||
#elif defined (TARGET_OPENBSD)
|
||||
#define SYSCALL_RESET 55
|
||||
#else
|
||||
#error unknown target
|
||||
#endif
|
||||
|
||||
#define MODE_RDRW 2
|
||||
#define FLAGS_NONE 0
|
||||
#define SYSCALL_OPEN 5
|
||||
#define SYSCALL_WRITE 4
|
||||
#define SYSCALL_RESET 208
|
||||
#define SYSCALL_EXIT 1
|
||||
#define SYSCALL_ARCH 165
|
||||
#define SYSCALL_INT 0x80
|
||||
#define SYSCALL_ARCH_IOPL 2
|
||||
|
||||
#define RESET_NOSYNC 0x4
|
||||
#define RESET_HALT 0x8
|
||||
#define RESET_POWEROFF 0x800
|
||||
|
||||
#define SHUTDOWN_PORT 0x8900
|
||||
|
||||
.section ".init", "ax"
|
||||
.global start,_start
|
||||
start:
|
||||
|
@ -53,6 +64,32 @@ _start:
|
|||
int $SYSCALL_INT
|
||||
addl $16, %esp
|
||||
|
||||
/* IOPL. */
|
||||
movl $SYSCALL_ARCH, %eax
|
||||
pushl $iopl_arg
|
||||
pushl $SYSCALL_ARCH_IOPL
|
||||
pushl $0
|
||||
int $SYSCALL_INT
|
||||
addl $12, %esp
|
||||
|
||||
movw $SHUTDOWN_PORT, %dx
|
||||
movb $'S', %al
|
||||
outb %al, %dx
|
||||
movb $'h', %al
|
||||
outb %al, %dx
|
||||
movb $'u', %al
|
||||
outb %al, %dx
|
||||
movb $'t', %al
|
||||
outb %al, %dx
|
||||
movb $'d', %al
|
||||
outb %al, %dx
|
||||
movb $'o', %al
|
||||
outb %al, %dx
|
||||
movb $'w', %al
|
||||
outb %al, %dx
|
||||
movb $'n', %al
|
||||
outb %al, %dx
|
||||
|
||||
/* shutdown. */
|
||||
movl $SYSCALL_RESET, %eax
|
||||
pushl $0
|
||||
|
@ -84,3 +121,5 @@ device:
|
|||
message:
|
||||
.ascii "Boot Test Passed Successfully\n" SUCCESSFUL_BOOT_STRING "\n"
|
||||
messageend:
|
||||
iopl_arg:
|
||||
.long 3
|
5
grub-core/tests/boot/kopenbsd.cfg
Normal file
5
grub-core/tests/boot/kopenbsd.cfg
Normal file
|
@ -0,0 +1,5 @@
|
|||
kopenbsd /kopenbsd -h
|
||||
kopenbsd_ramdisk /ramdisk
|
||||
boot
|
||||
# Shouln't happen
|
||||
halt
|
3
grub-core/tests/boot/kopenbsdlabel.txt
Normal file
3
grub-core/tests/boot/kopenbsdlabel.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
# size offset fstype [fsize bsize bps/cpg]
|
||||
a: 256 0 4.2BSD 0 0 1
|
||||
c: 256 0 unused 0 0 # "raw" part, don't edit
|
Loading…
Reference in a new issue