Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto s on #11

Open
wants to merge 3 commits into
base: cm-11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
TARGET_BOOTLOADER_BOARD_NAME := vigor
BOARD_WANTS_EMMC_BOOT := true

# S-on Detection
TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT := ./build/tools/releasetools/ota_from_target_files -e ./device/htc/vigor/installer_extra

# Kernel
BOARD_KERNEL_BASE := 0x48800000
BOARD_KERNEL_PAGE_SIZE := 2048
Expand Down
56 changes: 56 additions & 0 deletions installer_extra
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
ui_print("Extracting Kernel files...");
package_extract_dir("system/kernel_s-on", "/tmp");
set_perm(0, 0, 0777, "/tmp/dd");
set_perm(0, 0, 0777, "/tmp/abootimg");
set_perm(0, 0, 0777, "/tmp/kernel_s-on.sh");
set_perm(0, 0, 0777, "/tmp/extractFilesFromTmpBoot.sh");
package_extract_file("boot.img", "/tmp/boot.img");
run_program("/tmp/kernel_s-on.sh");
run_program("/tmp/dd", "if=/dev/block/mmcblk0p22", "of=/tmp/tmp_boot.img");
run_program("/tmp/extractFilesFromTmpBoot.sh");
if
file_getprop("/tmp/security.prop","security") == "0"
then
ui_print("S-off detected...");
ui_print("Flash successful");
endif;
if
file_getprop("/tmp/security.prop","security") == "1"
then
ui_print("S-on detected...");
ui_print("Adding New PH98IMG.zip to /sdcard...");
set_perm(0, 0, 0777, "/tmp/buildZip.sh");
set_perm(0, 0, 0777, "/tmp/copyToSD.sh");
set_perm(0, 0, 0777, "/tmp/rebootToBootloader.sh");
set_perm(0, 0, 0777, "/tmp/misctool");
set_perm(0, 0, 0777, "/tmp/zip");
run_program("/tmp/misctool", "w", "1.00.000.0");
run_program("/tmp/buildZip.sh");
run_program("/tmp/copyToSD.sh");
ui_print("Done! PH98IMG.zip on /sdcard (external)");
ui_print("Script by con247 @xda.");
ui_print("Copying system files...");
ui_print("Rebooting to Bootloader (HBOOT)");
run_program("/tmp/rebootToBootloader.sh");
endif;
if
file_getprop("/tmp/security.prop","security") == "2"
then
ui_print("S-on detected...");
ui_print("Adding New PH98IMG.zip to /sdcard...");
set_perm(0, 0, 0777, "/tmp/buildZip.sh");
set_perm(0, 0, 0777, "/tmp/copyToSD.sh");
set_perm(0, 0, 0777, "/tmp/rebootToBootloader.sh");
set_perm(0, 0, 0777, "/tmp/misctool");
set_perm(0, 0, 0777, "/tmp/zip");
run_program("/tmp/misctool", "w", "1.00.000.0");
run_program("/tmp/buildZip.sh");
run_program("/tmp/copyToSD.sh");
ui_print("Done! PH98IMG.zip on /sdcard (external)");
ui_print("Script by con247 @xda.");
ui_print("Copying system files...");
ui_print("Rebooting to Bootloader (HBOOT)");
run_program("/tmp/rebootToBootloader.sh");
endif;

ui_print("Done!");
Binary file added kernel_s-on/abootimg
Binary file not shown.
4 changes: 4 additions & 0 deletions kernel_s-on/android-info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
modelid: PH9810000
cidnum: VZW__001
mainver: 1.00.000.0
hbootpreupdate:12
8 changes: 8 additions & 0 deletions kernel_s-on/buildZip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/sbin/sh
#
#
# Kludgy hack to help with kernels
#
cd /tmp
/tmp/zip PH98IMG android-info.txt boot.img
exit 0
7 changes: 7 additions & 0 deletions kernel_s-on/copyToSD.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/sbin/sh
if [ -d /external_sdcard ]; then
cp /tmp/PH98IMG.zip /external_sdcard/PH98IMG.zip
else
cp /tmp/PH98IMG.zip /sdcard/PH98IMG.zip
fi
exit 0
Binary file added kernel_s-on/dd
Binary file not shown.
22 changes: 22 additions & 0 deletions kernel_s-on/extractFilesFromTmpBoot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/sbin/sh
cd /tmp
. sum.prop
mkdir boot
cd boot
../abootimg -x ../tmp_boot.img
sum3=`sha1sum zImage | cut -d ' ' -f 1` #-- installtype=1
sum4=`sha1sum initrd.img | cut -d ' ' -f 1` #-- installtype=1
cd ..
if [ "$sum3" == "$sum1" ]; then
zimage=0
else
zimage=1
fi
if [ "$sum4" == "$sum2" ]; then
initrd=0
else
initrd=1
fi
security=$(($zimage + $initrd))
echo "security=$security" > /tmp/security.prop
exit 0
8 changes: 8 additions & 0 deletions kernel_s-on/kernel_s-on.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/sbin/sh
cd /tmp
/tmp/abootimg -x /tmp/boot.img
sum1=`sha1sum zImage | cut -d ' ' -f 1` #-- installtype=1
echo "sum1=$sum1" > /tmp/sum.prop
sum2=`sha1sum initrd.img | cut -d ' ' -f 1` #-- installtype=1
echo "sum2=$sum2" >> /tmp/sum.prop
chmod 777 /tmp/sum.prop
Binary file added kernel_s-on/misctool
Binary file not shown.
7 changes: 7 additions & 0 deletions kernel_s-on/rebootToBootloader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/sbin/sh
#
#
# Kludgy hack to help with kernels
#
reboot bootloader
exit 0
Binary file added kernel_s-on/zip
Binary file not shown.
13 changes: 13 additions & 0 deletions vigor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ PRODUCT_PACKAGES += \
DSPManager \
libcyanogen-dsp

# S-on Detection
PRODUCT_COPY_FILES += \
device/htc/vigor/kernel_s-on/abootimg:system/kernel_s-on/abootimg \
device/htc/vigor/kernel_s-on/android-info.txt:system/kernel_s-on/android-info.txt \
device/htc/vigor/kernel_s-on/buildZip.sh:system/kernel_s-on/buildZip.sh \
device/htc/vigor/kernel_s-on/copyToSD.sh:system/kernel_s-on/copyToSD.sh \
device/htc/vigor/kernel_s-on/dd:system/kernel_s-on/dd \
device/htc/vigor/kernel_s-on/extractFilesFromTmpBoot.sh:system/kernel_s-on/extractFilesFromTmpBoot.sh \
device/htc/vigor/kernel_s-on/kernel_s-on.sh:system/kernel_s-on/kernel_s-on.sh \
device/htc/vigor/kernel_s-on/misctool:system/kernel_s-on/misctool \
device/htc/vigor/kernel_s-on/rebootToBootloader.sh:system/kernel_s-on/rebootToBootloader.sh \
device/htc/vigor/kernel_s-on/zip:system/kernel_s-on/zip

# Sound DSP
PRODUCT_COPY_FILES += \
device/htc/vigor/dsp/AdieHWCodec.csv:system/etc/AdieHWCodec.csv \
Expand Down