Convert to cookbook based build
This commit is contained in:
parent
9034701e8f
commit
c9950beec2
117 changed files with 246 additions and 6591 deletions
15
mk/config.mk
15
mk/config.mk
|
@ -7,7 +7,6 @@ ifeq ($(UNAME),Darwin)
|
|||
ECHO=/bin/echo
|
||||
FUMOUNT=sudo umount
|
||||
export LD=$(ARCH)-elf-ld
|
||||
export LDFLAGS=--gc-sections
|
||||
export NPROC=sysctl -n hw.ncpu
|
||||
export STRIP=$(ARCH)-elf-strip
|
||||
VB_AUDIO=coreaudio
|
||||
|
@ -16,7 +15,6 @@ else
|
|||
ECHO=echo
|
||||
FUMOUNT=fusermount -u
|
||||
export LD=ld
|
||||
export LDFLAGS=--gc-sections
|
||||
export NPROC=nproc
|
||||
export STRIP=strip
|
||||
VB_AUDIO="pulse"
|
||||
|
@ -25,23 +23,14 @@ endif
|
|||
|
||||
# Automatic variables
|
||||
ROOT=$(PWD)
|
||||
export INITFS_FOLDER=$(ROOT)/build/initfs
|
||||
export RUST_TARGET_PATH=$(ROOT)/kernel/targets
|
||||
export CC=$(ROOT)/libc-artifacts/gcc.sh
|
||||
export CFLAGS=-fno-stack-protector -U_FORTIFY_SOURCE
|
||||
export XARGO_RUST_SRC=$(ROOT)/rust/src
|
||||
|
||||
# Kernel variables
|
||||
KTARGET=$(ARCH)-unknown-none
|
||||
KBUILD=build/kernel
|
||||
KRUSTC=./krustc.sh
|
||||
KRUSTDOC=./krustdoc.sh
|
||||
KCARGO=RUSTC="$(KRUSTC)" RUSTDOC="$(KRUSTDOC)" CARGO_INCREMENTAL=1 cargo
|
||||
KCARGOFLAGS=--target $(KTARGET) --release -- -C soft-float
|
||||
|
||||
# Userspace variables
|
||||
export TARGET=$(ARCH)-unknown-redox
|
||||
BUILD=build/userspace
|
||||
export INITFS_FOLDER=$(ROOT)/initfs
|
||||
RUSTC=$(PWD)/rustc.sh
|
||||
RUSTDOC=./rustdoc.sh
|
||||
CARGO=RUSTC="$(RUSTC)" RUSTDOC="$(RUSTDOC)" CARGO_INCREMENTAL=1 cargo
|
||||
CARGOFLAGS=--target $(TARGET) --release -- -C codegen-units=`$(NPROC)`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
build/harddrive.bin: $(KBUILD)/kernel bootloader/$(ARCH)/** build/filesystem.bin
|
||||
build/harddrive.bin: build/kernel bootloader/$(ARCH)/** build/filesystem.bin
|
||||
nasm -f bin -o $@ -D ARCH_$(ARCH) -ibootloader/$(ARCH)/ bootloader/$(ARCH)/harddrive.asm
|
||||
|
||||
build/livedisk.bin: $(KBUILD)/kernel_live bootloader/$(ARCH)/**
|
||||
build/livedisk.bin: build/kernel_live bootloader/$(ARCH)/**
|
||||
nasm -f bin -o $@ -D ARCH_$(ARCH) -ibootloader/$(ARCH)/ bootloader/$(ARCH)/livedisk.asm
|
||||
|
||||
build/%.bin.gz: build/%.bin
|
||||
|
|
13
mk/doc.mk
13
mk/doc.mk
|
@ -1,13 +0,0 @@
|
|||
doc: $(KBUILD)/libkernel.a $(BUILD)/libstd.rlib FORCE
|
||||
$(KCARGO) doc --target $(KTARGET) --manifest-path kernel/Cargo.toml
|
||||
$(CARGO) doc --target $(TARGET) --manifest-path rust/src/libstd/Cargo.toml
|
||||
|
||||
ref: FORCE
|
||||
rm -rf filesystem/ref/
|
||||
mkdir -p filesystem/ref/
|
||||
#cargo run --manifest-path docgen/Cargo.toml -- programs/binutils/src/bin/ filesystem/ref/
|
||||
cargo run --manifest-path docgen/Cargo.toml -- programs/coreutils/src/bin/ filesystem/ref/
|
||||
cargo run --manifest-path docgen/Cargo.toml -- programs/extrautils/src/bin/ filesystem/ref/
|
||||
cargo run --manifest-path docgen/Cargo.toml -- programs/netutils/src/ filesystem/ref/
|
||||
cargo run --manifest-path docgen/Cargo.toml -- programs/pkgutils/src/ filesystem/ref/
|
||||
cargo run --manifest-path docgen/Cargo.toml -- programs/userutils/src/ filesystem/ref/
|
|
@ -1,14 +1,14 @@
|
|||
build/filesystem.bin: userspace
|
||||
build/filesystem.bin: filesystem.toml
|
||||
-$(FUMOUNT) build/filesystem/ || true
|
||||
rm -rf $@ build/filesystem/
|
||||
dd if=/dev/zero of=$@ bs=1048576 count=128
|
||||
cargo run --manifest-path schemes/redoxfs/Cargo.toml --quiet --release --bin redoxfs-mkfs $@
|
||||
cargo run --manifest-path installer/redoxfs/Cargo.toml --quiet --release --bin redoxfs-mkfs $@
|
||||
mkdir -p build/filesystem/
|
||||
cargo build --manifest-path schemes/redoxfs/Cargo.toml --quiet --release --bin redoxfs
|
||||
cargo run --manifest-path schemes/redoxfs/Cargo.toml --quiet --release --bin redoxfs -- $@ build/filesystem/
|
||||
cargo build --manifest-path installer/redoxfs/Cargo.toml --quiet --release --bin redoxfs
|
||||
cargo run --manifest-path installer/redoxfs/Cargo.toml --quiet --release --bin redoxfs -- $@ build/filesystem/
|
||||
sleep 2
|
||||
pgrep redoxfs
|
||||
cp -RL filesystem/* build/filesystem/
|
||||
cargo run --manifest-path installer/Cargo.toml -- --cookbook=cookbook $<
|
||||
chown -R 0:0 build/filesystem
|
||||
chown -R 1000:1000 build/filesystem/home/user
|
||||
chmod -R uog+rX build/filesystem
|
||||
|
@ -30,8 +30,8 @@ build/filesystem.bin: userspace
|
|||
|
||||
mount: FORCE
|
||||
mkdir -p build/filesystem/
|
||||
cargo build --manifest-path schemes/redoxfs/Cargo.toml --quiet --release --bin redoxfs
|
||||
cargo run --manifest-path schemes/redoxfs/Cargo.toml --quiet --release --bin redoxfs -- build/harddrive.bin build/filesystem/
|
||||
cargo build --manifest-path installer/redoxfs/Cargo.toml --quiet --release --bin redoxfs
|
||||
cargo run --manifest-path installer/redoxfs/Cargo.toml --quiet --release --bin redoxfs -- build/harddrive.bin build/filesystem/
|
||||
sleep 2
|
||||
pgrep redoxfs
|
||||
|
||||
|
|
20
mk/initfs.mk
20
mk/initfs.mk
|
@ -1,17 +1,3 @@
|
|||
$(KBUILD)/initfs.tag: initfs/bin/init \
|
||||
initfs/bin/ahcid \
|
||||
initfs/bin/bgad \
|
||||
initfs/bin/nvmed \
|
||||
initfs/bin/pcid \
|
||||
initfs/bin/ps2d \
|
||||
initfs/bin/redoxfs \
|
||||
initfs/bin/vboxd \
|
||||
initfs/bin/vesad \
|
||||
initfs/etc/**
|
||||
$(KCARGO) clean --manifest-path kernel/Cargo.toml
|
||||
touch $@
|
||||
|
||||
initfs/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p initfs/bin
|
||||
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
||||
build/initfs.tag: initfs.toml
|
||||
cargo run --manifest-path installer/Cargo.toml -- --cookbook=cookbook $<
|
||||
touch $@
|
||||
|
|
21
mk/kernel.mk
21
mk/kernel.mk
|
@ -1,16 +1,11 @@
|
|||
$(KBUILD)/libcollections.rlib: rust/src/libcollections/Cargo.toml rust/src/libcollections/**
|
||||
mkdir -p $(KBUILD)
|
||||
$(KCARGO) rustc --manifest-path $< $(KCARGOFLAGS) -o $@
|
||||
cp rust/src/target/$(KTARGET)/release/deps/*.rlib $(KBUILD)
|
||||
build/libkernel.a: kernel/Cargo.toml kernel/src/** build/initfs.tag
|
||||
cd kernel && xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@
|
||||
|
||||
$(KBUILD)/libkernel.a: kernel/Cargo.toml kernel/src/** $(KBUILD)/libcollections.rlib $(KBUILD)/initfs.tag
|
||||
$(KCARGO) rustc --manifest-path $< --lib $(KCARGOFLAGS) -o $@
|
||||
build/libkernel_live.a: kernel/Cargo.toml kernel/src/** build/initfs.tag build/filesystem.bin
|
||||
cd kernel && xargo rustc --lib --features live --target $(KTARGET) --release -- -C soft-float --emit link=../$@
|
||||
|
||||
$(KBUILD)/libkernel_live.a: kernel/Cargo.toml kernel/src/** $(KBUILD)/libcollections.rlib $(KBUILD)/initfs.tag build/filesystem.bin
|
||||
$(KCARGO) rustc --manifest-path $< --lib --features live $(KCARGOFLAGS) -o $@
|
||||
build/kernel: build/libkernel.a
|
||||
$(LD) --gc-sections -z max-page-size=0x1000 -T kernel/linkers/$(ARCH).ld -o $@ $<
|
||||
|
||||
$(KBUILD)/kernel: $(KBUILD)/libkernel.a
|
||||
$(LD) $(LDFLAGS) -z max-page-size=0x1000 -T kernel/linkers/$(ARCH).ld -o $@ $<
|
||||
|
||||
$(KBUILD)/kernel_live: $(KBUILD)/libkernel_live.a
|
||||
$(LD) $(LDFLAGS) -z max-page-size=0x1000 -T kernel/linkers/$(ARCH).ld -o $@ $<
|
||||
build/kernel_live: build/libkernel_live.a
|
||||
$(LD) --gc-sections -z max-page-size=0x1000 -T kernel/linkers/$(ARCH).ld -o $@ $<
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
coreutils: \
|
||||
filesystem/bin/basename \
|
||||
filesystem/bin/cat \
|
||||
filesystem/bin/chmod \
|
||||
filesystem/bin/clear \
|
||||
filesystem/bin/cp \
|
||||
filesystem/bin/cut \
|
||||
filesystem/bin/date \
|
||||
filesystem/bin/dd \
|
||||
filesystem/bin/df \
|
||||
filesystem/bin/du \
|
||||
filesystem/bin/echo \
|
||||
filesystem/bin/env \
|
||||
filesystem/bin/false \
|
||||
filesystem/bin/free \
|
||||
filesystem/bin/head \
|
||||
filesystem/bin/kill \
|
||||
filesystem/bin/ln \
|
||||
filesystem/bin/ls \
|
||||
filesystem/bin/mkdir \
|
||||
filesystem/bin/mv \
|
||||
filesystem/bin/printenv \
|
||||
filesystem/bin/ps \
|
||||
filesystem/bin/pwd \
|
||||
filesystem/bin/realpath \
|
||||
filesystem/bin/reset \
|
||||
filesystem/bin/rmdir \
|
||||
filesystem/bin/rm \
|
||||
filesystem/bin/seq \
|
||||
filesystem/bin/shutdown \
|
||||
filesystem/bin/sleep \
|
||||
filesystem/bin/sort \
|
||||
filesystem/bin/tail \
|
||||
filesystem/bin/tee \
|
||||
filesystem/bin/test \
|
||||
filesystem/bin/time \
|
||||
filesystem/bin/touch \
|
||||
filesystem/bin/true \
|
||||
filesystem/bin/wc \
|
||||
filesystem/bin/which \
|
||||
filesystem/bin/yes
|
||||
|
||||
filesystem/bin/%: programs/coreutils/Cargo.toml programs/coreutils/src/bin/%.rs $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,15 +0,0 @@
|
|||
drivers: \
|
||||
filesystem/sbin/pcid \
|
||||
filesystem/sbin/e1000d \
|
||||
filesystem/sbin/rtl8168d \
|
||||
filesystem/sbin/xhcid
|
||||
|
||||
initfs/bin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p initfs/bin
|
||||
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
||||
|
||||
filesystem/sbin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/sbin
|
||||
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,21 +0,0 @@
|
|||
extrautils: \
|
||||
filesystem/bin/calc \
|
||||
filesystem/bin/cksum \
|
||||
filesystem/bin/cur \
|
||||
filesystem/bin/grep \
|
||||
filesystem/bin/gunzip \
|
||||
filesystem/bin/gzip \
|
||||
filesystem/bin/less \
|
||||
filesystem/bin/man \
|
||||
filesystem/bin/mdless \
|
||||
filesystem/bin/mtxt \
|
||||
filesystem/bin/rem \
|
||||
filesystem/bin/resize \
|
||||
filesystem/bin/screenfetch \
|
||||
filesystem/bin/tar
|
||||
#filesystem/bin/dmesg filesystem/bin/info filesystem/bin/watch
|
||||
|
||||
filesystem/bin/%: programs/extrautils/Cargo.toml programs/extrautils/src/bin/%.rs $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,7 +0,0 @@
|
|||
installer: \
|
||||
filesystem/bin/redox_installer
|
||||
|
||||
filesystem/bin/redox_installer: installer/Cargo.toml installer/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin redox_installer $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,11 +0,0 @@
|
|||
ion: \
|
||||
filesystem/bin/ion \
|
||||
filesystem/bin/sh
|
||||
|
||||
filesystem/test/ion: programs/ion/Cargo.toml programs/ion/src/** $(BUILD)/libstd.rlib $(BUILD)/libtest.rlib
|
||||
mkdir -p filesystem/test
|
||||
$(CARGO) test --no-run --manifest-path $< $(CARGOFLAGS)
|
||||
cp programs/ion/target/$(TARGET)/release/deps/ion-* $@
|
||||
|
||||
filesystem/bin/sh: filesystem/bin/ion
|
||||
cp $< $@
|
|
@ -1,49 +0,0 @@
|
|||
userspace: \
|
||||
drivers \
|
||||
coreutils \
|
||||
extrautils \
|
||||
installer \
|
||||
ion \
|
||||
netutils \
|
||||
orbutils \
|
||||
pkgutils \
|
||||
userutils \
|
||||
schemes \
|
||||
filesystem/bin/acid \
|
||||
filesystem/bin/contain \
|
||||
filesystem/bin/smith \
|
||||
filesystem/bin/timeout \
|
||||
filesystem/ui/bin/orbterm \
|
||||
filesystem/ui/bin/sodium
|
||||
|
||||
include mk/userspace/coreutils.mk
|
||||
include mk/userspace/drivers.mk
|
||||
include mk/userspace/extrautils.mk
|
||||
include mk/userspace/installer.mk
|
||||
include mk/userspace/ion.mk
|
||||
include mk/userspace/netutils.mk
|
||||
include mk/userspace/orbutils.mk
|
||||
include mk/userspace/pkgutils.mk
|
||||
include mk/userspace/schemes.mk
|
||||
include mk/userspace/userutils.mk
|
||||
|
||||
$(BUILD)/libstd.rlib: rust/src/libstd/Cargo.toml rust/src/libstd/**
|
||||
mkdir -p $(BUILD)
|
||||
$(CARGO) rustc --manifest-path $< --features "panic-unwind" $(CARGOFLAGS) -L native=libc-artifacts/usr/lib -o $@
|
||||
cp rust/src/target/$(TARGET)/release/deps/*.rlib $(BUILD)
|
||||
|
||||
$(BUILD)/libtest.rlib: rust/src/libtest/Cargo.toml rust/src/libtest/** $(BUILD)/libstd.rlib
|
||||
mkdir -p $(BUILD)
|
||||
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -L native=libc-artifacts/usr/lib -o $@
|
||||
cp rust/src/target/$(TARGET)/release/deps/*.rlib $(BUILD)
|
||||
|
||||
filesystem/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
||||
|
||||
filesystem/ui/bin/%: programs/%/Cargo.toml programs/%/src/**.rs $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/ui/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
netutils: \
|
||||
filesystem/bin/dhcpd \
|
||||
filesystem/bin/dns \
|
||||
filesystem/bin/httpd \
|
||||
filesystem/bin/irc \
|
||||
filesystem/bin/nc \
|
||||
filesystem/bin/ntp \
|
||||
filesystem/bin/telnetd \
|
||||
filesystem/bin/wget
|
||||
|
||||
filesystem/bin/%: programs/netutils/Cargo.toml programs/netutils/src/%/**.rs $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,15 +0,0 @@
|
|||
orbutils: \
|
||||
filesystem/ui/bin/browser \
|
||||
filesystem/ui/bin/calculator \
|
||||
filesystem/ui/bin/character_map \
|
||||
filesystem/ui/bin/editor \
|
||||
filesystem/ui/bin/file_manager \
|
||||
filesystem/ui/bin/launcher \
|
||||
filesystem/ui/bin/orblogin \
|
||||
filesystem/ui/bin/orbterm \
|
||||
filesystem/ui/bin/viewer
|
||||
|
||||
filesystem/ui/bin/%: programs/orbutils/Cargo.toml programs/orbutils/src/%/**.rs $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/ui/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,7 +0,0 @@
|
|||
pkgutils: \
|
||||
filesystem/bin/pkg
|
||||
|
||||
filesystem/bin/%: programs/pkgutils/Cargo.toml programs/pkgutils/src/*.rs programs/pkgutils/src/bin/%.rs $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,25 +0,0 @@
|
|||
schemes: \
|
||||
filesystem/sbin/ethernetd \
|
||||
filesystem/sbin/ipd \
|
||||
filesystem/sbin/orbital \
|
||||
filesystem/sbin/ptyd \
|
||||
filesystem/sbin/randd \
|
||||
filesystem/sbin/redoxfs \
|
||||
filesystem/sbin/redoxfs-mkfs \
|
||||
filesystem/sbin/tcpd \
|
||||
filesystem/sbin/udpd
|
||||
|
||||
initfs/bin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p initfs/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
||||
|
||||
filesystem/sbin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/sbin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
||||
|
||||
filesystem/sbin/redoxfs-mkfs: schemes/redoxfs/Cargo.toml schemes/redoxfs/src/** $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin redoxfs-mkfs $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
|
@ -1,13 +0,0 @@
|
|||
userutils: \
|
||||
filesystem/bin/getty \
|
||||
filesystem/bin/id \
|
||||
filesystem/bin/login \
|
||||
filesystem/bin/passwd \
|
||||
filesystem/bin/su \
|
||||
filesystem/bin/sudo \
|
||||
filesystem/bin/whoami
|
||||
|
||||
filesystem/bin/%: programs/userutils/Cargo.toml programs/userutils/src/bin/%.rs $(BUILD)/libstd.rlib
|
||||
mkdir -p filesystem/bin
|
||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||
$(STRIP) $@
|
Loading…
Add table
Add a link
Reference in a new issue