mediatek: drop platform_get_bootdev
Now that we got fitblk_get_bootdev in /lib/upgrade/common.sh we don't need platform_get_bootdev in each of the subtargets any longer. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
fc865eb3ae
commit
eab44ec7ea
3 changed files with 5 additions and 50 deletions
|
@ -60,21 +60,6 @@ xiaomi_initial_setup()
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_get_bootdev() {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
platform_do_upgrade() {
|
platform_do_upgrade() {
|
||||||
local board=$(board_name)
|
local board=$(board_name)
|
||||||
|
|
||||||
|
@ -100,7 +85,7 @@ platform_do_upgrade() {
|
||||||
bananapi,bpi-r4)
|
bananapi,bpi-r4)
|
||||||
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
||||||
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
||||||
bootdev="$(platform_get_bootdev)"
|
bootdev="$(fitblk_get_bootdev)"
|
||||||
case "$bootdev" in
|
case "$bootdev" in
|
||||||
mmcblk*)
|
mmcblk*)
|
||||||
EMMC_KERN_DEV="/dev/$bootdev"
|
EMMC_KERN_DEV="/dev/$bootdev"
|
||||||
|
@ -221,7 +206,7 @@ platform_copy_config() {
|
||||||
bananapi,bpi-r3|\
|
bananapi,bpi-r3|\
|
||||||
bananapi,bpi-r3-mini|\
|
bananapi,bpi-r3-mini|\
|
||||||
bananapi,bpi-r4)
|
bananapi,bpi-r4)
|
||||||
case "$(platform_get_bootdev)" in
|
case "$(fitblk_get_bootdev)" in
|
||||||
mmcblk*)
|
mmcblk*)
|
||||||
emmc_copy_config
|
emmc_copy_config
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,21 +1,6 @@
|
||||||
REQUIRE_IMAGE_METADATA=1
|
REQUIRE_IMAGE_METADATA=1
|
||||||
RAMFS_COPY_BIN='fitblk'
|
RAMFS_COPY_BIN='fitblk'
|
||||||
|
|
||||||
platform_get_bootdev() {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
platform_do_upgrade() {
|
platform_do_upgrade() {
|
||||||
local board=$(board_name)
|
local board=$(board_name)
|
||||||
local file_type=$(identify $1)
|
local file_type=$(identify $1)
|
||||||
|
@ -28,7 +13,7 @@ platform_do_upgrade() {
|
||||||
ubnt,unifi-6-lr-v3-ubootmod)
|
ubnt,unifi-6-lr-v3-ubootmod)
|
||||||
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
||||||
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
||||||
bootdev="$(platform_get_bootdev)"
|
bootdev="$(fitblk_get_bootdev)"
|
||||||
case "$bootdev" in
|
case "$bootdev" in
|
||||||
mmcblk*)
|
mmcblk*)
|
||||||
EMMC_KERN_DEV="/dev/$bootdev"
|
EMMC_KERN_DEV="/dev/$bootdev"
|
||||||
|
@ -119,7 +104,7 @@ platform_check_image() {
|
||||||
platform_copy_config() {
|
platform_copy_config() {
|
||||||
case "$(board_name)" in
|
case "$(board_name)" in
|
||||||
bananapi,bpi-r64)
|
bananapi,bpi-r64)
|
||||||
if platform_get_bootdev | grep -q mmc; then
|
if fitblk_get_bootdev | grep -q mmc; then
|
||||||
emmc_copy_config
|
emmc_copy_config
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -1,20 +1,5 @@
|
||||||
REQUIRE_IMAGE_METADATA=1
|
REQUIRE_IMAGE_METADATA=1
|
||||||
|
|
||||||
platform_get_bootdev() {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
# Legacy full system upgrade including preloader for MediaTek SoCs on eMMC or SD
|
# Legacy full system upgrade including preloader for MediaTek SoCs on eMMC or SD
|
||||||
legacy_mtk_mmc_full_upgrade() {
|
legacy_mtk_mmc_full_upgrade() {
|
||||||
local diskdev partdev diff oldrecovery
|
local diskdev partdev diff oldrecovery
|
||||||
|
@ -100,7 +85,7 @@ platform_do_upgrade() {
|
||||||
unielec,u7623-02)
|
unielec,u7623-02)
|
||||||
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
||||||
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
||||||
bootdev="$(platform_get_bootdev)"
|
bootdev="$(fitblk_get_bootdev)"
|
||||||
EMMC_KERN_DEV="/dev/$bootdev"
|
EMMC_KERN_DEV="/dev/$bootdev"
|
||||||
emmc_do_upgrade "$1"
|
emmc_do_upgrade "$1"
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue