aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk6
-rw-r--r--etc/init.rc6
-rw-r--r--extendedcommands.c21
-rw-r--r--extendedcommands.h3
-rw-r--r--minadbd/adb.c2
-rw-r--r--minui/Android.mk6
-rw-r--r--minui/graphics.c29
-rw-r--r--minui/minui.h2
-rw-r--r--minzip/Android.mk8
-rw-r--r--minzip/DirUtil.c5
-rw-r--r--minzip/DirUtil.h4
-rw-r--r--minzip/SysUtil.c8
-rw-r--r--minzip/Zip.c4
-rw-r--r--minzip/Zip.h4
-rw-r--r--nandroid.c7
-rw-r--r--recovery.c46
-rw-r--r--updater/Android.mk8
-rw-r--r--updater/install.c4
-rw-r--r--updater/updater.c4
-rw-r--r--updater/updater.h4
20 files changed, 117 insertions, 64 deletions
diff --git a/Android.mk b/Android.mk
index abb9467..c7bfe62 100644
--- a/Android.mk
+++ b/Android.mk
@@ -37,7 +37,7 @@ RECOVERY_NAME := CWM-based Recovery
endif
endif
-RECOVERY_VERSION := $(RECOVERY_NAME) v6.0.2.8
+RECOVERY_VERSION := $(RECOVERY_NAME) v6.0.3.0
LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
RECOVERY_API_VERSION := 2
@@ -58,7 +58,7 @@ BOARD_RECOVERY_CHAR_HEIGHT := $(shell echo $(BOARD_USE_CUSTOM_RECOVERY_FONT) | c
LOCAL_CFLAGS += -DBOARD_RECOVERY_CHAR_WIDTH=$(BOARD_RECOVERY_CHAR_WIDTH) -DBOARD_RECOVERY_CHAR_HEIGHT=$(BOARD_RECOVERY_CHAR_HEIGHT)
-BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_UMS_LUNFILE BOARD_RECOVERY_ALWAYS_WIPES BOARD_RECOVERY_HANDLES_MOUNT BOARD_TOUCH_RECOVERY RECOVERY_EXTEND_NANDROID_MENU TARGET_USE_CUSTOM_LUN_FILE_PATH
+BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_UMS_LUNFILE BOARD_RECOVERY_ALWAYS_WIPES BOARD_RECOVERY_HANDLES_MOUNT BOARD_TOUCH_RECOVERY RECOVERY_EXTEND_NANDROID_MENU TARGET_USE_CUSTOM_LUN_FILE_PATH TARGET_DEVICE
$(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
$(if $($(board_define)), \
@@ -99,6 +99,8 @@ endif
LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
LOCAL_STATIC_LIBRARIES += libstdc++ libc
+LOCAL_STATIC_LIBRARIES += libselinux
+
LOCAL_C_INCLUDES += system/extras/ext4_utils
include $(BUILD_EXECUTABLE)
diff --git a/etc/init.rc b/etc/init.rc
index 70f4daf..241c292 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -52,11 +52,7 @@ service recovery /sbin/recovery
service adbd /sbin/adbd recovery
disabled
-# Always start adbd on userdebug and eng builds
-on property:ro.debuggable=1
- write /sys/class/android_usb/android0/enable 1
- start adbd
- setprop service.adb.root 1
+# Recovery will start adb once it has checked the keys
# Restart adbd so it can run as root
on property:service.adb.root=1
diff --git a/extendedcommands.c b/extendedcommands.c
index 1a2e6d4..eda092c 100644
--- a/extendedcommands.c
+++ b/extendedcommands.c
@@ -80,8 +80,17 @@ void write_string_to_file(const char* filename, const char* string) {
sprintf(tmp, "mkdir -p $(dirname %s)", filename);
__system(tmp);
FILE *file = fopen(filename, "w");
- fprintf(file, "%s", string);
- fclose(file);
+ if( file != NULL) {
+ fprintf(file, "%s", string);
+ fclose(file);
+ }
+}
+
+void write_recovery_version() {
+ if ( is_data_media() ) {
+ write_string_to_file("/sdcard/0/clockworkmod/.recovery_version",EXPAND(RECOVERY_VERSION) "\n" EXPAND(TARGET_DEVICE));
+ }
+ write_string_to_file("/sdcard/clockworkmod/.recovery_version",EXPAND(RECOVERY_VERSION) "\n" EXPAND(TARGET_DEVICE));
}
void
@@ -153,6 +162,7 @@ void show_install_update_menu()
}
case ITEM_CHOOSE_ZIP:
show_choose_zip_menu("/sdcard/");
+ write_recovery_version();
break;
case ITEM_CHOOSE_ZIP_INT:
if (other_sd != NULL)
@@ -225,7 +235,7 @@ char** gather_files(const char* directory, const char* fileExtensionOrDirectory,
char fullFileName[PATH_MAX];
strcpy(fullFileName, directory);
strcat(fullFileName, de->d_name);
- stat(fullFileName, &info);
+ lstat(fullFileName, &info);
// make sure it is a directory
if (!(S_ISDIR(info.st_mode)))
continue;
@@ -1146,16 +1156,20 @@ void show_nandroid_menu()
strftime(backup_path, sizeof(backup_path), "/sdcard/clockworkmod/backup/%F.%H.%M.%S", tmp);
}
nandroid_backup(backup_path);
+ write_recovery_version();
}
break;
case 1:
show_nandroid_restore_menu("/sdcard");
+ write_recovery_version();
break;
case 2:
show_nandroid_delete_menu("/sdcard");
+ write_recovery_version();
break;
case 3:
show_nandroid_advanced_restore_menu("/sdcard");
+ write_recovery_version();
break;
case 4:
run_dedupe_gc(other_sd);
@@ -1420,6 +1434,7 @@ void create_fstab()
write_fstab_root("/system", file);
write_fstab_root("/sdcard", file);
write_fstab_root("/sd-ext", file);
+ write_fstab_root("/external_sd", file);
fclose(file);
LOGI("Completed outputting fstab.\n");
}
diff --git a/extendedcommands.h b/extendedcommands.h
index 0430849..f6782f7 100644
--- a/extendedcommands.h
+++ b/extendedcommands.h
@@ -2,6 +2,9 @@ extern int signature_check_enabled;
extern int script_assert_enabled;
void
+write_recovery_version();
+
+void
toggle_signature_check();
void
diff --git a/minadbd/adb.c b/minadbd/adb.c
index 659fda7..da25b6b 100644
--- a/minadbd/adb.c
+++ b/minadbd/adb.c
@@ -30,8 +30,6 @@
#include "../common.h"
#include <private/android_filesystem_config.h>
-#include <linux/capability.h>
-#include <linux/prctl.h>
#if ADB_TRACE
ADB_MUTEX_DEFINE( D_lock );
diff --git a/minui/Android.mk b/minui/Android.mk
index 2314b78..7a327f5 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -25,6 +25,12 @@ ifeq ($(subst ",,$(TARGET_RECOVERY_PIXEL_FORMAT)),BGRA_8888)
LOCAL_CFLAGS += -DRECOVERY_BGRA
endif
+ifneq ($(TARGET_RECOVERY_OVERSCAN_PERCENT),)
+ LOCAL_CFLAGS += -DOVERSCAN_PERCENT=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
+else
+ LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
+endif
+
ifneq ($(BOARD_USE_CUSTOM_RECOVERY_FONT),)
LOCAL_CFLAGS += -DBOARD_USE_CUSTOM_RECOVERY_FONT=$(BOARD_USE_CUSTOM_RECOVERY_FONT)
endif
diff --git a/minui/graphics.c b/minui/graphics.c
index 358b6d9..d419598 100644
--- a/minui/graphics.c
+++ b/minui/graphics.c
@@ -65,6 +65,9 @@ static GGLSurface gr_framebuffer[NUM_BUFFERS];
static GGLSurface gr_mem_surface;
static unsigned gr_active_fb = 0;
static unsigned double_buffering = 0;
+static int overscan_percent = OVERSCAN_PERCENT;
+static int overscan_offset_x = 0;
+static int overscan_offset_y = 0;
static int gr_fb_fd = -1;
static int gr_vt_fd = -1;
@@ -137,6 +140,9 @@ static int get_framebuffer(GGLSurface *fb)
return -1;
}
+ overscan_offset_x = vi.xres * overscan_percent / 100;
+ overscan_offset_y = vi.yres * overscan_percent / 100;
+
fb->version = sizeof(*fb);
fb->width = vi.xres;
fb->height = vi.yres;
@@ -229,6 +235,9 @@ int gr_text(int x, int y, const char *s)
GRFont *font = gr_font;
unsigned off;
+ x += overscan_offset_x;
+ y += overscan_offset_y;
+
y -= font->ascent;
gl->bindTexture(gl, &font->texture);
@@ -255,6 +264,9 @@ void gr_texticon(int x, int y, gr_surface icon) {
}
GGLContext* gl = gr_context;
+ x += overscan_offset_x;
+ y += overscan_offset_y;
+
gl->bindTexture(gl, (GGLSurface*) icon);
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
@@ -268,11 +280,17 @@ void gr_texticon(int x, int y, gr_surface icon) {
gl->recti(gl, x, y, x+gr_get_width(icon), y+gr_get_height(icon));
}
-void gr_fill(int x, int y, int w, int h)
+void gr_fill(int x1, int y1, int x2, int y2)
{
+ x1 += overscan_offset_x;
+ y1 += overscan_offset_y;
+
+ x2 += overscan_offset_x;
+ y2 += overscan_offset_y;
+
GGLContext *gl = gr_context;
gl->disable(gl, GGL_TEXTURE_2D);
- gl->recti(gl, x, y, w, h);
+ gl->recti(gl, x1, y1, x2, y2);
}
void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) {
@@ -281,6 +299,9 @@ void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) {
}
GGLContext *gl = gr_context;
+ dx += overscan_offset_x;
+ dy += overscan_offset_y;
+
gl->bindTexture(gl, (GGLSurface*) source);
gl->texEnvi(gl, GGL_TEXTURE_ENV, GGL_TEXTURE_ENV_MODE, GGL_REPLACE);
gl->texGeni(gl, GGL_S, GGL_TEXTURE_GEN_MODE, GGL_ONE_TO_ONE);
@@ -390,12 +411,12 @@ void gr_exit(void)
int gr_fb_width(void)
{
- return gr_framebuffer[0].width;
+ return gr_framebuffer[0].width - 2*overscan_offset_x;
}
int gr_fb_height(void)
{
- return gr_framebuffer[0].height;
+ return gr_framebuffer[0].height - 2*overscan_offset_y;
}
gr_pixel *gr_fb_data(void)
diff --git a/minui/minui.h b/minui/minui.h
index 2e2f1f4..b281898 100644
--- a/minui/minui.h
+++ b/minui/minui.h
@@ -32,7 +32,7 @@ void gr_flip(void);
void gr_fb_blank(bool blank);
void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
-void gr_fill(int x, int y, int w, int h);
+void gr_fill(int x1, int y1, int x2, int y2);
int gr_text(int x, int y, const char *s);
int gr_measure(const char *s);
void gr_font_size(int *x, int *y);
diff --git a/minzip/Android.mk b/minzip/Android.mk
index 6c1d096..045f355 100644
--- a/minzip/Android.mk
+++ b/minzip/Android.mk
@@ -8,15 +8,11 @@ LOCAL_SRC_FILES := \
Inlines.c \
Zip.c
-LOCAL_C_INCLUDES += \
+LOCAL_C_INCLUDES := \
external/zlib \
external/safe-iop/include
-ifeq ($(HAVE_SELINUX),true)
-LOCAL_C_INCLUDES += external/libselinux/include
-LOCAL_STATIC_LIBRARIES += libselinux
-LOCAL_CFLAGS += -DHAVE_SELINUX
-endif
+LOCAL_STATIC_LIBRARIES := libselinux
LOCAL_MODULE := libminzip
diff --git a/minzip/DirUtil.c b/minzip/DirUtil.c
index 0d49b57..8dd5da1 100644
--- a/minzip/DirUtil.c
+++ b/minzip/DirUtil.c
@@ -145,24 +145,19 @@ dirCreateHierarchy(const char *path, int mode,
} else if (ds == DMISSING) {
int err;
-#ifdef HAVE_SELINUX
char *secontext = NULL;
if (sehnd) {
selabel_lookup(sehnd, &secontext, cpath, mode);
setfscreatecon(secontext);
}
-#endif
err = mkdir(cpath, mode);
-#ifdef HAVE_SELINUX
-
if (secontext) {
freecon(secontext);
setfscreatecon(NULL);
}
-#endif
if (err != 0) {
free(cpath);
diff --git a/minzip/DirUtil.h b/minzip/DirUtil.h
index f8be640..a5cfa76 100644
--- a/minzip/DirUtil.h
+++ b/minzip/DirUtil.h
@@ -24,12 +24,8 @@
extern "C" {
#endif
-#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
-#else
-struct selabel_handle;
-#endif
/* Like "mkdir -p", try to guarantee that all directories
* specified in path are present, creating as many directories
diff --git a/minzip/SysUtil.c b/minzip/SysUtil.c
index 49a2522..31c76d6 100644
--- a/minzip/SysUtil.c
+++ b/minzip/SysUtil.c
@@ -95,16 +95,16 @@ int sysLoadFileInShmem(int fd, MemMapping* pMap)
if (memPtr == NULL)
return -1;
- actual = read(fd, memPtr, length);
+ pMap->baseAddr = pMap->addr = memPtr;
+ pMap->baseLength = pMap->length = length;
+
+ actual = TEMP_FAILURE_RETRY(read(fd, memPtr, length));
if (actual != length) {
LOGE("only read %d of %d bytes\n", (int) actual, (int) length);
sysReleaseShmem(pMap);
return -1;
}
- pMap->baseAddr = pMap->addr = memPtr;
- pMap->baseLength = pMap->length = length;
-
return 0;
}
diff --git a/minzip/Zip.c b/minzip/Zip.c
index 54d5d55..c87f038 100644
--- a/minzip/Zip.c
+++ b/minzip/Zip.c
@@ -1115,23 +1115,19 @@ bool mzExtractRecursive(const ZipArchive *pArchive,
* Open the target for writing.
*/
-#ifdef HAVE_SELINUX
char *secontext = NULL;
if (sehnd) {
selabel_lookup(sehnd, &secontext, targetFile, UNZIP_FILEMODE);
setfscreatecon(secontext);
}
-#endif
int fd = creat(targetFile, UNZIP_FILEMODE);
-#ifdef HAVE_SELINUX
if (secontext) {
freecon(secontext);
setfscreatecon(NULL);
}
-#endif
if (fd < 0) {
LOGE("Can't create target file \"%s\": %s\n",
diff --git a/minzip/Zip.h b/minzip/Zip.h
index 4bb9ef6..c942828 100644
--- a/minzip/Zip.h
+++ b/minzip/Zip.h
@@ -18,12 +18,8 @@
extern "C" {
#endif
-#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
-#else
-struct selabel_handle;
-#endif
/*
* One entry in the Zip archive. Treat this as opaque -- use accessors below.
diff --git a/nandroid.c b/nandroid.c
index ed4c65a..99b8663 100644
--- a/nandroid.c
+++ b/nandroid.c
@@ -128,7 +128,7 @@ static int mkyaffs2image_wrapper(const char* backup_path, const char* backup_fil
static int tar_compress_wrapper(const char* backup_path, const char* backup_file_image, int callback) {
char tmp[PATH_MAX];
- sprintf(tmp, "cd $(dirname %s) ; touch %s.tar ; (tar cv %s $(basename %s) | split -a 1 -b 1000000000 /proc/self/fd/0 %s.tar.) 2> /proc/self/fd/1 ; exit $?", backup_path, backup_file_image, strcmp(backup_path, "/data") == 0 && is_data_media() ? "--exclude 'media'" : "", backup_path, backup_file_image);
+ sprintf(tmp, "cd $(dirname %s) ; touch %s.tar ; (tar cv --exclude=data/data/com.google.android.music/files/* %s $(basename %s) | split -a 1 -b 1000000000 /proc/self/fd/0 %s.tar.) 2> /proc/self/fd/1 ; exit $?", backup_path, backup_file_image, strcmp(backup_path, "/data") == 0 && is_data_media() ? "--exclude 'media'" : "", backup_path, backup_file_image);
FILE *fp = __popen(tmp, "r");
if (fp == NULL) {
@@ -415,7 +415,10 @@ int nandroid_backup(const char* backup_path)
ui_print("Error while generating md5 sum!\n");
return ret;
}
-
+
+ sprintf(tmp, "cp /tmp/recovery.log %s/recovery.log", backup_path);
+ __system(tmp);
+
sprintf(tmp, "chmod -R 777 %s ; chmod -R u+r,u+w,g+r,g+w,o+r,o+w /sdcard/clockworkmod ; chmod u+x,g+x,o+x /sdcard/clockworkmod/backup ; chmod u+x,g+x,o+x /sdcard/clockworkmod/blobs", backup_path);
__system(tmp);
sync();
diff --git a/recovery.c b/recovery.c
index 9e5ee94..9aa19ef 100644
--- a/recovery.c
+++ b/recovery.c
@@ -751,6 +751,39 @@ print_property(const char *key, const char *name, void *cookie) {
printf("%s=%s\n", key, name);
}
+static void
+setup_adbd() {
+ struct stat f;
+ static char *key_src = "/data/misc/adb/adb_keys";
+ static char *key_dest = "/adb_keys";
+
+ // Mount /data and copy adb_keys to root if it exists
+ ensure_path_mounted("/data");
+ if (stat(key_src, &f) == 0) {
+ FILE *file_src = fopen(key_src, "r");
+ if (file_src == NULL) {
+ LOGE("Can't open %s\n", key_src);
+ } else {
+ FILE *file_dest = fopen(key_dest, "w");
+ if (file_dest == NULL) {
+ LOGE("Can't open %s\n", key_dest);
+ } else {
+ char buf[4096];
+ while (fgets(buf, sizeof(buf), file_src)) fputs(buf, file_dest);
+ check_and_fclose(file_dest, key_dest);
+
+ // Enable secure adbd
+ property_set("ro.adb.secure", "1");
+ }
+ check_and_fclose(file_src, key_src);
+ }
+ }
+ ensure_path_unmounted("/data");
+
+ // Trigger (re)start of adb daemon
+ property_set("service.adb.root", "1");
+}
+
int
main(int argc, char **argv) {
@@ -844,6 +877,17 @@ main(int argc, char **argv) {
}
}
+ struct selinux_opt seopts[] = {
+ { SELABEL_OPT_PATH, "/file_contexts" }
+ };
+
+ sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
+
+ if (!sehandle) {
+ fprintf(stderr, "Warning: No file_contexts\n");
+ // ui_print("Warning: No file_contexts\n");
+ }
+
LOGI("device_recovery_start()\n");
device_recovery_start();
@@ -912,6 +956,8 @@ main(int argc, char **argv) {
}
}
+ setup_adbd();
+
if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) {
ui_set_show_text(1);
ui_set_background(BACKGROUND_ICON_ERROR);
diff --git a/updater/Android.mk b/updater/Android.mk
index 59e6391..51a7a05 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -28,19 +28,13 @@ LOCAL_STATIC_LIBRARIES += \
libz
endif
-ifeq ($(HAVE_SELINUX), true)
-LOCAL_C_INCLUDES += external/libselinux/include
-LOCAL_STATIC_LIBRARIES += libselinux
-LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
-
LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils
-
LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
LOCAL_STATIC_LIBRARIES += libmincrypt libbz
LOCAL_STATIC_LIBRARIES += libminelf
LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
+LOCAL_STATIC_LIBRARIES += libselinux
LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
diff --git a/updater/install.c b/updater/install.c
index 379e927..c1e0a63 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -78,23 +78,19 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
goto done;
}
-#ifdef HAVE_SELINUX
char *secontext = NULL;
if (sehandle) {
selabel_lookup(sehandle, &secontext, mount_point, 0755);
setfscreatecon(secontext);
}
-#endif
mkdir(mount_point, 0755);
-#ifdef HAVE_SELINUX
if (secontext) {
freecon(secontext);
setfscreatecon(NULL);
}
-#endif
if (strcmp(partition_type, "MTD") == 0) {
mtd_scan_partitions();
diff --git a/updater/updater.c b/updater/updater.c
index 5f15808..bf665ca 100644
--- a/updater/updater.c
+++ b/updater/updater.c
@@ -105,7 +105,6 @@ int main(int argc, char** argv) {
return 6;
}
-#ifdef HAVE_SELINUX
struct selinux_opt seopts[] = {
{ SELABEL_OPT_PATH, "/file_contexts" }
};
@@ -114,9 +113,8 @@ int main(int argc, char** argv) {
if (!sehandle) {
fprintf(stderr, "Warning: No file_contexts\n");
- fprintf(cmd_pipe, "ui_print Warning: No file_contexts\n");
+ // fprintf(cmd_pipe, "ui_print Warning: No file_contexts\n");
}
-#endif
// Evaluate the parsed script.
diff --git a/updater/updater.h b/updater/updater.h
index a00872c..d2e9011 100644
--- a/updater/updater.h
+++ b/updater/updater.h
@@ -20,12 +20,8 @@
#include <stdio.h>
#include "minzip/Zip.h"
-#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
-#else
-struct selabel_handle;
-#endif
typedef struct {
FILE* cmd_pipe;