From b36422b914ef3fdc17827481b61ab7d03a1790ac Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 21 Jul 2020 19:19:40 +0100 Subject: [PATCH] mediatek: mt7623: add full system image for UniElec U7623 This adds a full eMMC image including U-Boot, which means that the kernel can inherit the true RAM size detected by the preloader. As implemented in previous commits, sysupgrade to this image from the legacy layout (and via that, from the vendor-installed image) is supported. Rename the legacy image for the 512MiB board, for clarity. Signed-off-by: David Woodhouse --- target/linux/mediatek/image/Config.in | 2 +- target/linux/mediatek/image/mt7623.mk | 30 +++++++++++++++++-- .../image/mt7623a_unielec_u7623-uEnv.txt | 20 +++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 target/linux/mediatek/image/mt7623a_unielec_u7623-uEnv.txt diff --git a/target/linux/mediatek/image/Config.in b/target/linux/mediatek/image/Config.in index 12d47d77b9..ef8536ebab 100644 --- a/target/linux/mediatek/image/Config.in +++ b/target/linux/mediatek/image/Config.in @@ -1,4 +1,4 @@ config MTK_BOOT_PARTSIZE int "Boot (SD Card/eMMC) filesystem partition size (in MiB)" - depends on TARGET_mediatek_mt7623_DEVICE_bpi_bananapi-r2 || TARGET_DEVICE_mediatek_mt7623_DEVICE_bpi_bananapi-r2 + depends on TARGET_mediatek_mt7623_DEVICE_bpi_bananapi-r2 || TARGET_DEVICE_mediatek_mt7623_DEVICE_bpi_bananapi-r2 || TARGET_mediatek_mt7623_DEVICE_unielec_u7623-emmc || TARGET_DEVICE_mediatek_mt7623_DEVICE_unielec_u7623-emmc default 32 diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk index 881092f478..72758ddbaa 100644 --- a/target/linux/mediatek/image/mt7623.mk +++ b/target/linux/mediatek/image/mt7623.mk @@ -55,10 +55,33 @@ define Device/bpi_bananapi-r2 endef TARGET_DEVICES += bpi_bananapi-r2 -define Device/unielec_u7623-02-emmc-512m +# Full eMMC image including U-Boot and partition table +define Device/unielec_u7623-emmc + DEVICE_VENDOR := UniElec + DEVICE_MODEL := U7623 + DEVICE_VARIANT := eMMC + # When we use FIT images, U-Boot will populate the /memory node with the correct + # memory size discovered from the preloader, so we don't need separate builds. + DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512m + SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m + UBOOT_ENVSIZE := 0x1000 + UBOOT_OFFSET := 256k + UBOOT_TARGET := mt7623a_unielec_u7623 + IMAGES := img.gz + IMAGE/img.gz := mtk-mmc-img | gzip | append-metadata + DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \ + mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk + ARTIFACT/scatter.txt := scatterfile $$(firstword $$(FILESYSTEMS))-$$(firstword $$(IMAGES)) + ARTIFACTS := scatter.txt +endef +TARGET_DEVICES += unielec_u7623-emmc + +# Legacy partial image for U7623 +# This preserves the vendor U-Boot and starts with a uImage at 0xA00 +define Device/unielec_u7623-02-emmc-512m-legacy DEVICE_VENDOR := UniElec DEVICE_MODEL := U7623-02 - DEVICE_VARIANT := eMMC/512MB RAM + DEVICE_VARIANT := eMMC/512MiB RAM (legacy image) DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512m KERNEL_NAME := zImage KERNEL := kernel-bin | append-dtb | uImage none @@ -67,5 +90,6 @@ define Device/unielec_u7623-02-emmc-512m mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk IMAGES := sysupgrade-emmc.bin.gz IMAGE/sysupgrade-emmc.bin.gz := sysupgrade-emmc | gzip | append-metadata + SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m endef -TARGET_DEVICES += unielec_u7623-02-emmc-512m +TARGET_DEVICES += unielec_u7623-02-emmc-512m-legacy diff --git a/target/linux/mediatek/image/mt7623a_unielec_u7623-uEnv.txt b/target/linux/mediatek/image/mt7623a_unielec_u7623-uEnv.txt new file mode 100644 index 0000000000..5e5f8cae73 --- /dev/null +++ b/target/linux/mediatek/image/mt7623a_unielec_u7623-uEnv.txt @@ -0,0 +1,20 @@ +# Boot menu for UniElec U7623 +# Copyright © 2020 David Woodhouse + +kernel=uImage +loadaddr=0x88000000 +dtaddr=0x83f00000 +fdt_high=0xafffffff + +console=ttyS0,115200 +bootopts=rootfstype=squashfs,ext4 rootwait + +# Create the command line (with appropriate root=) and boot the Linux FIT image. +boot1=setenv bootargs "console=${console} root=${rootdev} ${bootopts}";printenv bootargs;\ + fatload mmc ${partition} ${loadaddr} ${kernel}; bootm + +bootmenu_0=Boot from eMMC.=setenv partition 0:2;setenv rootdev /dev/mmcblk0p3;run boot1 +bootmenu_default=0 + +bootdelay=0 +bootcmd=bootmenu