From 939b650125fc8885f9c5300f2f829f62f6b9652f Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 12 Sep 2022 07:51:13 -0600 Subject: [PATCH] Build repository outside of installer --- Makefile | 34 ++++++++++------------------------ installer | 2 +- mk/bootloader.mk | 40 ---------------------------------------- mk/config.mk | 15 ++++++++------- mk/disk.mk | 18 ++++-------------- mk/repo.mk | 16 ++++++++++++++++ 6 files changed, 39 insertions(+), 86 deletions(-) delete mode 100644 mk/bootloader.mk create mode 100644 mk/repo.mk diff --git a/Makefile b/Makefile index 12f575c..7807ea4 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,11 @@ include mk/depends.mk all: build/harddrive.img -coreboot: build/coreboot.elf - live: build/livedisk.iso rebuild: - touch $(FILESYSTEM_CONFIG) + -$(FUMOUNT) build/filesystem/ || true + rm -rf build $(MAKE) all clean: @@ -32,24 +31,15 @@ pull: git submodule sync --recursive git submodule update --recursive --init -update: - cd cookbook && ./update.sh \ - "$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../$(FILESYSTEM_CONFIG))" - cargo update --manifest-path cookbook/pkgutils/Cargo.toml - cargo update --manifest-path installer/Cargo.toml - cargo update --manifest-path redoxfs/Cargo.toml - cargo update --manifest-path relibc/Cargo.toml +fetch: build/fetch.tag -fetch: - cargo build --manifest-path cookbook/Cargo.toml --release - cd cookbook && ./fetch.sh \ - "$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../$(FILESYSTEM_CONFIG))" +repo: build/repo.tag # Cross compiler recipes include mk/prefix.mk -# Bootloader recipes -include mk/bootloader.mk +# Repository maintenance +include mk/repo.mk # Disk images include mk/disk.mk @@ -62,7 +52,7 @@ include mk/virtualbox.mk # CI image target IMG_TAG?=$(shell git describe --tags) ci-img: FORCE - $(MAKE) INSTALLER_FLAGS= \ + $(MAKE) REPO_BINARY=1 \ build/harddrive.img.gz \ build/livedisk.iso.gz rm -rf build/img @@ -73,9 +63,10 @@ ci-img: FORCE # CI packaging target ci-pkg: prefix FORCE - cargo build --manifest-path cookbook/Cargo.toml --release + $(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release + $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release export PATH="$(PREFIX_PATH):$$PATH" && \ - PACKAGES="$$(cargo run --manifest-path installer/Cargo.toml -- --list-packages -c ci.toml)" && \ + PACKAGES="$$($(INSTALLER) --list-packages -c ci.toml)" && \ cd cookbook && \ ./fetch.sh "$${PACKAGES}" && \ ./repo.sh "$${PACKAGES}" @@ -107,11 +98,6 @@ FORCE: %.gz: % gzip -k -f $< -# Create a listing for any binary -%.list: % - export PATH="$(PREFIX_PATH):$$PATH" && \ - $(OBJDUMP) -C -M intel -D $< > $@ - # Wireshark wireshark: FORCE wireshark build/network.pcap diff --git a/installer b/installer index 5e8e596..fa83600 160000 --- a/installer +++ b/installer @@ -1 +1 @@ -Subproject commit 5e8e596d409f6ae6b6531c57673b16266688434f +Subproject commit fa836008c09d71f40e4c5bdb5a8755ddcd227f89 diff --git a/mk/bootloader.mk b/mk/bootloader.mk deleted file mode 100644 index 72d4ea1..0000000 --- a/mk/bootloader.mk +++ /dev/null @@ -1,40 +0,0 @@ -bootloader/build/$(BOOTLOADER_TARGET)/bootloader.bin: FORCE - env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \ - $(MAKE) -C bootloader build/$(BOOTLOADER_TARGET)/bootloader.bin TARGET=$(BOOTLOADER_TARGET) - -build/bootloader.bin: bootloader/build/$(BOOTLOADER_TARGET)/bootloader.bin - mkdir -p build - cp -v $< $@ - -bootloader/build/$(BOOTLOADER_TARGET)/bootloader-live.bin: FORCE - env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \ - $(MAKE) -C bootloader build/$(BOOTLOADER_TARGET)/bootloader-live.bin TARGET=$(BOOTLOADER_TARGET) - -build/bootloader-live.bin: bootloader/build/$(BOOTLOADER_TARGET)/bootloader-live.bin - mkdir -p build - cp -v $< $@ - -bootloader/build/$(EFI_TARGET)/bootloader.efi: FORCE - env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \ - $(MAKE) -C bootloader build/$(EFI_TARGET)/bootloader.efi TARGET=$(EFI_TARGET) - -build/bootloader.efi: bootloader/build/$(EFI_TARGET)/bootloader.efi - mkdir -p build - cp -v $< $@ - -bootloader/build/$(EFI_TARGET)/bootloader-live.efi: FORCE - env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \ - $(MAKE) -C bootloader build/$(EFI_TARGET)/bootloader-live.efi TARGET=$(EFI_TARGET) - -build/bootloader-live.efi: bootloader/build/$(EFI_TARGET)/bootloader-live.efi - mkdir -p build - cp -v $< $@ - -#TODO: update coreboot bootloader/kernel -# bootloader-coreboot/build/bootloader: build/kernel_coreboot -# env --unset=RUST_TARGET_PATH --unset=RUSTUP_TOOLCHAIN --unset=XARGO_RUST_SRC \ -# $(MAKE) -C bootloader-coreboot clean build/bootloader KERNEL="$(ROOT)/$<" -# -# build/coreboot.elf: bootloader-coreboot/build/bootloader -# mkdir -p build -# cp -v $< $@ diff --git a/mk/config.mk b/mk/config.mk index 8a59e8c..03f25ad 100644 --- a/mk/config.mk +++ b/mk/config.mk @@ -3,10 +3,10 @@ # Configuration ## Architecture to build Redox for (aarch64, i686, or x86_64) ARCH?=x86_64 -## Flags to pass to the installer (empty to download binary packages) -INSTALLER_FLAGS?=--cookbook=cookbook -## Enabled to use binary prefix (much faster) +## Enable to use binary prefix (much faster) PREFIX_BINARY?=1 +## Enable to use binary packages (much faster) +REPO_BINARY?=0 ## Select filesystem config FILESYSTEM_CONFIG?=config/$(ARCH)/desktop.toml ## Filesystem size in MB (256 is the default) @@ -51,10 +51,11 @@ export XARGO_RUST_SRC=$(ROOT)/rust/src ## Userspace variables export TARGET=$(ARCH)-unknown-redox -BUILD=build/userspace -INSTALLER=\ - export PATH="$(PREFIX_PATH):$$PATH" && \ - installer/target/release/redox_installer $(INSTALLER_FLAGS) +INSTALLER=installer/target/release/redox_installer +ifeq ($(REPO_BINARY),0) +INSTALLER+=--cookbook=cookbook +REPO_TAG=build/repo.tag +endif ## Cross compiler variables AR=$(TARGET)-gcc-ar diff --git a/mk/disk.mk b/mk/disk.mk index 2a45c44..0bbfc69 100644 --- a/mk/disk.mk +++ b/mk/disk.mk @@ -1,31 +1,21 @@ -build/harddrive.img: prefix $(FILESYSTEM_CONFIG) - $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release - mkdir -p build +build/harddrive.img: $(REPO_TAG) rm -rf $@ $@.partial fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial $(INSTALLER) -c $(FILESYSTEM_CONFIG) $@.partial mv $@.partial $@ -build/livedisk.iso: prefix $(FILESYSTEM_CONFIG) - $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release - mkdir -p build +build/livedisk.iso: $(REPO_TAG) rm -rf $@ $@.partial fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial $(INSTALLER) -c $(FILESYSTEM_CONFIG) --live $@.partial mv $@.partial $@ -build/filesystem.img: prefix $(FILESYSTEM_CONFIG) - mkdir -p build - $(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release - $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release +build/filesystem.img: $(REPO_TAG) $(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release -$(FUMOUNT) build/filesystem/ || true rm -rf $@ $@.partial build/filesystem/ fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial - $(HOST_CARGO) run --release \ - --manifest-path redoxfs/Cargo.toml \ - --bin redoxfs-mkfs \ - -- $(REDOXFS_MKFS_FLAGS) $@.partial + redoxfs/target/release/redoxfs-mkfs $(REDOXFS_MKFS_FLAGS) $@.partial mkdir -p build/filesystem/ redoxfs/target/release/redoxfs $@.partial build/filesystem/ sleep 1 diff --git a/mk/repo.mk b/mk/repo.mk new file mode 100644 index 0000000..46febb5 --- /dev/null +++ b/mk/repo.mk @@ -0,0 +1,16 @@ +build/fetch.tag: cookbook installer prefix $(FILESYSTEM_CONFIG) + $(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release + $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release + PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \ + cd cookbook && \ + ./fetch.sh "$${PACKAGES}" + +build/repo.tag: build/fetch.tag + $(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release + $(HOST_CARGO) build --manifest-path installer/Cargo.toml --release + export PATH="$(PREFIX_PATH):$$PATH" && \ + PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \ + cd cookbook && \ + ./repo.sh "$${PACKAGES}" + mkdir -p build + touch $@