Skip to content

Instantly share code, notes, and snippets.

@luca020400
Last active June 12, 2016 19:29
Show Gist options
  • Save luca020400/4a1d2669b12149d7cc5db631dd1fc143 to your computer and use it in GitHub Desktop.
Save luca020400/4a1d2669b12149d7cc5db631dd1fc143 to your computer and use it in GitHub Desktop.
#!/sbin/sh
# TODO: Add msm8929 support
aboot="/dev/block/bootdevice/by-name/aboot"
hyp="/dev/block/bootdevice/by-name/hyp"
rpm="/dev/block/bootdevice/by-name/rpm"
sbl1="/dev/block/bootdevice/by-name/sbl1"
tz="/dev/block/bootdevice/by-name/tz"
modem="/dev/block/bootdevice/by-name/modem"
PRJ_ID=`cat /proc/apid`
PRJ_HD=`cat /proc/aphd`
PRJ_SKU=`cat /proc/aprf`
PRJ_SOC=`cat /sys/devices/soc0/soc_id`
case "$PRJ_SOC" in
"206" | "247" | "248" | "249" | "250")
IS_8916=1
;;
"268" | "269" | "270" | "271")
IS_8929=1
;;
"239" | "241" | "263")
IS_8939=1
;;
esac
if [ "$PRJ_HD" -eq 1 ] && [ "$IS_8916" -eq 1 ]; then
echo "Detected HD Display and MSM8916"
aboot_mbn="/tmp/emmc_appsboot_8916.mbn"
hyp_mbn="/tmp/HD@firmware@[email protected]"
rpm_mbn="/tmp/HD@firmware@[email protected]"
sbl1_mbn="/tmp/HD@firmware@[email protected]"
tz_mbn="/tmp/HD@firmware@[email protected]"
if [ "$PRJ_ID" -eq 0 ]; then
echo "Detected ZE550KL."
modem_bin="/tmp/FHD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_ID" -eq 1 ]; then
echo "Detected ZE600KL."
modem_bin="/tmp/FHD@modem@ZE600KL@[email protected]"
fi
elif [ "$PRJ_HD" -eq 1 ] && [ "$IS_8929" -eq 1 ]; then
echo "Detected FHD Display and MSM8939"
echo "MSM8929 isn't supported yet"
return 1
# aboot_mbn="/tmp/emmc_appsboot_8939.mbn"
# hyp_mbn="/tmp/FHD@firmware@[email protected]"
# rpm_mbn="/tmp/FHD@firmware@[email protected]"
# sbl1_mbn="/tmp/FHD@firmware@[email protected]"
# tz_mbn="/tmp/FHD@firmware@[email protected]"
# echo "Detected ZE550KL."
# modem_bin="/tmp/FHD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_HD" -eq 1 ] && [ "$IS_8939" -eq 1 ]; then
echo "Detected HD Display and MSM8939"
aboot_mbn="/tmp/emmc_appsboot_8939.mbn"
hyp_mbn="/tmp/HD@firmware@[email protected]"
rpm_mbn="/tmp/HD@firmware@[email protected]"
sbl1_mbn="/tmp/HD@firmware@[email protected]"
tz_mbn="/tmp/HD@firmware@[email protected]"
if [ "$PRJ_ID" -eq 0 ]; then
echo "Detected ZE550KL."
modem_bin="/tmp/HD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_ID" -eq 1 ]; then
echo "Detected ZE601KL."
modem_bin="/tmp/HD@modem@ZE600KL@[email protected]"
fi
elif [ "$PRJ_HD" -eq 0 ] && [ "$IS_8939" -eq 1 ]; then
echo "Detected FHD Display and MSM8939"
aboot_mbn="/tmp/emmc_appsboot_8939.mbn"
hyp_mbn="/tmp/FHD@firmware@[email protected]"
rpm_mbn="/tmp/FHD@firmware@[email protected]"
sbl1_mbn="/tmp/FHD@firmware@[email protected]"
tz_mbn="/tmp/FHD@firmware@[email protected]"
if [ "$PRJ_ID" -eq 0 ]; then
echo "Detected ZE551KL."
modem_bin="/tmp/FHD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_ID" -eq 1 ]; then
echo "Detected ZE601KL."
modem_bin="/tmp/FHD@modem@ZE600KL@[email protected]"
elif [ "$PRJ_ID" -eq 2 ]; then
echo "Detected ZX550KL."
modem_bin="/tmp/FHD@modem@ZX550KL@[email protected]"
elif [ "$PRJ_ID" -eq 3 ]; then
echo "Detected ZD550KL."
modem_bin="/tmp/FHD@modem@ZD550KL@[email protected]"
fi
fi
echo "Flashing aboot..."
dd if=${aboot_mbn} of=${aboot}
dd if=${aboot_mbn} of=${aboot}bak
echo "Successfully flashed aboot"
echo "Flashing hyp..."
dd if=${hyp_mbn} of=${hyp}
dd if=${hyp_mbn} of=${hyp}bak
echo "Successfully flashed hyp"
echo "Flashing rpm..."
dd if=${rpm_mbn} of=${rpm}
dd if=${rpm_mbn} of=${rpm}bak
echo "Successfully flashed rpm"
echo "Flashing sbl1..."
dd if=${sbl1_mbn} of=${sbl1}
dd if=${sbl1_mbn} of=${sbl1}bak
echo "Successfully flashed sbl1"
echo "Flashing tz..."
dd if=${tz_mbn} of=${tz}
dd if=${tz_mbn} of=${tz}bak
echo "Successfully flashed tz"
echo "Flashing modem..."
dd if=${modem_bin} of=${modem}
echo "Successfully flashed modem"
#!/sbin/sh
# TODO: Add msm8929 support
aboot="/dev/block/bootdevice/by-name/aboot"
hyp="/dev/block/bootdevice/by-name/hyp"
rpm="/dev/block/bootdevice/by-name/rpm"
sbl1="/dev/block/bootdevice/by-name/sbl1"
tz="/dev/block/bootdevice/by-name/tz"
modem="/dev/block/bootdevice/by-name/modem"
PRJ_ID=`cat /proc/apid`
PRJ_HD=`cat /proc/aphd`
PRJ_SKU=`cat /proc/aprf`
PRJ_SOC=`cat /sys/devices/soc0/soc_id`
case "$PRJ_SOC" in
"206" | "247" | "248" | "249" | "250")
IS_8916=1
;;
"268" | "269" | "270" | "271")
IS_8929=1
;;
"239" | "241" | "263")
IS_8939=1
;;
esac
if [ "$PRJ_HD" -eq 1 ] && [ "$IS_8916" -eq 1 ]; then
echo "Detected HD Display and MSM8916"
aboot_mbn="/tmp/emmc_appsboot_8916.mbn"
hyp_mbn="/tmp/HD@firmware@[email protected]"
rpm_mbn="/tmp/HD@firmware@[email protected]"
sbl1_mbn="/tmp/HD@firmware@[email protected]"
tz_mbn="/tmp/HD@firmware@[email protected]"
if [ "$PRJ_ID" -eq 0 ]; then
echo "Detected ZE550KL."
modem_bin="/tmp/FHD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_ID" -eq 1 ]; then
echo "Detected ZE600KL."
modem_bin="/tmp/FHD@modem@ZE600KL@[email protected]"
fi
elif [ "$PRJ_HD" -eq 1 ] && [ "$IS_8929" -eq 1 ]; then
echo "Detected FHD Display and MSM8939"
echo "MSM8929 isn't supported yet"
return 1
# aboot_mbn="/tmp/emmc_appsboot_8939.mbn"
# hyp_mbn="/tmp/FHD@firmware@[email protected]"
# rpm_mbn="/tmp/FHD@firmware@[email protected]"
# sbl1_mbn="/tmp/FHD@firmware@[email protected]"
# tz_mbn="/tmp/FHD@firmware@[email protected]"
# echo "Detected ZE550KL."
# modem_bin="/tmp/FHD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_HD" -eq 1 ] && [ "$IS_8939" -eq 1 ]; then
echo "Detected HD Display and MSM8939"
aboot_mbn="/tmp/emmc_appsboot_8939.mbn"
hyp_mbn="/tmp/HD@firmware@[email protected]"
rpm_mbn="/tmp/HD@firmware@[email protected]"
sbl1_mbn="/tmp/HD@firmware@[email protected]"
tz_mbn="/tmp/HD@firmware@[email protected]"
if [ "$PRJ_ID" -eq 0 ]; then
echo "Detected ZE550KL."
modem_bin="/tmp/HD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_ID" -eq 1 ]; then
echo "Detected ZE601KL."
modem_bin="/tmp/HD@modem@ZE600KL@[email protected]"
fi
elif [ "$PRJ_HD" -eq 0 ] && [ "$IS_8939" -eq 1 ]; then
echo "Detected FHD Display and MSM8939"
aboot_mbn="/tmp/emmc_appsboot_8939.mbn"
hyp_mbn="/tmp/FHD@firmware@[email protected]"
rpm_mbn="/tmp/FHD@firmware@[email protected]"
sbl1_mbn="/tmp/FHD@firmware@[email protected]"
tz_mbn="/tmp/FHD@firmware@[email protected]"
if [ "$PRJ_ID" -eq 0 ]; then
echo "Detected ZE551KL."
modem_bin="/tmp/FHD@modem@ZE550KL@[email protected]"
elif [ "$PRJ_ID" -eq 1 ]; then
echo "Detected ZE601KL."
modem_bin="/tmp/FHD@modem@ZE600KL@[email protected]"
elif [ "$PRJ_ID" -eq 2 ]; then
echo "Detected ZX550KL."
modem_bin="/tmp/FHD@modem@ZX550KL@[email protected]"
elif [ "$PRJ_ID" -eq 3 ]; then
echo "Detected ZD550KL."
modem_bin="/tmp/FHD@modem@ZD550KL@[email protected]"
fi
fi
echo "Flashing aboot..."
echo dd if=${aboot_mbn} of=${aboot}
echo dd if=${aboot_mbn} of=${aboot}bak
echo "Successfully flashed aboot"
echo "Flashing hyp..."
echo dd if=${hyp_mbn} of=${hyp}
echo dd if=${hyp_mbn} of=${hyp}bak
echo "Successfully flashed hyp"
echo "Flashing rpm..."
echo dd if=${rpm_mbn} of=${rpm}
echo dd if=${rpm_mbn} of=${rpm}bak
echo "Successfully flashed rpm"
echo "Flashing sbl1..."
echo dd if=${sbl1_mbn} of=${sbl1}
echo dd if=${sbl1_mbn} of=${sbl1}bak
echo "Successfully flashed sbl1"
echo "Flashing tz..."
echo dd if=${tz_mbn} of=${tz}
echo dd if=${tz_mbn} of=${tz}bak
echo "Successfully flashed tz"
echo "Flashing modem..."
echo dd if=${modem_bin} of=${modem}
echo "Successfully flashed modem"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment