diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index af1182cb1..ef8d01e16 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -165,6 +165,23 @@ part_magic_fat() { [ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ] } +fitblk_get_bootdev() { + [ -e /sys/firmware/devicetree/base/chosen/rootdisk ] || return + + local rootdisk="$(cat /sys/firmware/devicetree/base/chosen/rootdisk)" + local handle bootdev + for handle in /sys/class/block/*/of_node/phandle /sys/class/block/*/device/of_node/phandle; do + [ ! -e "$handle" ] && continue + if [ "$rootdisk" = "$(cat $handle)" ]; then + bootdev="${handle%/of_node/phandle}" + bootdev="${bootdev%/device}" + bootdev="${bootdev#/sys/class/block/}" + echo "$bootdev" + break + fi + done +} + export_bootdevice() { local cmdline uuid blockdev uevent line class local MAJOR MINOR DEVNAME DEVTYPE @@ -196,6 +213,7 @@ export_bootdevice() { done ;; /dev/*) + [ "$rootpart" = "/dev/fit0" ] && rootpart="$(fitblk_get_bootdev)" uevent="/sys/class/block/${rootpart##*/}/../uevent" ;; 0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \ diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 717e59f83..d54d5f872 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -20,6 +20,7 @@ CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= +PKG_USE_MIPS16:=0 PKG_BUILD_FLAGS:=no-mips16 PKG_FLAGS:=nonshared diff --git a/target/linux/mediatek/Makefile b/target/linux/mediatek/Makefile index 0175e62c1..e7ee31776 100644 --- a/target/linux/mediatek/Makefile +++ b/target/linux/mediatek/Makefile @@ -13,7 +13,7 @@ KERNEL_TESTING_PATCHVER:=6.6 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ - kmod-leds-gpio kmod-gpio-button-hotplug \ + kmod-leds-gpio kmod-gpio-button-hotplug fitblk \ autocore-arm htop wpad-openssl uboot-envtools $(eval $(call BuildTarget))