bootable with small multiboot kernel
git-svn-id: svn://anubis/hos/trunk@5 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
parent
bdf4ce8ae8
commit
8f00324b30
9
Makefile
9
Makefile
@ -2,8 +2,9 @@
|
||||
HOS = hos
|
||||
MKISOFS = genisoimage
|
||||
ISO = $(HOS).iso
|
||||
QEMU = qemu-system-x86_64
|
||||
|
||||
.PHONY: kernel iso clean
|
||||
.PHONY: kernel iso clean qemu
|
||||
|
||||
# default target: build the kernel and ISO image
|
||||
all: kernel iso
|
||||
@ -14,9 +15,13 @@ kernel:
|
||||
|
||||
# build the ISO image
|
||||
iso: kernel
|
||||
cp kernel/$(HOS) iso/boot
|
||||
$(MKISOFS) -R -b boot/grub/stage2_eltorito -no-emul-boot \
|
||||
-boot-load-size 4 -boot-info-table -o $(ISO) iso
|
||||
|
||||
clean:
|
||||
make -C kernel clean
|
||||
-rm -f $(ISO)
|
||||
-rm -f $(ISO) iso/boot/$(HOS)
|
||||
|
||||
qemu:
|
||||
$(QEMU) -cdrom $(ISO) -boot d -m 384 -localtime
|
||||
|
6
iso/boot/grub/menu.lst
Normal file
6
iso/boot/grub/menu.lst
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
timeout 10
|
||||
default 0
|
||||
|
||||
title HOS
|
||||
kernel /boot/hos
|
@ -1,8 +1,12 @@
|
||||
|
||||
KERNEL = hos
|
||||
TARGET = elf32-i386
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
all:
|
||||
@echo Nothing yet
|
||||
nasm -f elf -o boot.o boot.asm
|
||||
ld --oformat $(TARGET) -o $(KERNEL) boot.o
|
||||
|
||||
clean:
|
||||
@echo Nothing yet
|
||||
-rm -f *~ $(KERNEL) *.o
|
||||
|
27
kernel/boot.asm
Normal file
27
kernel/boot.asm
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
%define MULTIBOOT_HEADER_MAGIC 0x1BADB002
|
||||
%define MULTIBOOT_HEADER_FLAGS 0x3
|
||||
|
||||
[global start]
|
||||
[global _start]
|
||||
start:
|
||||
_start:
|
||||
jmp multiboot_entry
|
||||
align 4
|
||||
|
||||
multiboot_header:
|
||||
; magic
|
||||
dd MULTIBOOT_HEADER_MAGIC
|
||||
; flags
|
||||
dd MULTIBOOT_HEADER_FLAGS
|
||||
; checksum
|
||||
dd -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
|
||||
|
||||
multiboot_entry:
|
||||
mov byte [0xB8000+160*10+2*2], 'J'
|
||||
mov byte [0xB8001+160*10+2*2+1], 0x07
|
||||
|
||||
looplbl:
|
||||
hlt
|
||||
jmp looplbl
|
||||
|
Loading…
x
Reference in New Issue
Block a user