Assembling Collapse OS from within it
This is where we tie lose ends, complete the circle, loop the
loop: we assemble a new Collapse OS *entirely* from within
Build Collapse OS' from within Collapse OS is very similar to
how we do it from the makefiles in /arch. If you take
the time to look one, you'll see something that look like "cat
xcomp.fs | $(STAGE)". That's the thing. Open "xcomp.fs" in a
text editor and take a look at it. Some xcomp units are simple
proxy to a block, which you'll find in the blk/ subfolder for
To assemble Collapse OS from within it, all you need to do is
execute the content of this unit. When you run makefiles, it's
already Collapse OS building itself from within it, so it's not
different when it's the real deal.
When you do so, it will yield a binary in memory. To know the
start/end offset of the binary, You'll use ORG and HERE. ORG is
where your first byte starts in your host's memory, "HERE ORG -"
is the size of your binary.
With that, you can write that binary between those offsets on
your target media. That binary should be the exact same as what
you get in "os.bin" when you run "make". You now have a new
Collapse OS deployment.
See more details on bootstrapping at doc/bootstrap.
What to do on SDerr?
If you self host from a machine with a SD card and you get
"SDerr" in the middle of a LOAD operation, something went wrong
with the SD card. The bad news is that it left your xcomp
operation in an inconsistent state. The easiest thing to do it
to restart the operation from scratch. Those error are not
frequent unless hardware is faulty.
Cross-compiling directly to EEPROM
If your target media is a RAM mappable media, you can save prec-
ious RAM by cross-compiling Collapse OS directly to it. It req-
uires special handling.
You can begin the process in a regular manner, but right before
you're about to assemble the boot code, take a pause.
Up until now, you've been loading your cross compiling tools in
RAM, now, you're about to write Collapse OS. So what you need
to do is change HERE to the address of your EEPROM. Example:
$2000 'HERE !
Then, you can continue the process normally.
This page generated at 2023-12-05 21:05:04 from documentation in CollapseOS snapshot 20230427.