aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-03 12:11:37 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-03 12:11:37 +0100
commitb4054ac324b5d9ddb10236db0563d424fa9c4017 (patch)
treee5d32c52c909d7071707af3ede2041917c7afff3 /makefile
parent2b2cb626b527606436b6d7903407b7dbf66d9671 (diff)
fully automatic sd card partitioning and formatting
Diffstat (limited to 'makefile')
-rw-r--r--makefile25
1 files changed, 20 insertions, 5 deletions
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