diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile | 30 | ||||
| -rw-r--r-- | src/boot/boot.S | 27 | ||||
| -rwxr-xr-x | src/bringelle | bin | 0 -> 4204 bytes | |||
| -rw-r--r-- | src/bringelle.c | 11 | ||||
| -rw-r--r-- | src/utils/print.c | 7 | ||||
| -rw-r--r-- | src/utils/print.h | 7 |
6 files changed, 82 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..0dee4ff --- /dev/null +++ b/src/Makefile @@ -0,0 +1,30 @@ +EXEC := bringelle +CC := gcc -c -m32 -fno-pie -fno-builtin + +UTILS_SRC := $(wildcard utils/*.c) + +all: $(EXEC) + +$(EXEC): boot.o utils.o bringelle.o + for obj in $^ ;\ + do \ + objcopy --remove-section .note.gnu.property $${obj} ; \ + done + ld -Ttext=0x00100000 -melf_i386 -nostdlib --oformat=binary -o bringelle $^ + +bringelle.o: bringelle.c + $(CC) $^ + +utils.o: $(UTILS_SRC) + $(CC) $^ -o $@ + +boot.o: ./boot/boot.S + as --32 -o $@ $^ -mx86-used-note=no + +clean: + - rm $(EXEC) + - rm ./*.o + +.PHONY: clean + + diff --git a/src/boot/boot.S b/src/boot/boot.S new file mode 100644 index 0000000..746f858 --- /dev/null +++ b/src/boot/boot.S @@ -0,0 +1,27 @@ +.extern bringelle +.globl _start +.text + +.set MB_MAGIC, 0x1BADB002 +.set MB_FLAGS, 0x00010000 +.set MB_CHECKSUM, -(MB_MAGIC+MB_FLAGS) +.set MB_HEADER_ADDR, mb_header +.set MB_LOAD_ADDR, mb_header +.set MB_LOAD_END_ADDR, 0x0 +.set MB_BSS_END_ADDR, 0x0 +.set MB_ENTRY_ADDR, _start + +mb_header: +.align 4 +.long MB_MAGIC +.long MB_FLAGS +.long MB_CHECKSUM +.long MB_HEADER_ADDR +.long MB_LOAD_ADDR +.long MB_LOAD_END_ADDR +.long MB_BSS_END_ADDR +.long MB_ENTRY_ADDR + +_start: + call bringelle + diff --git a/src/bringelle b/src/bringelle Binary files differnew file mode 100755 index 0000000..73de16f --- /dev/null +++ b/src/bringelle diff --git a/src/bringelle.c b/src/bringelle.c new file mode 100644 index 0000000..4c8e39f --- /dev/null +++ b/src/bringelle.c @@ -0,0 +1,11 @@ +#include "utils/print.h" + + + + +void bringelle(){ + putchar('L'); + putchar('L'); + + while(1); +} diff --git a/src/utils/print.c b/src/utils/print.c new file mode 100644 index 0000000..c7c94d4 --- /dev/null +++ b/src/utils/print.c @@ -0,0 +1,7 @@ +#include "print.h" + + +void putchar(char c){ + char *video=(char *)0xB8000; + video[0]=c; +} diff --git a/src/utils/print.h b/src/utils/print.h new file mode 100644 index 0000000..51ed076 --- /dev/null +++ b/src/utils/print.h @@ -0,0 +1,7 @@ +#ifndef PRINT_H +#define PRINT_H + + +void putchar(char); + +#endif |
