Merge branch 'master' into filesystem

This commit is contained in:
Ian Douglas Scott 2017-06-02 19:50:41 -07:00 committed by GitHub
commit 84a2580eb3
122 changed files with 237 additions and 6675 deletions

View file

@ -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)`

View file

@ -1,8 +1,8 @@
build/harddrive.bin: $(KBUILD)/kernel bootloader/$(ARCH)/** build/filesystem.bin
nasm -f bin -o $@ -D ARCH_$(ARCH) -ibootloader/$(ARCH)/ bootloader/$(ARCH)/harddrive.asm
build/harddrive.bin: build/kernel build/filesystem.bin bootloader/$(ARCH)/**
nasm -f bin -o $@ -D ARCH_$(ARCH) -D KERNEL=$< -D FILESYSTEM=build/filesystem.bin -ibootloader/$(ARCH)/ bootloader/$(ARCH)/disk.asm
build/livedisk.bin: $(KBUILD)/kernel_live bootloader/$(ARCH)/**
nasm -f bin -o $@ -D ARCH_$(ARCH) -ibootloader/$(ARCH)/ bootloader/$(ARCH)/livedisk.asm
build/livedisk.bin: build/kernel_live bootloader/$(ARCH)/**
nasm -f bin -o $@ -D ARCH_$(ARCH) -D KERNEL=$< -ibootloader/$(ARCH)/ bootloader/$(ARCH)/disk.asm
build/%.bin.gz: build/%.bin
gzip -k -f $<

View file

@ -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/

View file

@ -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=1024
cargo run --manifest-path schemes/redoxfs/Cargo.toml --quiet --release --bin redoxfs-mkfs $@
rm -rf $@ $@.partial build/filesystem/
dd if=/dev/zero of=$@.partial bs=1048576 count=1024
cargo run --manifest-path installer/redoxfs/Cargo.toml --quiet --release --bin redoxfs-mkfs $@.partial
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 -- $@.partial 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
@ -27,11 +27,12 @@ build/filesystem.bin: userspace
sync
-$(FUMOUNT) build/filesystem/ || true
rm -rf build/filesystem/
mv $@.partial $@
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

View file

@ -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 $@

View file

@ -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/* kernel/src/*/* 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/* kernel/src/*/* kernel/src/*/*/* build/initfs.tag build/filesystem.bin
cd kernel && FILESYSTEM="$(PWD)/build/filesystem.bin" 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 $@ $<

View file

@ -28,28 +28,45 @@ endif
#,int,pcall
#-device intel-iommu
qemu: build/harddrive.bin
$(QEMU) $(QEMUFLAGS) -drive file=$<,format=raw
build/extra.qcow2:
qemu-img create -f qcow2 $@ 256M
qemu_no_build:
$(QEMU) $(QEMUFLAGS) -drive file=build/harddrive.bin,format=raw
qemu: build/harddrive.bin build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-drive file=build/harddrive.bin,format=raw \
-drive file=build/extra.qcow2
qemu_extra: build/harddrive.bin
if [ ! -e build/extra.bin ]; then dd if=/dev/zero of=build/extra.bin bs=1048576 count=1024; fi
$(QEMU) $(QEMUFLAGS) -drive file=$<,format=raw -drive file=build/extra.bin,format=raw,if=none,id=drv0 -device nvme,drive=drv0,serial=NVME_SERIAL
qemu_no_build: build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-drive file=build/harddrive.bin,format=raw \
-drive file=build/extra.qcow2
qemu_extra_no_build:
if [ ! -e build/extra.bin ]; then dd if=/dev/zero of=build/extra.bin bs=1048576 count=1024; fi
$(QEMU) $(QEMUFLAGS) -drive file=$<,format=raw -drive file=build/extra.bin,format=raw
qemu_nvme: build/harddrive.bin build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-drive file=build/harddrive.bin,format=raw -drive file=build/extra.qcow2,if=none,id=drv0 -device nvme,drive=drv0,serial=NVME_SERIAL \
-drive file=build/extra.qcow2
qemu_live: build/livedisk.bin
$(QEMU) $(QEMUFLAGS) -device usb-ehci,id=flash_bus -drive id=flash_drive,file=$<,format=raw,if=none -device usb-storage,drive=flash_drive,bus=flash_bus.0
qemu_nvme_no_build: build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-drive file=build/harddrive.bin,format=raw -drive file=build/extra.qcow2,if=none,id=drv0 -device nvme,drive=drv0,serial=NVME_SERIAL \
-drive file=build/extra.qcow2
qemu_live_no_build:
$(QEMU) $(QEMUFLAGS) -device usb-ehci,id=flash_bus -drive id=flash_drive,file=build/livedisk.bin,format=raw,if=none -device usb-storage,drive=flash_drive,bus=flash_bus.0
qemu_live: build/livedisk.bin build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-device usb-ehci,id=flash_bus -drive id=flash_drive,file=build/livedisk.bin,format=raw,if=none -device usb-storage,drive=flash_drive,bus=flash_bus.0 \
-drive file=build/extra.qcow2
qemu_iso: build/livedisk.iso
$(QEMU) $(QEMUFLAGS) -boot d -cdrom $<
qemu_live_no_build: build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-device usb-ehci,id=flash_bus -drive id=flash_drive,file=build/livedisk.bin,format=raw,if=none -device usb-storage,drive=flash_drive,bus=flash_bus.0 \
-drive file=build/extra.qcow2
qemu_iso_no_build:
$(QEMU) $(QEMUFLAGS) -boot d -cdrom build/livedisk.iso
qemu_iso: build/livedisk.iso build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-boot d -cdrom build/livedisk.iso \
-drive file=build/extra.qcow2
qemu_iso_no_build: build/extra.qcow2
$(QEMU) $(QEMUFLAGS) \
-boot d -cdrom build/livedisk.iso \
-drive file=build/extra.qcow2

View file

@ -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) $@

View file

@ -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) $@

View file

@ -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) $@

View file

@ -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) $@

View file

@ -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 $< $@

View file

@ -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) $@

View file

@ -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) $@

View file

@ -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) $@

View file

@ -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) $@

View file

@ -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) $@

View file

@ -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) $@