Subject: Overriding the path for init
To: None <tech-kern@NetBSD.ORG>
From: Gordon W. Ross <gwr@mc.com>
List: tech-kern
Date: 04/10/1996 18:38:49
I'd like to be able to change the value in initpaths[0] from
machine-dependent code.  Attached are some simple changes to
allow this.  Does this look like an OK way to do it?

Thanks,
Gordon


% cd src/sbin/init
% diff -c init_main.c.orig init_main.c
*** init_main.c.orig	Fri Apr  5 17:06:04 1996
--- init_main.c	Tue Apr  9 17:54:38 1996
***************
*** 112,121 ****
  
  static void start_init __P((struct proc *));
  static void start_pagedaemon __P((struct proc *));
- void main __P((void *));
  
  #ifdef cpu_set_init_frame
  void *initframep;				/* XXX should go away */
  #endif
  
  extern char sigcode[], esigcode[];
--- 112,123 ----
  
  static void start_init __P((struct proc *));
  static void start_pagedaemon __P((struct proc *));
  
  #ifdef cpu_set_init_frame
  void *initframep;				/* XXX should go away */
+ void main __P((void *));
+ #else
+ void main __P((void));
  #endif
  
  extern char sigcode[], esigcode[];
***************
*** 149,156 ****
--- 151,162 ----
   * startup(), which does memory initialization and autoconfiguration.
   */
  void
+ #ifdef cpu_set_init_frame
  main(framep)
  	void *framep;				/* XXX should go away */
+ #else
+ main()
+ #endif
  {
  	register struct proc *p;
  	register struct pdevinit *pdev;
***************
*** 373,380 ****
  
  /*
   * List of paths to try when searching for "init".
   */
! static char *initpaths[] = {
  	"/sbin/init",
  	"/sbin/oinit",
  	"/sbin/init.bak",
--- 379,387 ----
  
  /*
   * List of paths to try when searching for "init".
+  * This is global so MD code can set initpaths[0]
   */
! char *initpaths[] = {
  	"/sbin/init",
  	"/sbin/oinit",
  	"/sbin/init.bak",