Skip to content

Commit

Permalink
Add a make target for producing a release archive
Browse files Browse the repository at this point in the history
Signed-off-by: Miquel Sabaté Solà <[email protected]>
  • Loading branch information
mssola committed Nov 25, 2024
1 parent 2429f8a commit 8160449
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ test/*.o
test/test_dt
test/test_initrd

tmp/
/fbos.tar.gz

# You can generate it with Bear: `$ bear -- make`.
compile_commands.json
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# State of the project by the end of SUSE Hackweek 2024

As part of [SUSE Hack Week
24](https://hackweek.opensuse.org/24/projects/fizzbuzz-os) I started this
project with the scope in mind to at least have something running. This is what
I have achieved by the end of this week:

- The kernel knows how to parse the Device Tree blob to obtain the memory
location of the `initrd` blob.
- The kernel can parse the `initrd` (as referenced by the Device Tree blob) to
reference all the user-space binaries.
- The kernel can parse the ELF binary for each user-space binary in order to get
their binary entry.
- The kernel can react to the OpenSBI timer and count seconds on QEMU.
- The kernel can schedule each binary entry depending on the requirement of the
whole system.

Hence, by the end of the week I already got a kernel that could start on QEMU
and show the whole `fizz`, `buzz`, `fizzbuzz` strings as given by user-space
processes. Even with rough edges still to be polished, my initial goals have
been met.
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ endif
##
# Paths

SRC = $(filter-out kernel/fbos.ld.S, $(wildcard kernel/*.S kernel/*.c lib/*.c))
OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SRC)))
LINKER = kernel/fbos.ld
KRNL = fbos
USR = usr/bin/init usr/bin/fizz usr/bin/buzz usr/bin/fizzbuzz
INIT = usr/initramfs.cpio
TESTS = test/test_dt test/test_initrd
SRC = $(filter-out kernel/fbos.ld.S, $(wildcard kernel/*.S kernel/*.c lib/*.c))
OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SRC)))
LINKER = kernel/fbos.ld
KRNL = fbos
USR = usr/bin/init usr/bin/fizz usr/bin/buzz usr/bin/fizzbuzz
INIT = usr/initramfs.cpio
TESTS = test/test_dt test/test_initrd
TMP = tmp/
ARCHIVE = fbos.tar.gz

LDFLAGS += -T $(LINKER)

Expand Down Expand Up @@ -127,6 +129,18 @@ test/%: test/%.o
$(E) " TEST " $@
$(Q) $(HOSTCC) -Iinclude/ $< test/lib/*.o -o $@

##
# Produce an archive for releases.

.PHONY: archive
archive: all
$(Q) rm -rf $(TMP) && mkdir -p $(TMP)
$(Q) cp -r usr/ $(TMP) && rm -r $(TMP)/usr/src
$(Q) cp $(KRNL) $(TMP)
$(Q) tar czf $(ARCHIVE) $(TMP)
$(Q) rm -rf $(TMP)
$(E) " TAR $(ARCHIVE)"

##
# Hacking

Expand All @@ -144,7 +158,7 @@ gdb:

.PHONY: clean
clean:
$(Q) rm -f $(OBJ) $(KRNL) $(LINKER) $(USR) usr/src/*.o $(INIT) test/*.o test/lib/*.o $(TESTS)
$(Q) rm -rf $(OBJ) $(KRNL) $(LINKER) $(USR) usr/src/*.o $(INIT) test/*.o test/lib/*.o $(TESTS) $(TMP) $(ARCHIVE)

.PHONY: lint
lint:
Expand Down

0 comments on commit 8160449

Please sign in to comment.