Zvikomborero VIncent Zvikaramba | dd0e969 | 2016-08-18 21:17:38 -0400 | [diff] [blame^] | 1 | #!/system/bin/sh |
| 2 | # Copyright (c) 2014, The Linux Foundation. All rights reserved. |
| 3 | # |
| 4 | # Redistribution and use in source and binary forms, with or without |
| 5 | # modification, are permitted provided that the following conditions are |
| 6 | # met: |
| 7 | # * Redistributions of source code must retain the above copyright |
| 8 | # notice, this list of conditions and the following disclaimer. |
| 9 | # * Redistributions in binary form must reproduce the above |
| 10 | # copyright notice, this list of conditions and the following |
| 11 | # disclaimer in the documentation and/or other materials provided |
| 12 | # with the distribution. |
| 13 | # * Neither the name of The Linux Foundation nor the names of its |
| 14 | # contributors may be used to endorse or promote products derived |
| 15 | # from this software without specific prior written permission. |
| 16 | # |
| 17 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 18 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 21 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 24 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 26 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 27 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | # |
| 29 | # |
| 30 | |
| 31 | # No path is set up at this point so we have to do it here. |
| 32 | PATH=/sbin:/system/sbin:/system/bin:/system/xbin |
| 33 | export PATH |
| 34 | |
| 35 | # Check for images and set up symlinks |
| 36 | cd /firmware/image |
| 37 | |
| 38 | # Get the list of files in /firmware/image |
| 39 | # for which sym links have to be created |
| 40 | |
| 41 | fwfiles=`ls modem* adsp* wcnss* mba* venus* tima_*` |
| 42 | |
| 43 | # Check if the links with similar names |
| 44 | # have been created in /system/etc/firmware |
| 45 | |
| 46 | cd /system/etc/firmware |
| 47 | linksNeeded=1 |
| 48 | |
| 49 | # For everyfile in fwfiles check if |
| 50 | # the corresponding file exists |
| 51 | for fwfile in $fwfiles; do |
| 52 | |
| 53 | # if (condition) does not seem to work |
| 54 | # with the android shell. Therefore |
| 55 | # make do with case statements instead. |
| 56 | # if a file named $fwfile is present |
| 57 | # no need to create links. If the file |
| 58 | # with the name $fwfile is not present |
| 59 | # need to create links. |
| 60 | |
| 61 | case `ls $fwfile` in |
| 62 | $fwfile) |
| 63 | continue;; |
| 64 | *) |
| 65 | # file with $fwfile does not exist |
| 66 | # need to create links |
| 67 | linksNeeded=1 |
| 68 | break;; |
| 69 | esac |
| 70 | |
| 71 | done |
| 72 | |
| 73 | case $linksNeeded in |
| 74 | 1) |
| 75 | cd /firmware/image |
| 76 | |
| 77 | case `ls modem.mdt 2>/dev/null` in |
| 78 | modem.mdt) |
| 79 | for imgfile in modem*; do |
| 80 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 81 | done |
| 82 | ;; |
| 83 | *) |
| 84 | # trying to log here but nothing will be logged since it is |
| 85 | # early in the boot process. Is there a way to log this message? |
| 86 | log -p w -t PIL no modem image found;; |
| 87 | esac |
| 88 | |
| 89 | case `ls adsp.mdt 2>/dev/null` in |
| 90 | adsp.mdt) |
| 91 | for imgfile in adsp*; do |
| 92 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 93 | done |
| 94 | ;; |
| 95 | *) |
| 96 | log -p w -t PIL no adsp image found;; |
| 97 | esac |
| 98 | |
| 99 | case `ls wcnss.mdt 2>/dev/null` in |
| 100 | wcnss.mdt) |
| 101 | for imgfile in wcnss*; do |
| 102 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 103 | done |
| 104 | ;; |
| 105 | *) |
| 106 | log -p w -t PIL no wcnss image found;; |
| 107 | esac |
| 108 | |
| 109 | case `ls tima_pkm.mdt 2>/dev/null` in |
| 110 | tima_pkm.mdt) |
| 111 | for imgfile in tima_pkm*; do |
| 112 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 113 | done |
| 114 | ;; |
| 115 | *) |
| 116 | log -p w -t PIL 8974 device but no tima_pkm image found;; |
| 117 | esac |
| 118 | |
| 119 | case `ls tima_lkm.mdt 2>/dev/null` in |
| 120 | tima_lkm.mdt) |
| 121 | for imgfile in tima_lkm*; do |
| 122 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 123 | done |
| 124 | ;; |
| 125 | *) |
| 126 | log -p w -t PIL 8974 device but no tima_lkm image found;; |
| 127 | esac |
| 128 | |
| 129 | case `ls tima_atn.mdt 2>/dev/null` in |
| 130 | tima_atn.mdt) |
| 131 | for imgfile in tima_atn*; do |
| 132 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 133 | done |
| 134 | ;; |
| 135 | *) |
| 136 | log -p w -t PIL 8974 device but no tima_atn image found;; |
| 137 | esac |
| 138 | |
| 139 | case `ls mba.mdt 2>/dev/null` in |
| 140 | mba.mdt) |
| 141 | for imgfile in mba*; do |
| 142 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 143 | done |
| 144 | ;; |
| 145 | *) |
| 146 | log -p w -t PIL no mba image found;; |
| 147 | esac |
| 148 | |
| 149 | case `ls venus.mdt 2>/dev/null` in |
| 150 | venus.mdt) |
| 151 | for imgfile in venus*; do |
| 152 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 153 | done |
| 154 | ;; |
| 155 | *) |
| 156 | log -p w -t PIL no venus image found;; |
| 157 | esac |
| 158 | |
| 159 | case `ls tz_otp.mdt 2>/dev/null` in |
| 160 | tz_otp.mdt) |
| 161 | for imgfile in tz_otp*; do |
| 162 | ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null |
| 163 | done |
| 164 | ;; |
| 165 | *) |
| 166 | log -p w -t PIL 8974 device but no tz_otp image found;; |
| 167 | esac |
| 168 | |
| 169 | ;; |
| 170 | |
| 171 | *) |
| 172 | # Nothing to do. No links needed |
| 173 | ;; |
| 174 | esac |
| 175 | |
| 176 | cd / |
| 177 | |