tech-kern archive

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

Re: /rescue/init for alternative (Re: CVS commit:src/share/man/man8)



If there is no objection, I'll commit this change in a few days.
(with #include "opt_ddb.h" line)

I wrote:

> mouse%Rodents-Montreal.ORG@localhost wrote:
> 
> > >>> "init: not found".
> > >> Should we add "/rescue/init" to initpaths[] in src/sys/kern/init_main.c?
> > 
> > I still think the right thing to do is prompt for a path if the exec
> > fails, rather than having a handful of built-in paths and being SOL if
> > none of them work.
> 
> I agree "no init" panic is really annoying.
> (it's not easy to set RB_ASKNAME on some ports)
> 
> How about this change (taken from kern_subr.c:setroot())?
> 
> ---
> Index: init_main.c
> ===================================================================
> RCS file: /cvsroot/src/sys/kern/init_main.c,v
> retrieving revision 1.364
> diff -u -r1.364 init_main.c
> --- init_main.c       9 Oct 2008 10:48:21 -0000       1.364
> +++ init_main.c       20 Oct 2008 15:33:23 -0000
> @@ -811,13 +811,25 @@
>                                       path = initpaths[ipx++];
>                               else
>                                       continue;
> +                     } else if (len == 4 && strcmp(ipath, "halt") == 0) {
> +                             cpu_reboot(RB_HALT, NULL);
> +                     } else if (len == 6 && strcmp(ipath, "reboot") == 0) {
> +                             cpu_reboot(0, NULL);
> +#if defined(DDB)
> +                     } else if (len == 3 && strcmp(ipath, "ddb") == 0) {
> +                             console_debugger();
> +                             continue;
> +#endif
>                       } else {
>                               ipath[len] = '\0';
>                               path = ipath;
>                       }
>               } else {
> -                     if ((path = initpaths[ipx++]) == NULL)
> -                             break;
> +                     if ((path = initpaths[ipx++]) == NULL) {
> +                             ipx = 0;
> +                             boothowto |= RB_ASKNAME;
> +                             continue;
> +                     }
>               }
>  
>               ucp = (char *)USRSTACK;
> ---
> 

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index