diff --git a/airoha/an7581/target.mk b/airoha/an7581/target.mk index bbd0d419d5994adc02667b741e2e3395df52e134..e600d96f1ce9e80847b1745f0958c267e401e0b4 100644 --- a/airoha/an7581/target.mk +++ b/airoha/an7581/target.mk @@ -9,6 +9,8 @@ CPU_TYPE:=cortex-a53 FEATURES+=squashfs nand ramdisk ubifs KERNELNAME:=vmlinux +DEFAULT_PACKAGES+=blkpg-part + define Target/Description Build firmware images for Airoha an7581 ARM based boards. endef diff --git a/airoha/base-files/etc/hotplug.d/block/20-emmc-fip-partition b/airoha/base-files/etc/hotplug.d/block/20-emmc-fip-partition new file mode 100644 index 0000000000000000000000000000000000000000..bdcc241b2e05e779dfef299de76c519b1c8d35b8 --- /dev/null +++ b/airoha/base-files/etc/hotplug.d/block/20-emmc-fip-partition @@ -0,0 +1,26 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2025 IOPSYS Software Solutions AB + +FIP_PARTITION_NUMBER=64 +FIP_PARTITION_LABEL=fip + +if [ "$DEVTYPE" = disk ] && [ "$DEVICENAME" = mmcblk0 ]; then + case "$ACTION" in + add) + # The Airoha Boot ROM reads FIP from 2 KB offset. FIP goes until 512KB + # Create a 510 KB partition in software only, because this partition + # cannot be stored in the GPT. The reason for this is that in GPT all + # partitions must start after the PGPT entries, but the GPT entries (16 KB) + # cannot be put right after GPT header at 1KB, because the boot ROM + # expects FIP to be at 2 KB. + blkpg-part add -l "$FIP_PARTITION_LABEL" "/dev/$DEVICENAME" "$FIP_PARTITION_NUMBER" 2048 522240 + # While the kernel UAPI has a field for the partition label and + # we set it, there exists no code in the kernel that makes use of it. + # Create a symlink as a workaround while kernel is lacking the functionality + ln -sf "/dev/${DEVICENAME}p${FIP_PARTITION_NUMBER}" "/dev/${DEVICENAME}pfip" + ;; + remove) + rm "/dev/${DEVICENAME}pfip" + ;; + esac +fi