]> git.plutz.net Git - blast/commitdiff
less slack space when partitioning, experiment with nilfs2 filesystem
authorPaul Hänsch <paul@plutz.net>
Sun, 12 Apr 2026 18:17:27 +0000 (20:17 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 12 Apr 2026 18:17:27 +0000 (20:17 +0200)
targets/raspberrypi.mk

index 346c975429247b2046549d317b2c4b53cefa4765..cdd2049db73a15f44f243eec869faa28bc754272 100644 (file)
@@ -1,21 +1,25 @@
 ARCH := arm64
-fstype := ext4
+fstype := nilfs2
 
-# Partition Table (2M) + Boot Partition Root Partition + Slack Space (1M)
-BOOT_MB := 254
+# define RPICONFIG :=
+# # dtoverlay=vc4-fkms-v3d,cma-${rpivmem}
+# endef
+
+# Partition Table (1M) + Boot Partition Root Partition + Slack Space (1M)
+BOOT_MB := 255
 ifdef imagesize
-  ROOT_MB := $(shell printf '%i\n' "$$(( ${imagesize} - ${BOOT_MB} - 3 ))")
+  ROOT_MB := $(shell printf '%i\n' "$$(( ${imagesize} - ${BOOT_MB} - 2 ))")
 else
   ROOT_MB := 1791
 endif
 
 define PARTLAYOUT :=
 label: dos
-: start=2MiB, size=${BOOT_MB}MiB, type=c
+: start=1MiB, size=${BOOT_MB}MiB, type=c
 : size=${ROOT_MB}MiB, type=83
 endef
 
-define _fstab :=
+define FSTAB :=
 /dev/mmcblk0p2 /               ${fstype}       auto,nofail,rw  0 0
 /dev/mmcblk0p1 /boot/firmware  vfat    auto,nofail,ro  0 0
 endef
@@ -64,7 +68,7 @@ ${SYSROOT}/usr/bin/qemu-arm64-static: /usr/bin/qemu-arm64-static ${SYSROOT}
 
 ${VOLUME}: .FORCE
        dd count=0 of="$${VOLUME}"  # truncate
-       dd bs=1M count=0 seek=$$((3 + ${BOOT_MB} + ${ROOT_MB})) \
+       dd bs=1M count=0 seek=$$((2 + ${BOOT_MB} + ${ROOT_MB})) \
           of="$${VOLUME}"
        chmod g+w "$${VOLUME}"
 
@@ -93,9 +97,9 @@ ${CFGROOT}/boot/firmware/cmdline.txt: _config .FORCE
 _bootloader_raspi: ${CFGROOT}/boot/firmware/cmdline.txt
 
 _partcopy: ${VOLUME} ${PROOT} ${PBOOT}
-       dd conv=notrunc,sparse bs=1M seek=2 \
+       dd conv=notrunc,sparse bs=1M seek=1 \
           if="$${PBOOT}" of="$${VOLUME}"
-       dd conv=notrunc,sparse bs=1M seek=$$((2 + ${BOOT_MB})) \
+       dd conv=notrunc,sparse bs=1M seek=$$((1 + ${BOOT_MB})) \
           if="$${PROOT}" of="$${VOLUME}"
        rm -- "$${PBOOT}" "$${PROOT}"
 
@@ -103,12 +107,12 @@ _mount_boot: _mount_root
        mountpoint "$${CFGROOT}" || false
        mkdir -p -m 755 "$${CFGROOT}/boot/firmware"
        mountpoint "$${CFGROOT}/boot/firmware" \
-       || mount -o loop,offset=2M,sizelimit=${BOOT_MB}M \
+       || 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} + 2))"M,sizelimit=${ROOT_MB}M \
+       || mount -o loop,offset="$$((${BOOT_MB} + 1))"M,sizelimit=${ROOT_MB}M \
                 -t ${fstype} "$${VOLUME}" "$${CFGROOT}"
        chmod 755 "$${CFGROOT}"