NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/59665: There should be a "boot -r" option (or similar) to boot into /rescue



Index: sys/boot_flag.h
===================================================================
RCS file: /cvsroot/src/sys/sys/boot_flag.h,v
retrieving revision 1.8
diff -u -p -r1.8 boot_flag.h
--- sys/boot_flag.h     12 May 2024 10:34:56 -0000      1.8
+++ sys/boot_flag.h     21 Sep 2025 17:34:15 -0000
@@ -70,6 +70,9 @@
        case 'q': /* boot quietly */                            \
                (retval) |= AB_QUIET;                           \
                break;                                          \
+       case 'r': /* Use /rescue/init instead of /sbin/init */  \
+               (retval) |= RB_RESCUE;                          \
+               break;                                          \
        case 's': /* boot to single user */                     \
                (retval) |= RB_SINGLE;                          \
                break;                                          \
Index: sys/reboot.h
===================================================================
RCS file: /cvsroot/src/sys/sys/reboot.h,v
retrieving revision 1.26
diff -u -p -r1.26 reboot.h
--- sys/reboot.h        1 Jan 2020 22:57:17 -0000       1.26
+++ sys/reboot.h        21 Sep 2025 17:34:15 -0000
@@ -53,6 +53,7 @@
 #define        RB_STRING       0x00000400      /* use provided bootstr */
 #define        RB_POWERDOWN    (RB_HALT|0x800) /* turn power off (or at least halt) */
 #define RB_USERCONF    0x00001000      /* change configured devices */
+#define RB_RESCUE      0x00002000      /* use /rescue/init */
 
 /*
  * Extra autoboot flags (passed by boot prog to kernel). See also
Index: kern/init_main.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.552
diff -u -p -r1.552 init_main.c
--- kern/init_main.c    8 May 2025 05:31:16 -0000       1.552
+++ kern/init_main.c    21 Sep 2025 17:34:15 -0000
@@ -1016,7 +1016,7 @@ start_init(void *arg)
                panic("init: couldn't allocate argument space");
        p->p_vmspace->vm_maxsaddr = (void *)STACK_MAX(addr, PAGE_SIZE);
 
-       ipx = 0;
+       ipx = (boothowto & RB_RESCUE) ? 3 : 0;
        while (1) {
                if (boothowto & RB_ASKNAME) {
                        printf("init path");


Attachment: signature.asc
Description: Message signed with OpenPGP



Home | Main Index | Thread Index | Old Index