Android P have no make_ext4fs, use mke2fs as fallback

This commit is contained in:
topjohnwu 2018-03-11 02:52:24 +08:00
parent 9e737df534
commit e4e5269836
2 changed files with 8 additions and 6 deletions

View File

@ -58,11 +58,13 @@ int create_img(const char *img, int size) {
LOGI("Create %s with size %dM\n", img, size); LOGI("Create %s with size %dM\n", img, size);
int ret; int ret;
char buffer[16]; char size_str[16];
snprintf(buffer, sizeof(buffer), "%dM", size); snprintf(size_str, sizeof(size_str), "%dM", size);
ret = exec_command_sync("make_ext4fs", "-l", buffer, img, NULL); ret = exec_command_sync("make_ext4fs", "-b", "4096", "-l", size_str, img, NULL);
if (ret < 0) if (ret < 0) {
return 1; // On Android P there is no make_ext4fs, use mke2fs
ret = exec_command_sync("mke2fs", "-b", "4096", "-t", "ext4", img, size_str, NULL);
}
return ret; return ret;
} }

View File

@ -280,7 +280,7 @@ static int v_exec_command(int err, int *fd, void (*setupenv)(struct vector*), co
} }
execvpe(argv0, (char **) vec_entry(&args), envp); execvpe(argv0, (char **) vec_entry(&args), envp);
PLOGE("execvpe"); PLOGE("execvpe %s", argv0);
return -1; return -1;
} }