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(¶ms);
88 while ((c = getoptstr(¶ms)) != -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 * x86: The boot scripts don't prepend the kernel name to the boot
65 * arguments. (And beware making it do so: if the run-kernel command
66 * returns, it will loop, and you will end up with multiple copies
67 * 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(¶ms);
88 while ((c = getoptstr(¶ms)) != -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. "
|