diff --git a/fw_updater_packer_unpacker/.gitignore b/fw_updater_packer_unpacker/.gitignore index 6c9c348..65e3ba2 100644 --- a/fw_updater_packer_unpacker/.gitignore +++ b/fw_updater_packer_unpacker/.gitignore @@ -1,2 +1 @@ -*.pkg test/ diff --git a/fw_updater_packer_unpacker/README.md b/fw_updater_packer_unpacker/README.md index 6de4171..cea4a34 100644 --- a/fw_updater_packer_unpacker/README.md +++ b/fw_updater_packer_unpacker/README.md @@ -75,5 +75,3 @@ Then type `fw` and follow the instruction. # Known Issues * After reboot, it will appear errors saying update failed. But PKG is actually applied. - -* Not supporting animations yet. diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater.pkg b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater.pkg new file mode 100644 index 0000000..f3b2f86 Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater.pkg differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/animation.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/animation.sh new file mode 100755 index 0000000..d6de63c --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/animation.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +epd_cmd() +{ + epd_fb_test $@ >/dev/null 2>&1 +} + +dispClear() +{ + epd_cmd gray DU PART 0 +} + +get_screen_resolution() +{ + head -1 /sys/class/graphics/fb0/modes | sed -e 's/^.*://' -e 's/p.*$//' -e 's/x/ /' +} + +get_screen_width() +{ + set `get_screen_resolution` + echo $1 +} + +get_screen_height() +{ + set `get_screen_resolution` + echo $2 +} + +LOG_FP=$1 + +dispClear + +while [ 1 ] +do + for file in `\find $(dirname ${0})/images -name '*.bmp' | sort`; do + epd_cmd file GC16 PART $file + echo "[anim] displaying $file" >> $LOG_FP + sleep 1 + done +done + +exit 0 diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img new file mode 100644 index 0000000..4ca9b9f Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img.md5 b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img.md5 new file mode 100644 index 0000000..3a8297e --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/boot-1.4.01.16100-mod-181118.img.md5 @@ -0,0 +1 @@ +cad85861a484e850a0893a2e1d0c1b98 diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/chkver.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/chkver.sh new file mode 100755 index 0000000..6b82de1 --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/chkver.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# usage ./chkver.sh + +CURENT_VER=`rawdata --version | sed -e 's/[^0-9]//g' | cut -b 1-8` +PACKAGE_VER=`cat $1 | sed -e 's/[^0-9]//g' | cut -b 1-8` +LOG_FP=$2 + +echo "Current version: $CURENT_VER" >> $LOG_FP +echo "Package version: $PACKAGE_VER" >> $LOG_FP + +# if [ 10 -ge 10 ]; then echo "true"; else echo "false"; fi # true +# if [ 10 -ge 11 ]; then echo "true"; else echo "false"; fi # false +# if [ 10 -ge 9 ]; then echo "true"; else echo "false"; fi # true + +if [ $PACKAGE_VER -ge $CURENT_VER ] +then + # echo "true"; + echo "chkver.sh passed!" >> $LOG_FP + exit 0 +else + # echo "false"; + echo "chkver.sh failed!" >> $LOG_FP + exit 1 +fi + + diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/eufwupdater.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/eufwupdater.sh new file mode 100755 index 0000000..33ad9b9 --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/eufwupdater.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +# initialization +UPDATER_BASE=$(dirname ${0}) +ANIM_PID=0 +EPOCH=$(date +%s) +LOG_FP=/root/updater_$EPOCH.log +echo "" > $LOG_FP + +# start animation script +${UPDATER_BASE}/animation.sh $LOG_FP & +ANIM_PID=$! +sleep 2 + +# version check +${UPDATER_BASE}/chkver.sh ${UPDATER_BASE}/version $LOG_FP +if [ "$?" -eq 0 ] +then + echo "[updater.sh] version check OK" >> $LOG_FP +else + echo "[updater.sh] version check NG (TBD)" >> $LOG_FP + # strange version Package, so we must be install this package !! + exit 0; +fi +sync + +# flash customized boot img +echo "[updater.sh] writing boot.img.." >> $LOG_FP +if [ -f ${UPDATER_BASE}/boot-1.4.01.16100-mod-181118.img ] ; +then + dd if=${UPDATER_BASE}/boot-1.4.01.16100-mod-181118.img of=/dev/mmcblk0p8 bs=4M + sync +else + echo "[updater.sh] desired boot.img not exit; nothing did to boot partition" >> $LOG_FP +fi + +# verify the boot img success +RET=0 +${UPDATER_BASE}/verify.sh ${UPDATER_BASE} $LOG_FP +if [ $? -eq 0 ] +then + echo "[updater.sh] verify check OK" >> $LOG_FP +else + RET=$? + echo "[updater.sh] verify check NG, shudown, will retry upon boot up" >> $LOG_FP +fi + +# # enable su in adb shell +# echo "[updater.sh] run getsu.sh" >> $LOG_FP +# ${UPDATER_BASE}/getsu.sh $LOG_FP +# if [ ! $? -eq 0 ] +# then +# # shutdown, remove update, error occurs +# RET=$? +# fi + +sleep 2 + +# stop animation +if [ $ANIM_PID -ne 0 ] +then + kill $ANIM_PID +fi + +# if returned 1, will shutdown +exit $RET diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status01.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status01.bmp new file mode 100755 index 0000000..1353c8b Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status01.bmp differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status02.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status02.bmp new file mode 100755 index 0000000..2b97c2a Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status02.bmp differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status03.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status03.bmp new file mode 100755 index 0000000..3d49761 Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status03.bmp differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status04.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status04.bmp new file mode 100755 index 0000000..81ae252 Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status04.bmp differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status05.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status05.bmp new file mode 100755 index 0000000..052759d Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status05.bmp differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status06.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status06.bmp new file mode 100755 index 0000000..f335ccd Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status06.bmp differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status07.bmp b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status07.bmp new file mode 100755 index 0000000..17f2960 Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/images/status07.bmp differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/usbmemupdater.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/usbmemupdater.sh new file mode 100755 index 0000000..81c13bf --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/usbmemupdater.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +UPDATER_BASE=$(dirname ${0}) +${UPDATER_BASE}/eufwupdater.sh +# tentative exit +exit $? \ No newline at end of file diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/verify.sh b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/verify.sh new file mode 100755 index 0000000..1bda461 --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/verify.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +sync +echo 3 > /proc/sys/vm/drop_caches + +LOG_FP=$2 + +BOOT_IMG_SIZE=`stat -c%s $1/boot-1.4.01.16100-mod-181118.img` + +BLK8_MD5=`dd if=/dev/mmcblk0p8 bs=$BOOT_IMG_SIZE count=1 | md5sum | cut -d " " -f1` + +BOOT_MD5=`cat $1/boot-1.4.01.16100-mod-181118.img.md5` + +echo "BLK08=$BLK8_MD5" >> $LOG_FP +echo " BOOT=$BOOT_MD5" >> $LOG_FP + + +if [ $BLK8_MD5 = $BOOT_MD5 ]; +then +echo "Verify OK" >> $LOG_FP +exit 0; +fi +echo "Verify NG" >> $LOG_FP +exit 1; + + diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/version b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/version new file mode 100644 index 0000000..46f3713 --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/FwUpdater/version @@ -0,0 +1 @@ +1.4.01.16100 general \ No newline at end of file diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/aes.key b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/aes.key new file mode 100644 index 0000000..479d751 --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/aes.key @@ -0,0 +1 @@ +2714eb0d158c256c4868ef04f93cb50c56d0092c8df6285304b8ddb78d5f1ef9 diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/decrypted_pkg.tar.gz b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/decrypted_pkg.tar.gz new file mode 100644 index 0000000..e3c53bb Binary files /dev/null and b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/decrypted_pkg.tar.gz differ diff --git a/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/init_vector b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/init_vector new file mode 100644 index 0000000..f49f0ba --- /dev/null +++ b/fw_updater_packer_unpacker/pkg_example/flashable_mod_RP1_boot_img/init_vector @@ -0,0 +1 @@ +55460c2e3abf285af96fe660c0880bc