Here's the guide to building AstraOS v0.2 on manjaro. The Linux distro I have installed and the only one I pledge to support. Since extreme compatibility issues from distro to distro is one of the many reasons for making a new OS I have quite little will to put up with the problem.
First we begin by installing all the dependencies required.
sudo pacman -Syy ninja glusterfs libiscsi python \ python-sphinx spice-protocol xfsprogs sdl2 sdl2_image \ autoconf automake curl python3 mpc mpfr gmp gawk \ base-devel bison flex texinfo gperf libtool patchutils \ bc zlib expat gperftools
We need a risc-v toolchain to produce application binaries and OS binaries. You *can* use a distro provided toolchain, however you are putting yourself at risk for more breakage. I found it fine to use any toolchain until one day a breaking change was introduced into gcc that made debugging with gdb impossible. Just use a newer gdb? There was none yet. If you value sanity, I have made sure this exact toolchain definitely works. The following snippet installs it into /opt/riscv. Adding "export PATH=/opt/riscv/bin:$PATH" to the end of your bashrc is probably nice so that you don't have to add the toolchain to the PATH when you want to use it.
git clone https://github.com/riscv/riscv-gnu-toolchain.git && \ cd riscv-gnu-toolchain/ && \ git checkout 2021.01.26 && \ sudo mkdir /opt/riscv && \ export PATH=/opt/riscv/bin:$PATH && \ ./configure --prefix=/opt/riscv && \ sudo make -j$(nproc) && \ cd ..
Then we clone the AstraOS git repo and checkout version 0.2. This can take a while as it also pulls down the source code for qemu. You may ask, can't I just install qemu from my package manager? No, because then I wouldn't be able to customize qemu's source code to model the hardware AstraOS is being designed for. This is a reality we have to live with.
git clone https://git.sr.ht/~samhsmith/AstraOS && \ cd AstraOS && \ git checkout v0.2 git submodule update --init
Once that is done we can go ahead and build our custom qemu with the following command. Qemu only needs to be rebuilt when the git submodule is checkout to a different commit. So once you've done it this first time it should be a rare occurence. First time this is done in a freshly cloned repo there will be additional submodules to download, I'm very sorry. As I am writing this the build failed due to some python error, it is a sad world we live in. When in doubt nuke the build folder qemu/build with "rm -drf qemu/build" and try again. If it consistently doesn't clean build try something else, don't trust the incremental builds.
mkdir qemu/build && \ cd qemu/build && \ CFLAGS="-Wno-error -march=haswell" ../configure --target-list=riscv64-softmmu && \ make -j$(nproc) || \ cd ../..
Now finally we can get to the exciting part. Bulding and running AstraOS v0.2. The following command cleans, then builds with debugging symbols and optimizations, runs the OS. Always clean before building. You can run without rebuilding, but don't expect source code changes to have been applied.
./build.sh clean && CFLAGS="-w -O3" ./build.sh && ./build.sh run
Use CTRL + the up and down arrows to select program.
Use CTRL + Enter to launch the selected program.
Left Mouse Click and drag to move windows.
Right Mouse Click and drag to resize windows.
Use CTRL + f to toggle exclusive fullscreen on a window.
Arrow keys move the square's orbit around.
Pressing space will toggle lock "square to cursor position".
Enter name of program to run it when not already running a program.
CTRL + SHIFT + X is used to force kill a program, like CTRL + c in bash.
CTRL + TAB is used to toggle showing the console when a embedded gui application is running, ex super_cool_square.
Running the program "exit" or pressing SHIFT + ESCAPE will terminate Dave Terminal.
Just run this in the terminal, you will figure it out.
"Building AstraOS on Manjaro" was written by Sam H Smith on the 7th of December 2021, 2021-12-07.