Files
riscv64-kernel/justfile

28 lines
830 B
Makefile

release := ""
cargo_flags := if release != "" { "--release" } else { "" }
default: run
mount_filesystem:
# Add some permissions to be able to do next operations without sudo
@mountpoint -q mnt || sudo mount -o umask=0022,gid=$(id -g $USER),uid=$(id -u $USER) disk.img mnt
sync_filesystem:
sync
build_user_prog prog:
RUSTFLAGS="-C relocation-model=pic -C link-arg=-Tilm.ld" cargo b {{ cargo_flags }} --package {{ prog }}
riscv64-elf-objcopy -O binary {{ "target/riscv64/debug" / prog }} {{ "mnt/usr/bin" / prog }}
build: mount_filesystem (map_dir "user" "build_user_prog")
cargo b {{ cargo_flags }}
just sync_filesystem
run: build
cargo r {{ cargo_flags }}
map_dir dir recipe:
@for file in `ls {{ dir }}`; do \
just cargo_flags="{{ cargo_flags }}" {{ recipe }} $file ; \
done