armbian/lib/functions/image
Igor Pecovnik 05d93391f0 kernel-debs: copy the kernel into FAT32 /boot, and give FAT32 /boot room for it
On a board whose /boot is FAT32 there are no symlinks, so the kernel postinst
puts the image in place by moving it:

    mv -v /boot/vmlinuz-<ver> /boot/Image

That consumes the source, and this postinst is re-run in normal operation: a
failing postinst.d hook (typically a DKMS build still waiting on its
linux-headers) is deliberately re-surfaced at the end of the script so apt
retries it. On the retry the mv finds nothing, aborts under set -e, and the
package can never leave iF. Seen on Radxa Cubie A5E, trunk.57.

Copying instead of moving is the obvious fix -- it is what every other board
already does -- but it needs /boot to hold a second copy of the image, and
FAT32 /boot was 256 MiB or less on 39 of the 50 fat boards. So rather than
choosing between copy and move at run time based on measured free space, give
the partition the room and copy unconditionally:

- DEFAULT_BOOTSIZE_FAT=512 MiB, used when BOOTFS_TYPE=fat and no size is set
  (32 boards). ext4 /boot keeps DEFAULT_BOOTSIZE=256; it links rather than
  copies, so it does not need the space.
- the 7 fat boards that set BOOTSIZE explicitly below 512 are bumped:
  aml-s805-mxq 200, easepi-r2 256, longanpi-4b 256, microzed 128, odroidc1 200,
  onecloud 256, imx8ulp family 128 (maaxboard-8ulp).

All 50 fat boards are now at 512 MiB or more.

The copy goes to a temp name and is renamed into place. A rename within one
filesystem is atomic, so an interrupted write cannot leave a torn image for
u-boot to try to boot -- which matters because the preinst has already removed
the previous kernel, so there is nothing to fall back on. The preinst cleanup
also removes a stale temp left by an interrupted earlier copy.

Signed-off-by: Igor Pecovnik <igor@armbian.com>
2026-09-27 17:59:59 +02:00
..
compress-checksum.sh compress-checksum: add SKIP_COMPRESSING to leave formats uncompressed 2026-08-03 21:19:20 +02:00
fingerprint.sh (#9400 P1a) lib/functions/image/fingerprint.sh: convert [ ] to [[ ]] 2026-03-05 13:36:20 +01:00
initrd.sh (#9400 P1a) lib/functions/image/initrd.sh: convert [ ] to [[ ]] 2026-03-05 13:36:20 +01:00
loop.sh loop: include device path in check_loop_device timeout error 2026-08-22 05:42:54 +02:00
partitioning.sh kernel-debs: copy the kernel into FAT32 /boot, and give FAT32 /boot room for it 2026-09-27 17:59:59 +02:00
rootfs-to-image.sh chore: update copyright years to 2026 2025-12-25 12:03:34 +01:00
write-device.sh (#9400 P3a) Replace useless cat with input redirection (#9404) 2026-02-18 09:28:14 +01:00