Advertisement
Guest User

Untitled

a guest
Apr 5th, 2023
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. #!/bin/sh -e
  2.  
  3. cd /home/root
  4.  
  5. insmod /home/root/8189es.ko
  6. #insmod /home/root/8723bs.ko
  7.  
  8. echo 30000 > /proc/sys/vm/min_free_kbytes
  9. echo 2 >/proc/sys/kernel/printk
  10. echo -e "\033[9;0]" > /dev/tty0
  11. echo 0 > /sys/bus/platform/drivers/imx_busfreq/soc\:busfreq/enable
  12.  
  13. if [ -f "/home/root/fac/need_retry_upgrade_firmware.tag" ];then
  14. if [ -f "/home/root/fac/temp_gateway.bin" ];then
  15. cp /home/root/fac/lumi_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
  16. cd /tmp/lumi_hub.update && ./update.sh
  17. fi
  18. fi
  19. #/home/root/set_mac.sh &
  20. if [ -f "/home/root/test_ota.sh" ];then
  21. ret=`/home/root/test_ota.sh`
  22. fi
  23.  
  24. if [ -f "/lumi/conf/factory_add_scene" ];then
  25. rm /lumi/conf/factory_add_scene
  26. fi
  27.  
  28. if [ -f "/home/root/daemon.exe" ];then
  29. cp /home/root/daemon.exe /home/root/daemon
  30. chmod +x /home/root/daemon
  31.  
  32.  
  33. root@imx6ull14x14evk:~# cat /etc/rc.local
  34. #!/bin/sh -e
  35.  
  36. cd /home/root
  37.  
  38. insmod /home/root/8189es.ko
  39. #insmod /home/root/8723bs.ko
  40.  
  41. echo 30000 > /proc/sys/vm/min_free_kbytes
  42. echo 2 >/proc/sys/kernel/printk
  43. echo -e "\033[9;0]" > /dev/tty0
  44. echo 0 > /sys/bus/platform/drivers/imx_busfreq/soc\:busfreq/enable
  45.  
  46. if [ -f "/home/root/fac/need_retry_upgrade_firmware.tag" ];then
  47. if [ -f "/home/root/fac/temp_gateway.bin" ];then
  48. cp /home/root/fac/lumi_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
  49. cd /tmp/lumi_hub.update && ./update.sh
  50. fi
  51. fi
  52. #/home/root/set_mac.sh &
  53. if [ -f "/home/root/test_ota.sh" ];then
  54. ret=`/home/root/test_ota.sh`
  55. fi
  56.  
  57. if [ -f "/lumi/conf/factory_add_scene" ];then
  58. rm /lumi/conf/factory_add_scene
  59. fi
  60.  
  61. if [ -f "/home/root/daemon.exe" ];then
  62. cp /home/root/daemon.exe /home/root/daemon
  63. chmod +x /home/root/daemon
  64. fi
  65.  
  66. #update zigbee
  67. #if [ -f "/etc/os-release" ] && [ `grep ^MCU_FW_VERSION= /etc/os-release` == "MCU_FW_VERSION=0222" ];then
  68. # echo "the same ncp version not upgrade"
  69. # rm /home/root/fac/need_update_coordinator.tag
  70. #fi
  71.  
  72. if [ -f "/home/root/fac/need_update_coordinator.tag" ] && [ `cat /home/root/fac/need_update_coordinator.tag` -gt 1 ];then
  73. echo "start update zigbee coordinator"
  74. sleep 8
  75. if [ ! -f /home/root/hkbridge/stationmode ];then
  76. /home/root/hkbridge/control_light.sh yellow&
  77. else
  78. /home/root/hkbridge/control_light.sh blue&
  79. fi
  80.  
  81. try_times=`cat /home/root/fac/need_update_coordinator.tag`
  82. let try_times-=1
  83. echo "retry $try_times"
  84. echo $try_times > /home/root/fac/need_update_coordinator.tag
  85. sync
  86. echo "waiting ..."
  87. /home/root/fac/test_ota /home/root/fac/Zigbee_V2.27_20200324_1846_PA_Comp_CRC.bin > /tmp/update_coordinator.log
  88. if [ -f "/tmp/update_coordinator.log" ] && [ "`cat /tmp/update_coordinator.log | grep "Success"`" != "" ];then
  89. echo "update zigbee coordinator ok"
  90. rm /home/root/fac/need_update_coordinator.tag
  91. else
  92. echo "reboot"
  93. reboot
  94. fi
  95. echo 0 > /sys/class/backlight/lumi_r/brightness
  96. echo 0 > /sys/class/backlight/lumi_g/brightness
  97. echo 0 > /sys/class/backlight/lumi_b/brightness
  98.  
  99. killall control_light.sh
  100. fi
  101.  
  102. /home/root/key_rgb > /dev/null 2>&1 &
  103. /lumi/app/miio/start_ot.sh > /dev/null 2>&1 &
  104.  
  105. echo "=========================================="
  106. echo "======== ^_^ start miot hkbridge ========="
  107. echo "=========================================="
  108.  
  109. #check guard file, agin install if breakdown
  110. if [ `ls -l /home/root/launch.sh | awk '{print $5}'` -lt 100 -o `ls -l /home/root/launch.sh | awk '{print $5}'` -lt 100 ]; then
  111.  
  112. # record numbler of the update fial
  113. if [ ! -f "/home/root/fac/updateInstall" ];then
  114. echo "1" > /home/root/fac/updateInstall
  115. sync
  116. fi
  117.  
  118. if [ -f "/home/root/fac/temp_gateway.bin" ] && [ `md5sum /home/root/fac/temp_gateway.bin | awk '{print $1}'` == `cat /home/root/fac/temp_gateway_md5` ] && [ `cat /home/root/fac/updateInstall` -lt 2 ];then
  119. i=`cat /home/root/fac/updateInstall`
  120. echo "$((i + 1))" > /home/root/fac/updateInstall
  121. sync
  122.  
  123. cp /home/root/fac/temp_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
  124. cd /tmp/lumi_hub.update && ./update.sh
  125. else
  126. cp /home/root/fac/lumi_gateway.bin /tmp/hk_update.bin && cd /tmp && tar jxvf hk_update.bin
  127. cd /tmp/lumi_hub.update && ./update.sh
  128. fi
  129. fi
  130.  
  131. if [ -f "/home/root/fac/updateInstall" ];then
  132. rm /home/root/fac/updateInstall
  133. fi
  134.  
  135. cd /home/root && /home/root/launch.sh >/dev/null 2>&1 &
  136. cd /home/root && /home/root/launch_monitor.sh >/dev/null 2>&1 &
  137.  
  138. /etc/init.d/dropbear start &
  139.  
  140.  
  141. /home/root/fac/fac_test
  142.  
  143. exit 0
  144.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement