From 68df48c28fa9acc3d33a4012442a0c4329fe0f9f Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 13 Sep 2010 15:04:54 -0700 Subject: [PATCH] implement redbend flashing Change-Id: Icad93103ed2321ad8b6aecbbf2e0f2f8fe139c0f --- bmlutils/Android.mk | 1 + bmlutils/bmlutils.c | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/bmlutils/Android.mk b/bmlutils/Android.mk index f1a8525..38da88c 100644 --- a/bmlutils/Android.mk +++ b/bmlutils/Android.mk @@ -3,6 +3,7 @@ ifeq ($(BOARD_USES_BMLUTILS),true) LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) +LOCAL_CFLAGS += -DBOARD_BOOT_DEVICE=\"$(BOARD_BOOT_DEVICE)\" LOCAL_SRC_FILES := bmlutils.c LOCAL_MODULE := libbmlutils include $(BUILD_STATIC_LIBRARY) diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c index b870a58..b264e0a 100644 --- a/bmlutils/bmlutils.c +++ b/bmlutils/bmlutils.c @@ -1,4 +1,33 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +int +__system(const char *command); + int write_raw_image(const char* partition, const char* filename) { - // flash using redbend_ua here - return 0; -} \ No newline at end of file + char tmp[PATH_MAX]; + if (0 != strcmp("boot", partition)) { + return -1; + } + sprintf(tmp, "/sbin/redbend_ua restore %s %s", filename, BOARD_BOOT_DEVICE); + return __system(tmp); +}