Skip to content

kexec-recovery #3

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

Open
wants to merge 2 commits into
base: twrp2.7-safestrap
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
19 changes: 19 additions & 0 deletions safestrap/devices/motorola/common-omap4/build-install-kexec.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions safestrap/devices/motorola/common-omap4/build-safestrap.sh
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
32 changes: 32 additions & 0 deletions safestrap/devices/motorola/common-omap4/hijack
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
13 changes: 11 additions & 2 deletions safestrap/devices/motorola/common-omap4/safestrap-common-omap4.mk
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down
12 changes: 11 additions & 1 deletion safestrap/devices/motorola/maserati/build-install.sh
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion safestrap/devices/motorola/maserati/safestrap.mk
Original file line number Diff line number Diff line change
@@ -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
12 changes: 11 additions & 1 deletion safestrap/devices/motorola/spyder/build-install.sh
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion safestrap/devices/motorola/spyder/safestrap.mk
Original file line number Diff line number Diff line change
@@ -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

12 changes: 11 additions & 1 deletion safestrap/devices/motorola/targa/build-install.sh
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion safestrap/devices/motorola/targa/safestrap.mk
Original file line number Diff line number Diff line change
@@ -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
12 changes: 11 additions & 1 deletion safestrap/devices/motorola/umts_spyder/build-install.sh
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion safestrap/devices/motorola/umts_spyder/safestrap.mk
Original file line number Diff line number Diff line change
@@ -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