Skip to contentSkip to conversation

Palo and initial ramdisks

parisc-linux James Bottomley 2 participants 2 messages Dec 30, 2001 – Dec 31, 2001

lore
Share & tools
lore
#0 lore raw

Playing some more with modules and initial ramdisks, I noticed that palo only allows use of a ramdisk when the ramdisk is placed inside the palo partition rather than being able to read one from the boot ext2 filesystem.

The attached patch is a simple hack allowing palo to read a ramdisk from the boot ext2 filesystem.

James Bottomley

Index: ipl/bootloader.h
===================================================================
RCS file: /var/cvs/palo/ipl/bootloader.h,v
retrieving revision 1.9

bootloader.h +1 -0
diff -u -r1.9 bootloader.h
@@ -57,6 +57,7 @@
 /* ext2.c */
 int ext2_mount(long cons_dev, long p_offset, long quiet);
 int ext2_open(const char *filename);
+int ext2_filesize(int fd);
 
 /* lib.c */
 void blockprint(int zero_offset, char *buf, int nbytes);

Index: ipl/ext2.c
===================================================================
RCS file: /var/cvs/palo/ipl/ext2.c,v
retrieving revision 1.9

ext2.c +7 -0
diff -u -r1.9 ext2.c
@@ -733,6 +733,13 @@
 }
 #endif
 
+int ext2_filesize(int fd)
+{
+	struct ext2_inode * ip = fd2inode[fd];
+
+	return ip->i_size;
+}
+
 #if 0
 static int ext2_fstat(int fd, struct stat* buf)
 {

Index: ipl/ipl.c
===================================================================
RCS file: /var/cvs/palo/ipl/ipl.c,v
retrieving revision 1.26

ipl.c +16 -0
diff -u -r1.26 ipl.c
@@ -471,6 +471,7 @@
     {
 	int kern_fd;
 	int bkern_fd;
+	int rd_fd, brd_fd;
 	int part_fd;
 	int mount_fd;
 	struct diskpartition *pp;
@@ -502,6 +503,21 @@
 	if (!load_kernel(bkern_fd, &entry, &wide))
 	{
 	    die("ERROR: failed to load kernel\n");
+	}
+
+	if (rd_part != -1)
+	{
+	    rd_fd = ext2_open(rd_name);
+	    if(rd_fd >= 0) {
+		brd_fd = byteio_open(rd_fd);
+
+		if (!load_rd(brd_fd, ext2_filesize(rd_fd)))
+		{
+		    printf("ERROR: failed to load ramdisk - proceeding anyway\n");
+		}
+	    } else {
+		printf("ERROR: failed to open ramdisk %s\n", rd_name);
+	    }
 	}
     }
 
#1 lore raw

= Playing some more with modules and initial ramdisks, I noticed that palo only = allows use of a ramdisk when the ramdisk is placed inside the palo partition = rather than being able to read one from the boot ext2 filesystem. =
= The attached patch is a simple hack allowing palo to read a ramdisk from the = boot ext2 filesystem.

Oops, thought that was implemented. Thanks for the patch, I put it in CVS and uploaded a new debian package.

	-P