Print this page
3788 /etc/bootrc is defunct and should be removed
fix _OBP comment in kobj_bootflags.c


  44 void
  45 bootflags(struct bootops *ops)
  46 {
  47         struct gos_params params;
  48         uchar_t num_O_opt = 0;
  49         char *cp;
  50         int c;
  51         char scratch[BOOTARGS_MAX];
  52 
  53         if (BOP_GETPROP(ops, "bootargs", kern_bootargs) == -1) {
  54                 boothowto |= RB_ASKNAME;
  55                 return;
  56         }
  57 
  58         (void) BOP_GETPROP(ops, "boot-file", kern_bootfile);
  59 
  60         cp = kern_bootargs;
  61 
  62 #if defined(_OBP)
  63         /*
  64          * x86: The boot scripts (i.e., /etc/bootrc) don't prepend the kernel
  65          * name to the boot arguments.  (And beware making it do so: if the
  66          * run-kernel command returns, it will loop, and you will end up with
  67          * multiple copies of the kernel name.)
  68          */
  69         if (cp[0] != '-') {
  70                 /* if user booted kadb or kmdb, load kmdb */
  71                 if (cp[0] == 'k' && (cp[1] == 'a' || cp[1] == 'm') &&
  72                     cp[2] == 'd' && cp[3] == 'b' &&
  73                     (cp[4] == ' ' || cp[4] == ' ' || cp[4] == 0))
  74                         boothowto |= RB_KMDB;
  75                 SKIP_WORD(cp);          /* Skip the kernel's filename. */
  76         }
  77 #endif
  78         SKIP_SPC(cp);
  79 
  80 #if defined(_OBP)
  81         /* skip bootblk args */
  82         params.gos_opts = "abcdDf:F:gGHhi:km:o:O:rsvVwxZ:";
  83 #else
  84         params.gos_opts = "abcdgGhi:km:O:rsvwx";
  85 #endif
  86         params.gos_strp = cp;
  87         getoptstr_init(&params);
  88         while ((c = getoptstr(&params)) != -1) {
  89 
  90                 switch (c) {
  91                 case 'a':
  92                         boothowto |= RB_ASKNAME;
  93                         break;
  94                 case 'b':
  95                         boothowto |= RB_NOBOOTRC;
  96                         break;
  97                 case 'c':
  98                         boothowto |= RB_CONFIG;
  99                         break;
 100                 case 'd':
 101                         boothowto |= RB_DEBUGENTER;
 102                         break;
 103 #if defined(_OBP)
 104                 case 'D':
 105                 case 'F':
 106                         break;
 107                 case 'f':
 108                         (void)prom_setprop(prom_optionsnode(), "diag-level",
 109                             (char *)params.gos_optargp,
 110                             params.gos_optarglen + 1);
 111                         break;
 112 #endif
 113                 case 'g':
 114                         boothowto |= RB_FORTHDEBUG;
 115                         break;
 116                 case 'G':
 117                         boothowto |= RB_FORTHDEBUGDBP;
 118                         break;
 119                 case 'h':
 120                         boothowto |= RB_HALT;
 121                         break;
 122 #if defined(_OBP)
 123                 case 'H':
 124                         break;
 125 #endif
 126                 case 'i':
 127                         if (params.gos_optarglen + 1 > sizeof (initname)) {
 128                                 _kobj_printf(ops, "krtld: initname too long.  "




  44 void
  45 bootflags(struct bootops *ops)
  46 {
  47         struct gos_params params;
  48         uchar_t num_O_opt = 0;
  49         char *cp;
  50         int c;
  51         char scratch[BOOTARGS_MAX];
  52 
  53         if (BOP_GETPROP(ops, "bootargs", kern_bootargs) == -1) {
  54                 boothowto |= RB_ASKNAME;
  55                 return;
  56         }
  57 
  58         (void) BOP_GETPROP(ops, "boot-file", kern_bootfile);
  59 
  60         cp = kern_bootargs;
  61 
  62 #if defined(_OBP)
  63         /*
  64          * Sparc only, _OBP isn't defined on x86 any more.



  65          */
  66         if (cp[0] != '-') {
  67                 /* if user booted kadb or kmdb, load kmdb */
  68                 if (cp[0] == 'k' && (cp[1] == 'a' || cp[1] == 'm') &&
  69                     cp[2] == 'd' && cp[3] == 'b' &&
  70                     (cp[4] == ' ' || cp[4] == ' ' || cp[4] == 0))
  71                         boothowto |= RB_KMDB;
  72                 SKIP_WORD(cp);          /* Skip the kernel's filename. */
  73         }
  74 #endif
  75         SKIP_SPC(cp);
  76 
  77 #if defined(_OBP)
  78         /* skip bootblk args */
  79         params.gos_opts = "abcdDf:F:gGHhi:km:o:O:rsvVwxZ:";
  80 #else
  81         params.gos_opts = "abcdgGhi:km:O:rsvwx";
  82 #endif
  83         params.gos_strp = cp;
  84         getoptstr_init(&params);
  85         while ((c = getoptstr(&params)) != -1) {
  86 
  87                 switch (c) {
  88                 case 'a':
  89                         boothowto |= RB_ASKNAME;
  90                         break;
  91                 case 'b':
  92                         boothowto |= RB_NOBOOTRC;
  93                         break;
  94                 case 'c':
  95                         boothowto |= RB_CONFIG;
  96                         break;
  97                 case 'd':
  98                         boothowto |= RB_DEBUGENTER;
  99                         break;
 100 #if defined(_OBP)
 101                 case 'D':
 102                 case 'F':
 103                         break;
 104                 case 'f':
 105                         (void) prom_setprop(prom_optionsnode(), "diag-level",
 106                             (char *)params.gos_optargp,
 107                             params.gos_optarglen + 1);
 108                         break;
 109 #endif
 110                 case 'g':
 111                         boothowto |= RB_FORTHDEBUG;
 112                         break;
 113                 case 'G':
 114                         boothowto |= RB_FORTHDEBUGDBP;
 115                         break;
 116                 case 'h':
 117                         boothowto |= RB_HALT;
 118                         break;
 119 #if defined(_OBP)
 120                 case 'H':
 121                         break;
 122 #endif
 123                 case 'i':
 124                         if (params.gos_optarglen + 1 > sizeof (initname)) {
 125                                 _kobj_printf(ops, "krtld: initname too long.  "