aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-04-04 11:19:55 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-04-04 11:19:55 +0200
commit2a99c6259d54e6b5278b49ee248ba2ac66a7a56a (patch)
tree3fd96721f2a4a65c2e7893b23e61d1920f72216d /src
Create repository
Diffstat (limited to 'src')
-rw-r--r--src/Makefile30
-rw-r--r--src/boot/boot.S27
-rwxr-xr-xsrc/bringellebin0 -> 4204 bytes
-rw-r--r--src/bringelle.c11
-rw-r--r--src/utils/print.c7
-rw-r--r--src/utils/print.h7
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
new file mode 100755
index 0000000..73de16f
--- /dev/null
+++ b/src/bringelle
Binary files differ
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