diff --git a/target/linux/mediatek/image/gen_mt7623_emmc_img.sh b/target/linux/mediatek/image/gen_mt7623_emmc_img.sh index a5f296ef14..b9eedf80b4 100755 --- a/target/linux/mediatek/image/gen_mt7623_emmc_img.sh +++ b/target/linux/mediatek/image/gen_mt7623_emmc_img.sh @@ -1,5 +1,8 @@ #!/bin/sh - +# +# This script is used only to create the "legacy" image for UniElec U7623, +# suitable for upgrading from the vendor OpenWrt or from OpenWrt 19.07. +# OUTPUT_FILE=$1 KERNEL_FILE=$2 RECOVERY_FILE=$3 @@ -7,10 +10,19 @@ ROOTFS_FILE=$4 BS=512 -#These to offsets are relative to the absolute location of the kernel on the mmc -#(0xA00), so their position in the image is -2560 blocks -RECOVERY_OFFSET=67072 -ROOTFS_OFFSET=87552 +# These two offsets are relative to the absolute location of the kernel on the mmc +# (0xA00), so their position in the image is -2560 blocks +# +# They must be kept in sync with the default command line for U7623. +# blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)" +# +# For upgrading from the vendor firmware, the total image must fit in its +# MTD 'firmware' partition, which is typically 36MiB. + +# In the legacy image, the uImage starts at block 0xa00. Allow 4864 KiB (9728) blocks. +RECOVERY_OFFSET=9728 +# The recovery image is 3MiB, or 6144 blocks. +ROOTFS_OFFSET=15872 dd bs="$BS" of="$OUTPUT_FILE" if="$KERNEL_FILE" dd bs="$BS" of="$OUTPUT_FILE" if="$RECOVERY_FILE" seek="$RECOVERY_OFFSET" diff --git a/target/linux/mediatek/mt7623/config-5.4 b/target/linux/mediatek/mt7623/config-5.4 index 2ebdae7077..83ff7b3111 100644 --- a/target/linux/mediatek/mt7623/config-5.4 +++ b/target/linux/mediatek/mt7623/config-5.4 @@ -70,6 +70,7 @@ CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="earlyprintk console=ttyS0,115200 rootfstype=squashfs,jffs2" CONFIG_CMDLINE_FROM_BOOTLOADER=y +CONFIG_CMDLINE_PARTITION=y CONFIG_COMMON_CLK=y CONFIG_COMMON_CLK_MEDIATEK=y CONFIG_COMMON_CLK_MT2701=y diff --git a/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch b/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch index d1ea20c0ff..7371611059 100644 --- a/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch +++ b/target/linux/mediatek/patches-5.4/0227-arm-dts-Add-Unielec-U7623-DTS.patch @@ -63,7 +63,7 @@ Subject: [PATCH] arm: dts: Add Unielec U7623 DTS + }; + + chosen { -+ bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200"; ++ bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)"; + stdout-path = "serial2:115200n8"; + }; +