Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ x86) before running on bare metal.
## Building and Running

### Prerequisites
You will need QEMU for aarch64 emulation and dosfstools to create the virtual file system.
You will need QEMU for aarch64 emulation, dosfstools and mtools to create the
virtual file system.

```bash
sudo apt install qemu-system-aarch64 dosfstools
sudo apt install qemu-system-aarch64 dosfstools mtools
```

Additionally you will need a version of the [aarch64-none-elf](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) toolchain installed.
Expand Down Expand Up @@ -100,14 +101,12 @@ into the `build` directory.

Once that is done, you can create the image using the following command:
```bash
sudo ./scripts/create-image.sh
./scripts/create-image.sh
```

This will create an image file named `moss.img` in the root directory of the project,
format it as VFAT 32 and create the necessary files and directories for the kernel.

This script needs to run with sudo to mount the image through a loop device,
which is required to properly create the image for the kernel to work.
This will create an image file named `moss.img` in the root directory of the
project, format it as VFAT 32 and create the necessary files and directories for
the kernel.

### Running via QEMU

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly"
components = [ "rust-src", "llvm-tools-preview", "rustfmt", "clippy" ]
components = [ "rust-src", "llvm-tools-preview", "rustfmt", "clippy", "rust-analyzer" ]
targets = [ "aarch64-unknown-none-softfloat" ]
18 changes: 4 additions & 14 deletions scripts/create-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,13 @@ base="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )"
pushd "$base" &>/dev/null || exit 1

img="$base/moss.img"
mount="$base/build/mount"

mkdir -p "$mount"

dd if=/dev/zero of="$img" bs=1M count=128
mkfs.vfat -F 32 "$img"

if ! mountpoint -q "$mount"; then
mount -o loop "$img" "$mount"
fi

mkdir -p "$mount/bin"
mkdir -p "$mount/dev"
mmd -i "$img" ::/bin
mmd -i "$img" ::/dev

cp "$base/build/bin"/* "$mount/bin"
mcopy -i "$img" "$base/build/bin"/* "::/bin"

if mountpoint -q "$mount"; then
umount "$mount"
fi
popd &>/dev/null || exit 1
popd &>/dev/null || exit 1
13 changes: 5 additions & 8 deletions scripts/deps/bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ CC="${CC:-aarch64-linux-$stdlib-gcc}"

pushd "build" &>/dev/null || exit 1

if [ ! -d "bash" ]; then
git clone --depth 1 --branch "$bash_tag" "$bash_repo" "bash"
else
pushd "bash" &>/dev/null || exit 1
git pull
popd &>/dev/null || exit 1
if [ ! -d "bash-5.3" ]; then
wget https://ftp.gnu.org/gnu/bash/bash-5.3.tar.gz
tar xzf bash-5.3.tar.gz
fi

pushd "bash" &>/dev/null || exit 1
./configure --without-bash-malloc --enable-static-link --host="aarch64-linux-$stdlib"
pushd "bash-5.3" &>/dev/null || exit 1
CFLAGS_FOR_BUILD="-std=c99" ./configure --without-bash-malloc --enable-static-link --host="aarch64-linux-$stdlib"
make clean
make
mv bash ../bin/bash
Expand Down