Compare commits

..

8 Commits

Author SHA1 Message Date
Jeremy Soller 1e269d9fab
Add INSTALLER variable 2020-05-22 19:56:04 -06:00
Jeremy Soller 92b9c3892f
Set RUSTUP_TOOLCHAIN to rust-install by default 2020-05-22 19:54:57 -06:00
Jeremy Soller 33e425c95c
Set REDOXER_TOOLCHAIN in preperation for new cookbook 2020-05-22 16:04:13 -06:00
Jeremy Soller 621066cb53
Remove PREFIX_RUSTC 2020-05-22 16:00:40 -06:00
Jeremy Soller 5be4d46b50
Set relibc base depending on PREFIX_BINARY and PREFIX_RUSTC 2020-05-22 15:55:19 -06:00
Jeremy Soller 75c7456141
Update relibc 2020-05-22 15:50:00 -06:00
Jeremy Soller db8bc29994
Build redoxfs and installer outside of build environment 2020-05-22 15:45:34 -06:00
Jeremy Soller 5d6a610024
Download rust-install if PREFIX_BINARY is 1 2020-05-22 15:45:13 -06:00
5 changed files with 72 additions and 57 deletions

View File

@ -5,8 +5,6 @@ ARCH?=x86_64
INSTALLER_FLAGS?=--cookbook=cookbook INSTALLER_FLAGS?=--cookbook=cookbook
## Enabled to use binary prefix (much faster) ## Enabled to use binary prefix (much faster)
PREFIX_BINARY?=1 PREFIX_BINARY?=1
## Enabled to build custom rustc
PREFIX_RUSTC?=1
## Filesystem size in MB (256 is the default) ## Filesystem size in MB (256 is the default)
FILESYSTEM_SIZE?=256 FILESYSTEM_SIZE?=256
@ -48,6 +46,10 @@ KBUILD=build/kernel
## Userspace variables ## Userspace variables
export TARGET=$(ARCH)-unknown-redox export TARGET=$(ARCH)-unknown-redox
BUILD=build/userspace BUILD=build/userspace
INSTALLER=\
export REDOXER_TOOLCHAIN="$(ROOT)/$(PREFIX_INSTALL)" && \
export PATH="$(PREFIX_PATH):$$PATH" && \
installer/target/release/redox_installer $(INSTALLER_FLAGS)
## Bootloader variables ## Bootloader variables
EFI_TARGET=$(ARCH)-efi-pe EFI_TARGET=$(ARCH)-efi-pe

View File

@ -1,11 +1,12 @@
build/filesystem.bin: filesystem.toml build/bootloader build/kernel prefix build/filesystem.bin: filesystem.toml build/bootloader build/kernel prefix
cargo build --manifest-path installer/Cargo.toml --release
cargo build --manifest-path redoxfs/Cargo.toml --release
-$(FUMOUNT) build/filesystem/ || true -$(FUMOUNT) build/filesystem/ || true
rm -rf $@ $@.partial build/filesystem/ rm -rf $@ $@.partial build/filesystem/
dd if=/dev/zero of=$@.partial bs=1048576 count="$(FILESYSTEM_SIZE)" dd if=/dev/zero of=$@.partial bs=1048576 count="$(FILESYSTEM_SIZE)"
cargo run --manifest-path redoxfs/Cargo.toml --release --bin redoxfs-mkfs $@.partial cargo run --manifest-path redoxfs/Cargo.toml --release --bin redoxfs-mkfs $@.partial
mkdir -p build/filesystem/ mkdir -p build/filesystem/
cargo build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs redoxfs/target/release/redoxfs $@.partial build/filesystem/
cargo run --manifest-path redoxfs/Cargo.toml --release --bin redoxfs -- $@.partial build/filesystem/
sleep 2 sleep 2
pgrep redoxfs pgrep redoxfs
cp $< build/filesystem/filesystem.toml cp $< build/filesystem/filesystem.toml
@ -13,8 +14,7 @@ build/filesystem.bin: filesystem.toml build/bootloader build/kernel prefix
cp build/kernel build/filesystem/kernel cp build/kernel build/filesystem/kernel
cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/include build/filesystem/include cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/include build/filesystem/include
cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/lib build/filesystem/lib cp -r $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/lib build/filesystem/lib
export PATH="$(PREFIX_PATH):$$PATH" && \ $(INSTALLER) -c $< build/filesystem/
cargo run --manifest-path installer/Cargo.toml --release -- $(INSTALLER_FLAGS) -c $< build/filesystem/
sync sync
-$(FUMOUNT) build/filesystem/ || true -$(FUMOUNT) build/filesystem/ || true
rm -rf build/filesystem/ rm -rf build/filesystem/
@ -23,14 +23,14 @@ build/filesystem.bin: filesystem.toml build/bootloader build/kernel prefix
mount: FORCE mount: FORCE
mkdir -p build/filesystem/ mkdir -p build/filesystem/
cargo build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs cargo build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs
cargo run --manifest-path redoxfs/Cargo.toml --release --bin redoxfs -- build/harddrive.bin build/filesystem/ redoxfs/target/release/redoxfs build/harddrive.bin build/filesystem/
sleep 2 sleep 2
pgrep redoxfs pgrep redoxfs
mount_extra: FORCE mount_extra: FORCE
mkdir -p build/filesystem/ mkdir -p build/filesystem/
cargo build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs cargo build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs
cargo run --manifest-path redoxfs/Cargo.toml --release --bin redoxfs -- build/extra.bin build/filesystem/ redoxfs/target/release/redoxfs build/extra.bin build/filesystem/
sleep 2 sleep 2
pgrep redoxfs pgrep redoxfs

View File

@ -1,23 +1,23 @@
build/initfs.tag: initfs.toml prefix build/initfs.tag: initfs.toml prefix
cargo build --manifest-path installer/Cargo.toml --release
rm -f build/libkernel.a rm -f build/libkernel.a
rm -rf build/initfs rm -rf build/initfs
mkdir -p build/initfs mkdir -p build/initfs
export PATH="$(PREFIX_PATH):$$PATH" && \ $(INSTALLER) -c $< build/initfs/
cargo run --manifest-path installer/Cargo.toml -- $(INSTALLER_FLAGS) -c $< build/initfs/
touch $@ touch $@
build/initfs_coreboot.tag: initfs_coreboot.toml prefix build/initfs_coreboot.tag: initfs_coreboot.toml prefix
cargo build --manifest-path installer/Cargo.toml --release
rm -f build/libkernel_coreboot.a rm -f build/libkernel_coreboot.a
rm -rf build/initfs_coreboot rm -rf build/initfs_coreboot
mkdir -p build/initfs_coreboot mkdir -p build/initfs_coreboot
export PATH="$(PREFIX_PATH):$$PATH" && \ $(INSTALLER) -c $< build/initfs_coreboot/
cargo run --manifest-path installer/Cargo.toml -- $(INSTALLER_FLAGS) -c $< build/initfs_coreboot/
touch $@ touch $@
build/initfs_live.tag: initfs_live.toml prefix build/initfs_live.tag: initfs_live.toml prefix
cargo build --manifest-path installer/Cargo.toml --release
rm -f build/libkernel_live.a rm -f build/libkernel_live.a
rm -rf build/initfs_live rm -rf build/initfs_live
mkdir -p build/initfs_live mkdir -p build/initfs_live
export PATH="$(PREFIX_PATH):$$PATH" && \ $(INSTALLER) -c $< build/initfs_live/
cargo run --manifest-path installer/Cargo.toml -- $(INSTALLER_FLAGS) -c $< build/initfs_live/
touch $@ touch $@

View File

@ -1,17 +1,16 @@
PREFIX=prefix/$(TARGET) PREFIX=prefix/$(TARGET)
PREFIX_BASE_INSTALL=$(PREFIX)/binutils-install PREFIX_BASE_INSTALL=$(PREFIX)/rust-freestanding-install
PREFIX_FREESTANDING_INSTALL=$(PREFIX)/gcc-freestanding-install PREFIX_FREESTANDING_INSTALL=$(PREFIX)/gcc-freestanding-install
PREFIX_INSTALL=$(PREFIX)/relibc-install PREFIX_INSTALL=$(PREFIX)/relibc-install
ifeq ($(PREFIX_RUSTC),1)
PREFIX_BASE_INSTALL=$(PREFIX)/rust-freestanding-install
ifeq ($(PREFIX_BINARY),1) ifeq ($(PREFIX_BINARY),1)
export RUSTUP_TOOLCHAIN=$(ROOT)/$(PREFIX)/gcc-install PREFIX_RELIBC_BASE=$(PREFIX)/rust-install
export RUSTUP_TOOLCHAIN=$(ROOT)/$(PREFIX)/rust-install
else else
PREFIX_RELIBC_BASE=$(PREFIX)/gcc-install
export RUSTUP_TOOLCHAIN=$(ROOT)/$(PREFIX)/rust-freestanding-install export RUSTUP_TOOLCHAIN=$(ROOT)/$(PREFIX)/rust-freestanding-install
endif endif
endif
PREFIX_BASE_PATH=$(ROOT)/$(PREFIX_BASE_INSTALL)/bin PREFIX_BASE_PATH=$(ROOT)/$(PREFIX_BASE_INSTALL)/bin
PREFIX_FREESTANDING_PATH=$(ROOT)/$(PREFIX_FREESTANDING_INSTALL)/bin PREFIX_FREESTANDING_PATH=$(ROOT)/$(PREFIX_FREESTANDING_INSTALL)/bin
@ -32,9 +31,11 @@ PREFIX_STRIP=\
-exec strip --strip-unneeded {} ';' \ -exec strip --strip-unneeded {} ';' \
2> /dev/null 2> /dev/null
$(PREFIX)/relibc-install: $(ROOT)/relibc | $(PREFIX)/gcc-install $(PREFIX)/relibc-install: $(ROOT)/relibc | $(PREFIX_RELIBC_BASE)
rm -rf "$@.partial" "$@" rm -rf "$@.partial" "$@"
cp -r "$(PREFIX)/gcc-install" "$@.partial" cp -r "$(PREFIX_RELIBC_BASE)" "$@.partial"
rm -rf "$@.partial/$(TARGET)/include/"*
cp -r "$(PREFIX_RELIBC_BASE)/$(TARGET)/include/c++" "$@.partial/$(TARGET)/include/c++"
cd "$<" && \ cd "$<" && \
export PATH="$(ROOT)/$@.partial/bin:$$PATH" && \ export PATH="$(ROOT)/$@.partial/bin:$$PATH" && \
export CARGO="env -u CARGO xargo" && \ export CARGO="env -u CARGO xargo" && \
@ -52,38 +53,6 @@ $(PREFIX)/relibc-install.tar.gz: $(PREFIX)/relibc-install
--directory="$<" \ --directory="$<" \
. .
$(PREFIX)/rust-install: $(ROOT)/rust | $(PREFIX)/relibc-install
rm -rf "$(PREFIX)/rust-build" "$@.partial" "$@"
mkdir -p "$(PREFIX)/rust-build"
cp -r "$(PREFIX)/relibc-install" "$@.partial"
cd "$(PREFIX)/rust-build" && \
export PATH="$(ROOT)/$@.partial/bin:$$PATH" && \
"$</configure" \
--prefix="/" \
--disable-docs \
--enable-cargo-native-static \
--enable-extended \
--enable-llvm-static-stdcpp \
--tools=cargo \
--target="$(TARGET)" \
&& \
$(MAKE) -j `$(NPROC)` && \
rm -rf "$(ROOT)/$@.partial/lib/rustlib" "$(ROOT)/$@.partial/share/doc/rust" && \
$(MAKE) -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
rm -rf "$(PREFIX)/rust-build"
mkdir -p "$@.partial/lib/rustlib/x86_64-unknown-linux-gnu/bin"
cd "$@.partial" && find . -name *.old -exec rm {} ';' && $(PREFIX_STRIP)
touch "$@.partial"
mv "$@.partial" "$@"
$(PREFIX)/rust-install.tar.gz: $(PREFIX)/rust-install
tar \
--create \
--gzip \
--file "$@" \
--directory="$<" \
.
ifeq ($(PREFIX_BINARY),1) ifeq ($(PREFIX_BINARY),1)
$(PREFIX)/gcc-install.tar.gz: $(PREFIX)/gcc-install.tar.gz:
@ -98,6 +67,18 @@ $(PREFIX)/gcc-install: $(PREFIX)/gcc-install.tar.gz
touch "$@.partial" touch "$@.partial"
mv "$@.partial" "$@" mv "$@.partial" "$@"
$(PREFIX)/rust-install.tar.gz:
mkdir -p "$(@D)"
wget -O $@.partial "https://static.redox-os.org/toolchain/$(TARGET)/rust-install.tar.gz"
mv $@.partial $@
$(PREFIX)/rust-install: $(PREFIX)/rust-install.tar.gz
rm -rf "$@.partial" "$@"
mkdir -p "$@.partial"
tar --extract --file "$<" --directory "$@.partial" --strip-components=1
touch "$@.partial"
mv "$@.partial" "$@"
else else
$(PREFIX)/binutils.tar.bz2: $(PREFIX)/binutils.tar.bz2:
@ -232,4 +213,36 @@ $(PREFIX)/gcc-install.tar.gz: $(PREFIX)/gcc-install
--file "$@" \ --file "$@" \
--directory="$<" \ --directory="$<" \
. .
$(PREFIX)/rust-install: $(ROOT)/rust | $(PREFIX)/relibc-install
rm -rf "$(PREFIX)/rust-build" "$@.partial" "$@"
mkdir -p "$(PREFIX)/rust-build"
cp -r "$(PREFIX)/relibc-install" "$@.partial"
cd "$(PREFIX)/rust-build" && \
export PATH="$(ROOT)/$@.partial/bin:$$PATH" && \
"$</configure" \
--prefix="/" \
--disable-docs \
--enable-cargo-native-static \
--enable-extended \
--enable-llvm-static-stdcpp \
--tools=cargo \
--target="$(TARGET)" \
&& \
$(MAKE) -j `$(NPROC)` && \
rm -rf "$(ROOT)/$@.partial/lib/rustlib" "$(ROOT)/$@.partial/share/doc/rust" && \
$(MAKE) -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
rm -rf "$(PREFIX)/rust-build"
mkdir -p "$@.partial/lib/rustlib/x86_64-unknown-linux-gnu/bin"
cd "$@.partial" && find . -name *.old -exec rm {} ';' && $(PREFIX_STRIP)
touch "$@.partial"
mv "$@.partial" "$@"
$(PREFIX)/rust-install.tar.gz: $(PREFIX)/rust-install
tar \
--create \
--gzip \
--file "$@" \
--directory="$<" \
.
endif endif

2
relibc

@ -1 +1 @@
Subproject commit a6fffd3fb57b96e4b4769da2e205f2a2be09a23f Subproject commit 0cc0fbecdc40956a74863154d4eb9109b97db3d2