1#!/system/bin/sh 2# Copyright (c) 2013, 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. 32PATH=/sbin:/system/sbin:/system/bin:/system/xbin 33export PATH 34 35# Check for images and set up symlinks 36cd /firmware/image 37 38# Get the list of files in /firmware/image 39# for which sym links have to be created 40 41fwfiles=`ls modem* adsp* wcnss* mba*` 42 43# Check if the links with similar names 44# have been created in /system/etc/firmware 45 46cd /system/etc/firmware 47linksNeeded=0 48 49# For everyfile in fwfiles check if 50# the corresponding file exists 51for 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 71done 72 73# symlinks created for qca6714 firmware 74ln -s /firmware/image/athwlan.bin /system/etc/firmware/athwlan.bin 75ln -s /firmware/image/fakeboar.bin /system/etc/firmware/fakeBoardData_AR6004.bin 76ln -s /firmware/image/otp.bin /system/etc/firmware/otp.bin 77ln -s /firmware/image/utf.bin /system/etc/firmware/utf.bin 78 79case $linksNeeded in 80 1) 81 cd /firmware/image 82 83 case `ls modem.mdt 2>/dev/null` in 84 modem.mdt) 85 for imgfile in modem*; do 86 ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null 87 done 88 ;; 89 *) 90 # trying to log here but nothing will be logged since it is 91 # early in the boot process. Is there a way to log this message? 92 log -p w -t PIL no modem image found;; 93 esac 94 95 case `ls adsp.mdt 2>/dev/null` in 96 adsp.mdt) 97 for imgfile in adsp*; do 98 ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null 99 done 100 ;; 101 *) 102 log -p w -t PIL no adsp image found;; 103 esac 104 105 case `ls wcnss.mdt 2>/dev/null` in 106 wcnss.mdt) 107 for imgfile in wcnss*; do 108 ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null 109 done 110 ;; 111 *) 112 log -p w -t PIL no wcnss image found;; 113 esac 114 115 case `ls mba.mdt 2>/dev/null` in 116 mba.mdt) 117 for imgfile in mba*; do 118 ln -s /firmware/image/$imgfile /system/etc/firmware/$imgfile 2>/dev/null 119 done 120 ;; 121 *) 122 log -p w -t PIL no mba image found;; 123 esac 124 125 ;; 126 127 *) 128 # Nothing to do. No links needed 129 ;; 130esac 131 132cd / 133