From 9a45b7cd656661adc0ad5ca5fdecf073646d5e39 Mon Sep 17 00:00:00 2001 From: Markham Date: Thu, 30 May 2019 21:49:18 +0200 Subject: [PATCH] fix ofgwrite-neutrino.patch --- archive-patches/ofgwrite-neutrino.patch | 156 +++++++++++++++--------- 1 file changed, 99 insertions(+), 57 deletions(-) diff --git a/archive-patches/ofgwrite-neutrino.patch b/archive-patches/ofgwrite-neutrino.patch index 53f4aee..44ab369 100644 --- a/archive-patches/ofgwrite-neutrino.patch +++ b/archive-patches/ofgwrite-neutrino.patch @@ -1,20 +1,3 @@ -diff --git a/fb.c b/fb.c -index ee80682..09b81b7 100644 ---- a/fb.c -+++ b/fb.c -@@ -546,6 +546,10 @@ int loadBackgroundImage() - int ret; - - // search for background image -+ if (access("/share/tuxbox/neutrino/icons/flashback.jpg", R_OK) != 0) -+ return 0; -+ else -+ ret = system("/bin/logoview -t 1 -l /share/tuxbox/neutrino/icons/flashback.jpg"); - #if 0 - if (access("/etc/enigma2/bootlogo.mvi", R_OK) != 0) - if (access("/etc/enigma2/backdrop.mvi", R_OK) != 0) -diff --git a/ofgwrite.c b/ofgwrite.c -index d21d105..382af18 100644 --- a/ofgwrite.c +++ b/ofgwrite.c @@ -18,7 +18,7 @@ const char ofgwrite_version[] = "4.5.0"; @@ -31,7 +14,7 @@ index d21d105..382af18 100644 my_printf("Found kernel file: %s\n", kernel_filename); } - if (strcmp(entry->d_name, "rootfs.bin") == 0 // ET-xx00, XP1000 -+/* //M if (strcmp(entry->d_name, "rootfs.bin") == 0 // ET-xx00, XP1000 ++/* // M if (strcmp(entry->d_name, "rootfs.bin") == 0 // ET-xx00, XP1000 || strcmp(entry->d_name, "root_cfe_auto.bin") == 0 // Solo2 || strcmp(entry->d_name, "root_cfe_auto.jffs2") == 0 // other VU boxes || strcmp(entry->d_name, "oe_rootfs.bin") == 0 // DAGS boxes @@ -56,7 +39,7 @@ index d21d105..382af18 100644 strcpy(&kernel_device[5], kernel_device_arg); if (kernel_file_stat.st_size <= devsize) { -+/* //M ++/* // M if ((strcmp(name, "\"kernel\"") == 0 || strcmp(name, "\"nkernel\"") == 0 || strcmp(name, "\"kernel2\"") == 0)) @@ -69,7 +52,7 @@ index d21d105..382af18 100644 if (rootfs_file_stat.st_size <= devsize && strcmp(esize, "0001f000") != 0) { -+/* //M ++/* // M if (strcmp(name, "\"rootfs\"") == 0 || strcmp(name, "\"rootfs2\"") == 0) +*/ @@ -81,7 +64,7 @@ index d21d105..382af18 100644 } } // auto kernel -+/* //M ++/* // M else if (!user_kernel && (strcmp(name, "\"kernel\"") == 0 || strcmp(name, "\"nkernel\"") == 0)) @@ -91,69 +74,90 @@ index d21d105..382af18 100644 { if (found_kernel_device) { -@@ -606,9 +618,9 @@ int check_neutrino_stopped() +@@ -601,14 +613,16 @@ int check_neutrino_stopped() + int max_time = 70; + int neutrino_found = 1; + ++ if (!stop_neutrino_needed) // M + set_step_progress(0); ++ + if (!quiet) my_printf("Checking Neutrino is running...\n"); while (time < max_time && neutrino_found) { -// neutrino_found = exec_ps(); -+ //M neutrino_found = exec_ps(); //FIXME ++ // M neutrino_found = exec_ps(); //FIXME - system("init 4"); -+ //M ++ // M system("killall start_neutrino 2>/dev/null"); int ret = system("pidof neutrino >/dev/null"); if (ret == 0) -@@ -727,24 +739,32 @@ int umount_rootfs(int steps) +@@ -628,6 +642,7 @@ int check_neutrino_stopped() + if (!quiet) + my_printf("Neutrino still running\n"); + } ++ if (!stop_neutrino_needed) // M + set_step_progress(time * 100 / max_time); + } + +@@ -727,6 +742,7 @@ int umount_rootfs(int steps) // create directories ret += chdir("/newroot"); ret += mkdir("/newroot/bin", 777); -+ ret += mkdir("/newroot/boot", 777); //M ++ ret += mkdir("/newroot/boot", 777); // M ret += mkdir("/newroot/dev", 777); ret += mkdir("/newroot/etc", 777); ret += mkdir("/newroot/dev/pts", 777); - ret += mkdir("/newroot/lib", 777); - ret += mkdir("/newroot/media", 777); -- ret += mkdir("/newroot/mnt", 777); -+ ret += mkdir("/newroot/mnt", 777); //M - ret += mkdir("/newroot/oldroot", 777); - ret += mkdir("/newroot/oldroot_remount", 777); - ret += mkdir("/newroot/proc", 777); - ret += mkdir("/newroot/run", 777); +@@ -740,11 +756,15 @@ int umount_rootfs(int steps) ret += mkdir("/newroot/sbin", 777); -+ ret += mkdir("/newroot/srv", 777); //M ret += mkdir("/newroot/sys", 777); -- ret += mkdir("/newroot/tmp", 777); -+ ret += mkdir("/newroot/tmp", 777); //M -+/* //M + ret += mkdir("/newroot/tmp", 777); ++/* // M ret += mkdir("/newroot/usr", 777); ret += mkdir("/newroot/usr/lib", 777); ret += mkdir("/newroot/usr/lib/autofs", 777); +*/ ret += mkdir("/newroot/var", 777); - ret += mkdir("/newroot/var/volatile", 777); -+ ret += mkdir("/newroot/var/lib", 777); //NI -+ ret += mkdir("/newroot/var/lib/nfs", 777); //NI -+ ret += mkdir("/newroot/var/samba", 777); //NI -+ -+//M ret += mkdir("/newroot/var/volatile", 777); ++ ret += mkdir("/newroot/var/lib", 777); // M ++ ret += mkdir("/newroot/var/lib/nfs", 777); // M ++// M ret += mkdir("/newroot/var/volatile", 777); #if 0 if (multilib) -@@ -880,7 +900,9 @@ int umount_rootfs(int steps) +@@ -875,12 +895,15 @@ int umount_rootfs(int steps) + + // it can take several seconds until Neutrino is shut down + // wait because otherwise remounting read only is not possible ++#if 0 // M + set_step("Wait until Neutrino is stopped"); + if (!check_neutrino_stopped()) { my_printf("Error Neutrino can't be stopped! Abort flashing.\n"); set_error_text("Error neutrino can't be stopped! Abort flashing."); -+/* //M ++/* // M ret = system("init 3"); +*/ return 0; } -@@ -899,20 +921,28 @@ int umount_rootfs(int steps) +@@ -888,8 +911,10 @@ int umount_rootfs(int steps) + // reopen framebuffer to show the GUI + close_framebuffer(); + init_framebuffer(steps); ++#endif // M + show_main_window(1, ofgwrite_version); + set_overall_text("Flashing image"); ++ if (stop_neutrino_needed) // M + set_step_without_incr("Wait until Neutrino is stopped"); + sleep(2); + +@@ -899,20 +924,26 @@ int umount_rootfs(int steps) my_printf("Error executing pivot_root!\n"); set_error_text("Error pivot_root! Abort flashing."); sleep(5); -+/* //M ++/* // M ret = system("init 3"); +*/ return 0; @@ -162,15 +166,13 @@ index d21d105..382af18 100644 ret = chdir("/"); // move mounts to new root ret = mount("/oldroot/dev/", "dev/", NULL, MS_MOVE, NULL); -+ ret = mount("/oldroot/boot/", "boot/", NULL, MS_MOVE, NULL); //NI ++ ret = mount("/oldroot/boot/", "boot/", NULL, MS_MOVE, NULL); // M ret += mount("/oldroot/proc/", "proc/", NULL, MS_MOVE, NULL); ret += mount("/oldroot/sys/", "sys/", NULL, MS_MOVE, NULL); ret += mount("/oldroot/mnt/", "mnt/", NULL, MS_MOVE, NULL); ret += mount("/oldroot/tmp/", "tmp/", NULL, MS_MOVE, NULL); -+ ret += mount("/oldroot/tmp/", "tmp/", NULL, MS_MOVE, NULL); //NI -+ ret += mount("/oldroot/var/lib/nfs/", "var/lib/nfs/", NULL, MS_MOVE, NULL); //NI -+ ret += mount("/oldroot/var/samba/", "var/samba/", NULL, MS_MOVE, NULL); //NI -+/* //M ++ ret += mount("/oldroot/var/lib/nfs/", "var/lib/nfs/", NULL, MS_MOVE, NULL); // M ++/* // M ret += mount("/oldroot/var/volatile", "var/volatile/", NULL, MS_MOVE, NULL); // create link for tmp ret += symlink("/var/volatile/tmp", "/tmp"); @@ -178,16 +180,16 @@ index d21d105..382af18 100644 if (ret != 0) { my_printf("Error move mounts to newroot\n"); -@@ -952,6 +982,8 @@ int umount_rootfs(int steps) +@@ -952,6 +983,8 @@ int umount_rootfs(int steps) // create link for mount/umount for autofs ret = symlink("/bin/busybox", "/bin/mount"); ret += symlink("/bin/busybox", "/bin/umount"); -+ ret += symlink("/bin/busybox", "/bin/sh"); //M -+ ret += symlink("/bin/busybox", "/sbin/init"); //M ++ ret += symlink("/bin/busybox", "/bin/sh"); // M ++ ret += symlink("/bin/busybox", "/sbin/init"); // M #if 0 // try to restart autofs -@@ -1193,7 +1225,7 @@ void find_kernel_rootfs_device() +@@ -1193,7 +1226,7 @@ void find_kernel_rootfs_device() if (((current_rootfs_sub_dir[0] == '\0' && strcmp(rootfs_device, current_rootfs_device) != 0) || ( current_rootfs_sub_dir[0] != '\0' && strcmp(current_rootfs_sub_dir, rootfs_sub_dir) != 0 ) @@ -196,7 +198,39 @@ index d21d105..382af18 100644 ) { stop_neutrino_needed = 0; -@@ -1426,6 +1458,7 @@ int main(int argc, char *argv[]) +@@ -1344,7 +1377,18 @@ int main(int argc, char *argv[]) + return EXIT_FAILURE; + + my_printf("\n"); +- ++// M ++ if (stop_neutrino_needed) ++ { ++ set_step("Wait until Neutrino is stopped"); ++ if (!check_neutrino_stopped()) ++ { ++ my_printf("Error Neutrino can't be stopped! Abort flashing.\n"); ++ set_error_text("Error Neutrino can't be stopped! Abort flashing."); ++ return EXIT_FAILURE; ++ } ++ } ++// M + if (flash_kernel && !flash_rootfs) // flash only kernel + { + if (!quiet) +@@ -1369,7 +1413,10 @@ int main(int argc, char *argv[]) + { + my_printf("failed. System won't boot. Please flash backup!\n"); + set_error_text1("Error flashing kernel. System won't boot!"); +- set_error_text2("Please flash backup! Go back to Neutrino in 60 sec"); ++// M ++// set_error_text2("Please flash backup! Go back to Neutrino in 60 sec"); ++ set_error_text2("Please flash backup! Go back to prompt in 60 sec"); ++// M + sleep(60); + } + closelog(); +@@ -1426,6 +1473,7 @@ int main(int argc, char *argv[]) // stop autofs ret = system("/etc/init.d/autofs stop"); #endif @@ -204,3 +238,11 @@ index d21d105..382af18 100644 // ignore return values, because the processes might not run } +@@ -1540,6 +1588,7 @@ int main(int argc, char *argv[]) + sleep(3); + if (!no_write && stop_neutrino_needed) + { ++ set_step_progress(100); // M + my_printf("Rebooting in 3 seconds...\n"); + set_step("Successfully flashed! Rebooting in 3 seconds..."); + sleep(3); -- 2.39.5