Support booting ROMs via --boot-rom cmdline argument

This commit is contained in:
Vojtech Bocek
2013-12-29 19:41:07 +01:00
parent 12f3d072de
commit 1eb2fe13a0
3 changed files with 82 additions and 22 deletions

19
main.c
View File

@@ -59,9 +59,11 @@ static void do_kexec(void)
while(1);
}
int main(int argc, char *argv[])
int main(int argc, const char *argv[])
{
int i;
const char *rom_to_boot = NULL;
for(i = 1; i < argc; ++i)
{
if(strcmp(argv[i], "-v") == 0)
@@ -70,6 +72,10 @@ int main(int argc, char *argv[])
fflush(stdout);
return 0;
}
else if(strncmp(argv[i], "--boot-rom=", sizeof("--boot-rom")) == 0)
{
rom_to_boot = argv[i] + sizeof("--boot-rom");
}
}
srand(time(0));
@@ -81,7 +87,16 @@ int main(int argc, char *argv[])
ERROR("Running MultiROM v%d%s\n", VERSION_MULTIROM, VERSION_DEV_FIX);
int exit = multirom();
// root is mounted read only in android and MultiROM uses
// it to store some temp files, so remount it.
// Yes, there is better solution to this.
if(rom_to_boot)
mount(NULL, "/", NULL, MS_REMOUNT, NULL);
int exit = multirom(rom_to_boot);
if(rom_to_boot)
mount(NULL, "/", NULL, MS_RDONLY | MS_REMOUNT, NULL);
if(exit >= 0)
{