|
@@ -377,89 +377,17 @@ static int main_loop(int state)
|
377
|
377
|
/**************************************************************************
|
378
|
378
|
LOADKERNEL - Try to load kernel image
|
379
|
379
|
**************************************************************************/
|
380
|
|
-struct proto {
|
381
|
|
- char *name;
|
382
|
|
- int (*load)(const char *name,
|
383
|
|
- int (*fnc)(unsigned char *, unsigned int, unsigned int, int));
|
384
|
|
-};
|
|
380
|
+#if 0
|
|
381
|
+/* To be split out into individual files */
|
385
|
382
|
static const struct proto protos[] = {
|
386
|
|
-#ifdef DOWNLOAD_PROTO_TFTM
|
387
|
383
|
{ "x-tftm", url_tftm },
|
388
|
|
-#endif
|
389
|
|
-#ifdef DOWNLOAD_PROTO_SLAM
|
390
|
384
|
{ "x-slam", url_slam },
|
391
|
|
-#endif
|
392
|
|
-#ifdef DOWNLOAD_PROTO_NFS
|
393
|
385
|
{ "nfs", nfs },
|
394
|
|
-#endif
|
395
|
|
-#ifdef DOWNLOAD_PROTO_DISK
|
396
|
386
|
{ "file", url_file },
|
397
|
|
-#endif
|
398
|
|
-#ifdef DOWNLOAD_PROTO_TFTP
|
399
|
387
|
{ "tftp", tftp },
|
400
|
|
-#endif
|
401
|
|
-#ifdef DOWNLOAD_PROTO_HTTP
|
402
|
388
|
{ "http", http },
|
403
|
|
-#endif
|
404
|
389
|
};
|
405
|
|
-
|
406
|
|
-int loadkernel ( const char *fname,
|
407
|
|
- int ( * load_block ) ( unsigned char *data,
|
408
|
|
- unsigned int blocknum,
|
409
|
|
- unsigned int len, int eof ) ) {
|
410
|
|
- static const struct proto * const last_proto =
|
411
|
|
- &protos[sizeof(protos)/sizeof(protos[0])];
|
412
|
|
- const struct proto *proto;
|
413
|
|
- in_addr ip;
|
414
|
|
- int len;
|
415
|
|
- const char *name;
|
416
|
|
-#ifdef DNS_RESOLVER
|
417
|
|
- const char *resolvt;
|
418
|
390
|
#endif
|
419
|
|
- ip.s_addr = arptable[ARP_SERVER].ipaddr.s_addr;
|
420
|
|
- name = fname;
|
421
|
|
- url_port = -1;
|
422
|
|
- len = 0;
|
423
|
|
- while(fname[len] && fname[len] != ':') {
|
424
|
|
- len++;
|
425
|
|
- }
|
426
|
|
- for(proto = &protos[0]; proto < last_proto; proto++) {
|
427
|
|
- if (memcmp(name, proto->name, len) == 0) {
|
428
|
|
- break;
|
429
|
|
- }
|
430
|
|
- }
|
431
|
|
- if ((proto < last_proto) && (memcmp(fname + len, "://", 3) == 0)) {
|
432
|
|
- name += len + 3;
|
433
|
|
- if (name[0] != '/') {
|
434
|
|
-#ifdef DNS_RESOLVER
|
435
|
|
- resolvt = dns_resolver ( name );
|
436
|
|
- if ( NULL != resolvt ) {
|
437
|
|
- //printf ("Resolved host name [%s] to [%s]\n",
|
438
|
|
- // name, resolvt );
|
439
|
|
- inet_aton(resolvt, &ip);
|
440
|
|
- while ( ( '/' != name[0] ) && ( 0 != name[0]))
|
441
|
|
- ++name;
|
442
|
|
- } else
|
443
|
|
-#endif /* DNS_RESOLVER */
|
444
|
|
- name += inet_aton(name, &ip);
|
445
|
|
- if (name[0] == ':') {
|
446
|
|
- name++;
|
447
|
|
- url_port = strtoul(name, &name, 10);
|
448
|
|
- }
|
449
|
|
- }
|
450
|
|
- if (name[0] == '/') {
|
451
|
|
- arptable[ARP_SERVER].ipaddr.s_addr = ip.s_addr;
|
452
|
|
- printf( "Loading %s ", fname );
|
453
|
|
- return proto->load(name + 1, load_block);
|
454
|
|
- }
|
455
|
|
- }
|
456
|
|
- printf("Loading %@:%s ", arptable[ARP_SERVER].ipaddr, fname);
|
457
|
|
-#ifdef DEFAULT_PROTO_NFS
|
458
|
|
- return nfs(fname, load_block);
|
459
|
|
-#else
|
460
|
|
- return tftp(fname, load_block);
|
461
|
|
-#endif
|
462
|
|
-}
|
463
|
391
|
|
464
|
392
|
|
465
|
393
|
/**************************************************************************
|