Skip to content
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

Update GitHub build workflow. #294

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ 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

$(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
Expand All @@ -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
2 changes: 1 addition & 1 deletion kernel/kshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ int kshell_launch()
const char *argv[100];
int argc;

kshell_mount("atapi",2,"cdromfs");
kshell_automount();

while(1) {
printf("kshell> ");
Expand Down
4 changes: 2 additions & 2 deletions kernel/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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);
}
13 changes: 12 additions & 1 deletion user/sysstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down