diff --git a/Makefile b/Makefile index b5bae21..434f145 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=facinstall -PKG_VERSION:=1.5 -PKG_RELEASE:=20240131 +PKG_VERSION:=1.7 +PKG_RELEASE:=20240303 PKG_MAINTAINER:=remittor PKG_LICENSE:=MIT diff --git a/files/functions.sh b/files/functions.sh index 8d1409d..7ae7c13 100644 --- a/files/functions.sh +++ b/files/functions.sh @@ -226,7 +226,7 @@ fi_get_part_size() { local part_name=$1 local part local mtd_size_hex - part=$( grep "\"$part_name\"" < "/proc/mtd" ) + part=$( cat /proc/mtd | grep "\"$part_name\"" 2>/dev/null ) if [ -z "$part" ]; then mtd_size_hex=0 else diff --git a/files/xiaomi.sh b/files/xiaomi.sh index 3194e27..83e7440 100644 --- a/files/xiaomi.sh +++ b/files/xiaomi.sh @@ -382,6 +382,7 @@ fi_platform_do_upgrade() { } fi_platform_init() { + local krn_size ldr_size FI_FIT_IMG= FI_UBI_IMG= FI_KERNEL_PART=$CI_KERNPART @@ -393,6 +394,15 @@ fi_platform_init() { if [ -n "$CI_ROOT_UBIPART" ]; then FI_ROOTFS_PART=$CI_ROOT_UBIPART fi + krn_size=$( fi_get_part_size "$FI_KERNEL_PART" ) + if [ "$krn_size" = "0" ]; then + ldr_size=$( fi_get_part_size "ubi-loader" ) + if [ "$ldr_size" = "0" ]; then + fierr "cannot find mtd partition for kernel image" + return 1 + fi + FI_KERNEL_PART="ubi-loader" + fi [ -z "$FI_IMAGE_SIZE" ] && return 1 [ "$FI_IMAGE_SIZE" -lt 1000000 ] && return 1 FI_IMG_MODEL=$( fi_get_uint8_at 14 )