Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv30236/src
Modified Files:
Tag: blob_1_0_9_hack
linux.c
Log Message:
- an ATAG_INITRD tag also needs an ATAG_RAMDISK tag
- if there is no command line, don't issue an ATAG_CMDLINE node, so the
kernel will use its default command line
Index: linux.c
===================================================================
RCS file: /cvsroot/blob/blob/src/Attic/linux.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- linux.c 2001/07/26 10:58:40 1.1.2.4
+++ linux.c 2001/07/27 00:22:25 1.1.2.5
@@ -38,7 +38,8 @@
static void setup_start_tag(void);
static void setup_memory_tags(void);
static void setup_commandline_tag(char *commandline);
-/* static void setup_initrd_tag(void); */
+static void setup_ramdisk_tag(void);
+static void setup_initrd_tag(void);
static void setup_end_tag(void);
@@ -53,7 +54,8 @@
setup_start_tag();
setup_memory_tags();
setup_commandline_tag(commandline);
-/* setup_initrd_tag(); */
+ setup_initrd_tag();
+ setup_ramdisk_tag();
setup_end_tag();
/* we assume that the kernel is in place */
@@ -108,22 +110,32 @@
static void setup_commandline_tag(char *commandline)
{
+ char *p;
+
+ /* eat leading white space */
+ for(p = commandline; *p == ' '; p++)
+ ;
+
+ /* skip non-existent command lines so the kernel will still
+ * use its default command line.
+ */
+ if(*p == '\0')
+ return;
+
params->hdr.tag = ATAG_CMDLINE;
- params->hdr.size = (sizeof(struct tag_header) + strlen(commandline) + 1 + 4) >> 2;
+ params->hdr.size = (sizeof(struct tag_header) + strlen(p) + 1 + 4) >> 2;
- strcpy(params->u.cmdline.cmdline, commandline);
+ strcpy(params->u.cmdline.cmdline, p);
params = tag_next(params);
}
-#if 0
-/* no, this is not the right way. you can't boot from /dev/hda1 with
- * this stuff. we first need proper parameter block support to make
- * this work.
- */
static void setup_initrd_tag(void)
{
+ /* an ATAG_INITRD node tells the kernel where the compressed
+ * ramdisk can be found. ATAG_RDIMG is a better name, actually.
+ */
params->hdr.tag = ATAG_INITRD;
params->hdr.size = tag_size(tag_initrd);
@@ -131,8 +143,24 @@
params->u.initrd.size = INITRD_LEN;
params = tag_next(params);
+}
+
+
+static void setup_ramdisk_tag(void)
+{
+ /* an ATAG_RAMDISK node tells the kernel how large the
+ * decompressed ramdisk will become.
+ */
+ params->hdr.tag = ATAG_RAMDISK;
+ params->hdr.size = tag_size(tag_ramdisk);
+
+ params->u.ramdisk.start = 0;
+ params->u.ramdisk.size = RAMDISK_SIZE;
+ params->u.ramdisk.flags = 1; /* automatically load ramdisk */
+
+ params = tag_next(params);
}
-#endif
+
static void setup_end_tag(void)
{
|