Merge branch 'public'
This commit is contained in:
commit
703ddafc34
17
.github/workflows/build.yml
vendored
Normal file
17
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: build disk image
|
||||
run: make image.bin
|
||||
20
Makefile
20
Makefile
@ -10,6 +10,16 @@ endif
|
||||
CFLAGS = -fno-pic -ffreestanding -static -fno-builtin -fno-strict-aliasing \
|
||||
-Wall -ggdb -m32 -Werror -fno-omit-frame-pointer
|
||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||
ASMFLAGS = -m32 -ffreestanding -c -g
|
||||
|
||||
ifeq ($(LLVM),on)
|
||||
#AS=llvm-as
|
||||
LD=ld.lld
|
||||
CC=clang
|
||||
CFLAGS += -target elf-i386
|
||||
ASMFLAGS = -target elf-i386 -ffreestanding -c -g
|
||||
LDKERNELFLAGS = --script=script.ld
|
||||
endif
|
||||
|
||||
run: image.bin
|
||||
qemu-system-i386 -drive format=raw,file=$< -serial mon:stdio
|
||||
@ -33,6 +43,12 @@ debug-boot: image.bin mbr.elf
|
||||
-ex "break *0x7c00" \
|
||||
-ex "continue"
|
||||
|
||||
debug-server: image.bin
|
||||
qemu-system-i386 -drive format=raw,file=$< -s -S
|
||||
|
||||
debug-server-nox: image.bin
|
||||
qemu-system-i386 -nographic -drive format=raw,file=$< -s -S
|
||||
|
||||
debug: image.bin
|
||||
qemu-system-i386 -drive format=raw,file=$< -s -S &
|
||||
$(GDB) kernel.bin \
|
||||
@ -61,13 +77,13 @@ image.bin: mbr.bin fs.img
|
||||
kernel.bin: kernel.o console.o drivers/vga.o drivers/keyboard.o \
|
||||
drivers/ata.o cpu/vectors.o cpu/idt.o cpu/gdt.o drivers/uart.o \
|
||||
fs/fs.o lib/mem.o lib/string.o proc.o cpu/swtch.o
|
||||
$(LD) $(LDFLAGS) -o $@ -Ttext 0x1000 $^
|
||||
$(LD) $(LDFLAGS) $(LDKERNELFLAGS) -o $@ -Ttext 0x1000 $^
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.S
|
||||
$(CC) -m32 -ffreestanding -c -g $^ -o $@
|
||||
$(CC) $(ASMFLAGS) $^ -o $@
|
||||
|
||||
mbr.bin: mbr.o
|
||||
$(LD) -m elf_i386 -Ttext=0x7c00 --oformat=binary $^ -o $@
|
||||
|
||||
19
README.md
19
README.md
@ -1,12 +1,25 @@
|
||||
Yet Another BootLoader, OS Kernel and Other stuff
|
||||
# Yet Another BootLoader, OS Kernel and Other stuff
|
||||
|
||||
Quickstart:
|
||||
## Quickstart:
|
||||
```
|
||||
$ ./setup.sh
|
||||
$ make
|
||||
```
|
||||
## How to run using llvm
|
||||
|
||||
Includes code from:
|
||||
You can use this way even if you have windows. You need to install llvm and qemu.
|
||||
Check that executables `clang`, `ld.lld`, `qemu-system-i386` available from your terminal/console.
|
||||
|
||||
```
|
||||
make LLVM=on
|
||||
```
|
||||
|
||||
## How to debug in my favorite IDE
|
||||
|
||||
Start debug server using command `make debug-server` or `make debug-server-nox` if you don't want to see gui, and
|
||||
then connect using remote gdb option to localhost:1234 (symbols file is kernel.bin)
|
||||
|
||||
## Includes code from:
|
||||
* https://github.com/mit-pdos/xv6-public
|
||||
* https://github.com/FRosner/FrOS
|
||||
* https://github.com/dhavalhirdhav/LearnOS
|
||||
|
||||
25
script.ld
Normal file
25
script.ld
Normal file
@ -0,0 +1,25 @@
|
||||
SECTIONS
|
||||
{
|
||||
.text (0x1000) : {
|
||||
*( .text )
|
||||
}
|
||||
|
||||
.rodata : {
|
||||
_RODATA_START_ = .;
|
||||
*(.rodata)
|
||||
_RODATA_START_ = .;
|
||||
}
|
||||
|
||||
.data : ALIGN(CONSTANT(MAXPAGESIZE)) {
|
||||
_DATA_START_ = .;
|
||||
*(.data)
|
||||
_DATA_END_ = .;
|
||||
}
|
||||
|
||||
|
||||
.bss : ALIGN(CONSTANT(MAXPAGESIZE)) {
|
||||
_BSS_START_ = .;
|
||||
*(.bss)
|
||||
_BSS_END_ = .;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user