Skip to content

Commit

Permalink
Update GitHub build workflow. (#294)
Browse files Browse the repository at this point in the history
* Update build workflow and Makefile with separate phone steps to clarify any build failures.

* Remove debugging output.

* Remove disk image.

* Fix Makefile

* Switch fixed mount to automount.
  • Loading branch information
dthain committed Dec 15, 2023
1 parent f527119 commit 401e578
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 19 deletions.
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

0 comments on commit 401e578

Please sign in to comment.