宽带技术网

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 4192|回复: 25

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

[复制链接]
发表于 2018-4-4 22:39:49 | 显示全部楼层 |阅读模式
hs8546V的恢复出厂命令(restorehwmode.sh)分析
+ G5 w/ x0 Q2 y) H* ^# s! v( `) i
2 b, l! h' G  t6 e" D3 K+ k如下restorehwmode.sh这个命令的全部内容 & E6 d  ?8 F' k9 g& @% `
  1. #! /bin/sh
    ' U1 h) O+ C' J+ B, L

  2. . s) K) x% H8 J9 b+ k  I
  3. #set hw parameters
    5 X, s5 }! K' @
  4. #copy etc/wap/hw_default_ctree.xml to /mnt/jffs2/hw_ctree.xml
    4 C$ R0 s" Z9 @' d! J8 A
  5. #set the spec para+ X2 D. R: f& {* ]; M; q1 Q# g" y
  6. ! T1 a0 Y7 o. d' F2 [2 E2 I; ^
  7. var_default_ctree=/mnt/jffs2/hw_default_ctree.xml;2 ]3 Q7 s; m$ j
  8. var_ctree=/mnt/jffs2/hw_ctree.xml) O2 H( W3 M) Q  W0 N
  9. var_customize=/mnt/jffs2/customizepara.txt0 v8 D0 g) r0 P: e
  10. var_bms_prevxml_temp="/mnt/jffs2/hw_bms_prev.xml"  ]  l/ ]+ C3 Y+ V* T8 q1 ?
  11. var_bms_oldcrc_temp="/mnt/jffs2/oldcrc"
    6 e$ @- [0 a$ `; Y1 }; B3 E( b
  12. var_bms_oltoldcrc_temp="/mnt/jffs2/oltoldcrc"
    ' R6 Z/ d: u& C' |
  13. var_bms_prevcrc_temp="/mnt/jffs2/prevcrc"( q( P: N6 P: L9 @) r2 C# Y$ m
  14. var_bms_oltprevcrc_temp="/mnt/jffs2/oltprevcrc"4 G5 O+ J; T. @! o6 d
  15. var_bms_oskvoice_temp="/mnt/jffs2/hw_osk_voip_prev.xml"
    0 V, y5 O* J2 i+ @1 z* {
  16. var_rebootsave="/mnt/jffs2/cwmp_rebootsave"4 f. |8 c4 _% t& y6 v
  17. var_recovername_temp="/mnt/jffs2/recovername"
    , h' N( K7 ^6 ^1 {
  18. var_usr_device_temp="/mnt/jffs2/usr_device.bin"
    / C. P" U% {4 B5 _5 ?
  19. var_ftcrc_temp="/mnt/jffs2/FTCRC"
    ; \+ ?: I6 z2 D
  20. var_ftvoip_temp="/mnt/jffs2/ftvoipcfgstate"/ Q# T: D5 D7 ~9 s
  21. var_dhcp_temp="/mnt/jffs2/dhcpc"5 \) {# h7 h' g3 \! m# D
  22. var_dhcp6_temp="/mnt/jffs2/dhcp6c"
    $ g/ O" h7 q$ V# K" J& y
  23. var_DHCPlasterrwan1_temp="/mnt/jffs2/DHCPlasterrwan1"
    : d, T' J/ `9 k7 M  ~; r* {7 K2 }6 p
  24. var_DHCPlasterrwan2_temp="/mnt/jffs2/DHCPlasterrwan2"
    " ^% E8 I1 A  |" Z0 R+ ?+ t3 @, v
  25. var_DHCPlasterrwan3_temp="/mnt/jffs2/DHCPlasterrwan3"- x: B7 ]" g$ m1 D% T* V
  26. var_DHCPlasterrwan4_temp="/mnt/jffs2/DHCPlasterrwan4"0 b" c1 [" p* K) @  K' N
  27. var_DHCPstatewan1_temp="/mnt/jffs2/DHCPstatewan1"
    ) [" `( M6 U( b- p' a0 e* r0 w
  28. var_DHCPstatewan2_temp="/mnt/jffs2/DHCPstatewan2"5 ?9 d: ]5 S  T& C
  29. var_DHCPstatewan3_temp="/mnt/jffs2/DHCPstatewan3"
    / p: i+ e+ W* ^% M: u
  30. var_DHCPstatewan4_temp="/mnt/jffs2/DHCPstatewan4"  L& Y/ |( E4 N. P# `- f
  31. var_DHCPoutputwan1_temp="/mnt/jffs2/DHCPoutputwan1", c2 `, k: J6 t" v
  32. var_boardinfo_file="/mnt/jffs2/hw_boardinfo"9 \, R  I7 b4 o6 M3 x
  33. var_boardinfo_bakfile="/mnt/jffs2/hw_boardinfo.bak"
    4 `4 {& j% x8 F- ~: H
  34. var_boardinfo_temp="/mnt/jffs2/hw_boardinfo.temp"* L( R; m, w. x, F# S) P
  35. var_jffs2_customize_txt_file="/mnt/jffs2/customize.txt", D/ b) v) m7 O( O0 L3 Y+ u) W' C
  36. var_jffs2_choose_xml_dir="/mnt/jffs2/choose_xml": S' F+ |$ ~3 ]+ J& q# [
  37. var_jffs2_choose_xml_tar="/mnt/jffs2/choose_xml.tar.gz"4 ]9 R  O7 z6 e) a7 Y
  38. var_jffs2_spec_file="/mnt/jffs2/hw_hardinfo_spec"$ O/ F8 C% |# e* j6 ~
  39. var_jffs2_spec_bak_file="/mnt/jffs2/hw_hardinfo_spec.bak"+ C0 j1 X  ?0 g' e% k
  40. var_jffs2_feature_file="/mnt/jffs2/hw_hardinfo_feature"# U1 j7 M. N. J) e
  41. var_jffs2_feature_bak_file="/mnt/jffs2/hw_hardinfo_feature.bak"
    - ~/ N; O8 D: b" S1 g& @
  42. var_jffs2_hardinfo_para_file="/mnt/jffs2/hw_equip_hardinfo"
    ! C" e! N; F9 e: O5 ~7 @( y5 k; S, C
  43. var_ontfirstonline_temp="/mnt/jffs2/ontfirstonlinefile"+ N5 h# a2 p% O: ~
  44. var_dublecore="/mnt/jffs2/doublecore"" N& J6 t6 ?" z! i
  45. var_customize_telmex=/mnt/jffs2/TelmexCusomizePara
    . W- B9 M; F( J* b9 M9 a
  46. var_customize_dir="/mnt/jffs2/customize"! C: x( k1 j, W
  47. var_smartshowbssguide="/mnt/jffs2/smartshowbssguide"
    # a+ l) A5 r: I- G5 N: A
  48. var_smartshowuserguide="/mnt/jffs2/smartshowuserguide"; N* h( O$ {, ^! M5 u% b! p
  49. var_old_ctree="/mnt/jffs2/hw_old_ctree.xml"+ \& p- X. N: ^! b
  50. var_ctree_bak="/mnt/jffs2/hw_ctree_bak.xml"! v+ h, I: Z" G9 y' Q: m
  51. var_cfgbackup="/mnt/jffs2/CfgFile_Backup"1 {3 j* V/ }5 V, L
  52. var_PrimaryDir="/mnt/jffs2/PrimaryDir"
    3 ~( V+ |9 M# q4 l- \
  53. var_p2p_dhcp_file="/mnt/jffs2/p2pdhcpboot_prev.ini"
    * N' Z- x- a6 c* m" F
  54. var_jffs2_hardversion_bak_file="/mnt/jffs2/hw_boardinfo.bak"
    % S2 f; W$ p9 x7 j+ @6 L# ^) d* Y
  55. var_jffs2_specsn_file="/mnt/jffs2/customize_specsn"
    ( a' m. L- l( S

  56. ! U- \. e: S$ g* ]2 t
  57. var_plat_root="/mnt/jffs2/platroot.crt" ( ~- Y" n2 c& ~' p' Y6 @
  58. var_plat_pub="/mnt/jffs2/platpub.crt"8 X/ q2 [* s' S8 j# M
  59. var_plat_prvt="/mnt/jffs2/platprvt.key"
    / \0 E+ f. M6 b0 v1 o5 k

  60. , T& J1 f* }: Z7 ~
  61. # remove plugin files
    " H7 e: ~& s" Y# g1 X6 Q* h
  62. HW_Script_RemovePluginFile()8 q7 B9 V/ _; l, d/ G( _
  63. {
    , B5 w+ s9 X- H3 G2 t$ z
  64.         #通过特性开关来决定删除哪些插件
    & Y0 F; x/ T& k' V, K
  65.         var_feature_enble=`GetFeature HW_FT_OSGI_JVM_FROM_VAR`
    3 ]" B* K+ O: }; t, r
  66.         if [ $var_feature_enble = 1 ];then9 ?7 m/ ]# q' z9 E( Z
  67.                 rm  -rf /mnt/jffs2/app/osgi/felix-cache;
    $ y" Z' c' ~# d" Q2 e
  68.         rm  -f /mnt/jffs2/app/osgi/prebundlestatus.info;/ m6 N5 I5 a: }4 ^, v& f
  69.         rm  -f /mnt/jffs2/app/osgi/dlna.jar;" F" h* K$ \% T5 I6 h" a# w
  70.         rm  -f /mnt/jffs2/app/osgi/samba.jar;
    4 D8 H" t3 b% i% J$ K' E+ ^- s
  71.         else9 Z) B5 {8 w4 R' a
  72.                 rm  -rf /mnt/jffs2/app/osgi/* ;
    4 E  j9 _- @9 d
  73.         fi& C! D" ]: M9 y' a/ r$ X' W- a
  74.         rm -rf  /mnt/jffs2/app/cplugin/* /var/cplugin/*;
    ) e) n. _2 W  Q/ S, G% z
  75. }
    ! {7 u; n& d, M7 ~( {$ o" b! C! C
  76. - v$ C4 q% c& g+ E+ \+ Q; i
  77. # remove files
    ' W7 q* H* ]+ k! G. w" s; c0 Y
  78. HW_Script_RemoveFile()
    ! X- Z) f9 C" S7 x3 m% F; |: c
  79. {
    6 o% i# ]( D% q
  80.         rm -f $var_default_ctree
    % ^) ^  ]9 Q1 N+ [
  81.         rm -f $var_ctree
    2 J. r7 d6 y1 W4 o
  82.         rm -f $var_customize
    % E- _: M6 ^* l$ ~2 X/ {: U- a& i
  83.         rm -f $var_bms_prevxml_temp  \8 ]" l9 I, S) M! R+ ?
  84.         rm -f $var_bms_oldcrc_temp8 I+ i& b: D& A2 a8 u
  85.         rm -f $var_bms_oltoldcrc_temp
    - Z. A5 p( W- W: T4 X9 o: O
  86.         rm -f $var_bms_prevcrc_temp
    5 F& z( Q6 b4 E3 _/ g- M2 V" c8 j
  87.         rm -f $var_bms_oltprevcrc_temp2 S* t" H9 n/ A$ X  q3 t
  88.         rm -f $var_bms_oskvoice_temp9 Q8 v% P: u; @+ P9 y' g
  89.         rm -f $var_rebootsave6 x* c+ h! o( X2 R
  90.         rm -f $var_recovername_temp% a- l0 y0 }6 }& G9 k
  91.         rm -f $var_usr_device_temp- Z, U! r# \7 T- T: v  ~6 I
  92.         rm -rf $var_ftcrc_temp
    ) U! r- G9 o; T2 }: N4 r0 v$ @6 S
  93.         rm -rf $var_ftvoip_temp
    ; A+ E2 C# z5 {  o2 A( p* p1 G
  94.         rm -rf $var_dhcp_temp) C3 {8 K+ @2 n1 I4 S4 O
  95.         rm -rf $var_dhcp6_temp
    ; M1 j! L3 ?7 {3 d
  96.         rm -rf $var_DHCPlasterrwan1_temp
    + H+ m! j: Q- o& x
  97.         rm -rf $var_DHCPlasterrwan2_temp
    9 B. B$ s0 A; N
  98.         rm -rf $var_DHCPlasterrwan3_temp
    ; s" L+ M5 r% n4 O. n6 y
  99.         rm -rf $var_DHCPlasterrwan4_temp; r' x- ~2 q2 w! z6 W
  100.         rm -rf $var_DHCPstatewan1_temp
    + A! F2 ]; ]/ F0 |! M' Y
  101.         rm -rf $var_DHCPstatewan2_temp
    " x3 N& @' \1 p4 b0 a& z
  102.         rm -rf $var_DHCPstatewan3_temp3 u/ K3 W  ~4 J9 ^4 r* j! p
  103.         rm -rf $var_DHCPstatewan4_temp
    ) O0 O( k- G  c- f4 u  v
  104.         rm -rf $var_DHCPoutputwan1_temp
    # Z* j) s6 G" D0 m' t
  105.         rm -rf $var_jffs2_customize_txt_file
    . u3 R; V' N8 S7 r# F. v
  106.         rm -rf $var_jffs2_choose_xml_dir
    ' X" G. Z6 ^4 q% U* N8 V
  107.         rm -f $var_jffs2_choose_xml_tar3 Q! ]; b' U- a( u( x* I9 Z
  108.         rm -fr $var_jffs2_spec_file
    1 P- I+ n/ \* x! C
  109.         rm -fr $var_jffs2_spec_bak_file6 I, Y) n  X+ }/ y( L
  110.         rm -fr $var_jffs2_feature_file5 E* D  ?  H! l4 `9 ?
  111.         rm -fr $var_jffs2_feature_bak_file
    5 F6 q' h0 H+ `4 p( j5 q  x
  112.         rm -fr $var_jffs2_hardinfo_para_file
    $ n4 w( G# L  W- Q; T
  113.         rm -fr $var_ontfirstonline_temp) E1 a$ a/ ^6 L6 O
  114.         rm -f $var_dublecore" y" r$ g, ?' {2 I3 H7 P" d
  115.         rm -f /mnt/jffs2/simcard_flowflag0 K/ O  `! N2 A0 y! \
  116.         rm -f /mnt/jffs2/simcardreadflag/ }" ~. Y; h, W2 r6 J$ g" [) C; k
  117.         rm -f /mnt/jffs2/typeword
    6 |7 W0 t) B  l5 L8 G& V/ T
  118.         rm -f $var_customize_telmex
    1 g4 J) J2 v* K% x
  119.         rm -rf $var_customize_dir4 @' J8 |- Y0 _
  120.         rm -f $var_smartshowbssguide
    * y, s4 w9 o7 ^. V' x
  121.         rm -rf $var_smartshowuserguide
    ' B  {! v/ e! w0 m+ Q- C
  122.         rm -fr $var_old_ctree
    : X9 i+ _4 w- L. G0 k( V
  123.         rm -fr $var_ctree_bak
    # `9 ?, j7 `  I& F7 p. O, v7 p3 B
  124.         rm -fr $var_cfgbackup
    * N7 s" f$ n+ u4 Z$ }
  125.         rm -f $var_jffs2_hardversion_bak_file. u( A1 V. V5 b- l- v
  126.         rm -rf $var_PrimaryDir
    7 x- u" B2 b. q/ r8 a; e5 m
  127.         rm -rf /mnt/jffs2/p2ploadcfgdone
    7 l0 K9 B$ F2 Y6 M8 E; `
  128.         rm -rf /mnt/jffs2/dhcp6c
    3 w" y/ @: c( ^
  129.     rm -rf /mnt/jffs2/dhcpc
    4 R4 g1 |) z& ]% V" \0 g2 Y& b
  130.         rm -rf /mnt/jffs2/onlinecounter
    6 f: e' m$ m" w/ ~  v7 t
  131.         rm -rf $var_jffs2_specsn_file
    ; Z: u1 v6 K. ~1 Y8 T
  132.         rm -rf /mnt/jffs2/reboot_bind_tag
    ( V7 v& b3 W- q- o2 l3 Q5 r
  133.         rm -rf $var_p2p_dhcp_file
    ) n1 `% _8 i& A
  134.                
    ) S% X$ J  K9 d7 T: O
  135.         rm  -rf /mnt/jffs2/app/osgi/*
    4 h7 B% Z/ _, S" h. I' r1 |
  136.         rm  -rf /mnt/jffs2/app/cplugin/*; Q! j3 f6 [2 \1 T; x: S
  137.         & z3 z. q2 U8 e  r& \7 L5 [2 h! u3 n
  138.         rm -f /mnt/jffs2/smooth_finsh" x3 Q% _) H( Q0 a$ ~0 o
  139.         rm -f /mnt/jffs2/gdstbmac.bin
    0 B/ l% E% g# L  ?7 U
  140.        
    7 Y8 t4 Z9 ]3 r) x, y# _. v: Z
  141.         rm -f $var_plat_root
    4 ]' y, v& Q; Y, {
  142.         rm -f $var_plat_pub
    ; `/ e. f2 m4 g4 e/ m
  143.         rm -f $var_plat_prvt4 p7 o7 M1 }7 c* q6 l6 K

  144. 6 ^5 z0 d2 I% z# |. d. C7 }* L
  145.         HW_Script_RemovePluginFile* e$ H; ?& ]' c  o
  146.         return, I0 a. X6 l  w+ {4 c
  147. }
    0 G1 i% U0 [1 s/ x4 d& n

  148. $ p& U8 V* M( s( j, x  p! b9 W
  149. #creat files
    # a! E" T7 ], G( f6 g$ ^( C2 x
  150. HW_Script_CreateFile()0 e- @# q1 n9 C; g3 ^
  151. {) _% u/ e, ~: [4 T: n
  152.         var_telnet_flag=/mnt/jffs2/ProductLineMode; H( s' Z) p9 n% V) i' E$ x
  153. ) V$ Q) I+ O! B" F
  154.         echo "" > $var_telnet_flag; `. Z  ^3 ?( C+ s( g
  155.         if [ 0 -ne $? ]
    ; G. c7 B! e" s& R' I7 f. w6 ?) H
  156.         then
    * m# b  m2 `" H
  157.         {
    * w% }6 \6 s# p! O
  158.                 echo "ERROR::Failed to create telnet flag!"/ m6 s# n( w3 x7 Y+ J+ {
  159.         return 1# h2 m4 z. G. ~6 f# y. i/ q! n% S
  160.         }
    0 s6 N! @1 k  y8 S* K  C
  161.         fi
    / o2 }) @. O- E  l2 S
  162. 8 ~9 Y/ h2 c  B6 G! S
  163.         return 0" x7 B" S" a1 J$ f. e+ }7 E( C
  164. }
    2 L1 p5 e+ e9 D( v5 h2 f

  165. * Y3 }* J& q, n: h) L. b2 U8 X0 a
  166. # copy files
    ( a" o) [7 I! ^( ]8 k
  167. HW_Script_CopyFile()6 k5 q. g0 n/ E7 l4 f# p
  168. {
    1 r) \9 p; W' i8 D- R
  169.         var_etc_def=/etc/wap/hw_default_ctree.xml
    4 K" F; o. x; B3 E4 @0 c
  170.         * X, J! x4 M% v! e* c1 A
  171.         #增加延时,确保DB不保存
    * ?/ g' B: ~0 J5 h
  172.         echo > /var/notsavedata
    3 Q$ S8 a9 `- K
  173.         sleep 1+ ^  `: F1 J8 ?+ P/ n/ |
  174. 4 L) n2 d8 d2 k4 Y" v) Q
  175.         cp -f $var_etc_def $var_ctree
    7 k8 N) V8 G% ~& E% ]$ k3 _
  176.         if [ 0 -ne $? ]# a0 l! C3 X# @% g( m
  177.         then
    0 q$ w9 x1 w' K9 N
  178.                 rm -rf /var/notsavedata. u/ T5 P/ W3 Z$ Y# n
  179.                 echo "ERROR::Failed to cp hw_default_ctree.xml to hw_ctree.xml!"
    1 X0 `/ q- N8 S) V0 U4 Y8 i
  180.                 return 1; y: N$ L, L0 M: q+ \, d. G* v
  181.         fi
    7 E% G* |: O% O! U6 b) Q1 w% e

  182. " D# V, l( ]$ ]2 @$ s, t6 j
  183.         return3 m6 k0 L; i' ~% }! Y9 k
  184. }
    3 }4 x) f+ _6 h" Q2 O: C

  185. ' m8 S' T. h$ G. Q" x* L
  186. # set spec data- e" ^" V  p0 P' Q) {
  187. HW_Script_SetData()! }5 e7 M) \: Y1 K% d  A4 b5 w
  188. {; S2 V* Z( T5 n: ^* e
  189.         cat $var_boardinfo_file | while read -r line;/ W2 I- d! f. L8 ~8 ]* y! Z' V
  190.         do
    4 O# O3 Z  ?7 K
  191.                 obj_id_temp=`echo $line | sed 's/\(.*\)obj.value\(.*\)/\1/g'`  L& A$ {* c' ~6 K9 t- ]9 N# m
  192.                 obj_id=`echo $obj_id_temp | sed 's/\(.*\)"\(.*\)"\(.*\)/\2/g'`9 I: L  P6 V) a2 w' ^
  193. 3 U. s8 F& x/ ?
  194.                 if [ "0x00000003" == $obj_id ];then8 |4 ?0 `; Z2 C
  195.                         echo "obj.id = "0x00000003" ; obj.value = "";"# u! l' e( ~" W
  196.                 elif [ "0x00000004" == $obj_id ];then
    " f5 G0 W% l% |
  197.                         echo "obj.id = "0x00000004" ; obj.value = "";"
    % x4 F* W) m4 c7 Y* F0 t" I$ p$ x
  198.                 elif [ "0x00000005" == $obj_id ];then
    . ^$ A3 N" V8 G* X+ K( d6 R( J
  199.                         echo "obj.id = "0x00000005" ; obj.value = "";"$ c7 z) i3 F) u. q: H
  200.                 elif [ "0x00000006" == $obj_id ];then' P, V: I4 a& I! Q! |$ @
  201.                         echo "obj.id = "0x00000006" ; obj.value = "";"& k7 ~' ]# _8 i8 r5 m( Q5 F
  202.                 elif [ "0x00000016" == $obj_id ];then
    ! V5 k" e* t5 x# [
  203.                         echo "obj.id = "0x00000016" ; obj.value = "";"
    ! \' a% W! h1 {) a& s) l$ Q
  204.                 elif [ "0x0000001a" == $obj_id ];then
    8 V3 b1 f: d1 J
  205.                         echo "obj.id = "0x0000001a" ; obj.value = "COMMON";"2 n, q9 Q8 M3 p; q( ~# a% l
  206.                 elif [ "0x0000001b" == $obj_id ];then$ C' C+ G9 }+ x
  207.                         echo "obj.id = "0x0000001b" ; obj.value = "COMMON";") P' O/ U" ?& q7 v
  208.                 elif [ "0x00000019" == $obj_id ];then
    0 }% t; l2 k3 Z0 ], v4 `# i! c
  209.                         echo "obj.id = "0x00000019" ; obj.value = "";"
    & y9 [3 X) k3 D/ H! ^/ m9 Y1 s
  210.                 elif [ "0x00000020" == $obj_id ];then* f8 |9 \8 t( O* Y, h/ l0 f4 x
  211.                         echo "obj.id = "0x00000020" ; obj.value = "";") B: t0 t5 T) _! @. G
  212.                 elif [ "0x00000031" == $obj_id ];then
    3 O- D, V+ _, t2 T( o3 J: |
  213.                         echo "obj.id = "0x00000031" ; obj.value = "NOCHOOSE";"$ y) G1 ~) Q/ c5 ~6 u, {% ]
  214.                 elif [ "0x00000035" == $obj_id ];then
    1 ]2 D$ o1 j. b. X' ~; }# J
  215.                         echo "obj.id = "0x00000035" ; obj.value = "";"$ b. I. A/ Z9 E+ z- s, V: J! ?
  216.                 elif [ "0x0000003a" == $obj_id ];then
    0 J" Q! i8 F! Y4 Q# s
  217.                         echo "obj.id = "0x0000003a" ; obj.value = "";"
    / d3 y$ j3 |. b! I
  218.                 else
    ) D/ y& \$ q: C. _) X; G
  219.                         echo -E $line
    5 [4 C+ o1 w6 u$ y7 x
  220.                 fi
    ( B3 d7 ~: T, ^/ W9 R/ [  K( N+ m+ O+ k
  221.         done  > $var_boardinfo_temp: G6 H' s% U/ \. F2 Z+ V+ x
  222. 2 Y, {1 w/ Q% @7 H0 r. C8 ?
  223.         mv -f $var_boardinfo_temp $var_boardinfo_file9 j5 s4 S6 [# P4 a6 s

  224. $ y9 z7 M( Q7 C% B
  225.         return5 h: a" I) s% c+ I3 }; D/ ?, C
  226. }, Y' X7 d3 B3 u$ j
  227. ! ~( D6 o( c# z6 M
  228. # 刷新boardinfo文件的crc行
    ! k  y' }1 ]& H: `! f( K
  229. HW_Customize_ValidateBoardinfoCRC()
    # c, i5 R. H6 M* h5 f
  230. {5 X# z6 w0 J& m/ Y2 \
  231.         if [ -z $1 ]; then1 r+ [8 j* B! e# r' z" d( {4 y/ A
  232.                 return 0
    # l. D  a& G9 f5 [  Z9 ^
  233.         fi
    8 Q/ o' _' m& U+ I; s
  234.         if [ -x /bin/factparam ]; then
    % |. g" {) i! b: |/ m1 S9 p$ A
  235.                 /bin/factparam -v $1
    6 q1 \5 c- l& R' k
  236.                 if [ 0 -ne $? ]; then
    ) }  D5 S+ t3 Y- F9 U, |: W8 e
  237.                         echo "ERROR::Failed to validate boardinfo crc on $1!"& l( l# s; V7 E: j+ x3 O3 B& a3 n3 v
  238.                         return 1
    ' U( h! w. [! q0 x* ?" q
  239.                 fi1 I2 b" Q2 f' r. n
  240.         fi
    / \! P+ N3 S1 k# Q2 ?/ P) p
  241. }
    7 @3 V1 I+ j  r% I

  242. + W) i: u: L9 W9 ^3 R
  243. # 清除出厂参数备份
    7 O! i, X+ ~1 @
  244. HW_Customize_ClearFactoryParamsBackup()
    5 N, n) y9 `9 H4 J7 ?' }
  245. {* D$ p+ j& [2 a8 N/ m3 e
  246.         if [ -x /bin/factparam ]; then
    * m* k: [% Q$ [; |) N/ K6 N$ h8 {+ o
  247.                 /bin/factparam -e reserved1 U2 [4 P6 r) ~+ K
  248.                 if [ 0 -ne $? ]; then! P$ ^) ]5 `! ~
  249.                         echo "ERROR::Failed to clear factory parameter backup area!"2 T+ U! Y) P' O9 C1 _
  250.                         return 1* t) u% K! b$ u0 z
  251.                 fi" P! ^$ W3 a( k! }, ~& |, I! A5 O* k
  252.         fi
    , Y9 D& a" |& ?# ~. P/ N
  253. }
    8 s% f- J2 X) C: B3 c- Z, l

  254. ! A& o- @1 X6 b! q% O/ U+ t
  255. if [ 0 -ne $# ]; then3 g! h# n( o' G* \, a
  256.         echo "ERROR::input para is not right!";
    2 B& m+ O% v- |4 p8 g( z+ s
  257.         exit 1;- x8 D) n2 j7 y9 P. ~6 b7 Z: n
  258. else
    ) n  S5 y5 V% @  z7 c$ m- b2 }
  259. HW_Script_CreateFile
    ) f; }$ j1 W/ T! I3 i- d* h
  260. [ ! $? == 0 ] && exit 1
    : o  e# ?, G, O" K' z# t. j

  261. 4 f; P- B+ _2 d- r0 h
  262. HW_Script_RemoveFile
    ' @4 J- b. O- E& x! B
  263. [ ! $? == 0 ] && exit 1" G$ S8 u. u' {7 r+ k
  264. 1 I# U) h, R6 S( S( t7 f1 s
  265. HW_Script_CopyFile
    9 _9 Y4 W! P7 n; q$ t
  266. [ ! $? == 0 ] && exit 1
    ) x, D7 N2 ~2 Q

  267. 6 S( A' N! C6 [2 t+ C7 B4 e
  268. HW_Script_SetData. _' x; z5 a5 p- i
  269. [ ! $? == 0 ] && exit 1
    $ q2 K- q  a3 f& t1 {( C5 n

  270. , w) |5 h& ^8 M; U
  271. rm -rf $var_boardinfo_bakfile) W) D) V; i0 \% D& W" L# R
  272. - `6 o! ]6 E7 |; x1 k8 S
  273. ctrg_support=`GetFeature HW_SSMP_FEATURE_CTRG`
    - ~3 p  b4 ^  H- q
  274. if [ $ctrg_support = 1 ] ;then
    - O$ V. O( h' A6 s' o. V
  275.         dbus-send --system --print-reply --dest=com.ctc.saf1 /com/ctc/saf1 com.ctc.saf1.framework.Restore > /dev/null
    % Z8 B( y  Z( m2 l, f* _
  276. fi
    : z6 e0 i2 \# _: {

  277. : C! n1 x8 L; i& Q1 @+ o) |+ K
  278. # 必须刷新boardinfo文件的crc行,并且清除reserved分区的出厂参数备份# ]( ~! q+ S% j2 v0 j' W5 x
  279. HW_Customize_ValidateBoardinfoCRC $var_boardinfo_file2 [* }: ]. `" Z9 l% }& d
  280. [ ! $? == 0 ] && exit 1
    " |8 j2 F. R+ W3 j7 y7 |5 l
  281. HW_Customize_ClearFactoryParamsBackup8 \4 H! w, D: X) M
  282. [ ! $? == 0 ] && exit 1. e/ L% `- L) X7 q+ s- f
  283. 6 W  E5 m& P7 o% b& b+ ^8 L( W
  284. echo "success!"- j5 b2 W: w8 G% y) u
  285. $ Y8 \- F% ~( Z. d6 i# y8 E2 _
  286. exit 0
    & d) {! k, ^) \0 P
  287. fi
    1 Y/ x% c/ f5 q* W! A# n" Q. K
复制代码
第一部分的etc/wap/hw_default_ctree.xml ,文件附后,
, B( c. y/ {( J  x5 T2 F3 e: C5 t% d7 ~
hw_default_ctree.xml这个文件也就是恢复命令后jffs2下的hw_ctree.xml文件,内容大家可以参考下
5 g4 j6 @& P5 {& @% Y7 }' e! Z$ S9 Q
+ B, `. ]% n2 w& B, q
. o' j- _& `  d3 U2 {: B: s中间部分的含义见http://www.chinadsl.net/thread-131336-1-2.html,也就是hw_boardinfo文件内容/ N: F- O& X# c
# s5 p9 W* g/ k" b: e! Z0 i
至于jffs2/app的内容,恢复命令后删除,直接删除app数据/ ^4 F" D3 h% _6 o; ~& G9 n2 G9 O1 k  j
1 a6 }5 d6 k) o) Q1 ?7 x
这也就是为什么使用命令后,大家手机上使用天翼网关app不能连接光猫的原因8 c8 L7 g. w# V/ U! _1 l

: z) H0 y3 X' u/ N+ x) Y1 H; v0 U
至于其他内容,欢迎各位继续探讨   
8 R+ r& x0 F& o% {* |) B& g7 R9 @
6 ]9 C* g1 R8 P, N) ?* Q% x% O+ R, u4 H( t2 G, J" a* L
# e+ l( r7 A! p/ R5 y

本帖子中包含更多资源

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

x

点评

技术贴。。学习了。。。  发表于 2018-7-13 08:59
 楼主| 发表于 2018-4-4 22:41:11 | 显示全部楼层
本帖最后由 happyhack 于 2018-4-4 22:58 编辑
  k. R0 [2 c3 N$ X8 d0 {) |5 u$ l9 s' \0 i3 u9 m% H
restorehwmode.sh打包附后,+ O; K- y* e* y% _9 ~1 O' c
1 p: n2 @* }" y9 p5 T, q7 }2 t: _; c

8 O% A$ y# f$ [1 H: r' h  N大家看下,个人猜测这个应该是跟手机app控制光猫的一些文件0 e: f4 X  b7 M* }

本帖子中包含更多资源

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

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-4-22 08:53 , Processed in 0.115001 second(s), 29 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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