~demindiro/norost-b

a5d8ad06819702f4b794a3d5aba33a34ffb8e59f — David Hoppenbrouwers 5 months ago 1d51ff8
Fix rust-analyzer brokeness
9 files changed, 32 insertions(+), 11 deletions(-)

M .cargo/config.toml
M Makefile
M boot/amd64/Cargo.toml
A boot/amd64/i686-unknown-norostb.json
D clean.sh
M kernel/Cargo.toml
M mkiso.sh
M mkkernel.sh
M run.sh
M .cargo/config.toml => .cargo/config.toml +6 -0
@@ 1,3 1,9 @@
[build]
target = "x86_64-unknown-norostb.json"

[unstable]
build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins", "alloc"]

[target.x86_64-unknown-norostb]
runner = "./run.sh"

M Makefile => Makefile +15 -0
@@ 1,2 1,17 @@
# There's a bug in cargo that causes panics when using `forced-target`
# Use Makefiles as workaround for now
build: kernel boot

kernel:
	cargo b --bin nora

boot:
	cargo b --bin noraboot --target i686-unknown-norostb.json

run:
	cargo r --bin nora

disk0:
	fallocate -l $$((32 * 512)) $@

.PHONY: kernel boot run

M boot/amd64/Cargo.toml => boot/amd64/Cargo.toml +5 -0
@@ 1,7 1,12 @@
cargo-features = ["per-package-target"]

[package]
name = "noraboot"
version = "0.1.0"
edition = "2021"
#default-target = "i686-unknown-norostb.json"
# FIXME this causes a panic in cargo
#forced-target = "i686-unknown-norostb.json"

[dependencies]
rsdp = "*"

A boot/amd64/i686-unknown-norostb.json => boot/amd64/i686-unknown-norostb.json +1 -0
@@ 0,0 1,1 @@
../../i686-unknown-norostb.json
\ No newline at end of file

D clean.sh => clean.sh +0 -6
@@ 1,6 0,0 @@
#!/bin/sh

set -x

rm -rf build/
cargo clean

M kernel/Cargo.toml => kernel/Cargo.toml +1 -0
@@ 15,3 15,4 @@ mem-max-256m = []
driver-pci = []
driver-hpet = []
driver-pic = []


M mkiso.sh => mkiso.sh +1 -1
@@ 14,7 14,7 @@ cp boot/$ARCH/grub/grub.cfg isodir/boot/grub/grub.cfg
(cd drivers/hello_world && ./build.sh)
cp drivers/hello_world/hello isodir/drivers/hello_world
(cd drivers/virtio_block && cargo build --release --target $RUST_TARGET_FILE)
cp target/x86_64-unknown-norostb/release/driver_virtio_block isodir/drivers/virtio_block
cp target/$RUST_TARGET/release/driver_virtio_block isodir/drivers/virtio_block
grub-mkrescue -o norost.iso isodir \
	--locales= \
	--fonts= \

M mkkernel.sh => mkkernel.sh +1 -1
@@ 6,7 6,7 @@ set -e

cd kernel
cargo rustc \
	--target $RUST_TARGET_FILE \
	--release \
	-- \
	-C linker=$CC \
	-C link-arg=-nostartfiles \

M run.sh => run.sh +2 -3
@@ 10,8 10,7 @@ cpu="--enable-kvm -cpu host"
qemu-system-x86_64 \
	$cpu \
	-drive format=raw,file=norost.iso \
	-serial mon:stdio $@ \
	-serial mon:stdio \
	-machine q35 \
	-drive file=disk0,format=raw,if=none,id=disk0 \
	-device virtio-blk-pci,drive=disk0 \
	#-s
	-device virtio-blk-pci,drive=disk0