1 /*************************************************
2 * rpld - an IBM style RIPL server *
3 *************************************************/
5 /* Copyright (c) 1999,2000, James McKenzie.
7 * Copyright (c) 1998,2000, Christopher Lightfoot.
10 * By using this file, you agree to the terms and conditions set
11 * forth in the LICENCE file which can be found at the top level of
12 * the rpld distribution.
14 * IBM is a trademark of IBM corp.
20 "$Id: config.c,v 1.22 2000/09/26 04:06:07 root Exp root $";
24 * Revision 1.22 2000/09/26 04:06:07 root
27 * Revision 1.21 2000/09/26 03:48:23 root
30 * Revision 1.20 2000/09/26 03:44:29 root
33 * Revision 1.19 2000/09/26 02:32:46 root
36 * Revision 1.18 2000/09/26 01:42:24 root
39 * Revision 1.17 2000/09/26 01:41:22 root
42 * Revision 1.16 2000/09/26 01:41:08 root
45 * Revision 1.15 2000/09/26 01:39:17 root
48 * Revision 1.14 2000/07/29 23:25:58 root
51 * Revision 1.13 2000/07/29 23:25:25 root
54 * Revision 1.12 2000/07/23 19:14:19 root
57 * Revision 1.11 2000/07/23 19:07:49 root
60 * Revision 1.10 2000/07/17 10:49:20 root
63 * Revision 1.9 2000/07/17 10:45:38 root
66 * Revision 1.8 2000/07/17 10:43:54 root
69 * Revision 1.7 2000/07/17 10:43:34 root
72 * Revision 1.6 2000/07/16 14:05:28 root
75 * Revision 1.5 2000/07/16 13:18:10 root
78 * Revision 1.1 2000/07/16 13:16:33 root
81 * Revision 1.4 1999/09/13 11:17:35 root
84 * Revision 1.3 1999/09/13 11:08:34 root
87 * Revision 1.2 1999/09/13 11:05:27 root
90 * Revision 1.1 1999/09/13 11:04:13 root
97 #include "rpld_conf.tab.h"
102 do_linux_kernel (struct client *c, struct clfile *f)
104 struct clfile *bootsect, *kernel;
107 #define VMLINUZ_LOADLEN_OFFSET 497
109 /* The book says we should load top downwards so
110 * we init bottom upwards ie fr is the second stage
111 * bootloader at 0x92000 */
113 /* Firstly we need to load the bootsector to work out stuff */
114 bootsect = (struct clfile *) malloc (sizeof (struct clfile));
115 bzero (bootsect, sizeof (struct clfile));
117 bootsect->path = strdup (f->path);
118 bootsect->offset = 0;
119 bootsect->length = 0x200;
120 bootsect->load_addr = 0x90000;
122 cache_locally (bootsect);
126 fprintf (stderr, "Couldn't open %s for reading\n", f->path);
129 if (bootsect->length < 0x200)
131 fprintf (stderr, "Only read %d bytes from %s\n", bootsect->length,
136 /* FIXME: here we should add a pointer to the kernel parameter string */
137 /* and allocate a clfile structure to hold it */
139 loaderlen = (bootsect->data[VMLINUZ_LOADLEN_OFFSET]) ?
140 (0x200 * (bootsect->data[VMLINUZ_LOADLEN_OFFSET])) : 0x800;
143 kernel = (struct clfile *) malloc (sizeof (struct clfile));
144 bzero (kernel, sizeof (struct clfile));
146 kernel->path = strdup (f->path);
147 kernel->offset = loaderlen + 0x200;
149 kernel->load_addr = 0x10000;
151 kernel->next = c->files;
154 /* Tag in the bootsector */
155 bootsect->next = kernel;
159 /* Now set up f the secondary bootloader */
162 f->length = loaderlen;
163 f->load_addr = 0x90200;
169 parse_config (char *filename)
173 file = fopen (filename, "r");
177 fprintf (stderr, "Cannot open config file %s\n", filename);