Skip to content

Commit

Permalink
Squashfs: initrd support
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Lougher <[email protected]>
  • Loading branch information
Phillip Lougher committed Jan 5, 2009
1 parent 6ab5c1c commit b8fed87
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions init/do_mounts_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/string.h>

#include "do_mounts.h"
#include "../fs/squashfs/squashfs_fs.h"

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

Expand Down Expand Up @@ -41,6 +42,7 @@ static int __init crd_load(int in_fd, int out_fd);
* ext2
* romfs
* cramfs
* squashfs
* gzip
*/
static int __init
Expand All @@ -51,6 +53,7 @@ identify_ramdisk_image(int fd, int start_block)
struct ext2_super_block *ext2sb;
struct romfs_super_block *romfsb;
struct cramfs_super *cramfsb;
struct squashfs_super_block *squashfsb;
int nblocks = -1;
unsigned char *buf;

Expand All @@ -62,6 +65,7 @@ identify_ramdisk_image(int fd, int start_block)
ext2sb = (struct ext2_super_block *) buf;
romfsb = (struct romfs_super_block *) buf;
cramfsb = (struct cramfs_super *) buf;
squashfsb = (struct squashfs_super_block *) buf;
memset(buf, 0xe5, size);

/*
Expand Down Expand Up @@ -99,6 +103,16 @@ identify_ramdisk_image(int fd, int start_block)
goto done;
}

/* squashfs is at block zero too */
if (le32_to_cpu(squashfsb->s_magic) == SQUASHFS_MAGIC) {
printk(KERN_NOTICE
"RAMDISK: squashfs filesystem found at block %d\n",
start_block);
nblocks = (le64_to_cpu(squashfsb->bytes_used) + BLOCK_SIZE - 1)
>> BLOCK_SIZE_BITS;
goto done;
}

/*
* Read block 1 to test for minix and ext2 superblock
*/
Expand Down

0 comments on commit b8fed87

Please sign in to comment.