From b4054ac324b5d9ddb10236db0563d424fa9c4017 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sat, 3 Feb 2024 12:11:37 +0100 Subject: fully automatic sd card partitioning and formatting --- makefile | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index da94b65..a211676 100644 --- a/makefile +++ b/makefile @@ -18,7 +18,8 @@ CTRIZE += --env-file ./env CTRIZE += $(CTR_IMG_TAG) export -# create files that represent otherwise PHONY targets +# create dummy files to represent non-file targets (container image build +# status, sd card partition status, git submodule initialization, etc.) $(shell state/gen) -include state/auto.mk @@ -26,8 +27,12 @@ $(shell state/gen) include ./env export +# shortcuts .PHONY: all all: $(BOOTLOADER_FILES) +.PHONY: sd_format sd_partition +sd_format: state/sdcard_fmt +sd_partition: state/sdcard_part state/container_img: Containerfile $(CTR) build --tag $(CTR_IMG_TAG) . @@ -38,6 +43,15 @@ state/submodules: $(GIT) submodule update touch $@ +state/sdcard_part: + $(AS_ROOT) util/part $(SDCARD_DISK) + touch $@ + +state/sdcard_fmt: state/sdcard_part + $(AS_ROOT) mkfs.vfat -n BOOT -F 32 $(SDCARD_PART_BOOT) + $(AS_ROOT) mkfs.ext4 -L ROOTFS -F $(SDCARD_PART_ROOTFS) + touch $@ + BOOTLOADER_FILES += bootloader/MLO BOOTLOADER_FILES += bootloader/u-boot.img BOOTLOADER_FILES += bootloader/u-boot.dtb @@ -59,8 +73,9 @@ load_bootloader: $(BOOTLOADER_FILES) $(AS_ROOT) $(CP) $(BOOTLOADER_FILES) mnt/boot $(UMOUNT) mnt/boot -.PHONY: sd_format -sd_format: - $(AS_ROOT) mkfs.vfat -n BOOT -F 32 $(SDCARD_PART_BOOT) - $(AS_ROOT) mkfs.ext4 -L ROOTFS -F $(SDCARD_PART_ROOTFS) +.PHONY: status +status: + @echo '### STATUS REPORT' + @echo '# DETECTED SD CARD' + @cat state/auto.mk -- cgit v1.2.3