Files
aimee-os/Makefile
Dustin C. Hatch 869257701c make: rootfs: Support customize.sh
Projects can now include a `customize.sh` script.  If present, this
script will be run after the root filesystem hierarchy has been created,
but before the image is captured.  This allows projects to apply
additional customizations beyond adding or removing files.
2024-12-13 19:26:05 -06:00

134 lines
2.9 KiB
Makefile

O ?= .
IMAGESDIR ?= $(O)/images
CONFIGDIR ?= .
export CONFIGDIR
update.tar: $(IMAGESDIR)/update.tar.zstd
$(O)/portage/.stamp: \
$(shell find portage -type f) \
$(shell find $(CONFIGDIR)/portage -type f)
rm -rf $(O)/portage
mkdir -p $(O)/portage/etc/portage
tar -C portage -c . | tar -C $(O)/portage/etc/portage -x
tar -C $(CONFIGDIR)/portage -c . | tar -C $(O)/portage/etc/portage -x
touch $@
portage: $(O)/portage/.stamp
$(O)/.prepared: \
$(O)/portage/.stamp \
prepare.sh \
setup-local-repo.sh
./prepare.sh
./setup-local-repo.sh
mkdir -p $(O)
touch $(O)/.prepared
prepare: $(O)/.prepared
$(O)/.built: \
build.sh \
build.packages \
install.packages \
$(wildcard $(CONFIGDIR)/build.packages) \
$(CONFIGDIR)/install.packages \
$(O)/portage/.stamp \
$(O)/.prepared
./build.sh
touch $(O)/.built
build: $(O)/.built
$(O)/semanage.mods: \
semanage.mods \
$(wildcard $(CONFIGDIR)/semanage.mods)
cat $^ > $@
$(O)/.ready: \
build-rootfs.sh \
install.packages \
$(CONFIGDIR)/install.packages \
$(wildcard $(CONFIGDIR)/installonly.packages) \
busybox.symlinks \
$(wildcard $(CONFIGDIR)/busybox.symlinks) \
$(O)/linux/arch/arm64/boot/Image.gz \
$(O)/semanage.mods \
$(shell find overlay -type f) \
$(shell find $(CONFIGDIR)/overlay -type f 2>/dev/null) \
$(wildcard $(CONFIGDIR)/customize.sh) \
$(O)/.built
./build-rootfs.sh "$(O)"
if [ -x "$(CONFIGDIR)"/customize.sh ]; then "$(CONFIGDIR)"/customize.sh "$(O)"; fi
touch $(O)/.ready
$(O)/squashfs.exclude: \
squashfs.exclude \
$(shell test -f $(CONFIGDIR)/squashfs.exclude && echo $(CONFIGDIR)/squashfs.exclude)
mkdir -p $(O)
sort $^ > $@
$(O)/squashfs.pseudo: \
$(wildcard $(CONFIGDIR)/squashfs.pseudo)
sort /dev/null $^ > $@
$(IMAGESDIR)/rootfs.squashfs: \
build-squashfs.sh \
$(O)/squashfs.exclude \
$(O)/squashfs.pseudo \
$(O)/.ready
./build-squashfs.sh "$(O)" "$(IMAGESDIR)"
squashfs: $(IMAGESDIR)/rootfs.squashfs
$(O)/linux/arch/arm64/boot/Image.gz: \
build-kernel.sh \
$(CONFIGDIR)/linux.config \
$(O)/.prepared
./build-kernel.sh "$(O)"
kernel: $(O)/linux/arch/arm64/boot/Image.gz
$(O)/efi-part/EFI/BOOT/BOOTAA64.efi: \
build-grub.sh \
grub.cfg \
$(O)/.built
./build-grub.sh "$(O)"
grub: $(O)/efi-part/EFI/BOOT/BOOTAA64.efi
$(IMAGESDIR)/sdcard.img: \
genimage.cfg \
genimage.sh \
post-build.sh \
$(O)/efi-part/EFI/BOOT/BOOTAA64.efi \
$(IMAGESDIR)/rootfs.squashfs
./post-build.sh "$(O)"
./genimage.sh "$(O)" "$(IMAGESDIR)"
sdcard.img: $(IMAGESDIR)/sdcard.img
$(IMAGESDIR)/firmware.img: $(IMAGESDIR)/sdcard.img
$(IMAGESDIR)/update.tar.zstd: \
$(IMAGESDIR)/rootfs.squashfs \
$(IMAGESDIR)/firmware.img \
install-update.sh \
$(O)/.prepared
./build-update.sh "$(IMAGESDIR)"
clean:
rm -rf $(O)/linux $(O)/output $(IMAGESDIR) $(O)/tmp
rm -f $(O)/.prepared
.PHONY: \
build \
grub \
kernel \
portage \
prepare \
sdcard.img \
squashfs \
update.tar