Skip to content

Commit b8fed87

Browse files
author
Phillip Lougher
committed
Squashfs: initrd support
Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
1 parent 6ab5c1c commit b8fed87

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎init/do_mounts_rd.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/string.h>
1010

1111
#include "do_mounts.h"
12+
#include "../fs/squashfs/squashfs_fs.h"
1213

1314
int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */
1415

@@ -41,6 +42,7 @@ static int __init crd_load(int in_fd, int out_fd);
4142
* ext2
4243
* romfs
4344
* cramfs
45+
* squashfs
4446
* gzip
4547
*/
4648
static int __init
@@ -51,6 +53,7 @@ identify_ramdisk_image(int fd, int start_block)
5153
struct ext2_super_block *ext2sb;
5254
struct romfs_super_block *romfsb;
5355
struct cramfs_super *cramfsb;
56+
struct squashfs_super_block *squashfsb;
5457
int nblocks = -1;
5558
unsigned char *buf;
5659

@@ -62,6 +65,7 @@ identify_ramdisk_image(int fd, int start_block)
6265
ext2sb = (struct ext2_super_block *) buf;
6366
romfsb = (struct romfs_super_block *) buf;
6467
cramfsb = (struct cramfs_super *) buf;
68+
squashfsb = (struct squashfs_super_block *) buf;
6569
memset(buf, 0xe5, size);
6670

6771
/*
@@ -99,6 +103,16 @@ identify_ramdisk_image(int fd, int start_block)
99103
goto done;
100104
}
101105

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+
102116
/*
103117
* Read block 1 to test for minix and ext2 superblock
104118
*/

0 commit comments

Comments
 (0)