diff --git a/safestrap/devices/motorola/common-omap4/build-install-kexec.sh b/safestrap/devices/motorola/common-omap4/build-install-kexec.sh new file mode 100755 index 000000000..7cb929371 --- /dev/null +++ b/safestrap/devices/motorola/common-omap4/build-install-kexec.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +#sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/common/build-install.sh +cd $OUT +rm $OUT/APP/install-files.zip +rm $OUT/install-files/etc/safestrap/2nd-init.zip +rm $OUT/install-files/etc/safestrap/ramdisk-recovery.img +zip -9rj install-files/etc/safestrap/2nd-init 2nd-init-files/* + +cd $OUT/recovery/root +# copy correct bbx and fixboot.sh +cp $ANDROID_BUILD_TOP/bootable/recovery/safestrap/bbx ./sbin/bbx +cp $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/common/2nd-init-files/fixboot.sh ./sbin/fixboot.sh +cp $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/init.rc ./init.rc + +#kexec-files +cp $ANDROID_BUILD_TOP/device/motorola/omap4-common/kexec/* $OUT/install-files/etc/safestrap/kexec/ + +#kernel +cp $OUT/kernel $OUT/install-files/etc/safestrap/kexec/kernel diff --git a/safestrap/devices/motorola/common-omap4/build-safestrap.sh b/safestrap/devices/motorola/common-omap4/build-safestrap.sh index 6fe2b0447..3611f6382 100755 --- a/safestrap/devices/motorola/common-omap4/build-safestrap.sh +++ b/safestrap/devices/motorola/common-omap4/build-safestrap.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash mkdir -p $OUT/APP mkdir -p $OUT/install-files/bin/ +mkdir -p $OUT/install-files/etc/safestrap/kexec/ mkdir -p $OUT/install-files/etc/safestrap/res/ mkdir -p $OUT/install-files/etc/safestrap/rootfs/ mkdir -p $OUT/recovery/root/etc +mkdir -p $OUT/recovery/root/etc/firmware mkdir -p $OUT/recovery/root/sbin cd $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola cp -fr common-omap4/res/* $OUT/install-files/etc/safestrap/res/ diff --git a/safestrap/devices/motorola/common-omap4/hijack b/safestrap/devices/motorola/common-omap4/hijack index 7d758ebb4..967b77850 100755 --- a/safestrap/devices/motorola/common-omap4/hijack +++ b/safestrap/devices/motorola/common-omap4/hijack @@ -137,6 +137,33 @@ if [ "$RUN_SS" = "1" ]; then fi if [ "$ENTER_RECOVERY" = "1" ]; then + # check for kexec files + if [ -e "$RECOVERY_DIR/kexec/kernel" ]; then + $BBX cp $RECOVERY_DIR/ramdisk-recovery.img / + $BBX cp $RECOVERY_DIR/kexec/* / + + # unmount SS + $BBX umount $SS_MNT + if [ "$SS_USE_DATAMEDIA" = "1" ]; then + $BBX umount $DATAMEDIA_MNT + fi + $BBX umount -l /system + + /sbin/hijack.killall + + cd / + $BBX chmod 755 /kexec + $BBX chown 0.2000 /kexec + $BBX insmod /uart.ko + $BBX insmod /arm_kexec.ko + $BBX insmod /kexec.ko + /kexec -l /kernel --devtree=/devtree --ramdisk=/ramdisk-recovery.img + $BBX sleep 1 + /kexec -e + exit + fi + + # fall back to non-kexec recovery # filesystem cleanup $BBX rm /d $BBX rm /etc @@ -325,6 +352,11 @@ if [ "$RUN_SS" = "1" ]; then fi fi +if [ "$HIJACK_LOC" = "" -o "$HIJACK_BIN" = "" ]; then + HIJACK_LOC="bin" + HIJACK_BIN="logwrapper" +fi + # Run current file like expected by the system $BBX echo "<1>Passing through hijack: /system/$HIJACK_LOC/$HIJACK_BIN.bin $@" > /dev/kmsg diff --git a/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk b/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk index 9e6b0077d..f7783e093 100644 --- a/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk +++ b/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk @@ -1,3 +1,12 @@ +#SAFESTRAP COMMON +SS_INCLUDE_2NDINIT := true +SS_INCLUDE_SPLASHMENU := true +BOARD_USE_NO_DEVFS_SETUP := false +BOARD_SUPPRESS_EMMC_WIPE := true + +# Logging +#TWRP_EVENT_LOGGING := true + #TWRP TW_INTERNAL_STORAGE_PATH := "/sdcard" TW_INTERNAL_STORAGE_MOUNT_POINT := "sdcard" @@ -15,8 +24,8 @@ BOARD_DEFAULT_VIRT_SYSTEM_MAX_SIZE := 1000 BOARD_DEFAULT_VIRT_DATA_SIZE := 2000 BOARD_DEFAULT_VIRT_DATA_MIN_SIZE := 1000 BOARD_DEFAULT_VIRT_DATA_MAX_SIZE := 16000 -BOARD_DEFAULT_VIRT_CACHE_SIZE := 300 -BOARD_DEFAULT_VIRT_CACHE_MIN_SIZE := 300 +BOARD_DEFAULT_VIRT_CACHE_SIZE := 10 +BOARD_DEFAULT_VIRT_CACHE_MIN_SIZE := 10 BOARD_DEFAULT_VIRT_CACHE_MAX_SIZE := 1000 TW_CUSTOM_BATTERY_CAPACITY_FIELD := charge_counter diff --git a/safestrap/devices/motorola/maserati/build-install.sh b/safestrap/devices/motorola/maserati/build-install.sh index 5ceab8837..c35b6a929 100755 --- a/safestrap/devices/motorola/maserati/build-install.sh +++ b/safestrap/devices/motorola/maserati/build-install.sh @@ -1,4 +1,14 @@ #!/usr/bin/env bash -sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install.sh + +# target specific init.rc (blockdev-symlinks) +cp $ANDROID_BUILD_TOP/device/motorola/maserati/init.target.rc $OUT/recovery/root/ + +#ducati-firmware is needed for kexecd kernel +cp $ANDROID_BUILD_TOP/vendor/motorola/maserati/proprietary/etc/firmware/ducati-m3.bin $OUT/recovery/root/etc/firmware/ + +#kexec-files +cp $ANDROID_BUILD_TOP/device/motorola/maserati/kexec/* $OUT/install-files/etc/safestrap/kexec/ + +sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install-kexec.sh sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/common/build-install-finish.sh diff --git a/safestrap/devices/motorola/maserati/safestrap.mk b/safestrap/devices/motorola/maserati/safestrap.mk index 814314207..4e5dcf70f 100644 --- a/safestrap/devices/motorola/maserati/safestrap.mk +++ b/safestrap/devices/motorola/maserati/safestrap.mk @@ -1,4 +1,4 @@ -include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk +#include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk TW_BRIGHTNESS_PATH := /sys/class/backlight/lm3532_bl/brightness diff --git a/safestrap/devices/motorola/spyder/build-install.sh b/safestrap/devices/motorola/spyder/build-install.sh index 5ceab8837..27aa36d70 100755 --- a/safestrap/devices/motorola/spyder/build-install.sh +++ b/safestrap/devices/motorola/spyder/build-install.sh @@ -1,4 +1,14 @@ #!/usr/bin/env bash -sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install.sh + +# target specific init.rc (blockdev-symlinks) +cp $ANDROID_BUILD_TOP/device/motorola/spyder/init.target.rc $OUT/recovery/root/ + +#ducati-firmware is needed for kexecd kernel +cp $ANDROID_BUILD_TOP/vendor/motorola/spyder/proprietary/etc/firmware/ducati-m3.bin $OUT/recovery/root/etc/firmware/ + +#kexec-files +cp $ANDROID_BUILD_TOP/device/motorola/spyder/kexec/* $OUT/install-files/etc/safestrap/kexec/ + +sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install-kexec.sh sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/common/build-install-finish.sh diff --git a/safestrap/devices/motorola/spyder/safestrap.mk b/safestrap/devices/motorola/spyder/safestrap.mk index f4942999b..91b53345e 100644 --- a/safestrap/devices/motorola/spyder/safestrap.mk +++ b/safestrap/devices/motorola/spyder/safestrap.mk @@ -1,3 +1,3 @@ -include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk +#include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk diff --git a/safestrap/devices/motorola/targa/build-install.sh b/safestrap/devices/motorola/targa/build-install.sh index 5ceab8837..1bf33b2c8 100755 --- a/safestrap/devices/motorola/targa/build-install.sh +++ b/safestrap/devices/motorola/targa/build-install.sh @@ -1,4 +1,14 @@ #!/usr/bin/env bash -sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install.sh + +# target specific init.rc (blockdev-symlinks) +cp $ANDROID_BUILD_TOP/device/motorola/targa/init.target.rc $OUT/recovery/root/ + +#ducati-firmware is needed for kexecd kernel +cp $ANDROID_BUILD_TOP/vendor/motorola/targa/proprietary/etc/firmware/ducati-m3.bin $OUT/recovery/root/etc/firmware/ + +#kexec-files +cp $ANDROID_BUILD_TOP/device/motorola/targa/kexec/* $OUT/install-files/etc/safestrap/kexec/ + +sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install-kexec.sh sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/common/build-install-finish.sh diff --git a/safestrap/devices/motorola/targa/safestrap.mk b/safestrap/devices/motorola/targa/safestrap.mk index 814314207..4e5dcf70f 100644 --- a/safestrap/devices/motorola/targa/safestrap.mk +++ b/safestrap/devices/motorola/targa/safestrap.mk @@ -1,4 +1,4 @@ -include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk +#include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk TW_BRIGHTNESS_PATH := /sys/class/backlight/lm3532_bl/brightness diff --git a/safestrap/devices/motorola/umts_spyder/build-install.sh b/safestrap/devices/motorola/umts_spyder/build-install.sh index 5ceab8837..7985fb147 100755 --- a/safestrap/devices/motorola/umts_spyder/build-install.sh +++ b/safestrap/devices/motorola/umts_spyder/build-install.sh @@ -1,4 +1,14 @@ #!/usr/bin/env bash -sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install.sh + +# target specific init.rc (blockdev-symlinks) +cp $ANDROID_BUILD_TOP/device/motorola/umts_spyder/init.target.rc $OUT/recovery/root/ + +#ducati-firmware is needed for kexecd kernel +cp $ANDROID_BUILD_TOP/vendor/motorola/umts_spyder/proprietary/etc/firmware/ducati-m3.bin $OUT/recovery/root/etc/firmware/ + +#kexec-files +cp $ANDROID_BUILD_TOP/device/motorola/umts_spyder/kexec/* $OUT/install-files/etc/safestrap/kexec/ + +sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/motorola/common-omap4/build-install-kexec.sh sh $ANDROID_BUILD_TOP/bootable/recovery/safestrap/devices/common/build-install-finish.sh diff --git a/safestrap/devices/motorola/umts_spyder/safestrap.mk b/safestrap/devices/motorola/umts_spyder/safestrap.mk index f4942999b..91b53345e 100644 --- a/safestrap/devices/motorola/umts_spyder/safestrap.mk +++ b/safestrap/devices/motorola/umts_spyder/safestrap.mk @@ -1,3 +1,3 @@ -include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk +#include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/common/safestrap-common.mk include $(ANDROID_BUILD_TOP)/bootable/recovery/safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk