]> git.plutz.net Git - blast/commitdiff
simplified size calculation
authorPaul Hänsch <paul@plutz.net>
Mon, 20 Apr 2026 04:33:24 +0000 (06:33 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 20 Apr 2026 04:33:24 +0000 (06:33 +0200)
targets/raspberrypi.mk

index 14e4194b8574fd54ff408ba87c31f3ad51eb9185..e582c2593ee80e90846aa6b30b063b6a2e8960fe 100644 (file)
@@ -6,12 +6,9 @@ fstype := nilfs2
 # endef
 
 # Partition Table (1M) + Boot Partition Root Partition + Slack Space (1M)
+imagesize ?= 2048
 BOOT_MB := 255
-ifdef imagesize
-  ROOT_MB := $(shell printf '%i\n' "$$(( ${imagesize} - ${BOOT_MB} - 2 ))")
-else
-  ROOT_MB := 1791
-endif
+ROOT_MB := $(shell printf '%i\n' "$$(( ${imagesize} - ${BOOT_MB} - 2 ))")
 
 define PARTLAYOUT :=
 label: dos
@@ -51,11 +48,12 @@ _partition_raspi: _sparse
 _partcopy: _format
 _img_mount: _partcopy _partition_raspi
 _copy: _img_mount
+_bootloader_raspi: _copy  # prerequisite files actually depend on _config
 _umount: _config _bootloader_raspi
 _target: _umount
 clean: _raspberry_clean
 
-export VOLUME PBOOT PROOT SQUASH PARTLAYOUT
+export VOLUME PBOOT PROOT PARTLAYOUT
 
 img_mount:
        mkdir -p -m 755 "$@"
@@ -103,19 +101,18 @@ _partcopy: ${VOLUME} ${PROOT} ${PBOOT}
           if="$${PROOT}" of="$${VOLUME}"
        rm -- "$${PBOOT}" "$${PROOT}"
 
-_mount_boot: _mount_root
-       mountpoint "$${CFGROOT}" || false
-       mkdir -p -m 755 "$${CFGROOT}/boot/firmware"
-       mountpoint "$${CFGROOT}/boot/firmware" \
-       || mount -o loop,offset=1M,sizelimit=${BOOT_MB}M \
-                -t vfat "$${VOLUME}" "$${CFGROOT}/boot/firmware"
-
 _mount_root: ${CFGROOT}
        mountpoint "$${CFGROOT}" \
        || mount -o loop,offset="$$((${BOOT_MB} + 1))"M,sizelimit=${ROOT_MB}M \
                 -t ${fstype} "$${VOLUME}" "$${CFGROOT}"
        chmod 755 "$${CFGROOT}"
 
+_mount_boot: _mount_root
+       mkdir -p -m 755 "$${CFGROOT}/boot/firmware"
+       mountpoint "$${CFGROOT}/boot/firmware" \
+       || mount -o loop,offset=1M,sizelimit=${BOOT_MB}M \
+                -t vfat "$${VOLUME}" "$${CFGROOT}/boot/firmware"
+
 _img_mount: _mount_boot _mount_root
 
 _umount_boot: _config