diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index 147b30d6..1764468e 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -14,9 +14,19 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install + - name: Setup run: sudo apt-get install -y genisoimage - - name: Build - run: make - + - name: Build Kernel + run: make build-kernel + + - name: Build Standard Library + run: make build-library + + - name: Build Userspace + run: make build-userspace + + - name: Build CDROM Image + run: make build-cdrom-image + + diff --git a/Makefile b/Makefile index 3fb1eee7..6a667997 100644 --- a/Makefile +++ b/Makefile @@ -7,16 +7,20 @@ USER_PROGRAMS=$(USER_SOURCES:c=exe) KERNEL_SOURCES=$(wildcard kernel/*.[chS]) WORDS=/usr/share/dict/words -all: basekernel.iso +.PHONY: build-kernel build-library build-userspace build-cdrom-image -run: basekernel.iso disk.img - qemu-system-i386 -cdrom basekernel.iso -hda disk.img +all: build-cdrom-image -debug: basekernel.iso disk.img - qemu-system-i386 -cdrom basekernel.iso -hda disk.img -s -S & +build-kernel: kernel/basekernel.img -disk.img: - qemu-img create disk.img 10M +build-library: library/baselib.a + +build-userspace: $(USER_PROGRAMS) + +build-cdrom-image: basekernel.iso + +kernel/basekernel.img: $(KERNEL_SOURCES) $(LIBRARY_HEADERS) + cd kernel && make library/baselib.a: $(LIBRARY_SOURCES) $(LIBRARY_HEADERS) cd library && make @@ -24,9 +28,6 @@ library/baselib.a: $(LIBRARY_SOURCES) $(LIBRARY_HEADERS) $(USER_PROGRAMS): $(USER_SOURCES) library/baselib.a $(LIBRARY_HEADERS) cd user && make -kernel/basekernel.img: $(KERNEL_SOURCES) $(LIBRARY_HEADERS) - cd kernel && make - image: kernel/basekernel.img $(USER_PROGRAMS) rm -rf image mkdir image image/boot image/bin image/data @@ -37,8 +38,17 @@ image: kernel/basekernel.img $(USER_PROGRAMS) basekernel.iso: image ${ISOGEN} -input-charset utf-8 -iso-level 2 -J -R -o $@ -b boot/basekernel.img image +disk.img: + qemu-img create disk.img 10M + +run: basekernel.iso disk.img + qemu-system-i386 -cdrom basekernel.iso -hda disk.img + +debug: basekernel.iso disk.img + qemu-system-i386 -cdrom basekernel.iso -hda disk.img -s -S & + clean: - rm -rf basekernel.iso image + rm -rf basekernel.iso image disk.img cd kernel && make clean cd library && make clean cd user && make clean diff --git a/kernel/kshell.c b/kernel/kshell.c index dce1cdb0..371bd1f9 100644 --- a/kernel/kshell.c +++ b/kernel/kshell.c @@ -387,7 +387,7 @@ int kshell_launch() const char *argv[100]; int argc; - kshell_mount("atapi",2,"cdromfs"); + kshell_automount(); while(1) { printf("kshell> "); diff --git a/kernel/page.c b/kernel/page.c index 2577c2c1..1d80a6fd 100644 --- a/kernel/page.c +++ b/kernel/page.c @@ -82,7 +82,7 @@ void *page_alloc(bool zeroit) if(zeroit) memset(pageaddr, 0, PAGE_SIZE); pages_free--; - printf("page: alloc %d\n",pages_free); + //printf("page: alloc %d\n",pages_free); return pageaddr; } } @@ -103,5 +103,5 @@ void page_free(void *pageaddr) uint32_t cellmask = (1 << celloffset); freemap[cellnumber] |= cellmask; pages_free++; - printf("page: free %d\n",pages_free); + //printf("page: free %d\n",pages_free); } diff --git a/user/sysstat.c b/user/sysstat.c index cf6abfe7..385da0d9 100644 --- a/user/sysstat.c +++ b/user/sysstat.c @@ -6,13 +6,24 @@ See the file LICENSE for details. #include "library/syscalls.h" #include "library/string.h" +#include "library/stdio.h" + +struct system_stats s = {0}; int main(int argc, char *argv[]) { - struct system_stats s = {0}; + printf("a"); + flush(); + + printf("b"); + flush(); + if (syscall_system_stats(&s)) { return 1; } + printf("c"); + flush(); + printf("System uptime: %u:%u:%u\n", s.time / (3600), (s.time % 3600) / 60, s.time % 60); printf("Disk 0: %d blocks read, %d blocks written\n", s.blocks_read[0], s.blocks_written[0]);