Infinite loop, rm .elf output

This commit is contained in:
Ciro Santilli
2015-09-12 11:37:30 +02:00
parent 82bd584e71
commit bf4556b972
8 changed files with 28 additions and 5 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
*.bin
*.efi
*.elf
*.img
*.iso
*.o

View File

@@ -1,5 +1,8 @@
# Print a single `@` character with the BIOS.
# More minimal than the hello world.
/*
Print a single `@` character with the BIOS.
More minimal than the hello world.
*/
#include "common.h"
BEGIN
mov $0x40, %al

11
infinite_loop.S Normal file
View File

@@ -0,0 +1,11 @@
/*
This is a common alternative to `hlt`.
It likely wastes more energy? But is less prone to being interrupted than `hlt`.
*/
#include "common.h"
BEGIN
loop:
jmp loop
END

View File

@@ -25,4 +25,4 @@ GRUB leaves the application into a well defined starting state.
It seems that Linux does not implement Multiboot natively, but GRUB supports it as an exception: <http://stackoverflow.com/questions/17909429/booting-a-non-multiboot-kernel-with-grub2>
Use `grub-mkrescue` to make a multiboot file into a bootable disk.
Use `grub-mkrescue` and `grub-mkdisk` to make a multiboot file into a bootable ISO or disk.

View File

@@ -1,11 +1,12 @@
# main.elf is the main output: the multiboot file.
main.elf: entry.o main.o
ld -m elf_i386 -nostdlib -T linker.ld -o '$@' $^
entry.o: entry.asm
nasm -f elf '$<' -o '$@'
nasm -f elf32 '$<' -o '$@'
main.o: main.c
gcc -c -m32 -std=c99 -ffreestanding -fno-builtin -Os -Wall -Wextra -o '$@' '$<'
gcc -c -m32 -std=c99 -ffreestanding -fno-builtin -Os -o '$@' -Wall -Wextra '$<'
clean:
rm -f *.elf *.o

View File

@@ -0,0 +1,3 @@
menuentry "main" {
multiboot /boot/main.bin
}

Binary file not shown.

4
template.S Normal file
View File

@@ -0,0 +1,4 @@
#include "common.h"
BEGIN
hlt
END