[U-Boot] [PATCH] lib: zlib: update to 1.2.6

Hi,
In this patch, I update the current zlib from 1.2.5 to 1.2.6.
There is a lot of warnings when using checkpatch script, I don't know whether I should fix it or not... Since it is just copy from as it is from upstream zlib 1.2.6, so I didn't do the correction, so don't be panic when use checkpatch.
Best regards, Lei
======================================================== As it copy from zlib home page, the improvement from 1.2.5 to 1.2.6 contains following:
gzread() can now read a file that is being written concurrently gzgetc() is now a macro for increased speed Added a 'T' option to gzopen() for transparent writing (no compression) Added deflatePending() to return the amount of pending output Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode deflatePrime() can now insert bits in the middle of the stream ./configure now creates a configure.log file with all of the results Added a ./configure --solo option to compile zlib with no dependency on any libraries Fixed a problem with large file support macros Fixed a bug in contrib/puff Many portability improvements
Signed-off-by: Lei Wen leiwen@marvell.com ---
include/u-boot/zlib.h | 2002 +++++++++++++++++++++++++++++++++++++------------ lib/zlib/adler32.c | 112 ++- lib/zlib/inffast.c | 139 ++-- lib/zlib/inffast.h | 4 +- lib/zlib/inffixed.h | 6 +- lib/zlib/inflate.c | 727 ++++++++++++++++--- lib/zlib/inflate.h | 31 +- lib/zlib/inftrees.c | 93 +-- lib/zlib/inftrees.h | 27 +- lib/zlib/zutil.c | 282 +++++++- lib/zlib/zutil.h | 185 ++++- 11 files changed, 2790 insertions(+), 818 deletions(-)

On Tuesday 06 March 2012 03:55:19 Lei Wen wrote:
In this patch, I update the current zlib from 1.2.5 to 1.2.6.
There is a lot of warnings when using checkpatch script, I don't know whether I should fix it or not... Since it is just copy from as it is from upstream zlib 1.2.6, so I didn't do the correction, so don't be panic when use checkpatch.
did you test the performance ? i found it went down a bit which is why i didn't post a patch to update it to a newer version. improvements in API's we don't use aren't a good reason for updating ... -mike

Hi Mike,
On Wed, Mar 7, 2012 at 12:15 AM, Mike Frysinger vapier@gentoo.org wrote:
On Tuesday 06 March 2012 03:55:19 Lei Wen wrote:
In this patch, I update the current zlib from 1.2.5 to 1.2.6.
There is a lot of warnings when using checkpatch script, I don't know whether I should fix it or not... Since it is just copy from as it is from upstream zlib 1.2.6, so I didn't do the correction, so don't be panic when use checkpatch.
did you test the performance ? i found it went down a bit which is why i didn't post a patch to update it to a newer version. improvements in API's we don't use aren't a good reason for updating ...
I didn't do the performance test... Just did the compile and bring up a gziped kernel with the update zlib.
Is there some easy test case which could run in the uboot to show the unzip speed? I'd like to help to test it...
But your saying is right, we should always focus on our current usage.
-mike
Thanks, Lei

Dear Lei Wen,
In message CALZhoST8b_gwi=b696BcNCedoYSNs7Mb3qihioeLAzShSHwArw@mail.gmail.com you wrote:
--20cf300fafe1db2c6604ba8f33fe Content-Type: text/plain; charset=ISO-8859-1
Hi,
In this patch, I update the current zlib from 1.2.5 to 1.2.6.
There is a lot of warnings when using checkpatch script, I don't know whether I should fix it or not... Since it is just copy from as it is from upstream zlib 1.2.6, so I didn't do the correction, so don't be panic when use checkpatch.
Best regards, Lei
This text should not be here. It would become part of the commit message. Please add such comments only to the comment section, i. e. below the '---' line.
======================================================== As it copy from zlib home page, the improvement from 1.2.5 to 1.2.6 contains following:
gzread() can now read a file that is being written concurrently gzgetc() is now a macro for increased speed Added a 'T' option to gzopen() for transparent writing (no compression) Added deflatePending() to return the amount of pending output Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode deflatePrime() can now insert bits in the middle of the stream ./configure now creates a configure.log file with all of the results Added a ./configure --solo option to compile zlib with no dependency on any libraries Fixed a problem with large file support macros Fixed a bug in contrib/puff Many portability improvements
Unfortunately the new code is not even compile clean:
-> ./MAKEALL m28evk Configuring for m28evk board... In file included from /home/wd/git/u-boot/tmp/lib/crc32.c:20:0: /home/wd/git/u-boot/tmp/include/u-boot/zlib.h:86:5: error: unknown type name ‘z_const’ /home/wd/git/u-boot/tmp/include/u-boot/zlib.h:86:19: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token In file included from /home/wd/git/u-boot/tmp/lib/crc32.c:20:0: /home/wd/git/u-boot/tmp/include/u-boot/zlib.h:1326:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Z_ARG’ make[1]: *** [crc32.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [tools] Error 2
Best regards,
Wolfgang Denk

Hi Wolfgang,
On Wed, Mar 7, 2012 at 7:56 PM, Wolfgang Denk wd@denx.de wrote:
Dear Lei Wen,
In message CALZhoST8b_gwi=b696BcNCedoYSNs7Mb3qihioeLAzShSHwArw@mail.gmail.com you wrote:
--20cf300fafe1db2c6604ba8f33fe Content-Type: text/plain; charset=ISO-8859-1
Hi,
In this patch, I update the current zlib from 1.2.5 to 1.2.6.
There is a lot of warnings when using checkpatch script, I don't know whether I should fix it or not... Since it is just copy from as it is from upstream zlib 1.2.6, so I didn't do the correction, so don't be panic when use checkpatch.
Best regards, Lei
This text should not be here. It would become part of the commit message. Please add such comments only to the comment section, i. e. below the '---' line.
Opps, sorry for this...
======================================================== As it copy from zlib home page, the improvement from 1.2.5 to 1.2.6 contains following:
gzread() can now read a file that is being written concurrently gzgetc() is now a macro for increased speed Added a 'T' option to gzopen() for transparent writing (no compression) Added deflatePending() to return the amount of pending output Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode deflatePrime() can now insert bits in the middle of the stream ./configure now creates a configure.log file with all of the results Added a ./configure --solo option to compile zlib with no dependency on any libraries Fixed a problem with large file support macros Fixed a bug in contrib/puff Many portability improvements
Unfortunately the new code is not even compile clean:
-> ./MAKEALL m28evk Configuring for m28evk board... In file included from /home/wd/git/u-boot/tmp/lib/crc32.c:20:0: /home/wd/git/u-boot/tmp/include/u-boot/zlib.h:86:5: error: unknown type name ‘z_const’ /home/wd/git/u-boot/tmp/include/u-boot/zlib.h:86:19: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token In file included from /home/wd/git/u-boot/tmp/lib/crc32.c:20:0: /home/wd/git/u-boot/tmp/include/u-boot/zlib.h:1326:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Z_ARG’ make[1]: *** [crc32.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [tools] Error 2
I miss add the zconf.h into the patch... V2 patch is attached...
Best regards,
Wolfgang Denk
Thanks, Lei

Dear Lei Wen,
In message CALZhoSSzBhmZ_c79zKBQE7Z5YEtCKC_E-4Vgr35rmBLiV_LawQ@mail.gmail.com you wrote:
I miss add the zconf.h into the patch... V2 patch is attached...
Argh. Please NEVER send patches as attachments. Always send them inline. See http://www.denx.de/wiki/U-Boot/Patches
As it copy from zlib home page, the improvement from 1.2.5 to 1.2.6 contains following:
gzread() can now read a file that is being written concurrently gzgetc() is now a macro for increased speed Added a 'T' option to gzopen() for transparent writing (no compression) Added deflatePending() to return the amount of pending output Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode deflatePrime() can now insert bits in the middle of the stream ./configure now creates a configure.log file with all of the results Added a ./configure --solo option to compile zlib with no dependency on any libraries Fixed a problem with large file support macros Fixed a bug in contrib/puff Many portability improvements
This is a lot of changes / improvements for genral use, but which of these are actually useful for U-Boot?
I. e. what exactly is the motivation to switch to a new version of the code? Do you want to fix any specific bugs, or improve performance, or what?
What I see is that the code size grows by about 2 kB (measured on ARM):
-> bloat-o-meter u-boot-before u-boot-after add/remove: 23/2 grow/shrink: 2/5 up/down: 4523/-2496 (2027) function old new delta static.lenfix - 2048 +2048 inflateCopy - 352 +352 updatewindow - 308 +308 inflateSync - 276 +276 inflateSetDictionary - 192 +192 static.adler32_combine_ - 156 +156 inflateReset2 - 152 +152 inflateResetKeep - 148 +148 static.distfix - 128 +128 inflatePrime - 116 +116 inflateMark - 104 +104 syncsearch - 84 +84 zmemcmp - 68 +68 inflateSyncPoint - 64 +64 inflateGetHeader - 64 +64 inflate_copyright - 47 +47 inflateUndermine - 44 +44 inflate 5764 5800 +36 zmemzero - 28 +28 zmemcpy - 28 +28 zError - 24 +24 adler32_combine64 - 20 +20 adler32_combine - 20 +20 zlibVersion - 12 +12 zunzip 264 268 +4 inflateEnd 108 100 -8 inflateInit2_ 264 208 -56 inflate_table 1492 1428 -64 inflateReset 128 48 -80 inflate_fast 1480 1368 -112 distfix 128 - -128 lenfix 2048 - -2048
I wonder which benefits we get for this price we are paying?
Best regards,
Wolfgang Denk

Hi Wolfgang,
On Wed, Mar 7, 2012 at 10:30 PM, Wolfgang Denk wd@denx.de wrote:
Dear Lei Wen,
In message CALZhoSSzBhmZ_c79zKBQE7Z5YEtCKC_E-4Vgr35rmBLiV_LawQ@mail.gmail.com you wrote:
I miss add the zconf.h into the patch... V2 patch is attached...
Argh. Please NEVER send patches as attachments. Always send them inline. See http://www.denx.de/wiki/U-Boot/Patches
Sorry for that again. I send the patch as attachment, which is only for RFC, and another reason is the patch itself is very huge and almost all content is kept as it is from zlib main stream. Anyway, I would keep the send patch rule in mind next time.
As it copy from zlib home page, the improvement from 1.2.5 to 1.2.6 contains following:
gzread() can now read a file that is being written concurrently gzgetc() is now a macro for increased speed Added a 'T' option to gzopen() for transparent writing (no compression) Added deflatePending() to return the amount of pending output Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode deflatePrime() can now insert bits in the middle of the stream ./configure now creates a configure.log file with all of the results Added a ./configure --solo option to compile zlib with no dependency on any libraries Fixed a problem with large file support macros Fixed a bug in contrib/puff Many portability improvements
This is a lot of changes / improvements for genral use, but which of these are actually useful for U-Boot?
I. e. what exactly is the motivation to switch to a new version of the code? Do you want to fix any specific bugs, or improve performance, or what?
What I see is that the code size grows by about 2 kB (measured on ARM):
-> bloat-o-meter u-boot-before u-boot-after add/remove: 23/2 grow/shrink: 2/5 up/down: 4523/-2496 (2027) function old new delta static.lenfix - 2048 +2048 inflateCopy - 352 +352 updatewindow - 308 +308 inflateSync - 276 +276 inflateSetDictionary - 192 +192 static.adler32_combine_ - 156 +156 inflateReset2 - 152 +152 inflateResetKeep - 148 +148 static.distfix - 128 +128 inflatePrime - 116 +116 inflateMark - 104 +104 syncsearch - 84 +84 zmemcmp - 68 +68 inflateSyncPoint - 64 +64 inflateGetHeader - 64 +64 inflate_copyright - 47 +47 inflateUndermine - 44 +44 inflate 5764 5800 +36 zmemzero - 28 +28 zmemcpy - 28 +28 zError - 24 +24 adler32_combine64 - 20 +20 adler32_combine - 20 +20 zlibVersion - 12 +12 zunzip 264 268 +4 inflateEnd 108 100 -8 inflateInit2_ 264 208 -56 inflate_table 1492 1428 -64 inflateReset 128 48 -80 inflate_fast 1480 1368 -112 distfix 128 - -128 lenfix 2048 - -2048
I wonder which benefits we get for this price we are paying?
The main reason I'd like to introduce this upgrade is for I want to add the compressing feature for uboot. And the 1.2.6 has some fix for the deflate, so it is maybe a good base line for introducing it.
Also the reason why I want to enable the compressing is that sometimes we may want to dump whole ram in the uboot, and since the ram grows bigger and bigger, compressing and then send to host is a reasonable method to reduce the dumping time.
How about define a Macro like CONIFG_ENABLE_GZIP_COMPRESSION to compile the compression related code only when this flag is on?
Best regards,
Wolfgang Denk
Thanks, Lei

Dear Lei Wen,
In message CALZhoSSk3D9UY48ND_6HdZX1N_gP3rq0LP4w1e1M5bp3brzN9Q@mail.gmail.com you wrote:
I wonder which benefits we get for this price we are paying?
The main reason I'd like to introduce this upgrade is for I want to add the compressing feature for uboot.
This should be make optional code, including any extensions / additional functions that may be needed for zlib.
Most users will not need this, and they should not suffer (in terms of increased memory footprint) from such a change.
And the 1.2.6 has some fix for the deflate, so it is maybe a good base line for introducing it.
Which exact fix are you referring to?
How about define a Macro like CONIFG_ENABLE_GZIP_COMPRESSION to compile the compression related code only when this flag is on?
This makes sense, but please use standard naming rules. You will probably provide a "zip" command, so make all this depend on "CONFIG_CMD_ZIP" or so.
Best regards,
Wolfgang Denk

Hi Wolfgang,
On Thu, Mar 8, 2012 at 4:13 PM, Wolfgang Denk wd@denx.de wrote:
Dear Lei Wen,
In message CALZhoSSk3D9UY48ND_6HdZX1N_gP3rq0LP4w1e1M5bp3brzN9Q@mail.gmail.com you wrote:
I wonder which benefits we get for this price we are paying?
The main reason I'd like to introduce this upgrade is for I want to add the compressing feature for uboot.
This should be make optional code, including any extensions / additional functions that may be needed for zlib.
Most users will not need this, and they should not suffer (in terms of increased memory footprint) from such a change.
And the 1.2.6 has some fix for the deflate, so it is maybe a good base line for introducing it.
Which exact fix are you referring to?
I am referring to the zlib 1.2.5->1.2.6 changelog: Added deflatePending() to return the amount of pending output Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode deflatePrime() can now insert bits in the middle of the stream
How about define a Macro like CONIFG_ENABLE_GZIP_COMPRESSION to compile the compression related code only when this flag is on?
This makes sense, but please use standard naming rules. You will probably provide a "zip" command, so make all this depend on "CONFIG_CMD_ZIP" or so.
Yep, that is also what I am thinking.
Best regards,
Wolfgang Denk
Thanks, Lei

Dear Lei Wen,
In message CALZhoSRc1aV2JDqiZv5htDdQw28D8wn4pNSU3E9SanBwc7C1Dg@mail.gmail.com you wrote:
And the 1.2.6 has some fix for the deflate, so it is maybe a good base line for introducing it.
Which exact fix are you referring to?
I am referring to the zlib 1.2.5->1.2.6 changelog: Added deflatePending() to return the amount of pending output Allow deflateSetDictionary() and inflateSetDictionary() at any time in raw mode deflatePrime() can now insert bits in the middle of the stream
Are any of these relevant to U-Boot code? To me it looks more like extensions (which we do not use and thus not need) than bug fixes. But I may be wrong. Do you think it's fixes?
Best regards,
Wolfgang Denk
participants (3)
-
Lei Wen
-
Mike Frysinger
-
Wolfgang Denk