Build repository outside of installer

This commit is contained in:
Jeremy Soller 2022-09-12 07:51:13 -06:00
parent 25f4950761
commit 939b650125
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE
6 changed files with 39 additions and 86 deletions

View file

@ -6,12 +6,11 @@ include mk/depends.mk
all: build/harddrive.img all: build/harddrive.img
coreboot: build/coreboot.elf
live: build/livedisk.iso live: build/livedisk.iso
rebuild: rebuild:
touch $(FILESYSTEM_CONFIG) -$(FUMOUNT) build/filesystem/ || true
rm -rf build
$(MAKE) all $(MAKE) all
clean: clean:
@ -32,24 +31,15 @@ pull:
git submodule sync --recursive git submodule sync --recursive
git submodule update --recursive --init git submodule update --recursive --init
update: fetch: build/fetch.tag
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: repo: build/repo.tag
cargo build --manifest-path cookbook/Cargo.toml --release
cd cookbook && ./fetch.sh \
"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../$(FILESYSTEM_CONFIG))"
# Cross compiler recipes # Cross compiler recipes
include mk/prefix.mk include mk/prefix.mk
# Bootloader recipes # Repository maintenance
include mk/bootloader.mk include mk/repo.mk
# Disk images # Disk images
include mk/disk.mk include mk/disk.mk
@ -62,7 +52,7 @@ include mk/virtualbox.mk
# CI image target # CI image target
IMG_TAG?=$(shell git describe --tags) IMG_TAG?=$(shell git describe --tags)
ci-img: FORCE ci-img: FORCE
$(MAKE) INSTALLER_FLAGS= \ $(MAKE) REPO_BINARY=1 \
build/harddrive.img.gz \ build/harddrive.img.gz \
build/livedisk.iso.gz build/livedisk.iso.gz
rm -rf build/img rm -rf build/img
@ -73,9 +63,10 @@ ci-img: FORCE
# CI packaging target # CI packaging target
ci-pkg: prefix FORCE 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" && \ 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 && \ cd cookbook && \
./fetch.sh "$${PACKAGES}" && \ ./fetch.sh "$${PACKAGES}" && \
./repo.sh "$${PACKAGES}" ./repo.sh "$${PACKAGES}"
@ -107,11 +98,6 @@ FORCE:
%.gz: % %.gz: %
gzip -k -f $< gzip -k -f $<
# Create a listing for any binary
%.list: %
export PATH="$(PREFIX_PATH):$$PATH" && \
$(OBJDUMP) -C -M intel -D $< > $@
# Wireshark # Wireshark
wireshark: FORCE wireshark: FORCE
wireshark build/network.pcap wireshark build/network.pcap

@ -1 +1 @@
Subproject commit 5e8e596d409f6ae6b6531c57673b16266688434f Subproject commit fa836008c09d71f40e4c5bdb5a8755ddcd227f89

View file

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

View file

@ -3,10 +3,10 @@
# Configuration # Configuration
## Architecture to build Redox for (aarch64, i686, or x86_64) ## Architecture to build Redox for (aarch64, i686, or x86_64)
ARCH?=x86_64 ARCH?=x86_64
## Flags to pass to the installer (empty to download binary packages) ## Enable to use binary prefix (much faster)
INSTALLER_FLAGS?=--cookbook=cookbook
## Enabled to use binary prefix (much faster)
PREFIX_BINARY?=1 PREFIX_BINARY?=1
## Enable to use binary packages (much faster)
REPO_BINARY?=0
## Select filesystem config ## Select filesystem config
FILESYSTEM_CONFIG?=config/$(ARCH)/desktop.toml FILESYSTEM_CONFIG?=config/$(ARCH)/desktop.toml
## Filesystem size in MB (256 is the default) ## Filesystem size in MB (256 is the default)
@ -51,10 +51,11 @@ export XARGO_RUST_SRC=$(ROOT)/rust/src
## Userspace variables ## Userspace variables
export TARGET=$(ARCH)-unknown-redox export TARGET=$(ARCH)-unknown-redox
BUILD=build/userspace INSTALLER=installer/target/release/redox_installer
INSTALLER=\ ifeq ($(REPO_BINARY),0)
export PATH="$(PREFIX_PATH):$$PATH" && \ INSTALLER+=--cookbook=cookbook
installer/target/release/redox_installer $(INSTALLER_FLAGS) REPO_TAG=build/repo.tag
endif
## Cross compiler variables ## Cross compiler variables
AR=$(TARGET)-gcc-ar AR=$(TARGET)-gcc-ar

View file

@ -1,31 +1,21 @@
build/harddrive.img: prefix $(FILESYSTEM_CONFIG) build/harddrive.img: $(REPO_TAG)
$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
mkdir -p build
rm -rf $@ $@.partial rm -rf $@ $@.partial
fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial
$(INSTALLER) -c $(FILESYSTEM_CONFIG) $@.partial $(INSTALLER) -c $(FILESYSTEM_CONFIG) $@.partial
mv $@.partial $@ mv $@.partial $@
build/livedisk.iso: prefix $(FILESYSTEM_CONFIG) build/livedisk.iso: $(REPO_TAG)
$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
mkdir -p build
rm -rf $@ $@.partial rm -rf $@ $@.partial
fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial
$(INSTALLER) -c $(FILESYSTEM_CONFIG) --live $@.partial $(INSTALLER) -c $(FILESYSTEM_CONFIG) --live $@.partial
mv $@.partial $@ mv $@.partial $@
build/filesystem.img: prefix $(FILESYSTEM_CONFIG) build/filesystem.img: $(REPO_TAG)
mkdir -p build
$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
$(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release $(HOST_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/
fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" $@.partial
$(HOST_CARGO) run --release \ redoxfs/target/release/redoxfs-mkfs $(REDOXFS_MKFS_FLAGS) $@.partial
--manifest-path redoxfs/Cargo.toml \
--bin redoxfs-mkfs \
-- $(REDOXFS_MKFS_FLAGS) $@.partial
mkdir -p build/filesystem/ mkdir -p build/filesystem/
redoxfs/target/release/redoxfs $@.partial build/filesystem/ redoxfs/target/release/redoxfs $@.partial build/filesystem/
sleep 1 sleep 1

16
mk/repo.mk Normal file
View file

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