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

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

View file

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

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