8 #warning "Sparse checking disabled for this file"
11 #include <linux/kernel.h>
16 #include <linux/cramfs_fs.h>
18 #include <linux/string.h>
19 #include <linux/slab.h>
22 #include "../fs/squashfs/squashfs_fs.h"
29 static int __init prompt_ramdisk(
char *
str)
34 __setup(
"prompt_ramdisk=", prompt_ramdisk);
38 static int __init ramdisk_start_setup(
char *
str)
43 __setup(
"ramdisk_start=", ramdisk_start_setup);
71 const char *compress_name;
93 compress_name, start_block);
96 "RAMDISK: %s decompressor not configured!\n",
106 "RAMDISK: romfs filesystem found at block %d\n",
114 "RAMDISK: cramfs filesystem found at block %d\n",
123 "RAMDISK: squashfs filesystem found at block %d\n",
138 "RAMDISK: cramfs filesystem found at block %d\n",
154 "RAMDISK: Minix filesystem found at block %d\n",
161 n = ext2_image_size(buf);
164 "RAMDISK: ext2 filesystem found at block %d\n",
171 "RAMDISK: Couldn't find valid RAM disk image starting at %d.\n",
184 unsigned long rd_blocks, devblocks;
185 int nblocks,
i, disk;
187 unsigned short rotate = 0;
189 #if !defined(CONFIG_S390)
190 char rotator[4] = {
'|' ,
'/' ,
'-' ,
'\\' };
201 nblocks = identify_ramdisk_image(in_fd,
rd_image_start, &decompressor);
206 if (crd_load(in_fd, out_fd, decompressor) == 0)
207 goto successful_load;
227 if (nblocks > rd_blocks) {
228 printk(
"RAMDISK: image too big! (%dKiB/%ldKiB)\n",
241 if (
strcmp(from,
"/initrd.image") == 0)
244 if (devblocks == 0) {
256 nblocks, ((nblocks-1)/devblocks)+1, nblocks>devblocks ?
"s" :
"");
257 for (i = 0, disk = 1; i < nblocks; i++) {
258 if (i && (i % devblocks == 0)) {
259 printk(
"done disk #%d.\n", disk++);
262 printk(
"Error closing the disk.\n");
268 printk(
"Error opening disk.\n");
271 printk(
"Loading disk #%d... ", disk);
275 #if !defined(CONFIG_S390)
277 printk(
"%c\b", rotator[rotate & 0x3]);
299 change_floppy(
"root floppy disk to be loaded into RAM disk");
305 static int exit_code;
306 static int decompress_error;
307 static int crd_infd, crd_outfd;
309 static int __init compr_fill(
void *buf,
unsigned int len)
319 static int __init compr_flush(
void *
window,
unsigned int outcnt)
321 int written =
sys_write(crd_outfd, window, outcnt);
322 if (written != outcnt) {
323 if (decompress_error == 0)
325 "RAMDISK: incomplete write (%d != %d)\n",
327 decompress_error = 1;
337 decompress_error = 1;
346 if (decompress_error)