[OpenWrt-Devel] [PATCH 1/2] build: sysupgrade-tar alt-board= for legacy upgrades

Jeff Kletsky lede at allycomm.com
Wed Nov 6 22:09:43 EST 2019


On 11/6/19 2:47 PM, Daniel Golle wrote:

> Hi Jeff,
>
> On Thu, Oct 24, 2019 at 08:57:52PM -0700, Jeff Kletsky wrote:
>> From: Jeff Kletsky <git-commits at allycomm.com>
>>
>> Targets that use nand_do_platform_check() can't use SUPPORTED_DEVICES
>> as the check requires ./sysupgrade-legacy_boardname/CONTROL to be
>> non-zero length as extracted from the tar file. Previously, only
>> ./sysupgrade-new_boardname/CONTROL was present.
>>
>> [...]
>>
>> +
>> +for ab in $alt_boards ; do
>> +	[ "$ab" = "$board" ] && continue
>> +	mkdir "${tmpdir}/sysupgrade-${ab}/"
>> +	cp -vp "${tmpdir}/sysupgrade-${board}/CONTROL" "${tmpdir}/sysupgrade-${ab}/"
> Why not just add a symlink to the tar archive instead of a copy?
> I know it doesn't matter much due to compress, jet I'd consider it a
> more clean solution.
>

Thanks for taking a look at this!

If/when I pick it up again, I'll definitely re-check if symlinks can
be used.

It's been a while since I authored this, but my recollection is that
since the tar is not extracted "in whole" (to preserve space,
I assume), there is no target of the symlink to reference.

From: package/base-files/files/lib/upgrade/nand.sh (master)

nand_do_platform_check() {
         local board_name="$1"
         local tar_file="$2"
         local control_length=`(tar xf $tar_file 
sysupgrade-$board_name/CONTROL -O | wc -c) 2> /dev/null`
         local file_type="$(identify $2)"

         [ "$control_length" = 0 -a "$file_type" != "ubi" -a 
"$file_type" != "ubifs" ] && {
                 echo "Invalid sysupgrade file."
                 return 1
         }

         return 0
}


As this was primarily to handle upgrades from older firmware versions,
the upgrade tar needs to be compatible with previous code, which
`git blame` shows as commit 3dca5a158d, SVN-Revision: 41222, 2014-06-16


Jeff



_______________________________________________
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