mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 00:49:33 +02:00
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:
@@ -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
|
Add LZO support to mtd-utils to generate LZO compressed jffs2 images
|
||||||
|
|
||||||
Unlike the kernel version, the standard lzo userspace library is used
|
Unlike the kernel version, the standard lzo userspace library is used
|
||||||
@@ -39,7 +41,7 @@ Index: git/compr.c
|
|||||||
jffs2_rtime_init();
|
jffs2_rtime_init();
|
||||||
#endif
|
#endif
|
||||||
+#ifdef CONFIG_JFFS2_LZO
|
+#ifdef CONFIG_JFFS2_LZO
|
||||||
+ jffs2_lzo_init();
|
+ jffs2_lzo_init();
|
||||||
+#endif
|
+#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -49,7 +51,7 @@ Index: git/compr.c
|
|||||||
jffs2_zlib_exit();
|
jffs2_zlib_exit();
|
||||||
#endif
|
#endif
|
||||||
+#ifdef CONFIG_JFFS2_LZO
|
+#ifdef CONFIG_JFFS2_LZO
|
||||||
+ jffs2_lzo_exit();
|
+ jffs2_lzo_exit();
|
||||||
+#endif
|
+#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
Subject: [mtd-utils patch 2/2] Add favourlzo compression mode
|
||||||
|
|
||||||
Add a favourlzo compression mode to mtd-utils
|
Add a favourlzo compression mode to mtd-utils
|
||||||
|
|
||||||
This allows lzo compression to be used in the cases where the
|
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)
|
+ struct jffs2_compressor *best, uint32_t size, uint32_t bestsize)
|
||||||
+{
|
+{
|
||||||
+ switch (jffs2_compression_mode) {
|
+ switch (jffs2_compression_mode) {
|
||||||
+ case JFFS2_COMPR_MODE_SIZE:
|
+ case JFFS2_COMPR_MODE_SIZE:
|
||||||
+ if (bestsize > size)
|
+ if (bestsize > size)
|
||||||
+ return 1;
|
+ return 1;
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ case JFFS2_COMPR_MODE_FAVOURLZO:
|
+ case JFFS2_COMPR_MODE_FAVOURLZO:
|
||||||
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > size))
|
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > size))
|
||||||
+ return 1;
|
+ return 1;
|
||||||
+ if ((best->compr != JFFS2_COMPR_LZO) && (bestsize > size))
|
+ if ((best->compr != JFFS2_COMPR_LZO) && (bestsize > size))
|
||||||
+ return 1;
|
+ return 1;
|
||||||
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > (size * FAVOUR_LZO_PERCENT / 100)))
|
+ if ((this->compr == JFFS2_COMPR_LZO) && (bestsize > (size * FAVOUR_LZO_PERCENT / 100)))
|
||||||
+ return 1;
|
+ return 1;
|
||||||
+ if ((bestsize * FAVOUR_LZO_PERCENT / 100) > size)
|
+ if ((bestsize * FAVOUR_LZO_PERCENT / 100) > size)
|
||||||
+ return 1;
|
+ return 1;
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+ /* Shouldn't happen */
|
+ /* Shouldn't happen */
|
||||||
+ return 0;
|
+ return 0;
|
||||||
@@ -70,9 +72,9 @@ Index: git/compr.c
|
|||||||
+ uint32_t needed_buf_size;
|
+ uint32_t needed_buf_size;
|
||||||
+
|
+
|
||||||
+ if (jffs2_compression_mode == JFFS2_COMPR_MODE_FAVOURLZO)
|
+ 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
|
+ 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 */
|
/* Skip decompress-only backwards-compatibility and disabled modules */
|
||||||
if ((!this->compress)||(this->disabled))
|
if ((!this->compress)||(this->disabled))
|
||||||
@@ -105,7 +107,7 @@ Index: git/compr.c
|
|||||||
act_buf += sprintf(act_buf,"size");
|
act_buf += sprintf(act_buf,"size");
|
||||||
break;
|
break;
|
||||||
+ case JFFS2_COMPR_MODE_FAVOURLZO:
|
+ case JFFS2_COMPR_MODE_FAVOURLZO:
|
||||||
+ act_buf += sprintf(act_buf,"favourlzo");
|
+ act_buf += sprintf(act_buf, "favourlzo");
|
||||||
+ break;
|
+ break;
|
||||||
default:
|
default:
|
||||||
act_buf += sprintf(act_buf,"unkown");
|
act_buf += sprintf(act_buf,"unkown");
|
||||||
@@ -134,3 +136,5 @@ Index: git/compr.h
|
|||||||
|
|
||||||
#define kmalloc(a,b) malloc(a)
|
#define kmalloc(a,b) malloc(a)
|
||||||
#define kfree(a) free(a)
|
#define kfree(a) free(a)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user