From 22ad2cc9f7d92f9a8b20f33e4082c3d6af4dcb00 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Thu, 27 Sep 2012 15:00:27 -0400 Subject: Create symlinks at compile time for busybox --- Android.mk | 11 +++++++++++ gui/Android.mk | 3 ++- prebuilt/Android.mk | 18 ------------------ prebuilt/bbinstall.sh | 14 -------------- prebuilt/fs | 46 ---------------------------------------------- recovery.cpp | 7 +++++-- 6 files changed, 18 insertions(+), 81 deletions(-) delete mode 100755 prebuilt/bbinstall.sh delete mode 100644 prebuilt/fs diff --git a/Android.mk b/Android.mk index 3734330ea..7187ae73e 100644 --- a/Android.mk +++ b/Android.mk @@ -208,7 +208,18 @@ endif include $(BUILD_EXECUTABLE) +# Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead +BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links) +exclude := tune2fs mke2fs mkdosfs gzip gunzip +RECOVERY_BUSYBOX_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(filter-out $(exclude),$(notdir $(BUSYBOX_LINKS)))) +$(RECOVERY_BUSYBOX_SYMLINKS): BUSYBOX_BINARY := busybox +$(RECOVERY_BUSYBOX_SYMLINKS): $(LOCAL_INSTALLED_MODULE) + @echo "Symlink: $@ -> $(BUSYBOX_BINARY)" + @mkdir -p $(dir $@) + @rm -rf $@ + $(hide) ln -sf $(BUSYBOX_BINARY) $@ +ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_BUSYBOX_SYMLINKS) include $(CLEAR_VARS) LOCAL_MODULE := verifier_test diff --git a/gui/Android.mk b/gui/Android.mk index 86d7453b8..1bab0774a 100644 --- a/gui/Android.mk +++ b/gui/Android.mk @@ -66,7 +66,8 @@ $(TWRP_RES_GEN): cp -fr $(TWRP_RES_LOC)/common/res/* $(TARGET_RECOVERY_ROOT_OUT)/res/ cp -fr $(TWRP_RES_LOC)/$(DEVICE_RESOLUTION)/res/* $(TARGET_RECOVERY_ROOT_OUT)/res/ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/ - ln -sf /sbin/busybox $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh + ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip + ln -sf /sbin/unpigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN) LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN) diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index 4796d06ff..048077a22 100644 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -71,15 +71,6 @@ LOCAL_GENERATED_SOURCES := $(GEN) LOCAL_SRC_FILES := teamwin $(GEN) include $(BUILD_PREBUILT) -#bbinstall.sh -include $(CLEAR_VARS) -LOCAL_MODULE := bbinstall.sh -LOCAL_MODULE_TAGS := eng -LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES -LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin -LOCAL_SRC_FILES := $(LOCAL_MODULE) -include $(BUILD_PREBUILT) - #fix_permissions include $(CLEAR_VARS) LOCAL_MODULE := fix_permissions.sh @@ -89,15 +80,6 @@ LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin LOCAL_SRC_FILES := $(LOCAL_MODULE) include $(BUILD_PREBUILT) -#fs -include $(CLEAR_VARS) -LOCAL_MODULE := fs -LOCAL_MODULE_TAGS := eng -LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES -LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin -LOCAL_SRC_FILES := $(LOCAL_MODULE) -include $(BUILD_PREBUILT) - #mke2fs.conf include $(CLEAR_VARS) LOCAL_MODULE := mke2fs.conf diff --git a/prebuilt/bbinstall.sh b/prebuilt/bbinstall.sh deleted file mode 100755 index 2aab96958..000000000 --- a/prebuilt/bbinstall.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/sbin/sh - -if [ -f "/sbin/[" ]; -then -exit -fi - -for cmd in $(/sbin/busybox --list); do - /sbin/busybox ln -s /sbin/busybox /sbin/$cmd -done - -ln -sf /sbin/pigz /sbin/gzip -ln -sf /sbin/unpigz /sbin/gunzip -rm /sbin/mkdosfs \ No newline at end of file diff --git a/prebuilt/fs b/prebuilt/fs deleted file mode 100644 index 3092efe2a..000000000 --- a/prebuilt/fs +++ /dev/null @@ -1,46 +0,0 @@ -#!/sbin/sh - -um -if [ $? != "0" ]; then - echo "Unable to unmount!" - exit 1 -fi - - -case $1 in - repair) - if [ -e /dev/block/mmcblk0p2 ]; then - - e2fsck -yf /dev/block/mmcblk0p2 - else - echo "No ext partition found!" - exit 1 - fi - exit 0 - ;; - ext3) - if [ -e /dev/block/mmcblk0p2 ]; then - - e2fsck -yf /dev/block/mmcblk0p2 - tune2fs -c0 -i0 -j /dev/block/mmcblk0p2 - else - echo "No ext partition found!" - exit 1 - fi - exit 0 - ;; - ext4) - if [ -e /dev/block/mmcblk0p2 ]; then - - tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2 - e2fsck -fpDC0 /dev/block/mmcblk0p2 - else - echo "No ext partition found!" - exit 1 - fi - exit 0 - ;; - --) - exit 0 - ;; -esac diff --git a/recovery.cpp b/recovery.cpp index 1e1d9a952..3c4447274 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -809,8 +809,11 @@ main(int argc, char **argv) { DataManager_LoadDefaults(); printf("Starting the UI..."); gui_init(); - printf("=> Installing busybox into /sbin\n"); - system("/sbin/bbinstall.sh"); // Let's install busybox + //printf("=> Installing busybox into /sbin\n"); + //system("/sbin/bbinstall.sh"); // Let's install busybox + printf("Symlinking gzip to pigz\n"); + system("ln -sf /sbin/pigz /sbin/gzip"); + system("ln -sf /sbin/unpigz /sbin/gunzip"); printf("=> Linking mtab\n"); system("ln -s /proc/mounts /etc/mtab"); // And link mtab for mke2fs printf("=> Processing recovery.fstab\n"); -- cgit v1.2.3