diff --git a/components/Makefile b/components/Makefile new file mode 100644 index 0000000..b326f5f --- /dev/null +++ b/components/Makefile @@ -0,0 +1,38 @@ +BUILD=./build + +TOOLCHAIN = $(CURDIR)/../tools/x86_64-unknown-redox/toolchain +CARGO = $(TOOLCHAIN)/bin/cargo +PATH := $(TOOLCHAIN)/bin:$(PATH) + +export AR_x86_64_unknown_redox=x86_64-unknown-redox-ar +export CARGO_TARGET_X86_64_UNKNOWN_REDOX_LINKER=x86_64-unknown-redox-gcc +export CARGO_TARGET_X86_64_UNKNOWN_REDOX_RUNNER=../../redoxer/target/release/redoxer exec --folder . +export CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc +export CFLAGS_riscv64gc_unknown_redox=-march=rv64gc -mabi=lp64d +export CXX_x86_64_unknown_redox=x86_64-unknown-redox-g++ +export GNU_TARGET=x86_64-unknown-redox +export RUSTFLAGS=-L native=${TOOLCHAIN}/lib +export RUSTUP_TOOLCHAIN=${TOOLCHAIN} +export TARGET=x86_64-unknown-redox + +.PHONY: all +all: \ + $(BUILD)/bin/init $(BUILD)/bin/logd \ + $(BUILD)/bin/ramfs $(BUILD)/bin/randd \ + $(BUILD)/bin/redoxfs $(BUILD)/bin/zerod \ + $(BUILD)/boot/bootstrap \ + $(BUILD)/bin/acpid $(BUILD)/bin/fbcond \ + $(BUILD)/bin/inputd $(BUILD)/bin/lived \ + $(BUILD)/bin/nvmed $(BUILD)/bin/pcid \ + $(BUILD)/bin/vesad \ + $(BUILD)/bin/ahcid $(BUILD)/bin/ided \ + $(BUILD)/bin/ps2d \ + $(BUILD)/bin/virtio-blkd $(BUILD)/bin/virtio-gpud \ + $(BUILD)/etc/pcid/initfs.toml + + + +include make/simple +include make/bootstrap +include make/drivers +include make/zerod \ No newline at end of file diff --git a/components/make/bootstrap b/components/make/bootstrap new file mode 100644 index 0000000..394766a --- /dev/null +++ b/components/make/bootstrap @@ -0,0 +1,19 @@ +$(BUILD)/.inter/libbootstrap.a: $(shell find ./sources/bootstrap -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/.inter + cd sources/bootstrap && \ + $(CARGO) \ + -Zbuild-std=core,alloc,compiler_builtins \ + -Zbuild-std-features=compiler-builtins-mem rustc \ + --target "x86_64-unknown-redox" \ + --release \ + -- \ + --emit link="../../$(BUILD)/.inter/libbootstrap.a" + +$(BUILD)/boot/bootstrap: $(BUILD)/.inter/libbootstrap.a + @mkdir -p $(BUILD)/boot + x86_64-unknown-redox-ld \ + -o "$(BUILD)/boot/bootstrap" \ + --gc-sections \ + -T "./sources/bootstrap/src/x86_64.ld" \ + -z max-page-size=4096 \ + "$(BUILD)/.inter/libbootstrap.a" \ No newline at end of file diff --git a/components/make/drivers b/components/make/drivers new file mode 100644 index 0000000..8ffd5bf --- /dev/null +++ b/components/make/drivers @@ -0,0 +1,75 @@ +$(BUILD)/etc/pcid/initfs.toml: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/etc/pcid + cp sources/drivers/initfs.toml $@ + +$(BUILD)/bin/acpid: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p acpid + cp sources/drivers/target/x86_64-unknown-redox/release/acpid $@ + +$(BUILD)/bin/fbcond: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p fbcond + cp sources/drivers/target/x86_64-unknown-redox/release/fbcond $@ + +$(BUILD)/bin/inputd: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p inputd + cp sources/drivers/target/x86_64-unknown-redox/release/inputd $@ + +$(BUILD)/bin/lived: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p lived + cp sources/drivers/target/x86_64-unknown-redox/release/lived $@ + +$(BUILD)/bin/nvmed: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p nvmed + cp sources/drivers/target/x86_64-unknown-redox/release/nvmed $@ + +$(BUILD)/bin/pcid: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p pcid + cp sources/drivers/target/x86_64-unknown-redox/release/pcid $@ + +$(BUILD)/bin/vesad: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p vesad + cp sources/drivers/target/x86_64-unknown-redox/release/vesad $@ + +$(BUILD)/bin/ahcid: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p ahcid + cp sources/drivers/target/x86_64-unknown-redox/release/ahcid $@ + +$(BUILD)/bin/ided: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p ided + cp sources/drivers/target/x86_64-unknown-redox/release/ided $@ + +$(BUILD)/bin/ps2d: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p ps2d + cp sources/drivers/target/x86_64-unknown-redox/release/ps2d $@ + +$(BUILD)/bin/virtio-blkd: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p virtio-blkd + cp sources/drivers/target/x86_64-unknown-redox/release/virtio-blkd $@ + +$(BUILD)/bin/virtio-gpud: $(shell find ./sources/drivers -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/drivers && \ + $(CARGO) build --release --target x86_64-unknown-redox -p virtio-gpud + cp sources/drivers/target/x86_64-unknown-redox/release/virtio-gpud $@ \ No newline at end of file diff --git a/components/make/simple b/components/make/simple new file mode 100644 index 0000000..7a633bf --- /dev/null +++ b/components/make/simple @@ -0,0 +1,35 @@ +$(BUILD)/bin/init: $(shell find ./sources/init -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/init && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/init/target/x86_64-unknown-redox/release/init $@ + +$(BUILD)/bin/logd: $(shell find ./sources/logd -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/logd && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/logd/target/x86_64-unknown-redox/release/logd $@ + +$(BUILD)/bin/ramfs: $(shell find ./sources/ramfs -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/ramfs && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/ramfs/target/x86_64-unknown-redox/release/ramfs $@ + +$(BUILD)/bin/randd: $(shell find ./sources/randd -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/randd && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/randd/target/x86_64-unknown-redox/release/randd $@ + +$(BUILD)/bin/redoxfs: $(shell find ./sources/redoxfs -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/redoxfs && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/redoxfs/target/x86_64-unknown-redox/release/redoxfs $@ + +$(BUILD)/bin/zerod: $(shell find ./sources/zerod -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/zerod && \ + $(CARGO) build --release --target x86_64-unknown-redox --bin zerod + cp sources/zerod/target/x86_64-unknown-redox/release/zerod $@ diff --git a/components/make/zerod b/components/make/zerod new file mode 100644 index 0000000..64a4025 --- /dev/null +++ b/components/make/zerod @@ -0,0 +1,29 @@ +$(BUILD)/bin/init: $(shell find ./sources/init -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/init && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/init/target/x86_64-unknown-redox/release/init $@ + +$(BUILD)/bin/logd: $(shell find ./sources/logd -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/logd && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/logd/target/x86_64-unknown-redox/release/logd $@ + +$(BUILD)/bin/ramfs: $(shell find ./sources/ramfs -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/ramfs && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/ramfs/target/x86_64-unknown-redox/release/ramfs $@ + +$(BUILD)/bin/randd: $(shell find ./sources/randd -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/randd && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/randd/target/x86_64-unknown-redox/release/randd $@ + +$(BUILD)/bin/redoxfs: $(shell find ./sources/redoxfs -type f -not -path "*/target/*") + @mkdir -p $(BUILD)/bin + cd sources/redoxfs && \ + $(CARGO) build --release --target x86_64-unknown-redox + cp sources/redoxfs/target/x86_64-unknown-redox/release/redoxfs $@