Skip to content
Snippets Groups Projects
Commit 263f731b authored by Sukru Senli's avatar Sukru Senli
Browse files

ramips: change function names in upgrade script

parent c73b4de1
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ log() { ...@@ -22,7 +22,7 @@ log() {
} }
#-------------------------------------------------------------- #--------------------------------------------------------------
is_inteno_image() { is_iop_image() {
local magic local magic
[ -n "$1" ] || return 1 [ -n "$1" ] || return 1
...@@ -39,7 +39,7 @@ is_inteno_image() { ...@@ -39,7 +39,7 @@ is_inteno_image() {
#-------------------------------------------------------------- #--------------------------------------------------------------
get_image_type() { get_image_type() {
if is_inteno_image "$1"; then if is_iop_image "$1"; then
echo "INTENO" echo "INTENO"
else else
echo "UNKNOWN" echo "UNKNOWN"
...@@ -49,7 +49,7 @@ get_image_type() { ...@@ -49,7 +49,7 @@ get_image_type() {
#-------------------------------------------------------------- #--------------------------------------------------------------
get_inteno_tag_val() { get_iop_tag_val() {
local from="$1" local from="$1"
local tag="$2" local tag="$2"
local val local val
...@@ -64,21 +64,21 @@ get_inteno_tag_val() { ...@@ -64,21 +64,21 @@ get_inteno_tag_val() {
#-------------------------------------------------------------- #--------------------------------------------------------------
get_image_model_name() { get_image_model_name() {
get_inteno_tag_val $1 model get_iop_tag_val $1 model
} }
#-------------------------------------------------------------- #--------------------------------------------------------------
get_image_customer() { get_image_customer() {
get_inteno_tag_val $1 customer get_iop_tag_val $1 customer
} }
#-------------------------------------------------------------- #--------------------------------------------------------------
get_image_chip_id() { get_image_chip_id() {
get_inteno_tag_val $1 chip get_iop_tag_val $1 chip
} }
...@@ -91,7 +91,7 @@ get_section_size_v3() { ...@@ -91,7 +91,7 @@ get_section_size_v3() {
local sec="$2" # Named section local sec="$2" # Named section
local sz local sz
sz="$(get_inteno_tag_val $from $sec)" sz="$(get_iop_tag_val $from $sec)"
[ -z "$sz" ] && sz=0 [ -z "$sz" ] && sz=0
echo -n $sz echo -n $sz
} }
...@@ -143,8 +143,8 @@ get_section_offset_v5() { ...@@ -143,8 +143,8 @@ get_section_offset_v5() {
local from="$1" # Image file local from="$1" # Image file
local sec="$2" # Named section local sec="$2" # Named section
ofs="$(get_inteno_tag_val $from ${sec}ofs)" ofs="$(get_iop_tag_val $from ${sec}ofs)"
filesize="$(get_inteno_tag_val $from size)" filesize="$(get_iop_tag_val $from size)"
[ -n "$ofs" ] || ofs=0 [ -n "$ofs" ] || ofs=0
[ -n "$filesize" ] || filesize=0 [ -n "$filesize" ] || filesize=0
[ $ofs -ge 1024 -a $ofs -lt $filesize ] || ofs=0 # Verify tag is less than file size [ $ofs -ge 1024 -a $ofs -lt $filesize ] || ofs=0 # Verify tag is less than file size
...@@ -159,7 +159,7 @@ get_section_size() { ...@@ -159,7 +159,7 @@ get_section_size() {
local from="$1" # Image file local from="$1" # Image file
local ver local ver
ver=$(get_inteno_tag_val "$from" version) ver=$(get_iop_tag_val "$from" version)
if [ $ver -ge 3 -a $ver -le 8 ]; then # Version 4 differs from 3 in having a larger cfe. if [ $ver -ge 3 -a $ver -le 8 ]; then # Version 4 differs from 3 in having a larger cfe.
get_section_size_v3 "$@" || return # Version 5 appear in .y3 and have section offsets. get_section_size_v3 "$@" || return # Version 5 appear in .y3 and have section offsets.
else else
...@@ -175,7 +175,7 @@ get_section_offset() { ...@@ -175,7 +175,7 @@ get_section_offset() {
local from="$1" # Image file local from="$1" # Image file
local ver local ver
ver=$(get_inteno_tag_val "$from" version) ver=$(get_iop_tag_val "$from" version)
if [ $ver -ge 3 -a $ver -le 4 ]; then # Version 4 differs from 3 in having a larger cfe. if [ $ver -ge 3 -a $ver -le 4 ]; then # Version 4 differs from 3 in having a larger cfe.
get_section_offset_v3 "$@" || return get_section_offset_v3 "$@" || return
elif [ $ver -ge 5 -a $ver -le 8 ]; then # Version 5 appear in .y3 and have section offsets. elif [ $ver -ge 5 -a $ver -le 8 ]; then # Version 5 appear in .y3 and have section offsets.
...@@ -329,7 +329,7 @@ get_bootbank() { ...@@ -329,7 +329,7 @@ get_bootbank() {
check_crc() { check_crc() {
local from="$1" local from="$1"
case $(get_inteno_tag_val "$from" integrity) in case $(get_iop_tag_val "$from" integrity) in
MD5SUM) MD5SUM)
tail -c 32 "$from" >"${from}-$$.md5" tail -c 32 "$from" >"${from}-$$.md5"
echo " *-" >>"${from}-$$.md5" echo " *-" >>"${from}-$$.md5"
...@@ -407,7 +407,7 @@ iopsys_check_image() { ...@@ -407,7 +407,7 @@ iopsys_check_image() {
;; ;;
esac esac
is_inteno_image "$from" || { is_iop_image "$from" || {
echo "Header magic failed" echo "Header magic failed"
return 1 return 1
} }
...@@ -442,12 +442,12 @@ iopsys_check_image() { ...@@ -442,12 +442,12 @@ iopsys_check_image() {
k_sz=$(get_section_size $from vmlinux) || return 1 k_sz=$(get_section_size $from vmlinux) || return 1
ubi_sz=$(get_section_size $from ubi) || return 1 ubi_sz=$(get_section_size $from ubi) || return 1
ubifs_sz=$(get_section_size $from ubifs) || return 1 ubifs_sz=$(get_section_size $from ubifs) || return 1
ver=$(get_inteno_tag_val "$from" version) || return 1 ver=$(get_iop_tag_val "$from" version) || return 1
if [ $ver -eq 3 ]; then if [ $ver -eq 3 ]; then
echo "y2 image unsupported" echo "y2 image unsupported"
return 1 return 1
fi fi
filesize=$(get_inteno_tag_val "$from" size) || return 1 filesize=$(get_iop_tag_val "$from" size) || return 1
if [ $ver -le 4 -a $cfe_sz -eq 0 -a $k_sz -eq 0 -a $ubi_sz -eq 0 \ if [ $ver -le 4 -a $cfe_sz -eq 0 -a $k_sz -eq 0 -a $ubi_sz -eq 0 \
-a $ubifs_sz -eq 0 ]; then -a $ubifs_sz -eq 0 ]; then
echo "Unexpected image file contents, upgrade aborted!" echo "Unexpected image file contents, upgrade aborted!"
...@@ -615,7 +615,7 @@ perhaps_image_self_upgrade() { ...@@ -615,7 +615,7 @@ perhaps_image_self_upgrade() {
# the image do a self upgrade.) Instead we try a best effort # the image do a self upgrade.) Instead we try a best effort
# approach. Are there SOME backwards compatible parts we # approach. Are there SOME backwards compatible parts we
# recognize? Then try to satisfy with those parts only. # recognize? Then try to satisfy with those parts only.
is_inteno_image "$from" || return 0 is_iop_image "$from" || return 0
head -c 1024 "$from" | strings | \ head -c 1024 "$from" | strings | \
awk '$1 ~ "^version" && $2 ~ "[[:digit:]]+" { awk '$1 ~ "^version" && $2 ~ "[[:digit:]]+" {
if($2 < 7) { exit 1; }; # .y3 version 7 at least. if($2 < 7) { exit 1; }; # .y3 version 7 at least.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment