[OpenWrt-Devel] [PATCH v2] gemini: Support sysupgrade on DIR-685
Petr Štetiar
ynezz at true.cz
Tue May 14 04:30:38 EDT 2019
Linus Walleij <linus.walleij at linaro.org> [2019-05-12 21:13:17]:
Hi,
> --- /dev/null
> +++ b/target/linux/gemini/base-files/lib/upgrade/platform.sh
> @@ -0,0 +1,50 @@
> +REQUIRE_IMAGE_METADATA=1
once you set this, you don't need to check for the image magic, do you? If so,
please provide the reason for that. Generated image is simply going to contain
list of compatible boards in it's metadata JSON (comming from
SUPPORTED_DEVICES variable) so I think, that this generic check should be
enough.
> +wrgg_get_image_magic() {
> + get_image "$@" | dd bs=4 count=1 skip=8 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
> +}
So you can drop this.
> +platform_find_part_size() {
> + local first dev size erasesize name
> + while read dev size erasesize name; do
> + name=${name#'"'}; name=${name%'"'}
> + [ "$name" = "$1" ] && {
> + echo "$size"
> + break
> + }
> + done < /proc/mtd
> +}
Why is this needed? I don't see it being used anywhere.
> +platform_check_image() {
> + local board=$(board_name)
> +
> + case "$board" in
> + dlink,dir-685 )
> + local magic=$(wrgg_get_image_magic "$1")
> + [ "$magic" != "21030820" ] && {
> + echo "Invalid image. Bad magic for DIR-685."
> + return 1
> + }
> + echo "Image looks OK"
and this can be dropped as well.
> + return 0
> + ;;
> + esac
> +
> + echo "Sysupgrade is not yet supported on $board."
> + return 1
> +}
platform_check_image() {
local board=$(board_name)
case "$board" in
dlink,dir-685 )
return 0
;;
esac
echo "Sysupgrade is not yet supported on $board."
return 1
}
So this should be enough.
> diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile
> index 8fec250f186a..3339cd2467a9 100644
> --- a/target/linux/gemini/image/Makefile
> +++ b/target/linux/gemini/image/Makefile
> + SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
>
> @@ -143,9 +144,11 @@ define Device/dlink_dir-685
> + SUPPORTED_DEVICES += dlink,dir-685
You can drop this SUPPORTED_DEVICES as it's going to be created for you from
the device name by the code you've added above.
-- ynezz
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list