iROOT

fwEnvUpdate.sh

Jan 27th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.38 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. FW_SETENV="/usr/share/tek/fw_setenv"
  4. FW_PRINTENV="/usr/share/tek/fw_printenv"
  5.  
  6. echo "Updating environment variables..."
  7.  
  8. BOOTCMD=`$FW_PRINTENV bootcmd`
  9. ROMARGS=`$FW_PRINTENV romargs`
  10. ROMBOOT=`$FW_PRINTENV romboot`
  11. ROMBOOTCMD=`$FW_PRINTENV rombootcmd`
  12. RESERVE=`$FW_PRINTENV reserve`
  13.  
  14. if [ "$BOOTCMD" != "bootcmd=run romboot" ]
  15. then
  16.     $FW_SETENV bootcmd 'run romboot'
  17.     BOOTCMD=`$FW_PRINTENV bootcmd`
  18.     if [ "$BOOTCMD" != "bootcmd=run romboot" ]
  19.     then
  20.         echo "Failed to set bootcmd correctly"
  21.     fi
  22.  
  23. fi
  24.  
  25. if [ "$ROMARGS" != "romargs=setenv bootargs console=ttymxc0,\${baudrate) arm_freq=800 \${quiet) \${panic) \${lockout} root=/dev/mtdblock5 rootfstype=squashfs ro" ]
  26. then
  27.     $FW_SETENV romargs "setenv bootargs console=ttymxc0,\${baudrate) arm_freq=800 \${quiet) \${panic) \${lockout} root=/dev/mtdblock5 rootfstype=squashfs ro"
  28.     ROMARGS=`$FW_PRINTENV romargs`
  29.     if [ "$ROMARGS" != "romargs=setenv bootargs console=ttymxc0,\${baudrate) arm_freq=800 \${quiet) \${panic) \${lockout} root=/dev/mtdblock5 rootfstype=squashfs ro" ]
  30.     then
  31.         echo "Failed to set romargs correctly"
  32.     fi
  33. fi
  34.  
  35. if [ "$ROMBOOT" != "romboot=setenv bootcmd \${rombootcmd}; setenv verify yes; saveenv; boot" ]
  36. then
  37.     $FW_SETENV romboot 'setenv bootcmd \${rombootcmd}; setenv verify yes; saveenv; boot'
  38.     ROMBOOT=`$FW_PRINTENV romboot`
  39.     if [ "$ROMBOOT" != "romboot=setenv bootcmd \${rombootcmd}; setenv verify yes; saveenv; boot" ]
  40.     then
  41.         echo "Failed to set romboot correctly"
  42.     fi
  43. fi
  44.  
  45. if [ "$ROMBOOTCMD" != "rombootcmd=run romargs; bootm 0C140000; bootm 0C540000" ]
  46. then
  47.     $FW_SETENV rombootcmd 'run romargs; bootm 0C140000; bootm 0C540000'
  48.     ROMBOOTCMD=`$FW_PRINTENV rombootcmd`
  49.     if [ "$ROMBOOTCMD" != "rombootcmd=run romargs; bootm 0C140000; bootm 0C540000" ]
  50.     then
  51.         echo "Failed to set rombootcmd correctly"
  52.     fi
  53. fi
  54.  
  55. if [ "$RESERVE" != "reserve=14336" ]
  56. then
  57.     $FW_SETENV reserve '14336'
  58.     RESERVE=`$FW_PRINTENV reserve`
  59.     if [ "$RESERVE" != "reserve=14336" ]
  60.     then
  61.         echo "Failed to set reserve correctly"
  62.     fi
  63. fi
  64.  
  65. echo "Finished updating environment variables."
  66.  
  67. echo "Checking required environment variables..."
  68.  
  69. BBOBOARD=`$FW_PRINTENV bboboard#`
  70. ETHADDR=`$FW_PRINTENV ethaddr`
  71. MODEL=`$FW_PRINTENV model`
  72. SERIAL=`$FW_PRINTENV serial#`
  73.  
  74. echo "Finished checking required environment variables."
Advertisement
Add Comment
Please, Sign In to add comment