No bootable device
Posted: Sun Jun 10, 2012 11:52 pm
Hello
I have followed the Bare Bones tutorial and thought it would be nice to create a simple bootloader without grub myself. I have looked around various pages on the wiki here and on the net (living in China though you would be suprised to know how many programming related pages 'don't exist').
I have obvioulsy missed something really simple. Could you please let me know where I went wrong?
boot.asm
kernel.c
linker script
Makefile
Thank you very much,
Richard Hughes
I have followed the Bare Bones tutorial and thought it would be nice to create a simple bootloader without grub myself. I have looked around various pages on the wiki here and on the net (living in China though you would be suprised to know how many programming related pages 'don't exist').
I have obvioulsy missed something really simple. Could you please let me know where I went wrong?
boot.asm
Code: Select all
[BITS 16]
global loader
extern kmain
section .text
loader:
cli
mov ax, 0x7C00
mov ds, ax
sti
call kmain
times 510-($-$$) db 0
db 0xAA
db 0x55
Code: Select all
extern void kmain(void)
{
}
Code: Select all
ENTRY (loader)
SECTIONS
{
. = 0x00100000;
.text ALIGN (0x1000) :
{
*(.text)
}
.rodata ALIGN (0x1000) :
{
*(.rodata*)
}
.data ALIGN (0x1000) :
{
*(.data)
}
.bss :
{
sbss = .;
*(COMMON)
*(.bss)
ebss = .;
}
}
Code: Select all
CC =i586-elf-gcc
CFLAGS =-Werror -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
LD =i586-elf-ld
Debug: kernel.img
loader.o: boot.asm
nasm -f elf -o loader.o boot.asm
kernel.o: kernel.c
$(CC) $(CFLAGS) -o kernel.o -c kernel.c
kernel.bin: kernel.o loader.o
$(LD) -T linker.ld -o kernel.bin loader.o kernel.o
kernel.img: kernel.bin
#dd if=/dev/zero of=pad bs=1 count=750
cat kernel.bin > kernel.img
cleanDebug:
rm -f loader.o kernel.o kernel.bin kernel.img
install:
rm -f loader.o kernel.o kernel.bin
Richard Hughes