Advertisement
hman

A20 OLinuXino video resolution change with 1280x1024p60

Sep 26th, 2013
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 15.49 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. temp_dir="/tmp/screen"
  4. mmc_dir="/mnt/mmc"
  5. sunxi_tools_dir="/opt/sunxi-tools"
  6. bin_file="script.bin"
  7. fex_file="script.fex"
  8. ts_file="/usr/share/X11/xorg.conf.d/20-ts.conf"
  9.  
  10. tempfile1=/tmp/dialog_1_$$
  11. tempfile2=/tmp/dialog_2_$$
  12. tempfile3=/tmp/dialog_3_$$
  13. tempfile4=/tmp/dialog_4_$$
  14.  
  15. # Define some functions
  16. SET_NONE() {
  17.     #get line number
  18.     line=$(grep -nr "screen0_output_type" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  19.    
  20.     dialog --title "Confirmation" --yesno "Disable screen ?" 0 0
  21.     case $? in
  22.       0)  
  23.     #replace line
  24.     sed -i $line's/.*/screen0_output_type = 0/' $temp_dir/$fex_file
  25.     dialog --infobox "Changes saved" 3 17
  26.     sleep 2
  27.     ;;
  28.       1|255)
  29.     dialog --infobox "No changes done" 3 19
  30.     sleep 2
  31.     ;;
  32.     esac
  33. }
  34.  
  35. SET_HDMI() {
  36.     #get line number
  37.     line=$(grep -nr "screen0_output_type" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  38.     mode=$(grep -nr "screen0_output_mode" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  39.    
  40.     dialog --backtitle "OLimeXino-A20 screen configuration" \
  41.     --radiolist "Select screen mode:" 12 55 8 \
  42.     0   "480i"      on \
  43.     1   "576i"      off \
  44.     2   "480p"      off \
  45.     3   "576p"      off \
  46.     4   "720p50"    off \
  47.     5   "720p60"    off \
  48.     6   "1080i50"   off \
  49.     7   "1080i60"   off \
  50.     8   "1080p24"   off \
  51.     9   "1080p50"   off \
  52.     10  "1080p60"   off \
  53.     11  "pal"       off \
  54.     27  "1280x1024p60"  off \
  55.     14  "ntsc"      off 2> $tempfile3
  56.  
  57. retv=$?
  58. choice=$(cat $tempfile3)
  59.  
  60. # Check if ESC of CANCLE are pressed
  61. if [ $retv -eq 1 -o $retv -eq 255 ];
  62. then
  63.   clear
  64.   exit
  65. fi
  66.  
  67. case $choice in
  68.   0)
  69.     dialog --title "Confirmation" --yesno "Set HDMI to 480i ?" 0 0
  70.     case $? in
  71.       0)  
  72.     #replace line
  73.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  74.     sed -i $mode's/.*/screen0_output_mode = 0/' $temp_dir/$fex_file
  75.     dialog --infobox "Changes saved" 3 17
  76.     sleep 2
  77.     ;;
  78.       1|255)
  79.     dialog --infobox "No changes done" 3 19
  80.     sleep 2
  81.     ;;
  82.     esac
  83.     ;;
  84.   1)
  85.     dialog --title "Confirmation" --yesno "Set HDMI to 576i ?" 0 0
  86.     case $? in
  87.       0)  
  88.     #replace line
  89.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  90.     sed -i $mode's/.*/screen0_output_mode = 1/' $temp_dir/$fex_file
  91.     dialog --infobox "Changes saved" 3 17
  92.     sleep 2
  93.     ;;
  94.       1|255)
  95.     dialog --infobox "No changes done" 3 19
  96.     sleep 2
  97.     ;;
  98.     esac
  99.     ;;
  100.   2)
  101.     dialog --title "Confirmation" --yesno "Set HDMI to 480p ?" 0 0
  102.     case $? in
  103.       0)  
  104.     #replace line
  105.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  106.     sed -i $mode's/.*/screen0_output_mode = 2/' $temp_dir/$fex_file
  107.     dialog --infobox "Changes saved" 3 17
  108.     sleep 2
  109.     ;;
  110.       1|255)
  111.     dialog --infobox "No changes done" 3 19
  112.     sleep 2
  113.     ;;
  114.     esac
  115.     ;;
  116.   3)
  117.     dialog --title "Confirmation" --yesno "Set HDMI to 576p ?" 0 0
  118.     case $? in
  119.       0)  
  120.     #replace line
  121.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  122.     sed -i $mode's/.*/screen0_output_mode = 3/' $temp_dir/$fex_file
  123.     dialog --infobox "Changes saved" 3 17
  124.     sleep 2
  125.     ;;
  126.       1|255)
  127.     dialog --infobox "No changes done" 3 19
  128.     sleep 2
  129.     ;;
  130.     esac
  131.     ;;
  132.   4)
  133.     dialog --title "Confirmation" --yesno "Set HDMI to 720p50 ?" 0 0
  134.     case $? in
  135.       0)  
  136.     #replace line
  137.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  138.     sed -i $mode's/.*/screen0_output_mode = 4/' $temp_dir/$fex_file
  139.     dialog --infobox "Changes saved" 3 17
  140.     sleep 2
  141.     ;;
  142.       1|255)
  143.     dialog --infobox "No changes done" 3 19
  144.     sleep 2
  145.     ;;
  146.     esac
  147.     ;;
  148.   5)
  149.     dialog --title "Confirmation" --yesno "Set HDMI to 720p60 ?" 0 0
  150.     case $? in
  151.       0)  
  152.     #replace line
  153.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  154.     sed -i $mode's/.*/screen0_output_mode = 5/' $temp_dir/$fex_file
  155.     dialog --infobox "Changes saved" 3 17
  156.     sleep 2
  157.     ;;
  158.       1|255)
  159.     dialog --infobox "No changes done" 3 19
  160.     sleep 2
  161.     ;;
  162.     esac
  163.     ;;  
  164.   6)
  165.     dialog --title "Confirmation" --yesno "Set HDMI to 1080i50 ?" 0 0
  166.     case $? in
  167.       0)  
  168.     #replace line
  169.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  170.     sed -i $mode's/.*/screen0_output_mode = 6/' $temp_dir/$fex_file
  171.     dialog --infobox "Changes saved" 3 17
  172.     sleep 2
  173.     ;;
  174.       1|255)
  175.     dialog --infobox "No changes done" 3 19
  176.     sleep 2
  177.     ;;
  178.     esac
  179.     ;;  
  180.   7)
  181.     dialog --title "Confirmation" --yesno "Set HDMI to 1080i60 ?" 0 0
  182.     case $? in
  183.       0)  
  184.     #replace line
  185.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  186.     sed -i $mode's/.*/screen0_output_mode = 7/' $temp_dir/$fex_file
  187.     dialog --infobox "Changes saved" 3 17
  188.     sleep 2
  189.     ;;
  190.       1|255)
  191.     dialog --infobox "No changes done" 3 19
  192.     sleep 2
  193.     ;;
  194.     esac
  195.     ;;  
  196.   8)
  197.     dialog --title "Confirmation" --yesno "Set HDMI to 1080p24 ?" 0 0
  198.     case $? in
  199.       0)  
  200.     #replace line
  201.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  202.     sed -i $mode's/.*/screen0_output_mode = 8/' $temp_dir/$fex_file
  203.     dialog --infobox "Changes saved" 3 17
  204.     sleep 2
  205.     ;;
  206.       1|255)
  207.     dialog --infobox "No changes done" 3 19
  208.     sleep 2
  209.     ;;
  210.     esac
  211.     ;;  
  212.   9)
  213.     dialog --title "Confirmation" --yesno "Set HDMI to 1080p50 ?" 0 0
  214.     case $? in
  215.       0)  
  216.     #replace line
  217.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  218.     sed -i $mode's/.*/screen0_output_mode = 9/' $temp_dir/$fex_file
  219.     dialog --infobox "Changes saved" 3 17
  220.     sleep 2
  221.     ;;
  222.       1|255)
  223.     dialog --infobox "No changes done" 3 19
  224.     sleep 2
  225.     ;;
  226.     esac
  227.     ;;  
  228.   10)
  229.     dialog --title "Confirmation" --yesno "Set HDMI to 1080p60 ?" 0 0
  230.     case $? in
  231.       0)  
  232.     #replace line
  233.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  234.     sed -i $mode's/.*/screen0_output_mode = 10/' $temp_dir/$fex_file
  235.     dialog --infobox "Changes saved" 3 17
  236.     sleep 2
  237.     ;;
  238.       1|255)
  239.     dialog --infobox "No changes done" 3 19
  240.     sleep 2
  241.     ;;
  242.     esac
  243.     ;;  
  244.   11)
  245.     dialog --title "Confirmation" --yesno "Set HDMI to pal ?" 0 0
  246.     case $? in
  247.       0)  
  248.     #replace line
  249.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  250.     sed -i $mode's/.*/screen0_output_mode = 11/' $temp_dir/$fex_file
  251.     dialog --infobox "Changes saved" 3 17
  252.     sleep 2
  253.     ;;
  254.       1|255)
  255.     dialog --infobox "No changes done" 3 19
  256.     sleep 2
  257.     ;;
  258.     esac
  259.     ;;  
  260.   27)
  261.     dialog --title "Confirmation" --yesno "Set HDMI to 1280x1024p60 ?" 0 0
  262.     case $? in
  263.       0)  
  264.     #replace line
  265.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  266.     sed -i $mode's/.*/screen0_output_mode = 27/' $temp_dir/$fex_file
  267.     dialog --infobox "Changes saved" 3 17
  268.     sleep 2
  269.     ;;
  270.       1|255)
  271.     dialog --infobox "No changes done" 3 19
  272.     sleep 2
  273.     ;;
  274.     esac
  275.     ;;  
  276.   14)
  277.     dialog --title "Confirmation" --yesno "Set HDMI to ntsc ?" 0 0
  278.     case $? in
  279.       0)  
  280.     #replace line
  281.     sed -i $line's/.*/screen0_output_type = 3/' $temp_dir/$fex_file
  282.     sed -i $mode's/.*/screen0_output_mode = 14/' $temp_dir/$fex_file
  283.     dialog --infobox "Changes saved" 3 17
  284.     sleep 2
  285.     ;;
  286.       1|255)
  287.     dialog --infobox "No changes done" 3 19
  288.     sleep 2
  289.     ;;
  290.     esac
  291.     ;;  
  292. esac
  293.    
  294.    
  295. }
  296.  
  297. SET_VGA() {
  298.     #get line number
  299.     line=$(grep -nr "screen0_output_type" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  300.     mode=$(grep -nr "screen0_output_mode" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  301.    
  302.     dialog --backtitle "OLimeXino-A20 screen configuration" \
  303.     --radiolist "Select screen mode:" 0 0 0 \
  304.     0   "1680x1050" off \
  305.     1   "1440x900"  off \
  306.     2   "1360x768"  off \
  307.     3   "1280x1024" off \
  308.     4   "1024x768"  off \
  309.     5   "800x600"   off \
  310.     6   "640x480"   off \
  311.     10  "1920x1080" off \
  312.     11  "1280x720"  on  2> $tempfile4
  313.  
  314. retv=$?
  315. choice=$(cat $tempfile4)
  316.  
  317. # Check if ESC of CANCLE are pressed
  318. if [ $retv -eq 1 -o $retv -eq 255 ];
  319. then
  320.   clear
  321.   exit
  322. fi
  323.  
  324. case $choice in
  325.   0)
  326.     dialog --title "Confirmation" --yesno "Set VGA to 1680x1050 ?" 0 0
  327.     case $? in
  328.       0)  
  329.     #replace line
  330.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  331.     sed -i $mode's/.*/screen0_output_mode = 0/' $temp_dir/$fex_file
  332.     dialog --infobox "Changes saved" 3 17
  333.     sleep 2
  334.     ;;
  335.       1|255)
  336.     dialog --infobox "No changes done" 3 19
  337.     sleep 2
  338.     ;;
  339.     esac
  340.     ;;
  341.   1)
  342.     dialog --title "Confirmation" --yesno "Set VGA to 1440x900 ?" 0 0
  343.     case $? in
  344.       0)  
  345.     #replace line
  346.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  347.     sed -i $mode's/.*/screen0_output_mode = 1/' $temp_dir/$fex_file
  348.     dialog --infobox "Changes saved" 3 17
  349.     sleep 2
  350.     ;;
  351.       1|255)
  352.     dialog --infobox "No changes done" 3 19
  353.     sleep 2
  354.     ;;
  355.     esac
  356.     ;;
  357.   2)
  358.     dialog --title "Confirmation" --yesno "Set VGA to 1360x768 ?" 0 0
  359.     case $? in
  360.       0)  
  361.     #replace line
  362.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  363.     sed -i $mode's/.*/screen0_output_mode = 2/' $temp_dir/$fex_file
  364.     dialog --infobox "Changes saved" 3 17
  365.     sleep 2
  366.     ;;
  367.       1|255)
  368.     dialog --infobox "No changes done" 3 19
  369.     sleep 2
  370.     ;;
  371.     esac
  372.     ;;
  373.   3)
  374.     dialog --title "Confirmation" --yesno "Set VGA to 1280x1024 ?" 0 0
  375.     case $? in
  376.       0)  
  377.     #replace line
  378.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  379.     sed -i $mode's/.*/screen0_output_mode = 3/' $temp_dir/$fex_file
  380.     dialog --infobox "Changes saved" 3 17
  381.     sleep 2
  382.     ;;
  383.       1|255)
  384.     dialog --infobox "No changes done" 3 19
  385.     sleep 2
  386.     ;;
  387.     esac
  388.     ;;
  389.   4)
  390.     dialog --title "Confirmation" --yesno "Set VGA to 1024x768 ?" 0 0
  391.     case $? in
  392.       0)  
  393.     #replace line
  394.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  395.     sed -i $mode's/.*/screen0_output_mode = 4/' $temp_dir/$fex_file
  396.     dialog --infobox "Changes saved" 3 17
  397.     sleep 2
  398.     ;;
  399.       1|255)
  400.     dialog --infobox "No changes done" 3 19
  401.     sleep 2
  402.     ;;
  403.     esac
  404.     ;;
  405.   5)
  406.     dialog --title "Confirmation" --yesno "Set VGA to 800x600 ?" 0 0
  407.     case $? in
  408.       0)  
  409.     #replace line
  410.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  411.     sed -i $mode's/.*/screen0_output_mode = 5/' $temp_dir/$fex_file
  412.     dialog --infobox "Changes saved" 3 17
  413.     sleep 2
  414.     ;;
  415.       1|255)
  416.     dialog --infobox "No changes done" 3 19
  417.     sleep 2
  418.     ;;
  419.     esac
  420.     ;;  
  421.   6)
  422.     dialog --title "Confirmation" --yesno "Set VGA to 640x480 ?" 0 0
  423.     case $? in
  424.       0)  
  425.     #replace line
  426.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  427.     sed -i $mode's/.*/screen0_output_mode = 6/' $temp_dir/$fex_file
  428.     dialog --infobox "Changes saved" 3 17
  429.     sleep 2
  430.     ;;
  431.       1|255)
  432.     dialog --infobox "No changes done" 3 19
  433.     sleep 2
  434.     ;;
  435.     esac
  436.     ;;  
  437.   10)
  438.     dialog --title "Confirmation" --yesno "Set VGA to 1920x1080 ?" 0 0
  439.     case $? in
  440.       0)  
  441.     #replace line
  442.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  443.     sed -i $mode's/.*/screen0_output_mode = 10/' $temp_dir/$fex_file
  444.     dialog --infobox "Changes saved" 3 17
  445.     sleep 2
  446.     ;;
  447.       1|255)
  448.     dialog --infobox "No changes done" 3 19
  449.     sleep 2
  450.     ;;
  451.     esac
  452.     ;;  
  453.   11)
  454.     dialog --title "Confirmation" --yesno "Set VGA to 1280x720 ?" 0 0
  455.     case $? in
  456.       0)  
  457.     #replace line
  458.     sed -i $line's/.*/screen0_output_type = 4/' $temp_dir/$fex_file
  459.     sed -i $mode's/.*/screen0_output_mode = 11/' $temp_dir/$fex_file
  460.     dialog --infobox "Changes saved" 3 17
  461.     sleep 2
  462.     ;;
  463.       1|255)
  464.     dialog --infobox "No changes done" 3 19
  465.     sleep 2
  466.     ;;
  467.     esac
  468.     ;;  
  469. esac
  470.    
  471.    
  472. }
  473.  
  474. SET_LCD() {
  475.  
  476.   dialog --backtitle "OLimeXino-A20 screen configuration" \
  477.     --radiolist "Select screen mode:" 0 0 0 \
  478.     "4.3"   "480x272"   on \
  479.     "7.0"   "800x480"   off \
  480.     "10.3"  "1024x600"  off 2> $tempfile2
  481.  
  482.   retv=$?
  483.   choice=$(cat $tempfile2)
  484.  
  485.   # Check if ESC of CANCLE are pressed
  486.   if [ $retv -eq 1 -o $retv -eq 255 ];
  487.   then
  488.     clear
  489.     exit
  490.   fi
  491.  
  492.   case $choice in
  493.     "4.3")
  494.     x=480
  495.     y=272
  496.     freq=9
  497.     hbp=40
  498.     ht=525
  499.     vbp=8
  500.     vt=576
  501.     vspw=5
  502.     hspw=30
  503.     ;;
  504.     "7.0")
  505.     x=800
  506.     y=480
  507.     freq=33
  508.     hbp=46
  509.     ht=1055
  510.     vbp=23
  511.     vt=1050
  512.     vspw=1
  513.     hspw=30
  514.     ;;
  515.     "10.3")
  516.     x=1024
  517.     y=600
  518.     freq=45
  519.     hbp=160
  520.     ht=1200
  521.     vbp=23
  522.     vt=1250
  523.     vspw=2
  524.     hspw=10
  525.     ;;
  526.   esac
  527.  
  528.   dialog --title "Confirmation" --yesno "Set LCD to '$x'x'$y' ?" 0 0    
  529.   case $? in
  530.       0)
  531.     #Edit fex file
  532.     line_x=$(grep -nr -m 1 "lcd_x" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  533.     line_y=$(grep -nr -m 1 "lcd_y" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  534.     line_freq=$(grep -nr -m 1 "lcd_dclk_freq" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  535.     line_hbp=$(grep -nr -m 1 "lcd_hbp" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  536.     line_ht=$(grep -nr -m 1 "lcd_ht" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  537.     line_vbp=$(grep -nr -m 1 "lcd_vbp" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  538.     line_vt=$(grep -nr -m 1 "lcd_vt" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  539.     line_vspw=$(grep -nr -m 1 "lcd_vspw" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  540.     line_hspw=$(grep -nr -m 1 "lcd_hspw" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  541.     line=$(grep -nr "screen0_output_type" $temp_dir/$fex_file | awk '{print$1}' FS=":")
  542.    
  543.     sed -i $line's/.*/screen0_output_type = 1/' $temp_dir/$fex_file
  544.     sed -i $line_x's/.*/lcd_x = '$x'/' $temp_dir/$fex_file
  545.     sed -i $line_y's/.*/lcd_y = '$y'/' $temp_dir/$fex_file
  546.     sed -i $line_freq's/.*/lcd_dclk_freq = '$freq'/' $temp_dir/$fex_file
  547.     sed -i $line_hbp's/.*/lcd_hbp = '$hbp'/' $temp_dir/$fex_file
  548.     sed -i $line_ht's/.*/lcd_ht = '$ht'/' $temp_dir/$fex_file
  549.     sed -i $line_vbp's/.*/lcd_vbp = '$vbp'/' $temp_dir/$fex_file
  550.     sed -i $line_vt's/.*/lcd_vt = '$vt'/' $temp_dir/$fex_file
  551.     sed -i $line_vspw's/.*/lcd_vspw = '$vspw'/' $temp_dir/$fex_file
  552.     sed -i $line_hspw's/.*/lcd_hspw = '$hspw'/' $temp_dir/$fex_file
  553.    
  554.     #Edit TS
  555.     ts_line_x=$(grep -nr -m 1 "Width" $ts_file | awk '{print$1}' FS=":")
  556.     ts_line_y=$(grep -nr -m 1 "Height" $ts_file | awk '{print$1}' FS=":")
  557.     sed -i $ts_line_x's/.*/\tOption "Width" "'$x'"/' $ts_file
  558.     sed -i $ts_line_y's/.*/\tOption "Height" "'$y'"/' $ts_file
  559.    
  560.     dialog --infobox "Changes saved" 3 17
  561.     sleep 2
  562.     ;;
  563.       1|255)
  564.     dialog --infobox "No changes done" 3 19
  565.     sleep 2
  566.     ;;
  567.     esac  
  568. }
  569.  
  570. MAIN() {
  571.  
  572.   # Now to some fancy stuff
  573.   dialog --backtitle "OLimeXino-A20 screen configuration" \
  574.   --radiolist "Select output type:" 12 55 8 \
  575.   "None" "Disable all screens" off \
  576.   "LCD" "Set configuration for LCD" off \
  577.   "HDMI" "Set configuration for HDMI" on \
  578.   "VGA" "Set configuration for VGA" off 2> $tempfile1
  579.  
  580.   retv=$?
  581.   choice=$(cat $tempfile1)
  582.  
  583.   # Check if ESC of CANCLE are pressed
  584.   if [ $retv -eq 1 -o $retv -eq 255 ];
  585.   then
  586.     clear
  587.     exit
  588.   fi
  589.  
  590.   # Check selected option
  591.   case $choice in
  592.     "None") SET_NONE;;
  593.     "LCD") SET_LCD;;
  594.     "HDMI") SET_HDMI;;
  595.     "VGA") SET_VGA
  596.   esac
  597. }
  598. trap "rm -f $tempfile1" 0 1 2 5 15
  599.  
  600. # Export PATH
  601. export PATH=$PATH:$sunxi_tools_dir
  602.  
  603. # Check for /mnt/mmc
  604. if [ ! -d $mmc_dir ];
  605. then
  606.   mkdir -p $mmc_dir
  607. fi
  608.  
  609. # Check for /mnt/mmc
  610. if [ ! -d $temp_dir ];
  611. then
  612.   mkdir -p $temp_dir
  613. fi
  614.  
  615.  
  616. # Mount sdcard
  617. mount /dev/mmcblk0p1 $mmc_dir
  618.  
  619. # Copy current script
  620. cp $mmc_dir/$bin_file $temp_dir/
  621.  
  622. # bin2fex
  623. bin2fex $temp_dir/$bin_file > $temp_dir/$fex_file
  624.  
  625. # Unmount
  626. umount /dev/mmcblk0p1
  627.  
  628. # Remove binfile
  629. rm $temp_dir/$bin_file
  630.  
  631.  
  632. MAIN
  633.  
  634.  
  635.  
  636. # make the bin file
  637. fex2bin $temp_dir/$fex_file > $temp_dir/$bin_file
  638.  
  639. # Mount sdcard
  640. mount /dev/mmcblk0p1 $mmc_dir
  641.  
  642. # Copy current script
  643. cp $temp_dir/$bin_file $mmc_dir/
  644.  
  645. # Unmount
  646. umount /dev/mmcblk0p1
  647.  
  648. #rm -rf $temp_dir
  649.  
  650. dialog --title "Reboot" --yesno "Reboot the board? " 0 0
  651. case $? in
  652.   0)        reboot;;
  653.   1|255)    clear;;
  654. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement