diff -Nruw cramfs-1.1.org/cramfsck.c cramfs-1.1/cramfsck.c
--- cramfs-1.1.org/cramfsck.c	2002-02-23 01:00:42.000000000 +0100
+++ cramfs-1.1/cramfsck.c	2010-06-21 11:13:35.000000000 +0200
@@ -2,6 +2,7 @@
  * cramfsck - check a cramfs file system
  *
  * Copyright (C) 2000-2002 Transmeta Corporation
+ * Portions Copyright (C) 2002 Axis Communciations AB, Sweden
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -65,7 +66,9 @@
 #define FSCK_LIBRARY     128	/* Shared library error */
 
 #define PAD_SIZE 512
-#define PAGE_CACHE_SIZE (4096)
+#define DEFAULT_PAGE_CACHE_SIZE (4096) 
+#define MAX_PAGE_CACHE_SIZE (32768) 
+static unsigned int blksize = DEFAULT_PAGE_CACHE_SIZE;
 
 static const char *progname = "cramfsck";
 
@@ -85,14 +88,14 @@
 static unsigned long end_data = 0;	/* end of the data */
 
 /* Guarantee access to at least 8kB at a time */
-#define ROMBUFFER_BITS	13
-#define ROMBUFFERSIZE	(1 << ROMBUFFER_BITS)
+#define ROMBUFFER_BITS	16
+#define ROMBUFFERSIZE   (MAX_PAGE_CACHE_SIZE*2)
 #define ROMBUFFERMASK	(ROMBUFFERSIZE-1)
 static char read_buffer[ROMBUFFERSIZE * 2];
 static unsigned long read_buffer_block = ~0UL;
 
 /* Uncompressing data structures... */
-static char outbuffer[PAGE_CACHE_SIZE*2];
+static char outbuffer[MAX_PAGE_CACHE_SIZE*2];
 static z_stream stream;
 
 /* Prototypes */
@@ -104,11 +107,12 @@
 {
 	FILE *stream = status ? stderr : stdout;
 
-	fprintf(stream, "usage: %s [-hv] [-x dir] file\n"
+	fprintf(stream, "usage: %s [-hv] [-b blocksize] [-x dir] file\n"
 		" -h         print this help\n"
 		" -x dir     extract into dir\n"
+		" -b bsize   blocksize (default %i, max %i)\n"
 		" -v         be more verbose\n"
-		" file       file to test\n", progname);
+		" file       file to test\n", progname,DEFAULT_PAGE_CACHE_SIZE, MAX_PAGE_CACHE_SIZE);
 
 	exit(status);
 }
@@ -182,7 +186,7 @@
 	if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) {
 		die(FSCK_ERROR, 0, "unsupported filesystem features");
 	}
-	if (super.size < PAGE_CACHE_SIZE) {
+	if (super.size < blksize) {
 		die(FSCK_UNCORRECTED, 0, "superblock size (%d) too small", super.size);
 	}
 	if (super.flags & CRAMFS_FLAG_FSID_VERSION_2) {
@@ -335,7 +339,7 @@
 	return cramfs_iget(&super.root);
 }
 
-static int uncompress_block(void *src, int len)
+static int uncompress_block(void *src, unsigned int len)
 {
 	int err;
 
@@ -343,27 +347,27 @@
 	stream.avail_in = len;
 
 	stream.next_out = (unsigned char *) outbuffer;
-	stream.avail_out = PAGE_CACHE_SIZE*2;
+	stream.avail_out = blksize*2;
 
 	inflateReset(&stream);
 
-	if (len > PAGE_CACHE_SIZE*2) {
+	if (len > blksize*2) {
 		die(FSCK_UNCORRECTED, 0, "data block too large");
 	}
 	err = inflate(&stream, Z_FINISH);
 	if (err != Z_STREAM_END) {
-		die(FSCK_UNCORRECTED, 0, "decompression error %p(%d): %s",
-		    zError(err), src, len);
+		die(FSCK_UNCORRECTED, 0, "decompression error %p(%d): %s\n\tTry a different blocksize?",
+		    src, len,zError(err));
 	}
 	return stream.total_out;
 }
 
 static void do_uncompress(char *path, int fd, unsigned long offset, unsigned long size)
 {
-	unsigned long curr = offset + 4 * ((size + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE);
+	unsigned long curr = offset + 4 * ((size + blksize - 1) / blksize);
 
 	do {
-		unsigned long out = PAGE_CACHE_SIZE;
+		unsigned long out = blksize;
 		unsigned long next = *(u32 *) romfs_read(offset);
 
 		if (next > end_data) {
@@ -373,9 +377,9 @@
 		offset += 4;
 		if (curr == next) {
 			if (opt_verbose > 1) {
-				printf("  hole at %ld (%d)\n", curr, PAGE_CACHE_SIZE);
+				printf("  hole at %ld (%d)\n", curr, blksize);
 			}
-			if (size < PAGE_CACHE_SIZE)
+			if (size < blksize)
 				out = size;
 			memset(outbuffer, 0x00, out);
 		}
@@ -385,8 +389,8 @@
 			}
 			out = uncompress_block(romfs_read(curr), next - curr);
 		}
-		if (size >= PAGE_CACHE_SIZE) {
-			if (out != PAGE_CACHE_SIZE) {
+		if (size >= blksize) {
+			if (out != blksize) {
 				die(FSCK_UNCORRECTED, 0, "non-block (%ld) bytes", out);
 			}
 		} else {
@@ -665,10 +669,16 @@
 		progname = argv[0];
 
 	/* command line options */
-	while ((c = getopt(argc, argv, "hx:v")) != EOF) {
+	while ((c = getopt(argc, argv, "hb:x:v")) != EOF) {
 		switch (c) {
 		case 'h':
 			usage(FSCK_OK);
+		case 'b':
+			blksize = atoi(optarg);
+			if (blksize > MAX_PAGE_CACHE_SIZE || blksize == 0) {
+				die(FSCK_USAGE, 0, "Invalid blocksize");
+			}
+			break;
 		case 'x':
 #ifdef INCLUDE_FS_TESTS
 			opt_extract = 1;
@@ -687,6 +697,8 @@
 		usage(FSCK_USAGE);
 	filename = argv[optind];
 
+	printf("Using a blocksize of %d bytes.\n", blksize);
+
 	test_super(&start, &length);
 	test_crc(start);
 #ifdef INCLUDE_FS_TESTS
diff -Nruw cramfs-1.1.org/mkcramfs.c cramfs-1.1/mkcramfs.c
--- cramfs-1.1.org/mkcramfs.c	2002-02-20 09:03:32.000000000 +0100
+++ cramfs-1.1/mkcramfs.c	2010-06-21 11:13:36.000000000 +0200
@@ -2,6 +2,7 @@
  * mkcramfs - make a cramfs file system
  *
  * Copyright (C) 1999-2002 Transmeta Corporation
+ * Portions Copyright (C) 2002 Axis Communications AB, Sweden
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -45,7 +46,7 @@
 #define PAD_SIZE 512
 
 /* The kernel assumes PAGE_CACHE_SIZE as block size. */
-#define PAGE_CACHE_SIZE (4096)
+#define DEFAULT_PAGE_CACHE_SIZE (4096)
 
 /*
  * The longest filename component to allow for in the input directory tree.
@@ -69,10 +70,10 @@
  */
 #define MAXFSLEN ((((1 << CRAMFS_OFFSET_WIDTH) - 1) << 2) /* offset */ \
 		  + (1 << CRAMFS_SIZE_WIDTH) - 1 /* filesize */ \
-		  + (1 << CRAMFS_SIZE_WIDTH) * 4 / PAGE_CACHE_SIZE /* block pointers */ )
+		  + (1 << CRAMFS_SIZE_WIDTH) * 4 / blksize /* block pointers */ )
 
 static const char *progname = "mkcramfs";
-static unsigned int blksize = PAGE_CACHE_SIZE;
+static unsigned int blksize = DEFAULT_PAGE_CACHE_SIZE;
 static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */
 static int image_length = 0;
 
@@ -123,9 +124,10 @@
 {
 	FILE *stream = status ? stderr : stdout;
 
-	fprintf(stream, "usage: %s [-h] [-e edition] [-i file] [-n name] dirname outfile\n"
+	fprintf(stream, "usage: %s [-h] [-b blocksize] [-e edition] [-i file] [-n name] dirname outfile\n"
 		" -h         print this help\n"
 		" -E         make all warnings errors (non-zero exit status)\n"
+		" -b bsize   the page-size (default is %i)\n"
 		" -e edition set edition number (part of fsid)\n"
 		" -i file    insert a file image into the filesystem (requires >= 2.4.0)\n"
 		" -n name    set name of cramfs filesystem\n"
@@ -134,7 +136,7 @@
 		" -v         be more verbose\n"
 		" -z         make explicit holes (requires >= 2.3.39)\n"
 		" dirname    root of the directory tree to be compressed\n"
-		" outfile    output file\n", progname, PAD_SIZE);
+		" outfile    output file\n", progname, DEFAULT_PAGE_CACHE_SIZE, PAD_SIZE);
 
 	exit(status);
 }
@@ -699,13 +701,21 @@
 		progname = argv[0];
 
 	/* command line options */
-	while ((c = getopt(argc, argv, "hEe:i:n:psvz")) != EOF) {
+	while ((c = getopt(argc, argv, "hEb:e:i:n:psvz")) != EOF) {
 		switch (c) {
 		case 'h':
 			usage(MKFS_OK);
 		case 'E':
 			opt_errors = 1;
 			break;
+		case 'b':
+			errno = 0;
+			blksize = atoi(optarg);
+			if (errno || optarg[0] == '\0' || blksize <= 0)
+			{
+				die(MKFS_ERROR,0,"wrong block size\n");
+			}
+			break;
 		case 'e':
 			errno = 0;
 			opt_edition = strtoul(optarg, &ep, 10);
@@ -744,6 +754,7 @@
 	dirname = argv[optind];
 	outfile = argv[optind + 1];
 
+	printf("Using a blocksize of %d bytes.\n", blksize);
 	if (stat(dirname, &st) < 0) {
 		die(MKFS_USAGE, 1, "stat failed: %s", dirname);
 	}

