diff options
| author | jrior001 <jriordan001@gmail.com> | 2016-11-08 08:04:23 -0500 |
|---|---|---|
| committer | Jason Riordan <jriordan001@gmail.com> | 2016-11-17 22:32:56 -0700 |
| commit | 65dd33ebfd216da35ddbbd3964df906922553749 (patch) | |
| tree | a4967081eb0bc254ac66756b830437ea0da53612 | |
| parent | fa519516849d2160468e7a188eccc7af43908c5a (diff) | |
mofd: fun with boot verification [REVERT ME]
packages_extract_file() is corrupting our appened signature
when flashing to device in recovery. Since device will not pass
boot verification without the proper signature we must correct for this
Add additional script to perform typical "anyKernel" style boot image
extract/un-pack/re-pack and append the proper signature. Use dd to copy
the corrected image back to /boot.
Change-Id: I7a437fd2f2d1fd861805f744e5225f45603fb476
| -rw-r--r-- | BoardConfigCommon.mk | 2 | ||||
| -rw-r--r-- | mofd.mk | 6 | ||||
| -rw-r--r-- | releasetools/mkbootimg | bin | 0 -> 128400 bytes | |||
| -rw-r--r-- | releasetools/releasetools.py (renamed from releasetools.py) | 3 | ||||
| -rw-r--r-- | releasetools/sign_boot.sh | 28 | ||||
| -rw-r--r-- | releasetools/unmkbootimg | bin | 0 -> 517884 bytes |
6 files changed, 38 insertions, 1 deletions
diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index 7f64334..d83b9ba 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -183,7 +183,7 @@ TARGET_RECOVERY_DEVICE_MODULES := libinit_mofd librecovery_updater_mofd intel_pr TARGET_RECOVERY_DENSITY := hdpi # Release tools -TARGET_RELEASETOOLS_EXTENSIONS := device/asus/mofd-common +TARGET_RELEASETOOLS_EXTENSIONS := device/asus/mofd-common/releasetools # Security BUILD_WITH_SECURITY_FRAMEWORK := chaabi_token @@ -44,6 +44,12 @@ PRODUCT_COPY_FILES += \ device/asus/mofd-common/audio/audio_policy.conf:system/etc/audio_policy.conf \ device/asus/mofd-common/audio/route_criteria.conf:system/etc/route_criteria.conf +# Boot image hackery +PRODUCT_COPY_FILES += \ + device/asus/mofd-common/releasetools/mkbootimg:install/bin/mkbootimg \ + device/asus/mofd-common/releasetools/unmkbootimg:install/bin/unmkbootimg \ + device/asus/mofd-common/releasetools/sign_boot.sh:install/bin/sign_boot.sh + # Bluetooth PRODUCT_COPY_FILES += \ device/asus/mofd-common/bluetooth/bt_vendor.conf:system/etc/bluetooth/bt_vendor.conf diff --git a/releasetools/mkbootimg b/releasetools/mkbootimg Binary files differnew file mode 100644 index 0000000..927d267 --- /dev/null +++ b/releasetools/mkbootimg diff --git a/releasetools.py b/releasetools/releasetools.py index b53f3d5..5537f58 100644 --- a/releasetools.py +++ b/releasetools/releasetools.py @@ -40,3 +40,6 @@ def AddIfwiAssertion(info, input_zip): ');') info.script.AppendExtra(cmd) +def FullOTA_InstallEnd(info): + info.script.AppendExtra('assert(run_program("/tmp/install/bin/sign_boot.sh") == 0);') + diff --git a/releasetools/sign_boot.sh b/releasetools/sign_boot.sh new file mode 100644 index 0000000..cce45e7 --- /dev/null +++ b/releasetools/sign_boot.sh @@ -0,0 +1,28 @@ +#!/sbin/sh + +set -e + +# shell variables +block=/dev/block/by-name/boot; + +# dump boot +dump_boot() { + dd if=$block of=/tmp/old_boot.img; + /tmp/install/bin/unmkbootimg /tmp/old_boot.img; + echo "BOOT DUMPED TO /tmp!"; +} + +# append certificate and write image +write_boot() { + /tmp/install/bin/mkbootimg --kernel kernel.gz --ramdisk initramfs.cpio.gz --cmdline "init=/init pci=noearly console=logk0 loglevel=0 vmalloc=256M androidboot.hardware=mofd_v1 watchdog.watchdog_thresh=60 androidboot.spid=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx androidboot.serialno=01234567890123456789 gpt snd_pcm.maximum_substreams=8 ptrace.ptrace_can_access=1 panic=15 ip=50.0.0.2:50.0.0.1::255.255.255.0::usb0:on debug_locks=0 n_gsm.mux_base_conf=\"ttyACM0,0 ttyXMM0,1\" bootboost=1 androidboot.selinux=permissive" --base 0x10000000 --pagesize 2048 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --second second.gz -o /tmp/boot-new.img; + +cat /tmp/boot-new.img /tmp/install/bin/boot.sig > /tmp/boot.img; +dd if=/tmp/boot.img of=$block; + +} + +dump_boot; +write_boot; + + + diff --git a/releasetools/unmkbootimg b/releasetools/unmkbootimg Binary files differnew file mode 100644 index 0000000..3e3c407 --- /dev/null +++ b/releasetools/unmkbootimg |
