aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/mt7623
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-08-20 21:11:32 +0100
committerDaniel Golle <daniel@makrotopia.org>2022-01-23 20:20:37 +0000
commit1ee75dd2906e15f874220151cdd4802d50e4a082 (patch)
tree9c9fb99a31fe6efd9d2a79fd10d34a14c186fa1f /target/linux/mediatek/mt7623
parent213b406ae3364913ef73ea027a38605107fcf78d (diff)
downloadupstream-1ee75dd2906e15f874220151cdd4802d50e4a082.tar.gz
upstream-1ee75dd2906e15f874220151cdd4802d50e4a082.tar.bz2
upstream-1ee75dd2906e15f874220151cdd4802d50e4a082.zip
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>
Diffstat (limited to 'target/linux/mediatek/mt7623')
-rw-r--r--target/linux/mediatek/mt7623/base-files/etc/board.d/02_network3
-rw-r--r--target/linux/mediatek/mt7623/base-files/lib/preinit/07_set_iface_mac16
-rwxr-xr-xtarget/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh38
-rw-r--r--target/linux/mediatek/mt7623/config-5.101
4 files changed, 21 insertions, 37 deletions
diff --git a/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7623/base-files/etc/board.d/02_network
index 2006248530..aeab04001a 100644
--- 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()
case $board in
bananapi,bpi-r2|\
+ unielec,u7623-02|\
unielec,u7623-02-emmc-512m)
ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan"
;;
@@ -20,6 +21,8 @@ mediatek_setup_macs()
local board="$1"
case $board in
+ bananapi,bpi-r2|\
+ unielec,u7623-02|\
unielec,u7623-02-emmc-512m)
ucidef_set_interface_macaddr "wan" "$(cat /sys/class/net/wan/address)"
;;
diff --git 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
index 7b165df565..424fe50be2 100644
--- 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() {
local rootpart
case $(board_name) in
- bananapi,bpi-r2|\
unielec,u7623-02-emmc-512m)
- rootpart=$(cat /proc/cmdline)
- rootpart="${rootpart##*root=}"
- rootpart="${rootpart%% *}"
- case $rootpart in
- /dev/mmcblk0p2) # Legacy U7623 image
- set_recovery_mac_address /dev/mmcblk0p1
- ;;
- /dev/mmcblk0p3) # U7623 or Banana Pi R2 eMMC
- set_recovery_mac_address /dev/mmcblk0p2
- ;;
- /dev/mmcblk1p3) # Banana Pi R2 SD
- set_recovery_mac_address /dev/mmcblk1p2
- ;;
- esac
+ set_recovery_mac_address /dev/mmcblk0p1
;;
esac
}
diff --git a/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
index 452a533db0..e885f460e9 100755
--- 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 @@
REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fwtool'
-# Full system upgrade including preloader for MediaTek SoCs on eMMC or SD
-mtk_mmc_full_upgrade() {
+# Legacy full system upgrade including preloader for MediaTek SoCs on eMMC or SD
+legacy_mtk_mmc_full_upgrade() {
local diskdev partdev diff oldrecovery
if grep -q root=/dev/mmcblk0p2 /proc/cmdline; then
@@ -26,7 +26,7 @@ mtk_mmc_full_upgrade() {
fi
sync
- if [ "$SAVE_PARTITIONS" = "1" ]; then
+ if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
get_partitions "/dev/$diskdev" bootdisk
#extract the boot sector from the image
@@ -83,18 +83,18 @@ platform_do_upgrade() {
local board=$(board_name)
case "$board" in
- bananapi,bpi-r2)
+ bananapi,bpi-r2|\
+ unielec,u7623-02)
export_bootdevice
export_partdevice fitpart 3
[ "$fitpart" ] || return 1
EMMC_KERN_DEV="/dev/$fitpart"
emmc_do_upgrade "$1"
;;
-
unielec,u7623-02-emmc-512m)
local magic="$(get_magic_long "$1")"
if [ "$magic" = "53444d4d" ]; then
- mtk_mmc_full_upgrade "$1"
+ legacy_mtk_mmc_full_upgrade "$1"
else # Old partial image starting with uImage
# Keep the persistent random mac address (if it exists)
recoverydev=mmcblk0p1
@@ -120,17 +120,14 @@ platform_do_upgrade() {
esac
}
-PART_NAME=firmware
-
platform_check_image() {
- local board=$(board_name)
local magic="$(get_magic_long "$1")"
- local diskdev partdev diff
[ "$#" -gt 1 ] && return 1
- case "$board" in
- bananapi,bpi-r2)
+ case "$(board_name)" in
+ bananapi,bpi-r2|\
+ unielec,u7623-02)
[ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
@@ -140,19 +137,17 @@ platform_check_image() {
# Can always upgrade to the new-style full image
[ "$magic" = "53444d4d" ] && return 0
+ # need to update to new bootchain via full image first
+ [ "$magic" = "d00dfeed" ] && {
+ echo "Please use full eMMC image to update bootloader first."
+ return 1
+ }
+
# Legacy uImage directly at 0xA00 on the eMMC.
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
return 1
}
- rootpart=$(cat /proc/cmdline)
- rootpart="${rootpart##*root=}"
- rootpart="${rootpart%% *}"
- [ "$rootpart" != "/dev/mmcblk0p2" ] && {
- echo "Cannot downgrade to legacy image."
- return 1
- }
- return 0
;;
*)
echo "Sysupgrade is not supported on your board yet."
@@ -165,7 +160,8 @@ platform_check_image() {
platform_copy_config() {
case "$(board_name)" in
- bananapi,bpi-r2)
+ bananapi,bpi-r2|\
+ unielec,u7623-02)
emmc_copy_config
;;
unielec,u7623-02-emmc-512m)
diff --git a/target/linux/mediatek/mt7623/config-5.10 b/target/linux/mediatek/mt7623/config-5.10
index 308a08413b..09ecc16ef2 100644
--- 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
# CONFIG_MOUSE_PS2 is not set
# CONFIG_MOUSE_SERIAL is not set
# CONFIG_MOUSE_VSXXXAA is not set
-CONFIG_MTD_BLOCK2MTD=y
CONFIG_MTD_CMDLINE_PARTS=y
# CONFIG_MTD_NAND_MTK_BMT is not set
# CONFIG_MTD_PARSER_TRX is not set