-
Notifications
You must be signed in to change notification settings - Fork 26
updated make, string and kstring #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
603a3f3
updated make, string and kstring
CodeAnarchist 8a70918
Update kstring.c
CodeAnarchist 5578ed5
Update string.c
CodeAnarchist 4cb9557
Update kstring.c
CodeAnarchist 8211381
implemented linked list, chunked list, ring buffer
CodeAnarchist ad7568c
Merge branch 'hw' into hw
CodeAnarchist 28c285f
Update Makefile
CodeAnarchist ed32ada
Update Makefile
CodeAnarchist 9a229f0
queues and double linkedlist
CodeAnarchist f2c432d
Merge branch 'hw' into hw
CodeAnarchist 582a73e
Update kconsole.cpp
CodeAnarchist b9aa116
Update kconsole.cpp
CodeAnarchist c7a2896
Update kconsole.h
CodeAnarchist 2673f8e
Update kconsole.hpp
CodeAnarchist 9a58907
Update fat32.cpp
CodeAnarchist 38b04b7
Update kstring.c
CodeAnarchist c0e6bd8
Update chunked_list.cpp
CodeAnarchist 6d5119b
Update chunked_list.hpp
CodeAnarchist 18617b9
Update doubly_linked_list.cpp
CodeAnarchist b4c7d89
Update doubly_linked_list.hpp
CodeAnarchist 3e0badc
Update linked_list.cpp
CodeAnarchist 31aa644
Update linked_list.hpp
CodeAnarchist 8711102
Update queue.cpp
CodeAnarchist 6aaca80
Update queue.hpp
CodeAnarchist 065b9d1
Update ring_buffer.cpp
CodeAnarchist 1967c8f
Update ring_buffer.hpp
CodeAnarchist 6cf11c5
Update string.c
CodeAnarchist 1292655
Update doubly_linked_list.hpp
CodeAnarchist 38b796c
Update Makefile
CodeAnarchist 4ac1ef8
Update Makefile
CodeAnarchist 4ad766f
Update Makefile
CodeAnarchist 5bd3dfe
Update kconsole.cpp
CodeAnarchist 067282e
Update Makefile
CodeAnarchist 0fb02c5
split data structures in .c/.h and .hpp
CodeAnarchist 0d2d55f
rem xhci types h
CodeAnarchist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,97 @@ | ||
| MODE ?= virt | ||
| LOAD_ADDR ?= 0x41000000 | ||
| XHCI_CTX_SIZE ?= 32 | ||
| QEMU ?= true | ||
| #top make | ||
| ARCH ?= aarch64-none-elf | ||
| CC := $(ARCH)-gcc | ||
| LD := $(ARCH)-ld | ||
| AR := $(ARCH)-ar | ||
| OBJCOPY := $(ARCH)-objcopy | ||
|
|
||
| OS := $(shell uname) | ||
| #common flags | ||
| CFLAGS_BASE ?= -g -O0 -std=c17 -nostdlib -ffreestanding \ | ||
| -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables \ | ||
| -Wall -Wextra -mcpu=cortex-a72 | ||
| LDFLAGS_BASE ?= | ||
|
|
||
| #build vars | ||
| LOAD_ADDR ?= 0x41000000 | ||
| XHCI_CTX_SIZE ?= 32 | ||
| QEMU ?= true | ||
| MODE ?= virt | ||
|
|
||
| #export | ||
| export ARCH CC LD AR OBJCOPY CFLAGS_BASE LDFLAGS_BASE LOAD_ADDR XHCI_CTX_SIZE QEMU | ||
|
|
||
| #config filesystem | ||
| OS := $(shell uname) | ||
| FS_DIRS := fs/redos/user | ||
|
|
||
| ifeq ($(OS),Darwin) | ||
| BOOTFS=/Volumes/bootfs | ||
| BOOTFS := /Volumes/bootfs | ||
| else | ||
| BOOTFS=/media/bootfs | ||
| BOOTFS := /media/bootfs | ||
| endif | ||
|
|
||
| .PHONY: all kernel user shared clean raspi virt run debug dump | ||
| #targets | ||
| .PHONY: all shared user kernel clean raspi virt run debug dump prepare-fs help install | ||
|
|
||
| all: shared user kernel | ||
| @echo "Build complete." | ||
| ./createfs | ||
|
|
||
| dump: | ||
| aarch64-none-elf-objdump -D kernel.elf > dump | ||
|
|
||
| shared: | ||
| $(MAKE) -C shared | ||
|
|
||
| user: | ||
| user: prepare-fs | ||
| $(MAKE) -C user | ||
|
|
||
| kernel: | ||
| $(MAKE) -C kernel LOAD_ADDR=$(LOAD_ADDR) XHCI_CTX_SIZE=$(XHCI_CTX_SIZE) QEMU=$(QEMU) | ||
|
|
||
| clean: | ||
| $(MAKE) -C shared clean | ||
| $(MAKE) -C user clean | ||
| $(MAKE) -C kernel clean | ||
| $(MAKE) -C user clean | ||
| @echo "removing fs dirs" | ||
| rm -rf $(FS_DIRS) | ||
| @echo "removing images" | ||
| rm -f kernel.img kernel.elf disk.img dump | ||
|
|
||
| raspi: | ||
| $(MAKE) LOAD_ADDR=0x80000 XHCI_CTX_SIZE=64 QEMU=true all | ||
|
|
||
| virt: | ||
| $(MAKE) LOAD_ADDR=0x41000000 XHCI_CTX_SIZE=32 QEMU=true all | ||
|
|
||
| run: | ||
| $(MAKE) $(MODE) | ||
| ./run_$(MODE) | ||
|
|
||
| debug: | ||
| $(MAKE) $(MODE) | ||
| ./rundebug MODE=$(MODE) $(ARGS) | ||
|
|
||
|
|
||
| dump: | ||
| $(OBJCOPY) -O binary kernel.elf kernel.img | ||
| aarch64-none-elf-objdump -D kernel.elf > dump | ||
|
|
||
| install: | ||
| $(MAKE) clean | ||
| $(MAKE) LOAD_ADDR=0x80000 XHCI_CTX_SIZE=64 QEMU=false all | ||
| cp kernel.img $(BOOTFS)/kernel8.img | ||
| cp kernel.img $(BOOTFS)/kernel_2712.img | ||
| cp config.txt $(BOOTFS)/config.txt | ||
|
|
||
| run: | ||
| $(MAKE) $(MODE) | ||
| ./run_$(MODE) | ||
| prepare-fs: | ||
| @echo "creating dirs" | ||
| @mkdir -p $(FS_DIRS) | ||
|
|
||
| help: | ||
| @printf "usage:\n\ | ||
| make all build the os\n\ | ||
| make clean remove all build artifacts\n\ | ||
| make raspi build for raspberry\n\ | ||
| make virt build for qemu virt board\n\ | ||
| make run build and run in virt mode\n\ | ||
| make debug build and run with debugger\n\ | ||
| make dump disassemble kernel.elf\n\ | ||
| make install create raspi kernel and mount it on a bootable partition\n\ | ||
| make prepare-fs create directories for the filesystem\n\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,35 @@ | ||
| ARCH= aarch64-none-elf | ||
| CC = $(ARCH)-gcc | ||
| LD = $(ARCH)-ld | ||
| OBJCOPY = $(ARCH)-objcopy | ||
|
|
||
| CFLAGS = -g -O0 -std=c17 -nostdlib -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wall -Wextra -DXHCI_CTX_SIZE=$(XHCI_CTX_SIZE) -mcpu=cortex-a72 -I. -I../shared -I../user | ||
| #kernel | ||
| # toolchain (inherited from top-level) | ||
|
|
||
| CFLAGS := $(CFLAGS_BASE) -I. -I../shared -I../user -DXHCI_CTX_SIZE=$(XHCI_CTX_SIZE) | ||
| ifeq ($(QEMU),true) | ||
| CFLAGS += -DQEMU | ||
| CFLAGS += -DQEMU | ||
| endif | ||
|
|
||
| LDFLAGS = -T $(shell ls *.ld) --defsym=LOAD_ADDR=$(LOAD_ADDR) | ||
| LDFLAGS := $(LDFLAGS_BASE) -T $(shell ls *.ld) --defsym=LOAD_ADDR=$(LOAD_ADDR) | ||
|
|
||
| C_SRC = $(shell find . -name '*.c') | ||
| ASM_SRC = $(shell find . -name '*.S') | ||
| CPP_SRC = $(shell find . -name '*.cpp') | ||
| OBJ = $(C_SRC:.c=.o) $(CPP_SRC:.cpp=.o) $(ASM_SRC:.S=.o) | ||
| OBJL = $(filter-out ./boot.o, $(OBJ)) | ||
| CLEAN_OBJS := $(shell find . -name '*.o') | ||
| C_SRC := $(shell find . -name '*.c') | ||
| ASM_SRC := $(shell find . -name '*.S') | ||
| CPP_SRC := $(shell find . -name '*.cpp') | ||
| OBJ := $(C_SRC:.c=.o) $(ASM_SRC:.S=.o) $(CPP_SRC:.cpp=.o) | ||
| OBJL := $(filter-out ./boot.o,$(OBJ)) | ||
|
|
||
| TARGET = kernel.img | ||
| ELF = kernel.elf | ||
| ELF := ../kernel.elf | ||
| TARGET := ../kernel.img | ||
|
|
||
| all: $(TARGET) | ||
|
|
||
| $(TARGET): ../shared/libshared.a $(OBJ) | ||
| $(LD) $(LDFLAGS) -o ../$(ELF) $(OBJL) ../shared/libshared.a | ||
| $(OBJCOPY) -O binary ../$(ELF) ../$(TARGET) | ||
| $(LD) $(LDFLAGS) -o $(ELF) $(OBJL) ../shared/libshared.a | ||
| $(OBJCOPY) -O binary $(ELF) $@ | ||
|
|
||
| %.o: %.S | ||
| $(CC) $(CFLAGS) -c $< -o $@ | ||
|
|
||
| %.o: %.c | ||
| $(CC) $(CFLAGS) -c $< -o $@ | ||
|
|
||
| %.o: %.cpp | ||
| $(CC) $(CFLAGS) -fno-rtti -c $< -o $@ | ||
|
|
||
| clean: | ||
| rm -f $(shell find . -name '*.o') ../$(ELF) ../$(TARGET) $(TARGET) | ||
| rm -f $(CLEAN_OBJS) $(ELF) $(TARGET) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,4 @@ void kconsole_clear(); | |
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
| #endif | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.