diff options
| author | Phillip Lougher <phillip@lougher.demon.co.uk> | 2009-01-05 03:46:28 -0500 |
|---|---|---|
| committer | Phillip Lougher <phillip@lougher.demon.co.uk> | 2009-01-05 03:46:28 -0500 |
| commit | b8fed87d3265d21d6f90e34934d93f70cb1e5cc1 (patch) | |
| tree | 5c6d39e9f38eae8aeaac79e0a2e489ab8a4a6af8 | |
| parent | 6ab5c1ca71ea8e04e97cd8ed473bd04e636850fd (diff) | |
Squashfs: initrd support
Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
| -rw-r--r-- | init/do_mounts_rd.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index a7c748fa977a..0f0f0cf3ba9a 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/string.h> | 9 | #include <linux/string.h> |
| 10 | 10 | ||
| 11 | #include "do_mounts.h" | 11 | #include "do_mounts.h" |
| 12 | #include "../fs/squashfs/squashfs_fs.h" | ||
| 12 | 13 | ||
| 13 | int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */ | 14 | int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */ |
| 14 | 15 | ||
| @@ -41,6 +42,7 @@ static int __init crd_load(int in_fd, int out_fd); | |||
| 41 | * ext2 | 42 | * ext2 |
| 42 | * romfs | 43 | * romfs |
| 43 | * cramfs | 44 | * cramfs |
| 45 | * squashfs | ||
| 44 | * gzip | 46 | * gzip |
| 45 | */ | 47 | */ |
| 46 | static int __init | 48 | static int __init |
| @@ -51,6 +53,7 @@ identify_ramdisk_image(int fd, int start_block) | |||
| 51 | struct ext2_super_block *ext2sb; | 53 | struct ext2_super_block *ext2sb; |
| 52 | struct romfs_super_block *romfsb; | 54 | struct romfs_super_block *romfsb; |
| 53 | struct cramfs_super *cramfsb; | 55 | struct cramfs_super *cramfsb; |
| 56 | struct squashfs_super_block *squashfsb; | ||
| 54 | int nblocks = -1; | 57 | int nblocks = -1; |
| 55 | unsigned char *buf; | 58 | unsigned char *buf; |
| 56 | 59 | ||
| @@ -62,6 +65,7 @@ identify_ramdisk_image(int fd, int start_block) | |||
| 62 | ext2sb = (struct ext2_super_block *) buf; | 65 | ext2sb = (struct ext2_super_block *) buf; |
| 63 | romfsb = (struct romfs_super_block *) buf; | 66 | romfsb = (struct romfs_super_block *) buf; |
| 64 | cramfsb = (struct cramfs_super *) buf; | 67 | cramfsb = (struct cramfs_super *) buf; |
| 68 | squashfsb = (struct squashfs_super_block *) buf; | ||
| 65 | memset(buf, 0xe5, size); | 69 | memset(buf, 0xe5, size); |
| 66 | 70 | ||
| 67 | /* | 71 | /* |
| @@ -99,6 +103,16 @@ identify_ramdisk_image(int fd, int start_block) | |||
| 99 | goto done; | 103 | goto done; |
| 100 | } | 104 | } |
| 101 | 105 | ||
| 106 | /* squashfs is at block zero too */ | ||
| 107 | if (le32_to_cpu(squashfsb->s_magic) == SQUASHFS_MAGIC) { | ||
| 108 | printk(KERN_NOTICE | ||
| 109 | "RAMDISK: squashfs filesystem found at block %d\n", | ||
| 110 | start_block); | ||
| 111 | nblocks = (le64_to_cpu(squashfsb->bytes_used) + BLOCK_SIZE - 1) | ||
| 112 | >> BLOCK_SIZE_BITS; | ||
| 113 | goto done; | ||
| 114 | } | ||
| 115 | |||
| 102 | /* | 116 | /* |
| 103 | * Read block 1 to test for minix and ext2 superblock | 117 | * Read block 1 to test for minix and ext2 superblock |
| 104 | */ | 118 | */ |
