From 6becd918de4c0253e9446262277a9817d1189603 Mon Sep 17 00:00:00 2001 From: Aaron Klingaman Date: Tue, 15 Mar 2005 21:57:06 +0000 Subject: [PATCH] a simple boot loader that will be copied to all disks that outputs a message telling the user that the machine requires a boot cd --- dummy_bootloader/Makefile | 17 +++++++++++ dummy_bootloader/dummy_bootloader.S | 44 +++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 dummy_bootloader/Makefile create mode 100644 dummy_bootloader/dummy_bootloader.S diff --git a/dummy_bootloader/Makefile b/dummy_bootloader/Makefile new file mode 100644 index 0000000..6268133 --- /dev/null +++ b/dummy_bootloader/Makefile @@ -0,0 +1,17 @@ +all: dummy_bootloader + +dummy_bootloader: dummy_bootloader.S + nasm $< -o $@ + +testbootdisk: dummy_bootloader + $(shell dd if=/dev/zero of=testbootdisk bs=512 count=2880) + +run: testbootdisk + $(shell dd if=dummy_bootloader of=testbootdisk conv=notrunc) + $(shell qemu -fda testbootdisk -boot a) + +clean: + rm -f dummy_bootloader + rm -f testbootdisk + +.phony: all run clean diff --git a/dummy_bootloader/dummy_bootloader.S b/dummy_bootloader/dummy_bootloader.S new file mode 100644 index 0000000..c8f1512 --- /dev/null +++ b/dummy_bootloader/dummy_bootloader.S @@ -0,0 +1,44 @@ +SCREEN_COLS equ 80 +SCREEN_ROWS equ 25 +STACK_SEGMENT equ 09000h ; top of memory +STACK_SIZE equ 00fffh ; 4K - 1 bytes of stack + +TEXT_COLOR equ 0x07 ; white on black + + jmp 07c0h:start + +message db "PlanetLab nodes require a boot cd at all times to function.",0 + +start: + mov ax, cs + mov ds, ax + mov es, ax + + mov sp, STACK_SEGMENT ; setup stack (not really used) + mov ss, sp + mov sp, STACK_SIZE + + ;; clear out the screen, using the scroll down bios int. + mov ah, 0x07 ; for int 0x10, 0x07 is scroll down window + mov al, 0 ; entire window + mov cx, 0 ; upper left corner = (0,0) + mov dh, SCREEN_ROWS ; row of bottom + mov dl, SCREEN_COLS ; column of right + mov bh, 7 + int 10h + + mov si, message + +strout: lodsb + cmp al, 0 + je done + mov ah, 0x0E ; for int 0x10, 0xOE is char out + mov bx, TEXT_COLOR + int 0x10 + jmp strout + +done: + jmp done + + times 510 - ($ - $$) db 0 ; last two bytes are magic for x86 boot sectors + dw 0aa55h -- 2.43.0