1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 05:28:06 +11:00

recipes/rc2014/zasm: add instructions to assemble kernel

This commit is contained in:
Virgil Dupras 2019-06-17 14:17:47 -04:00
parent 3e437747c2
commit 95b658897a
2 changed files with 46 additions and 12 deletions

View File

@ -1,9 +1,4 @@
# source files required to build os.bin. We copy them in cfsin so that we can
# build the same kernel from within the RC2014.
KERNEL_SRCS = err.h acia.asm blockdev.asm blockdev_cmds.asm core.asm fs.asm \
fs_cmds.asm mmap.asm parse.asm pgm.asm sdc.asm shell.asm stdio.asm
CFSTARGETS = $(addprefix cfsin/, zasm sdct at28w user.h $(KERNEL_SRCS))
CFSTARGETS = $(addprefix cfsin/, zasm sdct memt at28w user.h)
BASE = ../../..
TOOLS = $(BASE)/tools
ZASM = $(TOOLS)/zasm.sh
@ -29,15 +24,14 @@ cfsin/zasm: $(ZASMBIN)
cfsin/sdct: $(ZASMBIN)
$(ZASM) $(APPS) user.h < $(APPS)/sdct/glue.asm > $@
cfsin/memt: $(ZASMBIN)
$(ZASM) $(APPS) user.h < $(APPS)/memt/glue.asm > $@
cfsin/at28w: $(ZASMBIN)
$(ZASM) $(APPS) $(KERNEL) user.h < $(APPS)/at28w/glue.asm > $@
cfsin/user.h: user.h
cp $< $@
cfsin/err.h: $(KERNEL)/err.h
cp $< $@
cfsin/%.asm: $(KERNEL)/%.asm
cp $< $@
.PHONY: clean
clean:

View File

@ -8,8 +8,6 @@ assembly to binary.
Have a RC2014 assemble a Collapse OS kernel with its source living on a CFS on
a SD card.
**Work in progress: for now, we compile a simple hello.asm source file.**
## Gathering parts
* Same parts as the [SD card recipe](../sdcard).
@ -59,3 +57,45 @@ Compiling and running `hello.asm` is done very much like in
>
That RC2014 is starting to feel powerful now, right?
## Test your hardware
Now that you have a fully functional filesystem that can load programs and run
them easily, you'll see that this recipe's CFS include a couple of programs
besides `zasm`. Among them, there's `sdct` that stress tests reading and
writing on the SD card and `memt` that stress tests RAM. You might be
interested in running them. Look at their description in `apps/`. All you need
to to do run them is to type their name.
## Assembling the kernel
Now let's go for something a little more fun! Jiu-jitsu? No, you're not going to
learn jiu-jitsu! You're going to assemble the kernel from within your RC2014!
The makefile doesn't prepare a CFS blob for this, let's learn to build that blob
yourself. First of all, we'll need to have what we already had in `sdcard.cfs`
because it has `zasm` and `user.h`. But we're going to add the contents of
the `/kernel/` directory to it.
$ cp ../../../kernel/*.{h,asm} cfsin
You'll also need your glue file (at this time, the RC2014 can't assemble the
kernel of this very recipe, I'm not sure why. It can, however, assemble the
simpler kernel of the base RC2014 recipe. We'll use this one):
$ cp ../glue.asm cfsin
You're now ready to re-make your CFS:
$ rm sdcard.cfs && make
Now you can write this into your card and boot Collapse OS:
Collapse OS
> sdci
> fson
> fopn 0 glue.asm
> fnew 10 dest
> fopn 1 dest
> zasm 1 2 # This takes a while. About 3 minutes.
> sdcf # success! sdcf flushes SD card buffers to the card.