diff options
-rw-r--r-- | Android.mk | 7 | ||||
-rw-r--r-- | BoardConfig.mk | 5 | ||||
-rw-r--r-- | board-info.txt | 2 | ||||
-rw-r--r-- | device.mk | 3 | ||||
-rw-r--r-- | init.smdkc110.rc | 6 | ||||
-rw-r--r-- | setup_fs.c | 62 |
6 files changed, 83 insertions, 2 deletions
@@ -26,6 +26,13 @@ LOCAL_SRC_FILES := melfas-touchkey.kcm LOCAL_MODULE_TAGS := optional include $(BUILD_KEY_CHAR_MAP) +include $(CLEAR_VARS) +LOCAL_SRC_FILES := setup_fs.c +LOCAL_MODULE := setup_fs +LOCAL_MODULE_TAGS := optional +#LOCAL_SHARED_LIBRARIES += libext4_utils libz +include $(BUILD_EXECUTABLE) + endif include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/BoardConfig.mk b/BoardConfig.mk index c3e8b55..7074daf 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -66,3 +66,8 @@ BOARD_KERNEL_PAGESIZE := 4096 TARGET_RECOVERY_UI_LIB := librecovery_ui_crespo TARGET_RELEASETOOLS_EXTENSIONS := device/samsung/crespo + +TARGET_USERIMAGES_USE_EXT4 := true +BOARD_SYSTEMIMAGE_PARTITION_SIZE := 536870912 +BOARD_USERDATAIMAGE_PARTITION_SIZE := 1073741824 +BOARD_FLASH_BLOCK_SIZE := 4096 diff --git a/board-info.txt b/board-info.txt index cbd6015..162fcb2 100644 --- a/board-info.txt +++ b/board-info.txt @@ -1,3 +1,3 @@ require board=crespo -require version-bootloader=I9020XXJI4 +require version-bootloader=I9020XXJI5 require version-baseband=I9020XXJI2 @@ -62,7 +62,8 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES := \ s3c-keypad.kcm \ melfas-touchkey.kcm \ - make_ext4fs + make_ext4fs \ + setup_fs # Misc other modules PRODUCT_PACKAGES += \ diff --git a/init.smdkc110.rc b/init.smdkc110.rc index b7d8baa..43f7500 100644 --- a/init.smdkc110.rc +++ b/init.smdkc110.rc @@ -57,6 +57,12 @@ service glgps /system/bin/gpsd/glgps_samsungJupiter -c /system/etc/jupiter.xml user system group system inet +# create filesystems if necessary +service setup_fs /system/bin/setup_fs mmcblk0p3 mmcblk0p4 + user root + group root + oneshot + # 3D init service pvrsrvinit /system/bin/pvrsrvinit user root diff --git a/setup_fs.c b/setup_fs.c new file mode 100644 index 0000000..74a6e71 --- /dev/null +++ b/setup_fs.c @@ -0,0 +1,62 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/reboot.h> +#include <sys/wait.h> + +const char *mkfs = "/system/bin/make_ext4fs"; + +int setup_fs(const char *blockdev) +{ + char buf[128]; + pid_t child; + int status; + + sprintf(buf,"/sys/fs/ext4/%s", blockdev); + if (access(buf, F_OK) == 0) { + fprintf(stderr,"device %s already has a filesystem\n", blockdev); + return 0; + } + sprintf(buf,"/dev/block/%s", blockdev); + + fprintf(stderr,"+++\n"); + + child = fork(); + if (child < 0) { + fprintf(stderr,"error: fork failed\n"); + return 0; + } + if (child == 0) { + execl(mkfs, mkfs, buf, NULL); + exit(-1); + } + + while (waitpid(-1, &status, 0) != child) ; + + fprintf(stderr,"---\n"); + return 1; +} + + +int main(int argc, char **argv) +{ + int need_reboot = 0; + + while (argc > 1) { + if (strlen(argv[1]) > 32) continue; + need_reboot |= setup_fs(argv[1]); + argv++; + argc--; + } + + if (need_reboot) { + sync(); + sync(); + sync(); + fprintf(stderr,"REBOOT!\n"); + reboot(RB_AUTOBOOT); + exit(-1); + } + return 0; +} |