Browse Source

Replaced main loop with a trivial implementation so that we can try

out the new probing logic.
tags/v0.9.3
Michael Brown 19 years ago
parent
commit
3901d197f7
1 changed files with 40 additions and 21 deletions
  1. 40
    21
      src/core/main.c

+ 40
- 21
src/core/main.c View File

41
 char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE];
41
 char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE];
42
 #endif
42
 #endif
43
 
43
 
44
+#if 0
45
+
44
 static inline unsigned long ask_boot(unsigned *index)
46
 static inline unsigned long ask_boot(unsigned *index)
45
 {
47
 {
46
 	unsigned long order = DEFAULT_BOOT_ORDER;
48
 	unsigned long order = DEFAULT_BOOT_ORDER;
131
 	{ &disk.dev, disk_probe, disk_load_configuration, disk_load },
133
 	{ &disk.dev, disk_probe, disk_load_configuration, disk_load },
132
 };
134
 };
133
 
135
 
136
+#endif
137
+
138
+
134
 
139
 
135
 static int main_loop(int state);
140
 static int main_loop(int state);
136
 static int exit_ok;
141
 static int exit_ok;
138
 static int initialized;
143
 static int initialized;
139
 
144
 
140
 
145
 
146
+/* Global instance of the current boot device */
147
+struct dev dev;
148
+
141
 /**************************************************************************
149
 /**************************************************************************
142
  * initialise() - perform any C-level initialisation
150
  * initialise() - perform any C-level initialisation
143
  *
151
  *
150
 	/* Zero the BSS */
158
 	/* Zero the BSS */
151
 	memset ( _bss, 0, _ebss - _bss );
159
 	memset ( _bss, 0, _ebss - _bss );
152
 
160
 
153
-	/* Call all registered initialisation functions.
154
-	 */
161
+	/* Call all registered initialisation functions */
155
 	call_init_fns ();
162
 	call_init_fns ();
156
 }
163
 }
157
 
164
 
159
 MAIN - Kick off routine
166
 MAIN - Kick off routine
160
 **************************************************************************/
167
 **************************************************************************/
161
 int main ( void ) {
168
 int main ( void ) {
162
-	int state;
163
 
169
 
170
+	/* Print out configuration */
164
 	print_config();
171
 	print_config();
165
-	cleanup();
166
-
167
-	/* -1:	timeout or ESC
168
-	   -2:	error return from loader
169
-	   -3:  finish the current run.
170
-	   0:	retry booting bootp and tftp
171
-	   1:   retry tftp with possibly modified bootp reply
172
-	   2:   retry bootp and tftp
173
-	   3:   retry probe bootp and tftp
174
-	   4:   start with the next device and retry from there...
175
-	   255: exit Etherboot
176
-	   256: retry after relocation
177
-	*/
178
-	state = setjmp(restart_etherboot);
179
-	exit_ok = 1;
180
-	for(;state != 255;) {
181
-		state = main_loop(state);
172
+
173
+	/*
174
+	 * Trivial main loop: we need to think about how we want to
175
+	 * prompt the user etc.
176
+	 *
177
+	 */
178
+	for ( ; ; disable ( &dev ), call_reset_fns() ) {
179
+	
180
+		/* Get next boot device */
181
+		if ( ! probe ( &dev ) ) {
182
+			/* Reached end of device list */
183
+			continue;
184
+		}
185
+		
186
+		/* Load configuration (e.g. DHCP) */
187
+		if ( ! load_configuration ( &dev ) ) {
188
+			/* DHCP failed */
189
+			continue;
190
+		}
191
+
192
+		/* Load image */
193
+		if ( ! load ( &dev ) )
194
+			/* Load failed */
195
+			continue;
182
 	}
196
 	}
183
-	/* arch_on_exit(exit_status) */
184
 
197
 
185
 	/* Call registered per-object exit functions */
198
 	/* Call registered per-object exit functions */
186
 	call_exit_fns ();
199
 	call_exit_fns ();
196
 	longjmp(restart_etherboot, 255);
209
 	longjmp(restart_etherboot, 255);
197
 }
210
 }
198
 
211
 
212
+
213
+#if 0
214
+
199
 static int main_loop(int state)
215
 static int main_loop(int state)
200
 {
216
 {
201
 	/* Splitting main into 2 pieces makes the semantics of 
217
 	/* Splitting main into 2 pieces makes the semantics of 
331
 }
347
 }
332
 
348
 
333
 
349
 
350
+#endif
351
+
352
+
334
 /**************************************************************************
353
 /**************************************************************************
335
 LOADKERNEL - Try to load kernel image
354
 LOADKERNEL - Try to load kernel image
336
 **************************************************************************/
355
 **************************************************************************/

Loading…
Cancel
Save