aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/mt7623
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-07-10 16:35:47 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-07-20 04:16:48 +0100
commit86a61e716efe2e0ef2f4ce9b2fdd7a532661ef56 (patch)
tree9d933bb05ab52a825301b54f71ebc4d384d08e66 /target/linux/mediatek/mt7623
parent6b2000b6ff19165d33b7f67fb7275334cbf80395 (diff)
downloadupstream-86a61e716efe2e0ef2f4ce9b2fdd7a532661ef56.tar.gz
upstream-86a61e716efe2e0ef2f4ce9b2fdd7a532661ef56.tar.bz2
upstream-86a61e716efe2e0ef2f4ce9b2fdd7a532661ef56.zip
mediatek: rework Bananapi BPi-R2
* introduce recovery (=initramfs) vs. production dual boot scheme * make use of uImage.FIT (instead of FAT partition) * generate images using build steps (instead of external scripts) * simplify sysupgrade and config restore (thanks to uImage.FIT) * make sure mmc devices are ordered persistently (set DT aliases) This commit breaks sysupgrade from existing installations, you will have to re-install using the sdcard.img.gz image. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/mediatek/mt7623')
-rw-r--r--target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config3
-rwxr-xr-xtarget/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh50
-rw-r--r--target/linux/mediatek/mt7623/config-5.101
3 files changed, 26 insertions, 28 deletions
diff --git a/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config b/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config
index f47894c0fd..9dfb06bd81 100644
--- a/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config
+++ b/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config
@@ -6,9 +6,6 @@ move_config() {
local partdev partnum
case $(board_name) in
- bananapi,bpi-r2)
- partnum=2
- ;;
unielec,u7623-02-emmc-512m)
if grep -q root=/dev/mmcblk0p2 /proc/cmdline; then
partnum=1;
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 d3da22d496..4564bc61dd 100755
--- a/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,6 @@
REQUIRE_IMAGE_METADATA=1
+RAMFS_COPY_BIN='blockdev'
# Full system upgrade including preloader for MediaTek SoCs on eMMC or SD
mtk_mmc_full_upgrade() {
@@ -83,7 +84,18 @@ platform_do_upgrade() {
case "$board" in
bananapi,bpi-r2)
- mtk_mmc_full_upgrade "$1"
+ export_bootdevice
+ export_partdevice rootdev 0
+ export_partdevice fitpart 3
+ [ "$fitpart" ] || return 1
+ dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null
+ blockdev --rereadpt /dev/$rootdev
+ get_image "$1" | dd of=/dev/$fitpart
+ blockdev --rereadpt /dev/$rootdev
+ local datapart=$(get_partition_by_name $rootdev "rootfs_data")
+ [ "$datapart" ] || return 0
+ dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null
+ echo $datapart > /tmp/sysupgrade.datapart
;;
unielec,u7623-02-emmc-512m)
@@ -126,32 +138,10 @@ platform_check_image() {
case "$board" in
bananapi,bpi-r2)
- [ "$magic" != "53444d4d" ] && {
+ [ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
}
- export_bootdevice && export_partdevice diskdev 0 || {
- echo "Unable to determine upgrade device"
- return 1
- }
-
- get_partitions "/dev/$diskdev" bootdisk
-
- #extract the boot sector from the image
- get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null
-
- get_partitions /tmp/image.bs image
-
- #compare tables
- diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
-
- rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
-
- if [ -n "$diff" ]; then
- echo "Partition layout has changed. Full image will be written."
- ask_bool 0 "Abort" && exit 1
- return 0
- fi
;;
unielec,u7623-02-emmc-512m)
# Can always upgrade to the new-style full image
@@ -180,9 +170,19 @@ platform_check_image() {
return 0
}
+platform_copy_config_mmc() {
+ [ -e "$UPGRADE_BACKUP" ] || return
+ local datapart=$(cat /tmp/sysupgrade.datapart)
+ [ "$datapart" ] || echo "no rootfs_data partition, cannot keep configuration." >&2
+ dd if="$UPGRADE_BACKUP" of=/dev/$datapart
+ sync
+}
+
platform_copy_config() {
case "$(board_name)" in
- bananapi,bpi-r2|\
+ bananapi,bpi-r2)
+ platform_copy_config_mmc
+ ;;
unielec,u7623-02-emmc-512m)
# platform_do_upgrade() will have set $recoverydev
if [ -n "$recoverydev" ]; then
diff --git a/target/linux/mediatek/mt7623/config-5.10 b/target/linux/mediatek/mt7623/config-5.10
index 4a43b51675..ca1f92ae78 100644
--- a/target/linux/mediatek/mt7623/config-5.10
+++ b/target/linux/mediatek/mt7623/config-5.10
@@ -229,6 +229,7 @@ CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT_MAP=y
+CINFIG_HAVE_ARM_ARCH_TIMER=y
CONFIG_HAVE_SMP=y
CONFIG_HDMI=y
CONFIG_HIGHMEM=y