Re: ramdisk and initrd in 2.1.9x

Paul Gortmaker (paul@rasty.ph.unimelb.edu.au)
Tue, 7 Apr 1998 19:21:37 +1000 (EST)


> Matthias Urlichs wrote:
>
> Paul:
> Since 2.1.91 tries to determine the disk size for multi-disk loads
> the ramdisk load from HD fails.

Yes, blk_size[RAMDISK_MAJOR] isn't assigned, and to do so would be a
waste just for blk_size[RAMDISK_MAJOR][INITRD_MINOR]. This patch against
2.1.92 should fix that. Let me know if there are any other problems.

Paul.

--- linux/drivers/block/rd.c.orig Wed Mar 18 23:45:34 1998
+++ linux/drivers/block/rd.c Tue Apr 7 18:03:02 1998
@@ -328,7 +328,7 @@

#ifdef RD_LOADER
/*
- * This routine tries to a ramdisk image to load, and returns the
+ * This routine tries to find a ramdisk image to load, and returns the
* number of blocks to read for a non-compressed image, 0 if the image
* is a compressed image, and -1 if an image with the right magic
* numbers could not be found.
@@ -503,15 +503,21 @@
if (blk_size[MAJOR(device)])
devblocks = blk_size[MAJOR(device)][MINOR(device)];

+#ifdef CONFIG_BLK_DEV_INITRD
+ if (MAJOR(device) == MAJOR_NR && MINOR(device) == INITRD_MINOR)
+ devblocks = nblocks; /* (initrd_end - initrd_start)/BLOCK_SIZE */
+#endif
+
if (devblocks == 0) {
printk(KERN_ERR "RAMDISK: could not determine device size\n");
goto done;
}

- printk(KERN_NOTICE "RAMDISK: Loading %d blocks [%d disk(s)] into ram disk... ", nblocks, nblocks/devblocks+1);
+ printk(KERN_NOTICE "RAMDISK: Loading %d blocks [%d disk%s] into ram disk... ",
+ nblocks, ((nblocks-1)/devblocks)+1, nblocks>devblocks ? "s" : "");
for (i=0; i < nblocks; i++) {
if (i && (i % devblocks == 0)) {
- printk("done.\n");
+ printk("done disk #%d.\n", i/devblocks);
rotate = 0;
invalidate_buffers(device);
if (infile.f_op->release)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu