mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-10 15:03:07 +00:00
mediatek: mt7622: sync buffalo.sh with ramips/mt7621
Sync buffalo.sh with the one in ramips/mt7621 to improve handling of the TRX magic numbers of Buffalo WSR devices and switching sysupgrade method between buffalo_upgrade_ubinized() and nand_do_upgrade(). Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> Link: https://github.com/openwrt/openwrt/pull/17408 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
5d0f61e957
commit
376d8f96b1
@ -34,20 +34,30 @@
|
|||||||
#
|
#
|
||||||
# The mtd partitions "firmware" and "Kernel2" on NAND flash are os-image
|
# The mtd partitions "firmware" and "Kernel2" on NAND flash are os-image
|
||||||
# partitions. These partitions are called as "Image1/Image2" in U-Boot
|
# partitions. These partitions are called as "Image1/Image2" in U-Boot
|
||||||
# on WSR-2533DHP2, and they are checked conditions when booting.
|
# on WSR devices, and they are checked conditions when booting.
|
||||||
# "Image1" is always used for booting.
|
# "Image1" is always used for booting.
|
||||||
#
|
#
|
||||||
# == U-Boot Behaviors ==
|
# == U-Boot Behaviors ==
|
||||||
# - "Image1"/"Image2" images are good, images are different or
|
# - "Image1"/"Image2" images are good, images are different or
|
||||||
# "Image2" image is broken
|
# "Image2" image is broken
|
||||||
# -> writes os-image to "Image2" from "Image1"
|
# -> copy os-image to "Image2" from "Image1"
|
||||||
#
|
#
|
||||||
# - "Image1" image is broken
|
# - "Image1" image is broken
|
||||||
# -> writes os-image to "Image1" from "Image2"
|
# -> copy os-image to "Image1" from "Image2"
|
||||||
#
|
#
|
||||||
# - "Image1"/"Image2" images are broken
|
# - "Image1"/"Image2" images are broken
|
||||||
# -> fall to U-Boot command line
|
# -> fall to U-Boot command line
|
||||||
|
|
||||||
|
# TRX magic numbers of each model
|
||||||
|
case "$(board_name)" in
|
||||||
|
buffalo,wsr-2533dhp2)
|
||||||
|
BUFFALO_TRX_MAGIC="44485032" # "DHP2"
|
||||||
|
;;
|
||||||
|
buffalo,wsr-3200ax4s)
|
||||||
|
BUFFALO_TRX_MAGIC="44485033" # "DHP3"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
buffalo_check_image() {
|
buffalo_check_image() {
|
||||||
local board="$1"
|
local board="$1"
|
||||||
local boardname="$(echo $board | tr ',' '_')"
|
local boardname="$(echo $board | tr ',' '_')"
|
||||||
@ -56,7 +66,7 @@ buffalo_check_image() {
|
|||||||
|
|
||||||
# return error state if TRX + UBI formatted image specified
|
# return error state if TRX + UBI formatted image specified
|
||||||
# to notify about configurations
|
# to notify about configurations
|
||||||
if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then
|
if [ "$magic" = "$BUFFALO_TRX_MAGIC" ]; then
|
||||||
echo "Your configurations won't be saved if factory-uboot.bin image specified."
|
echo "Your configurations won't be saved if factory-uboot.bin image specified."
|
||||||
echo "But if you want to upgrade, please execute sysupgrade with \"-F\" option."
|
echo "But if you want to upgrade, please execute sysupgrade with \"-F\" option."
|
||||||
return 1
|
return 1
|
||||||
@ -124,3 +134,12 @@ buffalo_upgrade_ubinized() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buffalo_do_upgrade() {
|
||||||
|
if [ "$(get_magic_long "$1")" = "$BUFFALO_TRX_MAGIC" ]; then
|
||||||
|
buffalo_upgrade_ubinized "$1"
|
||||||
|
else
|
||||||
|
CI_KERNPART="firmware"
|
||||||
|
nand_do_upgrade "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@ -16,16 +16,7 @@ platform_do_upgrade() {
|
|||||||
;;
|
;;
|
||||||
buffalo,wsr-2533dhp2|\
|
buffalo,wsr-2533dhp2|\
|
||||||
buffalo,wsr-3200ax4s)
|
buffalo,wsr-3200ax4s)
|
||||||
local magic="$(get_magic_long "$1")"
|
buffalo_do_upgrade "$1"
|
||||||
|
|
||||||
# use "mtd write" if the magic is "DHP2 (0x44485032)"
|
|
||||||
# or "DHP3 (0x44485033)"
|
|
||||||
if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then
|
|
||||||
buffalo_upgrade_ubinized "$1"
|
|
||||||
else
|
|
||||||
CI_KERNPART="firmware"
|
|
||||||
nand_do_upgrade "$1"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
dlink,eagle-pro-ai-m32-a1|\
|
dlink,eagle-pro-ai-m32-a1|\
|
||||||
dlink,eagle-pro-ai-r32-a1|\
|
dlink,eagle-pro-ai-r32-a1|\
|
||||||
|
Loading…
Reference in New Issue
Block a user