Change way to generate initfs for kernel

this change should be merged along with corresponding PR in kernel
This commit is contained in:
Konrad Lipner 2017-02-15 22:47:10 +01:00
parent 52d640b591
commit 4987b70e97
2 changed files with 1 additions and 12 deletions

View file

@ -40,6 +40,7 @@ KCARGOFLAGS=--target $(KTARGET) --release -- -C soft-float
# Userspace variables # Userspace variables
export TARGET=$(ARCH)-unknown-redox export TARGET=$(ARCH)-unknown-redox
BUILD=build/userspace BUILD=build/userspace
export INITFS_FOLDER=$(ROOT)/initfs
RUSTC=./rustc.sh RUSTC=./rustc.sh
RUSTDOC=./rustdoc.sh RUSTDOC=./rustdoc.sh
CARGO=RUSTC="$(RUSTC)" RUSTDOC="$(RUSTDOC)" CARGO_INCREMENTAL=1 cargo CARGO=RUSTC="$(RUSTC)" RUSTDOC="$(RUSTDOC)" CARGO_INCREMENTAL=1 cargo

View file

@ -7,18 +7,6 @@ $(BUILD)/initfs.rs: \
initfs/bin/redoxfs \ initfs/bin/redoxfs \
initfs/bin/vesad \ initfs/bin/vesad \
initfs/etc/** initfs/etc/**
echo 'use collections::BTreeMap;' > $@
echo 'pub fn gen() -> BTreeMap<&'"'"'static [u8], (&'"'"'static [u8], bool)> {' >> $@
echo ' let mut files: BTreeMap<&'"'"'static [u8], (&'"'"'static [u8], bool)> = BTreeMap::new();' >> $@
for folder in `find initfs -type d | sort`; do \
name=$$(echo $$folder | sed 's/initfs//' | cut -d '/' -f2-) ; \
$(ECHO) -n ' files.insert(b"'$$name'", (b"' >> $@ ; \
ls -1 $$folder | sort | awk 'NR > 1 {printf("\\n")} {printf("%s", $$0)}' >> $@ ; \
echo '", true));' >> $@ ; \
done
find initfs -type f -o -type l | cut -d '/' -f2- | sort | awk '{printf(" files.insert(b\"%s\", (include_bytes!(\"../../initfs/%s\"), false));\n", $$0, $$0)}' >> $@
echo ' files' >> $@
echo '}' >> $@
initfs/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib initfs/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
mkdir -p initfs/bin mkdir -p initfs/bin