Infinite loop, rm .elf output
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
*.bin
|
||||
*.efi
|
||||
*.elf
|
||||
*.img
|
||||
*.iso
|
||||
*.o
|
||||
|
||||
@@ -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
11
infinite_loop.S
Normal 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
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
3
multiboot/hello-world/isodir/boot/grub/grub.cfg
Normal file
3
multiboot/hello-world/isodir/boot/grub/grub.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
menuentry "main" {
|
||||
multiboot /boot/main.bin
|
||||
}
|
||||
Binary file not shown.
4
template.S
Normal file
4
template.S
Normal file
@@ -0,0 +1,4 @@
|
||||
#include "common.h"
|
||||
BEGIN
|
||||
hlt
|
||||
END
|
||||
Reference in New Issue
Block a user