mtd-utils: Tweak LZO patches
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2145 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
parent
b15ec7a7ff
commit
df6134d575
|
@ -1,3 +1,5 @@
|
|||
Subject: [mtd-utils patch 1/2] Add lzo support to mtd-utils
|
||||
|
||||
Add LZO support to mtd-utils to generate LZO compressed jffs2 images
|
||||
|
||||
Unlike the kernel version, the standard lzo userspace library is used
|
||||
|
@ -39,7 +41,7 @@ Index: git/compr.c
|
|||
jffs2_rtime_init();
|
||||
#endif
|
||||
+#ifdef CONFIG_JFFS2_LZO
|
||||
+ jffs2_lzo_init();
|
||||
+ jffs2_lzo_init();
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,7 +51,7 @@ Index: git/compr.c
|
|||
jffs2_zlib_exit();
|
||||
#endif
|
||||
+#ifdef CONFIG_JFFS2_LZO
|
||||
+ jffs2_lzo_exit();
|
||||
+ jffs2_lzo_exit();
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Subject: [mtd-utils patch 2/2] Add favourlzo compression mode
|
||||
|
||||
Add a favourlzo compression mode to mtd-utils
|
||||
|
||||
This allows lzo compression to be used in the cases where the
|
||||
|
@ -35,21 +37,21 @@ Index: git/compr.c
|
|||
+ struct jffs2_compressor *best, uint32_t size, uint32_t bestsize)
|
||||
+{
|
||||
+ switch (jffs2_compression_mode) {
|
||||
+ case JFFS2_COMPR_MODE_SIZE:
|
||||
+ if (bestsize > size)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+ case JFFS2_COMPR_MODE_FAVOURLZO:
|
||||
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > size))
|
||||
+ return 1;
|
||||
+ if ((best->compr != JFFS2_COMPR_LZO) && (bestsize > size))
|
||||
+ return 1;
|
||||
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > (size * FAVOUR_LZO_PERCENT / 100)))
|
||||
+ return 1;
|
||||
+ if ((bestsize * FAVOUR_LZO_PERCENT / 100) > size)
|
||||
+ return 1;
|
||||
+ case JFFS2_COMPR_MODE_SIZE:
|
||||
+ if (bestsize > size)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+ case JFFS2_COMPR_MODE_FAVOURLZO:
|
||||
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > size))
|
||||
+ return 1;
|
||||
+ if ((best->compr != JFFS2_COMPR_LZO) && (bestsize > size))
|
||||
+ return 1;
|
||||
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > (size * FAVOUR_LZO_PERCENT / 100)))
|
||||
+ return 1;
|
||||
+ if ((bestsize * FAVOUR_LZO_PERCENT / 100) > size)
|
||||
+ return 1;
|
||||
+
|
||||
+ return 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /* Shouldn't happen */
|
||||
+ return 0;
|
||||
|
@ -70,9 +72,9 @@ Index: git/compr.c
|
|||
+ uint32_t needed_buf_size;
|
||||
+
|
||||
+ if (jffs2_compression_mode == JFFS2_COMPR_MODE_FAVOURLZO)
|
||||
+ needed_buf_size = orig_slen+jffs2_compression_check;
|
||||
+ needed_buf_size = orig_slen + jffs2_compression_check;
|
||||
+ else
|
||||
+ needed_buf_size = orig_dlen+jffs2_compression_check;
|
||||
+ needed_buf_size = orig_dlen + jffs2_compression_check;
|
||||
+
|
||||
/* Skip decompress-only backwards-compatibility and disabled modules */
|
||||
if ((!this->compress)||(this->disabled))
|
||||
|
@ -105,7 +107,7 @@ Index: git/compr.c
|
|||
act_buf += sprintf(act_buf,"size");
|
||||
break;
|
||||
+ case JFFS2_COMPR_MODE_FAVOURLZO:
|
||||
+ act_buf += sprintf(act_buf,"favourlzo");
|
||||
+ act_buf += sprintf(act_buf, "favourlzo");
|
||||
+ break;
|
||||
default:
|
||||
act_buf += sprintf(act_buf,"unkown");
|
||||
|
@ -134,3 +136,5 @@ Index: git/compr.h
|
|||
|
||||
#define kmalloc(a,b) malloc(a)
|
||||
#define kfree(a) free(a)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue