From 87337b9da8842846d48fdda3033f10939f6ddf41 Mon Sep 17 00:00:00 2001 From: Tomaz Zaman Date: Mon, 10 Aug 2026 13:51:12 +0200 Subject: [PATCH 06/72] layerscape: add Mono Gateway DK device and eMMC image GPT with the entry array relocated to 5 MiB (stock ptgen -e) so the header ends at 1 KiB and the raw boot-firmware region (PBL@4K, FIP@1M, env@3M, FMan ucode@4M) stays untouched; partitions start at 32 MiB: boot ext4 (/boot/extlinux for the U-Boot sysboot flow, Image.gz + dtb) then squashfs rootfs. KERNEL_NAME=Image because booti cannot boot the target default vmlinux ELF. Co-Authored-By: Claude Fable 5 --- target/linux/layerscape/image/armv8_64b.mk | 32 +++++++++++++++++++ .../layerscape/image/gen_mono_emmc_img.sh | 32 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100755 target/linux/layerscape/image/gen_mono_emmc_img.sh diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk index 6c486e73fa..ff58009063 100644 --- a/target/linux/layerscape/image/armv8_64b.mk +++ b/target/linux/layerscape/image/armv8_64b.mk @@ -406,3 +406,35 @@ define Device/traverse_ten64_mtd endef TARGET_DEVICES += traverse_ten64_mtd +# Boot partition for the Mono Gateway: ext4 with /boot/extlinux for the +# QSPI/eMMC U-Boot's `sysboot mmc 0:1 any ... /boot/extlinux/extlinux.conf` +define Build/mono-bootfs + rm -rf $@.bootdir $@.bootfs + mkdir -p $@.bootdir/boot/extlinux + $(CP) $(IMAGE_KERNEL) $@.bootdir/boot/Image.gz + $(CP) $(DEVICE_DTS_DIR)/$(DEVICE_DTS).dtb $@.bootdir/boot/ + printf 'label OpenWrt\n\tkernel /boot/Image.gz\n\tfdt /boot/%s.dtb\n\tappend root=/dev/mmcblk0p2 rootwait console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500\n' \ + "$(DEVICE_DTS)" > $@.bootdir/boot/extlinux/extlinux.conf + truncate -s $(MONO_BOOTFS_SIZE)M $@.bootfs + $(STAGING_DIR_HOST)/bin/mkfs.ext4 -F -L boot -d $@.bootdir $@.bootfs +endef + +define Build/mono-emmc-img + rm -f $@ + ./gen_mono_emmc_img.sh $@ $@.bootfs $(IMAGE_ROOTFS) \ + $(MONO_BOOTFS_SIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE) +endef + +define Device/mono_gateway-dk + DEVICE_VENDOR := Mono + DEVICE_MODEL := Gateway DK + DEVICE_PACKAGES := kmod-ask-cdx kmod-ask-fci kmod-ask-auto-bridge \ + cmm dpa-app fmc + KERNEL_NAME := Image + KERNEL := kernel-bin | gzip + MONO_BOOTFS_SIZE := 64 + IMAGES := emmc.img.gz + IMAGE/emmc.img.gz := mono-bootfs | mono-emmc-img | gzip | append-metadata +endef +TARGET_DEVICES += mono_gateway-dk + diff --git a/target/linux/layerscape/image/gen_mono_emmc_img.sh b/target/linux/layerscape/image/gen_mono_emmc_img.sh new file mode 100755 index 0000000000..92d37d004d --- /dev/null +++ b/target/linux/layerscape/image/gen_mono_emmc_img.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-2.0-only +# +# Mono Gateway eMMC image: +# - 8-entry-equivalent GPT: header at LBA0/1, entry array relocated to +# 5 MiB (-e 5120) so the LS1046A boot firmware region stays clear: +# PBL@4K, FIP@1M, U-Boot env@3M, FMan ucode@4M (raw, dd'd by the +# factory flow / write_uboot_platform - NOT part of this image) +# - partition 1 (boot, ext4: /boot/extlinux + Image.gz + dtb) at 32 MiB +# - partition 2 (rootfs) right after +# +set -ex +[ $# -eq 5 ] || { + echo "SYNTAX: $0 " + exit 1 +} + +OUTPUT="$1" +BOOTFS="$2" +ROOTFS="$3" +BOOTFSSIZE="$4" +ROOTFSSIZE="$5" + +set $(ptgen -o $OUTPUT -v -g -e 5120 \ + -N boot -p ${BOOTFSSIZE}M@32M \ + -N rootfs -p ${ROOTFSSIZE}M) + +BOOTOFFSET=$(($1 / 512)) +ROOTFSOFFSET=$(($3 / 512)) + +dd bs=512 if="$BOOTFS" of="$OUTPUT" seek=${BOOTOFFSET} conv=notrunc +dd bs=512 if="$ROOTFS" of="$OUTPUT" seek=${ROOTFSOFFSET} conv=notrunc -- 2.47.3