|
|
|
@ -229,39 +229,52 @@ is_mounted () {
|
|
|
|
|
# mount partitions
|
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
|
|
toupper() {
|
|
|
|
|
echo "$@" | tr '[:lower:]' '[:upper:]'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
find_block () {
|
|
|
|
|
unset tmp
|
|
|
|
|
tmp=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${1}${SLOT} | head -n 1)
|
|
|
|
|
[ -z "${tmp}" ] && tmp=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${1}${SLOT} | head -n 1)
|
|
|
|
|
if [ -z "${tmp}" ]; then
|
|
|
|
|
for uevent in /sys/dev/block/*/uevent; do
|
|
|
|
|
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
|
|
|
|
if [ "${1}${SLOT}" = "${partname}" ]; then
|
|
|
|
|
tmp="/dev/block/$(awk -F= '/DEVNAME/{print $2}' ${uevent})"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
local block tmp partname devname device
|
|
|
|
|
|
|
|
|
|
block=${1}${SLOT}
|
|
|
|
|
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
|
|
|
|
|
|
|
|
|
if [ ! -z ${device} ]; then
|
|
|
|
|
readlink -f ${device}
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
readlink -f "${tmp}"
|
|
|
|
|
|
|
|
|
|
for uevent in /sys/dev/block/*/uevent; do
|
|
|
|
|
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
|
|
|
|
devname=$(awk -F= '/DEVNAME/{print $2}' ${uevent})
|
|
|
|
|
if [ "$(toupper ${block})" = "$(toupper ${partname})" ]; then
|
|
|
|
|
echo /dev/block/${devname}
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
|
|
|
|
if [ ! -z ${device} ]; then
|
|
|
|
|
readlink -f ${device}
|
|
|
|
|
return 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mount_partitions () {
|
|
|
|
|
if ! ${BOOTMODE}; then
|
|
|
|
|
DEVICE_AB=FALSE
|
|
|
|
|
VENDOR_COMPAT=FALSE
|
|
|
|
|
SYSTEM_AS_ROOT=FALSE
|
|
|
|
|
|
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
|
|
|
|
decho " INFO: #1 [SLOT] ${SLOT}"
|
|
|
|
|
if [ -z ${SLOT} ]; then
|
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot)
|
|
|
|
|
echo " INFO: #2 [SLOT] ${SLOT}"
|
|
|
|
|
if [ ! -z ${SLOT} ]; then
|
|
|
|
|
SLOT=_${SLOT}
|
|
|
|
|
echo " INFO: #3 [SLOT] ${SLOT}"
|
|
|
|
|
DEVICE_AB=TRUE
|
|
|
|
|
fi
|
|
|
|
|
[ -z ${SLOT} ] || SLOT=_${SLOT}
|
|
|
|
|
fi
|
|
|
|
|
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TRUE
|
|
|
|
|
decho " INFO: #1 [SLOT] ${SLOT}"
|
|
|
|
|
|
|
|
|
|
is_mounted /data || mount /data || decho "failed to mount /data!"
|
|
|
|
|
|
|
|
|
@ -270,6 +283,11 @@ mount_partitions () {
|
|
|
|
|
SYSTEM_BLOCK=$(find_block system)
|
|
|
|
|
decho " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
|
|
|
|
|
|
|
|
|
if is_mounted /system_root; then
|
|
|
|
|
umount /system 2&>/dev/null
|
|
|
|
|
umount /system_root 2&>/dev/null
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
mkdir -p /system /system_root
|
|
|
|
|
mount -o rw ${SYSTEM_BLOCK} /system
|
|
|
|
|
|
|
|
|
|