Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/sbin/sh
- OUTFD=$2
- ZIP=$3
- debugfile=/sdcard/buz.log
- buzver="1.0"
- datever="2018-02-25"
- pdaver="DRAA"
- blver="DRAA"
- cpver="DRA9"
- dateSecurLvl="2018-01-01"
- ui_print(){
- echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
- echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
- }
- debug(){
- t1=$(date +"%H:%M:%S")
- t2=$(awk 'NR==3 {print $3}' /proc/timer_list | cut -c1-5)
- echo "$t1.$t2: $1" >> $debugfile
- }
- getinfo(){
- BPROP=/system/build.prop
- TXT=$1
- if [ -f $BPROP ]; then
- tmp=$(cat $BPROP | grep -i $TXT | cut -d= -f2)
- [ -z "$tmp" ] && echo "key not found" || echo $tmp
- else
- echo "build.prop not found"
- fi
- }
- ui_print " "
- ui_print " B3UZ: BaseBand & Booloader Updater Zip"
- ui_print " version $buzver"
- ui_print " $datever"
- ui_print " (c) hypo59 @ mmgmobile.com"
- ui_print " "
- # remove log file if it already exists
- [ -f $debugfile ] && rm -f $debugfile
- debug "date: $(date +%Y-%m-%d)"
- debug "B3UZ version: $buzver"
- debug "PDA-BL-CP version: $pdaver-$blver-$cpver"
- # mount partitions
- debug "mount /system"
- mount /system
- debug "rc=$?"
- debug "mount /data"
- mount /data
- debug "rc=$?"
- # display informations
- ui_print " # support ONLY for SM-G930F (flat S7)"
- model=$(getinfo ro.product.model)
- ui_print " # phone model detected: $model"
- debug "ro.product.model = $model"
- if [ ! "$model" = "SM-G930F" ]; then
- ui_print " # bad detection: exit"
- ui_print " "
- exit
- fi
- ui_print " # source firmware version: $pdaver"
- ui_print " # bootloader version to flash: $blver"
- ui_print " # baseband version to flash: $cpver"
- ui_print " # security patch level date: $dateSecurLvl"
- # extract stuff
- ui_print " # extract files for update"
- unzip -o "$ZIP" firmware/* -d /tmp
- unziprc=$?
- debug "extract rc=$unziprc"
- if [ ! "$unziprc" = "0" ]; then
- ui_print " # error while extracting: exit"
- ui_print " # logfile saved to: $debugfile"
- exit
- fi
- # apply update
- ui_print " # apply $cpver baseband update"
- dd if=/tmp/firmware/modem_debug.bin of=/dev/block/platform/155a0000.ufs/by-name/CP_DEBUG
- sleep 2
- cpdebugrc=$?
- debug "CP_DEBUG rc = $cpdebugrc"
- if [ ! "$cpdebugrc" = "0" ]; then
- ui_print " # error while applying update: exit"
- ui_print " # logfile saved to: $debugfile"
- ui_print " "
- exit
- fi
- dd if=/tmp/firmware/modem.bin of=/dev/block/platform/155a0000.ufs/by-name/RADIO
- sleep 2
- radiorc=$?
- debug "RADIO rc = $radiorc"
- if [ ! "$radiorc" = "0" ]; then
- ui_print " # error while applying update: exit"
- ui_print " # logfile saved to: $debugfile"
- ui_print " "
- exit
- fi
- ui_print " # successfully done !"
- ui_print " # apply $blver bootloader update"
- dd if=/tmp/firmware/sboot.bin of=/dev/block/platform/155a0000.ufs/by-name/BOTA0
- sleep 2
- botazerorc=$?
- debug "BOTA0 rc = $botazerorc"
- if [ ! "$botazerorc" = "0" ]; then
- ui_print " # error while applying update: exit"
- ui_print " # logfile saved to: $debugfile"
- ui_print " "
- exit
- fi
- dd if=/tmp/firmware/cm.bin of=/dev/block/platform/155a0000.ufs/by-name/BOTA1
- sleep 2
- botaonerc=$?
- debug "BOTA1 rc = $botaonerc"
- if [ ! "$botaonerc" = "0" ]; then
- ui_print " # error while applying update: exit"
- ui_print " # logfile saved to: $debugfile"
- ui_print " "
- exit
- fi
- ui_print " # successfully done !"
- ui_print " "
- # automatic reboot with fota_bl option
- ui_print " # logfile saved to: $debugfile"
- ui_print " # automatic reboot in 5s..."
- debug "end of script"
- sleep 5
- reboot fota_bl
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement