• R/O
  • HTTP
  • SSH
  • HTTPS

immortalwrt: Commit

Mirror only - Please move to https://github.com/immortalwrt/immortalwrt


Commit MetaInfo

Revisão1ee75dd2906e15f874220151cdd4802d50e4a082 (tree)
Hora2022-01-24 05:20:37
AutorDaniel Golle <daniel@makr...>
CommiterDaniel Golle

Mensagem de Log

mediatek: mt7623: rework images for U7623-02 board

Users of older OpenWrt versions need sysupgrade using the *emmc.img.gz
file once which will upgrade U-Boot and switch to the new image layout.
Users of the vendor firmware need to first flash the legacy image to
then sunsequently carry out a full-flash upgrade.

Alternatively the board can also be flashed using MediaTek's
proprietary SP Flash Tool.

Configuration as well as persistent MAC address will be lost once at
this point and you will have to redo (or restore) all configuration
manually. To restore the previous persistent MAC address users may set
it manually using

fw_setenv ethaddr 00:11:22:33:44:55

For future upgrades once running OpenWrt past this commit, the usual
*sysupgrade.itb file can be used.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>

Mudança Sumário

Diff

--- a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts
+++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc-512m.dts
@@ -4,11 +4,15 @@
44 */
55
66 /dts-v1/;
7-#include "mt7623a-unielec-u7623-02-emmc.dtsi"
7+#include "mt7623a-unielec-u7623-02.dtsi"
88
99 / {
10- model = "UniElec U7623-02 eMMC (512M RAM)";
11- compatible = "unielec,u7623-02-emmc-512m", "unielec,u7623-02-emmc", "mediatek,mt7623";
10+ model = "UniElec U7623-02 eMMC (legacy loader, 512M RAM)";
11+ compatible = "unielec,u7623-02-emmc-512m", "unielec,u7623-02", "mediatek,mt7623";
12+
13+ chosen {
14+ bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)";
15+ };
1216
1317 memory@80000000 {
1418 device_type = "memory";
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dts
@@ -0,0 +1,12 @@
1+// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
2+/*
3+ * Copyright 2018 Kristian Evensen <kristian.evensen@gmail.com>
4+ */
5+
6+/dts-v1/;
7+#include "mt7623a-unielec-u7623-02.dtsi"
8+
9+/ {
10+ model = "UniElec U7623-02 eMMC";
11+ compatible = "unielec,u7623-02", "mediatek,mt7623";
12+};
--- a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi
+++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi
@@ -8,7 +8,7 @@
88 #include "mt6323.dtsi"
99
1010 / {
11- compatible = "unielec,u7623-02-emmc", "mediatek,mt7623";
11+ compatible = "unielec,u7623-02", "mediatek,mt7623";
1212
1313 aliases {
1414 serial0 = &uart2;
@@ -21,8 +21,7 @@
2121 };
2222
2323 chosen {
24- bootargs = "root=/dev/mmcblk0p2 rootfstype=squashfs,f2fs console=ttyS0,115200 blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)";
25- stdout-path = "serial2:115200n8";
24+ stdout-path = "serial0:115200n8";
2625 };
2726
2827 cpus {
--- a/target/linux/mediatek/image/Config.in
+++ /dev/null
@@ -1,4 +0,0 @@
1-config MTK_BOOT_PARTSIZE
2- int "Boot (SD Card/eMMC) filesystem partition size (in MiB)"
3- depends on TARGET_mediatek_mt7623_DEVICE_unielec_u7623-emmc || TARGET_DEVICE_mediatek_mt7623_DEVICE_unielec_u7623-emmc
4- default 32
--- a/target/linux/mediatek/image/Makefile
+++ b/target/linux/mediatek/image/Makefile
@@ -6,17 +6,7 @@
66 include $(TOPDIR)/rules.mk
77 include $(INCLUDE_DIR)/image.mk
88
9-define Build/sysupgrade-emmc
10- rm -f $@.recovery
11- mkfs.fat -C $@.recovery 3070
12-
13- ./gen_$(SUBTARGET)_emmc_img.sh $@ \
14- $(IMAGE_KERNEL) \
15- $@.recovery \
16- $(IMAGE_ROOTFS)
17-endef
18-
19-# default all platform image(fit) build
9+# default all platform image(fit) build
2010 define Device/Default
2111 PROFILES = Default $$(DEVICE_NAME)
2212 KERNEL_NAME := Image
--- a/target/linux/mediatek/image/gen_mt7623_emmc_img.sh
+++ /dev/null
@@ -1,30 +0,0 @@
1-#!/bin/sh
2-#
3-# This script is used only to create the "legacy" image for UniElec U7623,
4-# suitable for upgrading from the vendor OpenWrt or from OpenWrt 19.07.
5-#
6-OUTPUT_FILE=$1
7-KERNEL_FILE=$2
8-RECOVERY_FILE=$3
9-ROOTFS_FILE=$4
10-
11-BS=512
12-
13-# These two offsets are relative to the absolute location of the kernel on the mmc
14-# (0xA00), so their position in the image is -2560 blocks
15-#
16-# They must be kept in sync with the default command line for U7623.
17-# blkdevparts=mmcblk0:3M@6M(recovery),256M@9M(root)"
18-#
19-# For upgrading from the vendor firmware, the total image must fit in its
20-# MTD 'firmware' partition, which is typically 36MiB.
21-
22-# In the legacy image, the uImage starts at block 0xa00. Allow 4864 KiB (9728) blocks.
23-RECOVERY_OFFSET=9728
24-# The recovery image is 3MiB, or 6144 blocks.
25-ROOTFS_OFFSET=15872
26-
27-dd bs="$BS" of="$OUTPUT_FILE" if="$KERNEL_FILE"
28-dd bs="$BS" of="$OUTPUT_FILE" if="$RECOVERY_FILE" seek="$RECOVERY_OFFSET"
29-dd bs="$BS" of="$OUTPUT_FILE" if="$ROOTFS_FILE" seek="$ROOTFS_OFFSET"
30-dd if=/dev/zero of="$OUTPUT_FILE" bs=128k count=1 oflag=append conv=notrunc
--- a/target/linux/mediatek/image/gen_mtk_mmc_img.sh
+++ /dev/null
@@ -1,147 +0,0 @@
1-#!/bin/bash
2-# SPDX-License-Identifier: GPL-2.0-only
3-#
4-# Copyright © 2019 Alexey Loukianov <lx2@lexa2.ru>
5-# Copyright © 2020 David Woodhouse <dwmw2@infradead.org>
6-
7-# Generates a bootable SD card image for Banana Pi R2 (and probably
8-# other similar boards) as documented at
9-# http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:storage
10-#
11-# The first sector must contain the SDMMC_BOOT header shown
12-# below, and also contains the MBR partition table in the end
13-# of the sector. The partition table must contain no active
14-# partitions.
15-#
16-# The second sector must contain the BRLYT header, and the
17-# special preloader image goes in sector 4; 2KiB into the image.
18-#
19-# The preloader loads U-Boot from sector 640; 320KiB into the image.
20-# The location and the size (512KiB) are fixed and not read from
21-# the partition table. We set up a partition for it merely for
22-# our own convenience for upgrades, etc.
23-#
24-# The second partition is a FAT file system containing the kernel
25-# image and a uboot.env file, which is provided to this script as
26-# $4 (bootfs image). Its size is configurable with the
27-# CONFIG_MTK_BOOT_PARTSIZE option; by default 32MiB.
28-#
29-# The root filesystem comes next in the third partition.
30-#
31-#
32-# ------------------------ Sector Offset
33-# | MBR + SDMMC_BOOT | 0 0x0
34-# |----------------------|
35-# | BRLYT header | 1 0x200
36-# |----------------------|
37-# . .
38-# . .
39-# |----------------------|
40-# | | 4 0x800
41-# | |
42-# | Preloader |
43-# . .
44-# . .
45-# | | 639
46-# |----------------------|
47-# | MBR partition #1 | 640 0x50000
48-# | |
49-# | U-Boot |
50-# . .
51-# . .
52-# | | 1663
53-# |----------------------|
54-# | MBR partition #2 |
55-# | |
56-# | FAT partition | ( MTK_BOOT_PARTSIZE
57-# . . default 32MiB )
58-# . (kernel, uEnv) .
59-# | |
60-# |----------------------|
61-# | MBR partition #3 |
62-# | |
63-# | Root partition |
64-# | | ( TARGET_ROOTFS_PARTSIZE
65-# | (squashfs+overlay | default 104MiB )
66-# . or ext4, etc.) .
67-# . .
68-# | |
69-# ------------------------
70-#
71-# For eMMC boot, everything up to and including the preloader must be
72-# written to /dev/mmcblk0boot0, with the SDMMC_BOOT header changed to
73-# read EMMC_BOOT\0 instead.
74-#
75-# The contents of the main eMMC are identical to the SD card layout,
76-# with the preloader loading 512KiB of U-Boot starting at 0x50000.
77-
78-usage() {
79- echo "SYNTAX: $0 sd <file> <preloader image> <u-boot image> <u-boot offset> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
80- echo " OR: $0 emmc <file> <preloader image>"
81- exit 1
82-}
83-
84-set -e
85-
86-PRELOADER_OFFSET=2 # 2KiB
87-
88-SDMMC_BOOT="SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
89-EMMC_BOOT="EMMC_BOOT\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
90-BRLYT="BRLYT\x00\x00\x00\x01\x00\x00\x00\x00\x08\x00\x00\
91-\x00\x08\x00\x00\x42\x42\x42\x42\x08\x00\x01\x00\x00\x08\x00\x00\
92-\x00\x08\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
93-
94-case $1 in
95- sd)
96- [ $# -eq 9 ] || usage
97- OUTPUT="$2"
98- PRELOADER="$3"
99- UBOOT="$4"
100- UBOOTOFS="$5"
101- BOOTFS="$6"
102- ROOTFS="$7"
103- BOOTFSSIZE="$8"
104- ROOTFSSIZE="$9"
105-
106- head=4
107- sect=63
108-
109- set $(ptgen -o $OUTPUT -h $head -s $sect -a 0 -l 1024 \
110- -t 41 -p 512k@${UBOOTOFS} \
111- -t c -p ${BOOTFSSIZE}M \
112- -t 83 -p ${ROOTFSSIZE}M )
113-
114- UBOOT_OFFSET="$(($1 / 512))"
115- UBOOT_SIZE="$(($2 / 512))"
116- BOOTFS_OFFSET="$(($3 / 512))"
117- BOOTFS_SIZE="$(($4 / 512))"
118- ROOTFS_OFFSET="$(($5 / 512))"
119- ROOTFS_SIZE="$(($6 / 512))"
120-
121- echo -en "${SDMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0 conv=notrunc
122- echo -en "${BRLYT}" | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc
123-
124- # For eMMC-only boards like U7623 the preloader doesn't need to be included in the
125- # main image as it's only ever needed in the eMMC boot partition.
126- if [ -r ${PRELOADER} ]; then
127- dd bs=1024 if="${PRELOADER}" of="${OUTPUT}" seek="${PRELOADER_OFFSET}" conv=notrunc
128- fi
129- dd bs=512 if="${UBOOT}" of="${OUTPUT}" seek="${UBOOT_OFFSET}" conv=notrunc
130- dd bs=512 if="${BOOTFS}" of="${OUTPUT}" seek="${BOOTFS_OFFSET}" conv=notrunc
131- dd bs=512 if="${ROOTFS}" of="${OUTPUT}" seek="${ROOTFS_OFFSET}" conv=notrunc
132- dd bs=128k if=/dev/zero of="${OUTPUT}" count=1 oflag=append conv=notrunc
133- ;;
134- emmc)
135- [ $# -eq 3 ] || usage
136- OUTPUT="$2"
137- PRELOADER="$3"
138-
139- echo -en "${EMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0
140- echo -en "${BRLYT}" | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc
141-
142- dd bs=1024 if="${PRELOADER}" of="${OUTPUT}" seek="${PRELOADER_OFFSET}" conv=notrunc
143- ;;
144- *)
145- usage
146- ;;
147-esac
--- a/target/linux/mediatek/image/mt7623.mk
+++ b/target/linux/mediatek/image/mt7623.mk
@@ -1,5 +1,5 @@
11 KERNEL_LOADADDR := 0x80008000
2-DEVICE_VARS += UBOOT_TARGET UBOOT_OFFSET UBOOT_ENVSIZE
2+DEVICE_VARS += UBOOT_TARGET UBOOT_OFFSET UBOOT_IMAGE
33
44 # The bootrom of MT7623 expects legacy MediaTek headers present in
55 # exactly the location also used for the primary GPT partition table.
@@ -55,7 +55,7 @@ DEVICE_VARS += UBOOT_TARGET UBOOT_OFFSET UBOOT_ENVSIZE
5555 define Build/mt7623-mbr
5656 cp $@ $@.tmp 2>/dev/null || true
5757 ptgen -o $@.tmp -h 4 -s 63 -a 0 -l 1024 \
58- -t 0x41 -N uboot -p 3584k@320k \
58+ -t 0x41 -N uboot -p 1M@$(UBOOT_OFFSET) \
5959 -t 0xea -N recovery -p 40M@4M \
6060 $(if $(findstring sdmmc,$1), \
6161 -t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@48M \
@@ -81,7 +81,12 @@ define Build/append-preloader
8181 endef
8282
8383 define Build/append-bootloader
84- cat $(STAGING_DIR_IMAGE)/$1-u-boot.bin >> $@
84+ cat $(STAGING_DIR_IMAGE)/$1-$(UBOOT_IMAGE) >> $@
85+endef
86+
87+define Build/scatterfile
88+ ./gen_scatterfile.sh $(subst mt,MT,$(SUBTARGET)) "$1" \
89+ $(subst -scatter.txt,,$(notdir $@)) "$(DEVICE_TITLE)" > $@
8590 endef
8691
8792 define Device/bananapi_bpi-r2
@@ -89,84 +94,69 @@ define Device/bananapi_bpi-r2
8994 DEVICE_MODEL := BPi-R2
9095 DEVICE_DTS := mt7623n-bananapi-bpi-r2
9196 DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-usb3 kmod-ata-ahci
92- UBOOT_ENVSIZE := 0x10000
9397 UBOOT_OFFSET := 320k
9498 UBOOT_TARGET := mt7623n_bpir2
95- UBOOT_PATH := $(STAGING_DIR_IMAGE)/mt7623n_bpir2-u-boot.bin
99+ UBOOT_IMAGE := u-boot.bin
100+ UBOOT_PATH := $(STAGING_DIR_IMAGE)/$$(UBOOT_TARGET)-$$(UBOOT_IMAGE)
96101 IMAGES := sysupgrade.itb
97102 KERNEL := kernel-bin | gzip
98103 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
99104 KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd
100105 IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
101- ARTIFACT/preloader.bin := append-preloader $$(UBOOT_TARGET)
106+ ARTIFACT/preloader.bin := mt7623-mbr emmc |\
107+ pad-to 2k | append-preloader $$(UBOOT_TARGET)
102108 ARTIFACT/u-boot.bin := append-uboot
103109 ARTIFACT/sdcard.img.gz := mt7623-mbr sdmmc |\
104110 pad-to 2k | append-preloader $$(UBOOT_TARGET) |\
105- pad-to 320k | append-bootloader $$(UBOOT_TARGET) |\
111+ pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\
106112 pad-to 4092k | mt7623-mbr emmc |\
107113 pad-to 4M | append-image-stage initramfs-recovery.itb |\
108114 pad-to 48M | append-image squashfs-sysupgrade.itb |\
109115 gzip
110- ARTIFACTS = u-boot.bin preloader.bin scatter.txt sdcard.img.gz
116+ ARTIFACTS := u-boot.bin preloader.bin sdcard.img.gz
111117 SUPPORTED_DEVICES := bananapi,bpi-r2
112118 endef
113119 TARGET_DEVICES += bananapi_bpi-r2
114120
115-
116-ifneq ($(CONFIG_MTK_BOOT_PARTSIZE),)
117-BOOTFS_BLOCK_SIZE := 1024
118-BOOTFS_BLOCKS := $(shell echo $$(($(CONFIG_MTK_BOOT_PARTSIZE)*1024*1024/$(BOOTFS_BLOCK_SIZE))))
119-endif
120-
121-define Build/mtk-mmc-img
122- rm -f $@.boot
123- mkfs.fat -C $@.boot $(BOOTFS_BLOCKS)
124-
125- if [ -r $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-preloader.bin ]; then \
126- ./gen_mtk_mmc_img.sh emmc $@.emmc \
127- $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-preloader.bin; \
128- mcopy -i $@.boot $@.emmc ::eMMCboot.bin; \
129- fi
130- mkenvimage -s $(UBOOT_ENVSIZE) -o $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-uboot.env $(UBOOT_TARGET)-uEnv.txt
131- mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-uboot.env ::uboot.env
132- mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
133- ./gen_mtk_mmc_img.sh sd $@ \
134- $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-preloader.bin \
135- $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-u-boot*.bin \
136- $(UBOOT_OFFSET) \
137- $@.boot \
138- $(IMAGE_ROOTFS) \
139- $(CONFIG_MTK_BOOT_PARTSIZE) \
140- 104
141-endef
142-
143-define Build/scatterfile
144- ./gen_scatterfile.sh $(subst mt,MT,$(SUBTARGET)) "$1" \
145- $(subst -scatter.txt,,$(notdir $@)) "$(DEVICE_TITLE)" > $@
146-endef
147-
148-
149-# Full eMMC image including U-Boot and partition table
150-define Device/unielec_u7623-emmc
121+define Device/unielec_u7623-02
151122 DEVICE_VENDOR := UniElec
152- DEVICE_MODEL := U7623
153- DEVICE_VARIANT := eMMC
123+ DEVICE_MODEL := U7623-02
154124 # When we use FIT images, U-Boot will populate the /memory node with the correct
155125 # memory size discovered from the preloader, so we don't need separate builds.
156- DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512m
126+ DEVICE_DTS := mt7623a-unielec-u7623-02
157127 DEVICE_DTS_DIR := ../dts
158- SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m
159- UBOOT_ENVSIZE := 0x1000
128+ DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \
129+ mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci
160130 UBOOT_OFFSET := 256k
161131 UBOOT_TARGET := mt7623a_unielec_u7623
162- IMAGES := img.gz
163- IMAGE/img.gz := mtk-mmc-img | gzip | append-metadata
164- DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \
165- mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk
166- ARTIFACT/scatter.txt := scatterfile $$(firstword $$(FILESYSTEMS))-$$(firstword $$(IMAGES))
167- ARTIFACTS := scatter.txt
132+ UBOOT_IMAGE := u-boot-mtk.bin
133+ UBOOT_PATH := $(STAGING_DIR_IMAGE)/$$(UBOOT_TARGET)-$$(UBOOT_IMAGE)
134+ IMAGES := sysupgrade.itb
135+ KERNEL := kernel-bin | gzip
136+ KERNEL_INITRAMFS_SUFFIX := -recovery.itb
137+ KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
138+ IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
139+ ARTIFACT/u-boot.bin := append-uboot
140+# vendor Preloader seems not to care about SDMMC_BOOT/EMMC_BOOT header,
141+# but OpenWrt expects 'SDMM' magic for sysupgrade.
142+ ARTIFACT/emmc.img.gz := mt7623-mbr sdmmc |\
143+ pad-to $$(UBOOT_OFFSET) | append-bootloader $$(UBOOT_TARGET) |\
144+ pad-to 4M | append-image-stage initramfs-recovery.itb |\
145+ pad-to 48M | append-image squashfs-sysupgrade.itb |\
146+ gzip | append-metadata
147+ ARTIFACT/scatter.txt := scatterfile emmc.img.gz
148+ ARTIFACTS := u-boot.bin scatter.txt emmc.img.gz
149+ SUPPORTED_DEVICES += unielec,u7623-02-emmc-512m
150+endef
151+TARGET_DEVICES += unielec_u7623-02
152+
153+
154+# Legacy helper for U7623 board
155+define Build/fat-recovery-fs
156+ rm -f $@.recovery
157+ mkfs.fat -C $@.recovery 3070
158+ cat $@.recovery >> $@
168159 endef
169-TARGET_DEVICES += unielec_u7623-emmc
170160
171161 # Legacy partial image for U7623
172162 # This preserves the vendor U-Boot and starts with a uImage at 0xA00
@@ -180,9 +170,13 @@ define Device/unielec_u7623-02-emmc-512m-legacy
180170 KERNEL := kernel-bin | append-dtb | uImage none
181171 KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
182172 DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \
183- mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk
173+ mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \
174+ partx-utils
184175 IMAGES := sysupgrade-emmc.bin.gz
185- IMAGE/sysupgrade-emmc.bin.gz := sysupgrade-emmc | gzip | append-metadata
176+ IMAGE/sysupgrade-emmc.bin.gz := append-kernel |\
177+ pad-to 4864k | fat-recovery-fs |\
178+ pad-to 7936k | append-rootfs |\
179+ gzip | append-metadata
186180 SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m
187181 endef
188182 TARGET_DEVICES += unielec_u7623-02-emmc-512m-legacy
--- a/target/linux/mediatek/image/mt7623a_unielec_u7623-uEnv.txt
+++ /dev/null
@@ -1,20 +0,0 @@
1-# Boot menu for UniElec U7623
2-# Copyright © 2020 David Woodhouse <dwmw2@infradead.org>
3-
4-kernel=uImage
5-loadaddr=0x88000000
6-dtaddr=0x83f00000
7-fdt_high=0xafffffff
8-
9-console=ttyS0,115200
10-bootopts=rootfstype=squashfs,ext4 rootwait
11-
12-# Create the command line (with appropriate root=) and boot the Linux FIT image.
13-boot1=setenv bootargs "console=${console} root=${rootdev} ${bootopts}";printenv bootargs;\
14- fatload mmc ${partition} ${loadaddr} ${kernel}; bootm
15-
16-bootmenu_0=Boot from eMMC.=setenv partition 0:2;setenv rootdev /dev/mmcblk0p3;run boot1
17-bootmenu_default=0
18-
19-bootdelay=0
20-bootcmd=bootmenu
--- a/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network
+++ b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network
@@ -9,6 +9,7 @@ mediatek_setup_interfaces()
99
1010 case $board in
1111 bananapi,bpi-r2|\
12+ unielec,u7623-02|\
1213 unielec,u7623-02-emmc-512m)
1314 ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan"
1415 ;;
@@ -20,6 +21,8 @@ mediatek_setup_macs()
2021 local board="$1"
2122
2223 case $board in
24+ bananapi,bpi-r2|\
25+ unielec,u7623-02|\
2326 unielec,u7623-02-emmc-512m)
2427 ucidef_set_interface_macaddr "wan" "$(cat /sys/class/net/wan/address)"
2528 ;;
--- a/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac
+++ b/target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac
@@ -42,22 +42,8 @@ preinit_set_mac_address() {
4242 local rootpart
4343
4444 case $(board_name) in
45- bananapi,bpi-r2|\
4645 unielec,u7623-02-emmc-512m)
47- rootpart=$(cat /proc/cmdline)
48- rootpart="${rootpart##*root=}"
49- rootpart="${rootpart%% *}"
50- case $rootpart in
51- /dev/mmcblk0p2) # Legacy U7623 image
52- set_recovery_mac_address /dev/mmcblk0p1
53- ;;
54- /dev/mmcblk0p3) # U7623 or Banana Pi R2 eMMC
55- set_recovery_mac_address /dev/mmcblk0p2
56- ;;
57- /dev/mmcblk1p3) # Banana Pi R2 SD
58- set_recovery_mac_address /dev/mmcblk1p2
59- ;;
60- esac
46+ set_recovery_mac_address /dev/mmcblk0p1
6147 ;;
6248 esac
6349 }
--- a/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
@@ -2,8 +2,8 @@
22 REQUIRE_IMAGE_METADATA=1
33 RAMFS_COPY_BIN='fwtool'
44
5-# Full system upgrade including preloader for MediaTek SoCs on eMMC or SD
6-mtk_mmc_full_upgrade() {
5+# Legacy full system upgrade including preloader for MediaTek SoCs on eMMC or SD
6+legacy_mtk_mmc_full_upgrade() {
77 local diskdev partdev diff oldrecovery
88
99 if grep -q root=/dev/mmcblk0p2 /proc/cmdline; then
@@ -26,7 +26,7 @@ mtk_mmc_full_upgrade() {
2626 fi
2727 sync
2828
29- if [ "$SAVE_PARTITIONS" = "1" ]; then
29+ if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
3030 get_partitions "/dev/$diskdev" bootdisk
3131
3232 #extract the boot sector from the image
@@ -83,18 +83,18 @@ platform_do_upgrade() {
8383 local board=$(board_name)
8484
8585 case "$board" in
86- bananapi,bpi-r2)
86+ bananapi,bpi-r2|\
87+ unielec,u7623-02)
8788 export_bootdevice
8889 export_partdevice fitpart 3
8990 [ "$fitpart" ] || return 1
9091 EMMC_KERN_DEV="/dev/$fitpart"
9192 emmc_do_upgrade "$1"
9293 ;;
93-
9494 unielec,u7623-02-emmc-512m)
9595 local magic="$(get_magic_long "$1")"
9696 if [ "$magic" = "53444d4d" ]; then
97- mtk_mmc_full_upgrade "$1"
97+ legacy_mtk_mmc_full_upgrade "$1"
9898 else # Old partial image starting with uImage
9999 # Keep the persistent random mac address (if it exists)
100100 recoverydev=mmcblk0p1
@@ -120,17 +120,14 @@ platform_do_upgrade() {
120120 esac
121121 }
122122
123-PART_NAME=firmware
124-
125123 platform_check_image() {
126- local board=$(board_name)
127124 local magic="$(get_magic_long "$1")"
128- local diskdev partdev diff
129125
130126 [ "$#" -gt 1 ] && return 1
131127
132- case "$board" in
133- bananapi,bpi-r2)
128+ case "$(board_name)" in
129+ bananapi,bpi-r2|\
130+ unielec,u7623-02)
134131 [ "$magic" != "d00dfeed" ] && {
135132 echo "Invalid image type."
136133 return 1
@@ -140,19 +137,17 @@ platform_check_image() {
140137 # Can always upgrade to the new-style full image
141138 [ "$magic" = "53444d4d" ] && return 0
142139
140+ # need to update to new bootchain via full image first
141+ [ "$magic" = "d00dfeed" ] && {
142+ echo "Please use full eMMC image to update bootloader first."
143+ return 1
144+ }
145+
143146 # Legacy uImage directly at 0xA00 on the eMMC.
144147 [ "$magic" != "27051956" ] && {
145148 echo "Invalid image type."
146149 return 1
147150 }
148- rootpart=$(cat /proc/cmdline)
149- rootpart="${rootpart##*root=}"
150- rootpart="${rootpart%% *}"
151- [ "$rootpart" != "/dev/mmcblk0p2" ] && {
152- echo "Cannot downgrade to legacy image."
153- return 1
154- }
155- return 0
156151 ;;
157152 *)
158153 echo "Sysupgrade is not supported on your board yet."
@@ -165,7 +160,8 @@ platform_check_image() {
165160
166161 platform_copy_config() {
167162 case "$(board_name)" in
168- bananapi,bpi-r2)
163+ bananapi,bpi-r2|\
164+ unielec,u7623-02)
169165 emmc_copy_config
170166 ;;
171167 unielec,u7623-02-emmc-512m)
--- a/target/linux/mediatek/mt7623/config-5.10
+++ b/target/linux/mediatek/mt7623/config-5.10
@@ -391,7 +391,6 @@ CONFIG_MODULES_USE_ELF_REL=y
391391 # CONFIG_MOUSE_PS2 is not set
392392 # CONFIG_MOUSE_SERIAL is not set
393393 # CONFIG_MOUSE_VSXXXAA is not set
394-CONFIG_MTD_BLOCK2MTD=y
395394 CONFIG_MTD_CMDLINE_PARTS=y
396395 # CONFIG_MTD_NAND_MTK_BMT is not set
397396 # CONFIG_MTD_PARSER_TRX is not set
Show on old repository browser