Create repository
This commit is contained in:
commit
2a99c6259d
11 changed files with 191 additions and 0 deletions
30
src/Makefile
Normal file
30
src/Makefile
Normal file
|
@ -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
|
||||
|
||||
|
27
src/boot/boot.S
Normal file
27
src/boot/boot.S
Normal file
|
@ -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
|
||||
|
BIN
src/bringelle
Executable file
BIN
src/bringelle
Executable file
Binary file not shown.
11
src/bringelle.c
Normal file
11
src/bringelle.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "utils/print.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void bringelle(){
|
||||
putchar('L');
|
||||
putchar('L');
|
||||
|
||||
while(1);
|
||||
}
|
7
src/utils/print.c
Normal file
7
src/utils/print.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "print.h"
|
||||
|
||||
|
||||
void putchar(char c){
|
||||
char *video=(char *)0xB8000;
|
||||
video[0]=c;
|
||||
}
|
7
src/utils/print.h
Normal file
7
src/utils/print.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef PRINT_H
|
||||
#define PRINT_H
|
||||
|
||||
|
||||
void putchar(char);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue