int main(int argc, char *argv[]) { int i; for(i = 1; i < argc; ++i) { if(strcmp(argv[i], "-v") == 0) { printf("%d%s\n", VERSION_MULTIROM, VERSION_DEV_FIX); return 0; } } srand(time(0)); klog_init(); // output all messages to dmesg, // but it is possible to filter out INFO messages klog_set_level(6); ERROR("Running MultiROM v%d%s\n", VERSION_MULTIROM, VERSION_DEV_FIX); int exit = multirom(); if(exit >= 0) { if(exit & EXIT_REBOOT_MASK) { do_reboot(exit); return 0; } if(exit & EXIT_KEXEC) { do_kexec(); return 0; } // indicates trampoline to keep /realdata mounted if(!(exit & EXIT_UMOUNT)) close(open(KEEP_REALDATA, O_WRONLY | O_CREAT, 0000)); } vt_set_mode(0); return 0; }
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) { printf("%d%s apkL%d\n", VERSION_MULTIROM, VERSION_DEV_FIX, VERSION_APKL); fflush(stdout); return 0; } else if(strcmp(argv[i], "-apkL") == 0) { // Return all (internal and external) installed ROMs needed for the MultiROM Manager app // external partitions will be mounted to /mnt/mrom/APK and kept mounted so the app // can manipulate them, use "multirom -apkU" to unmount them when no longer needed // unmount everything in /mnt/mrom/APK first //multirom_apk_umount_usb(); int i; struct multirom_status s; memset(&s, 0, sizeof(struct multirom_status)); multirom_apk_get_roms(&s); for(i = 0; s.roms && s.roms[i]; ++i) { if (!s.roms[i]->partition) { // Internal ROMs printf("ROM: name=%s base=%s icon=%s\n", s.roms[i]->name, s.roms[i]->base_path, s.roms[i]->icon_path); } else { // External ROMs printf("ROM: name=%s base=%s icon=%s part_name=%s part_mount=%s part_uuid=%s part_fs=%s\n", s.roms[i]->name, s.roms[i]->base_path, s.roms[i]->icon_path, s.roms[i]->partition->name, s.roms[i]->partition->mount_path, s.roms[i]->partition->uuid, s.roms[i]->partition->fs); } } fflush(stdout); multirom_free_status(&s); return 0; } else if(strcmp(argv[i], "-apkU") == 0) { // Unmount all partitions mounted in /mnt/mrom/APK multirom_apk_umount_usb(); return 0; } else if(strncmp(argv[i], "--boot-rom=", sizeof("--boot-rom")) == 0) { rom_to_boot = argv[i] + sizeof("--boot-rom"); } } srand(time(0)); klog_init(); // output all messages to dmesg, // but it is possible to filter out INFO messages klog_set_level(6); mrom_set_log_tag("multirom"); ERROR("Running MultiROM v%d%s\n", VERSION_MULTIROM, VERSION_DEV_FIX); // 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) { if(exit & EXIT_REBOOT_RECOVERY) do_reboot(REBOOT_RECOVERY); else if(exit & EXIT_REBOOT_BOOTLOADER) do_reboot(REBOOT_BOOTLOADER); else if(exit & EXIT_SHUTDOWN) do_reboot(REBOOT_SHUTDOWN); else if(exit & EXIT_REBOOT) do_reboot(REBOOT_SYSTEM); if(exit & EXIT_KEXEC) { do_kexec(); return 0; } // indicates trampoline to keep /realdata mounted if(!(exit & EXIT_UMOUNT)) close(open(KEEP_REALDATA, O_WRONLY | O_CREAT, 0000)); } return 0; }
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) { printf("%d%s\n", VERSION_MULTIROM, VERSION_DEV_FIX); 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)); klog_init(); // output all messages to dmesg, // but it is possible to filter out INFO messages klog_set_level(6); mrom_set_log_tag("multirom"); ERROR("Running MultiROM v%d%s\n", VERSION_MULTIROM, VERSION_DEV_FIX); // 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) { if(exit & EXIT_REBOOT_RECOVERY) do_reboot(REBOOT_RECOVERY); else if(exit & EXIT_REBOOT_BOOTLOADER) do_reboot(REBOOT_BOOTLOADER); else if(exit & EXIT_SHUTDOWN) do_reboot(REBOOT_SHUTDOWN); else if(exit & EXIT_REBOOT) do_reboot(REBOOT_SYSTEM); if(exit & EXIT_KEXEC) { do_kexec(); return 0; } // indicates trampoline to keep /realdata mounted if(!(exit & EXIT_UMOUNT)) close(open(KEEP_REALDATA, O_WRONLY | O_CREAT, 0000)); } vt_set_mode(0); return 0; }