宽带技术网

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4878|回复: 25

hs8546V的恢复出厂命令(restorehwmode.sh)分析

[复制链接]
发表于 2018-4-4 22:39:49 | 显示全部楼层 |阅读模式
hs8546V的恢复出厂命令(restorehwmode.sh)分析1 q" q; o2 F+ }% m5 R0 ^
/ F0 r2 c( X* d. ^9 q
如下restorehwmode.sh这个命令的全部内容
9 K4 T2 c; `- q9 y, o' _
  1. #! /bin/sh' [1 `% X/ ?% |, s4 o) e. }
  2. - H3 Z. v# `% p7 M7 C8 x  O
  3. #set hw parameters
    3 j9 ~- Q. m0 U- B5 E
  4. #copy etc/wap/hw_default_ctree.xml to /mnt/jffs2/hw_ctree.xml% e7 k5 J% v% r* |$ t2 j! P
  5. #set the spec para( j8 a+ v! u; @# i* |; P
  6. 2 Q3 K$ q3 U, l- q, J3 \  G4 G
  7. var_default_ctree=/mnt/jffs2/hw_default_ctree.xml;
    & L% k- _4 }4 c- }* G8 F
  8. var_ctree=/mnt/jffs2/hw_ctree.xml
    # y! C' R, X/ I/ p# E
  9. var_customize=/mnt/jffs2/customizepara.txt. J, v1 C' H; z+ O4 Z' W8 \5 |
  10. var_bms_prevxml_temp="/mnt/jffs2/hw_bms_prev.xml"
    + E1 D+ a) i2 d7 S& f
  11. var_bms_oldcrc_temp="/mnt/jffs2/oldcrc"
    3 x$ a$ I  d! l3 Q
  12. var_bms_oltoldcrc_temp="/mnt/jffs2/oltoldcrc"
    % C8 n& S. ~. A
  13. var_bms_prevcrc_temp="/mnt/jffs2/prevcrc"2 D4 [5 a& C( ]
  14. var_bms_oltprevcrc_temp="/mnt/jffs2/oltprevcrc"$ Y. D5 f# y0 C# ^+ a5 g. e
  15. var_bms_oskvoice_temp="/mnt/jffs2/hw_osk_voip_prev.xml"
    9 B0 |$ N! @$ }. M& u" x& }
  16. var_rebootsave="/mnt/jffs2/cwmp_rebootsave"
    * e# y$ W- M5 Z/ G
  17. var_recovername_temp="/mnt/jffs2/recovername") V8 C  K3 O8 z) R9 L9 Q; R: x
  18. var_usr_device_temp="/mnt/jffs2/usr_device.bin"
    9 Q6 w" z7 M: |" F) ?! Y3 K: |3 W
  19. var_ftcrc_temp="/mnt/jffs2/FTCRC"4 s5 G" ~( K+ _, G% R! p& G
  20. var_ftvoip_temp="/mnt/jffs2/ftvoipcfgstate"
    ; z. P! Q: F; y( v; _9 d
  21. var_dhcp_temp="/mnt/jffs2/dhcpc"2 f2 H6 F# ?# M- R) q, n
  22. var_dhcp6_temp="/mnt/jffs2/dhcp6c"
    7 y( h! X3 F  ]! _7 @- a- P! e
  23. var_DHCPlasterrwan1_temp="/mnt/jffs2/DHCPlasterrwan1", Z4 Y! V9 l% X# g' v+ s
  24. var_DHCPlasterrwan2_temp="/mnt/jffs2/DHCPlasterrwan2"; a9 ^! g2 }4 J0 }, G' }  G% V
  25. var_DHCPlasterrwan3_temp="/mnt/jffs2/DHCPlasterrwan3"
    - j" }4 z1 r" s5 q
  26. var_DHCPlasterrwan4_temp="/mnt/jffs2/DHCPlasterrwan4"
    : g5 m1 @! m0 A8 b
  27. var_DHCPstatewan1_temp="/mnt/jffs2/DHCPstatewan1"
    3 m  X& P4 z( ^& n' |
  28. var_DHCPstatewan2_temp="/mnt/jffs2/DHCPstatewan2"+ N3 B7 w. H. n+ z
  29. var_DHCPstatewan3_temp="/mnt/jffs2/DHCPstatewan3"/ b. b" B5 C# j9 z
  30. var_DHCPstatewan4_temp="/mnt/jffs2/DHCPstatewan4"
    , `5 p  S% I0 `" o2 w  k- @" L
  31. var_DHCPoutputwan1_temp="/mnt/jffs2/DHCPoutputwan1": e0 E: e3 E! e
  32. var_boardinfo_file="/mnt/jffs2/hw_boardinfo"
    9 U: r7 h  T* d2 d
  33. var_boardinfo_bakfile="/mnt/jffs2/hw_boardinfo.bak"& F0 ?' n- M) z& H
  34. var_boardinfo_temp="/mnt/jffs2/hw_boardinfo.temp"
    ) M+ u3 U' m5 K5 T
  35. var_jffs2_customize_txt_file="/mnt/jffs2/customize.txt"1 }# ]( E! r! o* m2 l4 F3 L& U( b
  36. var_jffs2_choose_xml_dir="/mnt/jffs2/choose_xml"
    , `! {7 |0 r7 q/ e% P3 F% |
  37. var_jffs2_choose_xml_tar="/mnt/jffs2/choose_xml.tar.gz"
    " v& q' }7 |5 \# i; E% J) n9 K
  38. var_jffs2_spec_file="/mnt/jffs2/hw_hardinfo_spec") W1 o, F/ G1 u+ o1 K
  39. var_jffs2_spec_bak_file="/mnt/jffs2/hw_hardinfo_spec.bak"& Q6 K( Z; n) f  }! \
  40. var_jffs2_feature_file="/mnt/jffs2/hw_hardinfo_feature"
    3 C/ y1 _8 R4 w/ L7 ?0 ?% @2 k
  41. var_jffs2_feature_bak_file="/mnt/jffs2/hw_hardinfo_feature.bak"
    - ~- E2 j* C' T+ n: R/ S
  42. var_jffs2_hardinfo_para_file="/mnt/jffs2/hw_equip_hardinfo". s% Q( O& r2 X. o9 i  j
  43. var_ontfirstonline_temp="/mnt/jffs2/ontfirstonlinefile"
    - ]# {+ n/ x( p/ [3 M
  44. var_dublecore="/mnt/jffs2/doublecore"
    0 w* e. |# }6 `0 A! F/ i
  45. var_customize_telmex=/mnt/jffs2/TelmexCusomizePara
    " ?5 d8 g9 J" P- X) Y
  46. var_customize_dir="/mnt/jffs2/customize"
    ( f3 z" r% g( U* ]
  47. var_smartshowbssguide="/mnt/jffs2/smartshowbssguide"
    " R- k1 c9 s; p, J
  48. var_smartshowuserguide="/mnt/jffs2/smartshowuserguide"1 u" h' d  q$ F# n) o
  49. var_old_ctree="/mnt/jffs2/hw_old_ctree.xml"3 S3 K. ^; i7 K" A
  50. var_ctree_bak="/mnt/jffs2/hw_ctree_bak.xml"
    1 s6 Y/ H* M& h% ~+ S0 K: a- n
  51. var_cfgbackup="/mnt/jffs2/CfgFile_Backup"
    3 y  H5 |" D0 x5 ^8 J
  52. var_PrimaryDir="/mnt/jffs2/PrimaryDir"3 ^5 X# Q! W( p7 \
  53. var_p2p_dhcp_file="/mnt/jffs2/p2pdhcpboot_prev.ini"
    5 [* p! B/ w7 s/ s, }6 ~9 Q+ O
  54. var_jffs2_hardversion_bak_file="/mnt/jffs2/hw_boardinfo.bak"
    " H4 \1 L% [4 W& o! V2 a/ S# ]
  55. var_jffs2_specsn_file="/mnt/jffs2/customize_specsn"
    - v$ N) `: {' w$ U( g

  56. 1 f! f" v" ?2 S  w
  57. var_plat_root="/mnt/jffs2/platroot.crt"
    1 Y1 B; l$ Q) Q0 j+ `+ C
  58. var_plat_pub="/mnt/jffs2/platpub.crt"8 l. i9 \. Q+ S7 H0 P1 ~
  59. var_plat_prvt="/mnt/jffs2/platprvt.key"/ ]6 r5 Q* t% s/ X( P: |7 B9 j- Z2 b

  60. / j. H( c: m- x: ]+ _& I5 M+ t8 Q
  61. # remove plugin files 3 ~9 V2 Y+ K8 q% u' B
  62. HW_Script_RemovePluginFile()
    * s# s  Y( m3 H& T
  63. {
    8 r- c0 w8 x4 a! ^7 G. d0 x7 i3 W
  64.         #通过特性开关来决定删除哪些插件
    8 S- p. [  ]5 m4 t
  65.         var_feature_enble=`GetFeature HW_FT_OSGI_JVM_FROM_VAR`
    + R3 E) M0 O0 C5 ?/ {/ H' r# ~5 Q
  66.         if [ $var_feature_enble = 1 ];then
    ( Y1 t  J0 J& w! k
  67.                 rm  -rf /mnt/jffs2/app/osgi/felix-cache;8 Y+ C0 `$ }) _# m
  68.         rm  -f /mnt/jffs2/app/osgi/prebundlestatus.info;* W0 H# B5 D9 ^
  69.         rm  -f /mnt/jffs2/app/osgi/dlna.jar;1 S. l! A  R* I4 `
  70.         rm  -f /mnt/jffs2/app/osgi/samba.jar;
    7 C) C( _$ W% ~5 h
  71.         else
    ) j" I& N4 f% d5 o
  72.                 rm  -rf /mnt/jffs2/app/osgi/* ;' S- X' T- Y. \  F
  73.         fi7 S' p' H6 k' b
  74.         rm -rf  /mnt/jffs2/app/cplugin/* /var/cplugin/*;
    , q  x1 t2 X! f1 Y
  75. }
    " ]( |+ i/ A, Z+ B/ x: l, U' l5 L
  76. . H( Z* Y# [6 k9 l5 ~
  77. # remove files7 ~) S8 u) D% p6 B( T
  78. HW_Script_RemoveFile()* C- M2 F% b* o2 m& z8 X- ]
  79. {
    1 ]; z8 E4 L) U! S1 G5 B
  80.         rm -f $var_default_ctree
    1 i$ D/ Q! a6 m( y
  81.         rm -f $var_ctree
    * \; P% Y  X( `: E# S
  82.         rm -f $var_customize5 v% z$ C; A* s2 `! h* E+ }2 a& a7 e2 O
  83.         rm -f $var_bms_prevxml_temp
    $ ?- S/ O7 x) X
  84.         rm -f $var_bms_oldcrc_temp
    + o. ]9 o7 q& V/ V
  85.         rm -f $var_bms_oltoldcrc_temp
    % f1 A+ A6 C" [& H, @8 U# I! t
  86.         rm -f $var_bms_prevcrc_temp* f7 K* l3 `, D3 {$ U/ Z2 {  D
  87.         rm -f $var_bms_oltprevcrc_temp
    - |0 C& i9 i* h" z3 {: W
  88.         rm -f $var_bms_oskvoice_temp
    3 W4 r9 X( z7 `- [
  89.         rm -f $var_rebootsave
    4 |3 p" D3 y  ?. g/ Z# v( }( f
  90.         rm -f $var_recovername_temp* i/ o  _$ N% Z7 e4 T0 E/ n
  91.         rm -f $var_usr_device_temp8 W9 C! p% u; D: u" e( L
  92.         rm -rf $var_ftcrc_temp
    " v0 g3 P8 ?& H8 K! u
  93.         rm -rf $var_ftvoip_temp% V& F2 J' o- V5 ^; o! h% L# X& N
  94.         rm -rf $var_dhcp_temp
    7 k2 ~  |5 i" O0 K; s2 s9 f
  95.         rm -rf $var_dhcp6_temp
    3 S- W' U  n6 ~
  96.         rm -rf $var_DHCPlasterrwan1_temp
    2 m. `; R2 w6 V. ^6 u% Z# @
  97.         rm -rf $var_DHCPlasterrwan2_temp1 e. Y7 w2 O, w4 p  n, |1 M
  98.         rm -rf $var_DHCPlasterrwan3_temp
    * j6 Y, R) \  x. _9 ?
  99.         rm -rf $var_DHCPlasterrwan4_temp: E0 y" g7 n  s/ ]  R. y: N' @
  100.         rm -rf $var_DHCPstatewan1_temp1 v( Y7 L3 e/ V. \6 L; e
  101.         rm -rf $var_DHCPstatewan2_temp2 o- e7 T3 j+ U" _+ ^
  102.         rm -rf $var_DHCPstatewan3_temp8 J6 p5 V$ \+ g+ n
  103.         rm -rf $var_DHCPstatewan4_temp
    $ o$ @7 l* o; x8 b/ K: J
  104.         rm -rf $var_DHCPoutputwan1_temp
    , s+ G3 b: S$ b$ ?; W/ t
  105.         rm -rf $var_jffs2_customize_txt_file
    + }" B) D' U; ^
  106.         rm -rf $var_jffs2_choose_xml_dir8 e+ ]  L; v% H$ k! ~: w1 C
  107.         rm -f $var_jffs2_choose_xml_tar
    4 g0 m, H3 w0 [" t7 W" g
  108.         rm -fr $var_jffs2_spec_file
    1 j. N1 I% i8 R2 t* S
  109.         rm -fr $var_jffs2_spec_bak_file
    ( ^: h$ I$ Z( E1 w4 N5 c- _/ v7 y( U
  110.         rm -fr $var_jffs2_feature_file
    $ V* [* j3 y; x
  111.         rm -fr $var_jffs2_feature_bak_file
    : e2 L' B3 \6 l: O* |$ C
  112.         rm -fr $var_jffs2_hardinfo_para_file
    ( M$ v0 }% D' Z" B6 r
  113.         rm -fr $var_ontfirstonline_temp
    3 S  j4 v- }! q, B! N1 a* E
  114.         rm -f $var_dublecore
    $ ^: |0 r6 f, G+ c) I8 E* d+ e3 ^
  115.         rm -f /mnt/jffs2/simcard_flowflag/ O6 b* ?9 q: U" B0 B- @- {% Z
  116.         rm -f /mnt/jffs2/simcardreadflag" |, k/ H& _6 s3 }" t
  117.         rm -f /mnt/jffs2/typeword1 q6 ]2 G0 c' p2 y# x" f4 t. B
  118.         rm -f $var_customize_telmex
    4 S- f$ ?( x' f: T$ l' ^+ J
  119.         rm -rf $var_customize_dir+ ~6 E7 m* D( P3 y
  120.         rm -f $var_smartshowbssguide
    & [- H( M9 S. m7 g& ^# e5 z# r; e
  121.         rm -rf $var_smartshowuserguide
    # N2 s- X# T, h/ Z. j7 u- ]) |' [1 S
  122.         rm -fr $var_old_ctree
    8 c" {4 S, P! F% |
  123.         rm -fr $var_ctree_bak% J; a* `  X- T& B8 g3 {2 }. |
  124.         rm -fr $var_cfgbackup
    # q3 R- Q9 U3 Q; f; @
  125.         rm -f $var_jffs2_hardversion_bak_file5 `+ g" X0 p* G$ Y, d% H  \
  126.         rm -rf $var_PrimaryDir
    * F% I5 ^0 d* F3 u
  127.         rm -rf /mnt/jffs2/p2ploadcfgdone8 \4 j0 }% _' W: _% |2 L8 i( c
  128.         rm -rf /mnt/jffs2/dhcp6c
    . _1 t. s2 n% t5 U( b" G) X7 f" K
  129.     rm -rf /mnt/jffs2/dhcpc
    & R9 T  s& A+ S6 D; D
  130.         rm -rf /mnt/jffs2/onlinecounter
    9 y6 E9 h# j+ U) {4 f
  131.         rm -rf $var_jffs2_specsn_file: M( e( m! _1 `4 o$ [
  132.         rm -rf /mnt/jffs2/reboot_bind_tag' X$ D4 Q) f$ _' Q3 }* H
  133.         rm -rf $var_p2p_dhcp_file) G0 p5 V  g& q9 s( {) d' G8 `
  134.                 ! W- Y/ D) E' r2 |3 \
  135.         rm  -rf /mnt/jffs2/app/osgi/*
    + _- u- `8 T* f1 R7 w
  136.         rm  -rf /mnt/jffs2/app/cplugin/*
    ; R8 U9 Q$ J  h" w/ i' c  W
  137.         4 n" _. L" t& E! i1 O% K* L
  138.         rm -f /mnt/jffs2/smooth_finsh
    2 A& |2 x' v5 [) o4 a
  139.         rm -f /mnt/jffs2/gdstbmac.bin
    & [& e! s2 v$ j5 H1 ~
  140.        
    " V: N5 M% v# B) s7 r; L
  141.         rm -f $var_plat_root
    & v/ ]  L# V* W  n
  142.         rm -f $var_plat_pub
    1 b0 P: ?( I, A3 g% b
  143.         rm -f $var_plat_prvt8 H* `" S9 H: [2 f

  144. ( d4 D$ l% P- A1 e" h
  145.         HW_Script_RemovePluginFile$ \6 f6 Q. ^1 D& ]/ }$ t
  146.         return. e+ U  {/ B6 r7 j: X
  147. }
    6 B1 k% g  J- K- g* v$ Z2 n
  148. 8 l) g9 d7 ~; P
  149. #creat files) N' s& ?- |5 k- ~  l. O
  150. HW_Script_CreateFile(). R" M) @* _- e+ c2 ]+ T5 y
  151. {) t  s" M* p+ f+ D. Q7 t
  152.         var_telnet_flag=/mnt/jffs2/ProductLineMode
    . ~5 ^. [9 u" q4 d& j& [0 W+ i4 y

  153. " l- H! g0 r- o
  154.         echo "" > $var_telnet_flag8 C. ^; g; B% k3 S
  155.         if [ 0 -ne $? ]7 b1 E5 M7 n- @; |" ~
  156.         then0 N7 }3 p# f& m4 s9 Z9 k' D
  157.         {
    - y4 R# I; P/ D+ ^3 H
  158.                 echo "ERROR::Failed to create telnet flag!"7 T5 K) V2 |! |4 t1 G" m5 _2 ?
  159.         return 1
    6 _: p4 c$ l* L+ D8 m% ?) u# B
  160.         }
    4 n" d4 N2 [- d$ I- r
  161.         fi1 C6 U+ m0 e( y* F9 ^

  162. 0 e7 J4 f$ u6 o5 A! w9 p9 P0 B/ h5 e
  163.         return 0
    5 K3 `5 ?' W3 U6 b/ O2 D
  164. }
    * W; X7 u5 A! Y: C

  165.   P- k  x" L0 }3 Z+ B- V
  166. # copy files
    . _+ `; u" C' n9 H
  167. HW_Script_CopyFile()# A$ j- x% s6 W* n# N1 i
  168. {, {9 L/ X( }- w* G
  169.         var_etc_def=/etc/wap/hw_default_ctree.xml
    " K2 T8 h; y; t- c' q
  170.           U/ j. Z+ N' x: R/ u" F! `* V: B
  171.         #增加延时,确保DB不保存
    8 R# |6 c! f( @% [) o4 |8 _( L+ w, b
  172.         echo > /var/notsavedata+ X, R$ E# }6 M; f. ]( U- S# q& x
  173.         sleep 1/ P. ]6 y9 c5 o' v
  174.   {3 G+ w  w  G8 q9 E  O- `' q
  175.         cp -f $var_etc_def $var_ctree
    : m6 Y! n5 e6 O2 j1 j
  176.         if [ 0 -ne $? ]9 J. `, b+ c# j0 {
  177.         then
    3 S& m+ {5 ^' p+ l5 e# @
  178.                 rm -rf /var/notsavedata* K' t  |4 j# V, G# ^5 J
  179.                 echo "ERROR::Failed to cp hw_default_ctree.xml to hw_ctree.xml!"# W, H! j' ^( }! H5 T1 ?4 R" l
  180.                 return 1; A+ c0 e7 X! K$ b8 s, t5 e
  181.         fi
    3 S5 T0 T) O  l, j1 k
  182. " ^9 z: j6 e1 u1 Q
  183.         return/ T9 Q+ R2 I: O; K
  184. }: v3 V$ j- y& b# h  k, E
  185. 7 I* O: @$ J( o( P" V3 p
  186. # set spec data7 H! d# z6 t: @5 s+ W& W; x5 `
  187. HW_Script_SetData()
    2 E2 H& a( d# B* k, D2 l
  188. {
    $ x0 L  x! H" Q4 c; `/ _
  189.         cat $var_boardinfo_file | while read -r line;+ ?) Y/ Q3 B3 n' e" y
  190.         do. B3 Y4 _. Z0 P
  191.                 obj_id_temp=`echo $line | sed 's/\(.*\)obj.value\(.*\)/\1/g'`
    7 `6 s; S  d0 t
  192.                 obj_id=`echo $obj_id_temp | sed 's/\(.*\)"\(.*\)"\(.*\)/\2/g'`
    / S  \7 u  Z3 r. D. B7 U
  193. . e9 h6 D2 B) G: u
  194.                 if [ "0x00000003" == $obj_id ];then0 L5 u0 C4 n. O' R' X) ?
  195.                         echo "obj.id = "0x00000003" ; obj.value = "";"9 m& s5 B) b7 w* h: N! ^
  196.                 elif [ "0x00000004" == $obj_id ];then
    / x1 `- h# z- u6 ]! m; Q4 o
  197.                         echo "obj.id = "0x00000004" ; obj.value = "";") I0 Q8 s; O" N6 U6 W* v5 w
  198.                 elif [ "0x00000005" == $obj_id ];then$ @' s( u0 ?- m# X
  199.                         echo "obj.id = "0x00000005" ; obj.value = "";"! B" B' o) h% x6 E3 v' }( b
  200.                 elif [ "0x00000006" == $obj_id ];then  a+ F5 D$ C4 W" y7 `, x$ `
  201.                         echo "obj.id = "0x00000006" ; obj.value = "";"9 u4 u6 n% W, R- `# Q
  202.                 elif [ "0x00000016" == $obj_id ];then, {6 n0 I( N6 Q# A. A
  203.                         echo "obj.id = "0x00000016" ; obj.value = "";"! k0 Z# Y/ ]/ [) j2 r
  204.                 elif [ "0x0000001a" == $obj_id ];then: x& A, e! r- }% H9 x! L/ X5 Q
  205.                         echo "obj.id = "0x0000001a" ; obj.value = "COMMON";"8 I( C, q( ^6 B9 U! s+ I- f6 T6 B
  206.                 elif [ "0x0000001b" == $obj_id ];then
    ; h" [# u0 d! @2 E" {
  207.                         echo "obj.id = "0x0000001b" ; obj.value = "COMMON";"1 |  W3 i6 |' M+ R; y* Y  i/ H% v3 ?
  208.                 elif [ "0x00000019" == $obj_id ];then! J( f* z  J9 c+ ?8 {/ V  r
  209.                         echo "obj.id = "0x00000019" ; obj.value = "";"
    2 n) J1 U# h. J% S3 T, T
  210.                 elif [ "0x00000020" == $obj_id ];then
    # x4 C% O2 K) k8 p  g: s
  211.                         echo "obj.id = "0x00000020" ; obj.value = "";"
    7 l; M& c8 `' e' y- z$ B6 k' q
  212.                 elif [ "0x00000031" == $obj_id ];then
    2 Z/ o& N6 ^$ S. e; }; u3 G
  213.                         echo "obj.id = "0x00000031" ; obj.value = "NOCHOOSE";"
    + u$ p- V5 l! d# |* t
  214.                 elif [ "0x00000035" == $obj_id ];then
    9 k/ b0 d& t6 ?
  215.                         echo "obj.id = "0x00000035" ; obj.value = "";"1 J2 y8 n3 P% T3 s0 n
  216.                 elif [ "0x0000003a" == $obj_id ];then& D; }; k% T0 T% e+ M
  217.                         echo "obj.id = "0x0000003a" ; obj.value = "";"
    1 b$ \8 D5 ^( }8 Y4 u% |# G0 q1 H8 i
  218.                 else
    ! v- a9 O' f5 p$ Y3 M
  219.                         echo -E $line
    1 v$ b4 B/ Z' G" ~. Z* o8 `
  220.                 fi3 I. e4 U  D0 t% z; ~
  221.         done  > $var_boardinfo_temp. o1 q$ _6 \/ `) I' c

  222. ' u- n- J1 |/ ?& W, I
  223.         mv -f $var_boardinfo_temp $var_boardinfo_file( v; Q9 G7 v; z  M

  224. 7 _: R, p, K! r7 ~: N6 _6 O
  225.         return
    2 n* e) a- K& K, I0 S8 c
  226. }
    % ^5 _# L0 F! W) F* A, D

  227. . ?- |& A( y4 Q) H' Y5 W
  228. # 刷新boardinfo文件的crc行. t& P8 j% K! _# v5 x
  229. HW_Customize_ValidateBoardinfoCRC(); d0 c2 n$ c% p! H1 B: U; V) w% S' b
  230. {5 t4 o. P4 U, H- x( T8 c
  231.         if [ -z $1 ]; then# }; Q% x! |  n; l5 o/ V) R
  232.                 return 0
    , y1 T9 I% Y' g7 j0 N
  233.         fi( a7 s( t6 u/ d
  234.         if [ -x /bin/factparam ]; then  R: ~+ s+ o* V# q" K  m5 Q
  235.                 /bin/factparam -v $1
    ' N  B: v- Q9 O# `7 B3 t# F. b
  236.                 if [ 0 -ne $? ]; then; r$ c$ o, `5 V
  237.                         echo "ERROR::Failed to validate boardinfo crc on $1!"- @7 H* ~7 `( k7 S7 s& K1 s
  238.                         return 1
    ' }  k8 V; ?9 d. J$ K
  239.                 fi! ]$ j2 p' \$ j: }) p3 V
  240.         fi
    1 H, b  Q, p9 `7 M, T
  241. }
    - O2 e7 d6 R1 C& s0 H

  242. . z8 K. T8 f- A* r3 a, S" V. n
  243. # 清除出厂参数备份( b: ]* |3 l4 ]  W- O5 z
  244. HW_Customize_ClearFactoryParamsBackup()& M$ @; f+ o5 }: _9 m
  245. {. k' _7 ~& F0 D4 {  V* \# ]
  246.         if [ -x /bin/factparam ]; then8 a1 }1 l, S/ Y  A1 j9 P
  247.                 /bin/factparam -e reserved1 ~3 H# }1 K6 f6 ^$ R3 O; q* l
  248.                 if [ 0 -ne $? ]; then
    ) \) V! d$ E* M$ v
  249.                         echo "ERROR::Failed to clear factory parameter backup area!"
    * r0 e9 R; d* J& X8 |. y- e9 o
  250.                         return 1
    # _% X/ I' j0 G" @& p6 {: T4 r; m9 C
  251.                 fi7 @  G3 c8 s1 h/ e3 m3 k, D
  252.         fi
    ' U8 T" i% ]% N; f3 N$ j2 A+ ^
  253. }/ x: m& |+ Y7 I, q: a; I* C

  254. 8 c3 ~$ `6 v0 d8 a( G6 v% m
  255. if [ 0 -ne $# ]; then" |2 @7 g" F& y- r. j
  256.         echo "ERROR::input para is not right!";
    8 G# P$ {1 Z( q0 o, q
  257.         exit 1;6 x5 s" e' R9 e' R! J  H' {
  258. else  q0 j6 y$ c4 J( k9 y) m* E( q$ m
  259. HW_Script_CreateFile
    6 b6 r& z  ]  M# m6 C( d% M
  260. [ ! $? == 0 ] && exit 1
    , @/ F. ]4 _( O
  261. $ o  F$ Q7 A. z/ ]
  262. HW_Script_RemoveFile
    4 \$ Y- X' t/ |! o
  263. [ ! $? == 0 ] && exit 1
      i% a+ Y$ R8 _+ _3 p9 }4 P8 q+ C" ~
  264. & }" D3 a: Q" B! K1 W- L
  265. HW_Script_CopyFile( Z0 P1 x* i: o. ?" [( N# L
  266. [ ! $? == 0 ] && exit 10 L/ M3 l# X$ G+ t4 x2 ?' t* ]
  267. 4 Y& Q# n8 w1 N. D
  268. HW_Script_SetData
    $ t" [7 @! R3 G" d
  269. [ ! $? == 0 ] && exit 10 b: e1 a9 t4 s6 h* B  q1 F" C
  270. % z# z6 c1 Q: q( F0 R; `4 L
  271. rm -rf $var_boardinfo_bakfile
    ! ?3 [4 `; ^4 p' u* m
  272. ! N) q" U/ _# V3 m
  273. ctrg_support=`GetFeature HW_SSMP_FEATURE_CTRG`" ~8 J- i4 l( m& i4 }; \
  274. if [ $ctrg_support = 1 ] ;then
    / m6 F  r- d' K  M
  275.         dbus-send --system --print-reply --dest=com.ctc.saf1 /com/ctc/saf1 com.ctc.saf1.framework.Restore > /dev/null" R  l2 O4 r! `; N0 c0 g" \
  276. fi
    + |' a0 i$ u" S* u) \
  277. 3 B- e5 O: T& N$ s
  278. # 必须刷新boardinfo文件的crc行,并且清除reserved分区的出厂参数备份: a# B* ]9 K! @, w% T/ N, E
  279. HW_Customize_ValidateBoardinfoCRC $var_boardinfo_file. q+ S: ?; a3 u- {# `! ?
  280. [ ! $? == 0 ] && exit 1
    ( S0 t# a1 {0 _) k/ n1 p
  281. HW_Customize_ClearFactoryParamsBackup
      N9 t4 q" H' x( S6 \6 j  q
  282. [ ! $? == 0 ] && exit 1
    ( V; i$ i: l+ I/ \
  283.   o8 |+ i- o3 p' ]$ D6 @2 A$ e5 g. a. r
  284. echo "success!"
    . i# f. S$ _1 q0 x9 r  ?

  285. - i' Z2 h4 x- ]$ u1 r7 [
  286. exit 0
    0 \) o% T# u0 {
  287. fi
    , Y! z: Q5 J. _
复制代码
第一部分的etc/wap/hw_default_ctree.xml ,文件附后,
2 K; a& P7 R7 B( A8 }
, g" |/ P# i& L  B! u# ghw_default_ctree.xml这个文件也就是恢复命令后jffs2下的hw_ctree.xml文件,内容大家可以参考下
2 ~9 @2 n, c& ?8 E4 Z* H. Q% s( [% t' n" P2 R* |# g$ O
# F1 u: `) N/ Z$ f- w
中间部分的含义见http://www.chinadsl.net/thread-131336-1-2.html,也就是hw_boardinfo文件内容1 u8 G  S0 y( a( h% J, U& w& T( y+ {
/ ^% P- L; d) S
至于jffs2/app的内容,恢复命令后删除,直接删除app数据; f1 `. W3 P, n4 H

% k( K) m/ ?0 d7 g这也就是为什么使用命令后,大家手机上使用天翼网关app不能连接光猫的原因$ O3 z0 [0 g  g2 P) c

4 Z3 S0 |" I9 I+ U5 q4 W0 A1 [. p7 m$ I! Y7 _1 J! a) _% L
至于其他内容,欢迎各位继续探讨    9 ~4 A, p# r3 P! o9 |% b+ _' ]! ]

" t5 L( C, X* }* Z" b0 m4 [1 B5 V) }' ^) ], v$ c% V; a

* x( K: t9 l: F

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

点评

技术贴。。学习了。。。  发表于 2018-7-13 08:59
 楼主| 发表于 2018-4-4 22:41:11 | 显示全部楼层
本帖最后由 happyhack 于 2018-4-4 22:58 编辑
  z( d; `9 L  x! J5 h( Y, E2 W- `- Q2 u5 f) y' H
restorehwmode.sh打包附后,, S! L4 w) y7 |8 g5 ~! y

0 K- F- r& \, ]7 g$ U7 U& n6 L# {& c$ D/ ]$ Z
大家看下,个人猜测这个应该是跟手机app控制光猫的一些文件/ h- q: |8 A* Z9 g$ {

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2018-4-5 15:16:10 | 显示全部楼层
这个是不是要破解才能用的?
发表于 2018-4-8 22:28:23 | 显示全部楼层
技术贴,谢谢,学习了
发表于 2018-4-10 18:19:21 | 显示全部楼层
技术学习了
发表于 2018-4-13 20:57:06 | 显示全部楼层
专门学习的,楼主辛苦!
发表于 2018-5-6 22:32:33 | 显示全部楼层
谢谢,楼主无私的分享你宝贵的经验,顺便来赚个猫粮
发表于 2018-5-7 22:25:42 | 显示全部楼层
专门学习的,楼主辛苦!
发表于 2018-5-10 11:17:22 | 显示全部楼层
感谢lz的分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|宽带技术网 ( 粤ICP备15054574号 )|网站地图

粤公网安备 44152102000001号

GMT+8, 2019-6-16 15:52 , Processed in 0.144659 second(s), 29 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表