bcm53xx: sysupgrade: extract TRX partitions directly from vendor image

Extracting full TRX out of vendor format is not needed as otrx supports
passing TRX offset. This saves some RAM during sysupgrade.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45911 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Rafał Miłecki 2015-06-06 17:05:31 +00:00
parent 1575292186
commit 2abf42fc31
1 changed files with 5 additions and 3 deletions

View File

@ -123,19 +123,21 @@ platform_pre_upgrade() {
local file_type=$(platform_identify "$1")
local dir="/tmp/sysupgrade-bcm53xx"
local trx="$1"
local offset
[ "$(platform_flash_type)" != "nand" ] && return
# Extract trx
# Find trx offset
case "$file_type" in
"chk") trx="/tmp/$(basename $1).trx"; platform_extract_trx_from_chk "$1" "$trx";;
"cybertan") trx="/tmp/$(basename $1).trx"; platform_extract_trx_from_cybertan "$1" "$trx";;
"chk") offset=$((0x$(get_magic_long_at "$1" 4)));;
"cybertan") offset=32;;
esac
# Extract partitions from trx
rm -fR $dir
mkdir -p $dir
otrx extract "$trx" \
${offset:+-o $offset} \
-1 $dir/kernel \
-2 $dir/root