Initfs makefile

This commit is contained in:
Mark 2024-12-15 21:27:29 -08:00
parent b156510422
commit 0f42691db8
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
7 changed files with 34 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
/build
**/target
/tools
*.ignore

3
.gitmodules vendored
View File

@ -22,3 +22,6 @@
[submodule "components/sources/zerod"]
path = components/sources/zerod
url = https://gitlab.redox-os.org/redox-os/zerod.git
[submodule "tools/initfs"]
path = tools/initfs
url = https://gitlab.redox-os.org/redox-os/redox-initfs.git

View File

@ -1,6 +1,6 @@
BUILD=./build
TOOLCHAIN = $(CURDIR)/../tools/x86_64-unknown-redox/toolchain
TOOLCHAIN = $(CURDIR)/../tools/bin/x86_64-unknown-redox/toolchain
CARGO = $(TOOLCHAIN)/bin/cargo
PATH := $(TOOLCHAIN)/bin:$(PATH)

View File

@ -1,13 +1,19 @@
$(BUILD_DIR)/filesystem:
@mkdir -p $(BUILD_DIR)
rm -f $@.partial
mkdir $@.partial
fallocate -l 1MiB $@.partial/kernel
mv $@.partial $@
$(BUILD_DIR)/filesystem/boot/initfs: $(shell find ./components -type f -not -path "*/target/*")
@mkdir -p $(BUILD_DIR)/filesystem/boot
rm -f $@
make -C tools
make -C components
./tools/bin/redox-initfs-ar --output $@ ./components/build
$(BUILD_DIR)/filesystem.img: $(BUILD_DIR)/filesystem
$(BUILD_DIR)/filesystem/boot/kernel:
@mkdir -p $(BUILD_DIR)/filesystem/boot
rm -f $@
fallocate -l 1MiB $(BUILD_DIR)/filesystem/boot/kernel
$(BUILD_DIR)/filesystem.img: $(BUILD_DIR)/filesystem/boot/kernel $(BUILD_DIR)/filesystem/boot/initfs
@mkdir -p $(BUILD_DIR)
rm -f $@.partial
fallocate -l 254MiB $@.partial
redoxfs-ar $@.partial $<
redoxfs-ar $@.partial $(BUILD_DIR)/filesystem
mv $@.partial $@

1
tools/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bin

14
tools/Makefile Normal file
View File

@ -0,0 +1,14 @@
.PHONY: all
all: bin/redox-initfs-ar bin/redox-initfs-dump
bin/redox-initfs-ar: $(shell find ./initfs -type f -not -path "*/target/*")
@mkdir -p bin
cd initfs/tools && \
cargo build --release --bin redox-initfs-ar
cp initfs/target/release/redox-initfs-ar $@
bin/redox-initfs-dump: $(shell find ./initfs -type f -not -path "*/target/*")
@mkdir -p bin
cd initfs/tools && \
cargo build --release --bin redox-initfs-dump
cp initfs/target/release/redox-initfs-dump $@

1
tools/initfs Submodule

@ -0,0 +1 @@
Subproject commit d0802237d7894881df7ddd338dfc64220d0646ff