The same cpio that generates the archive seems to give checksum errors when extracting it.

1,030 views
Skip to first unread message

Triacta

unread,
Mar 6, 2017, 11:45:56 PM3/6/17
to swupdate
I am having checksum errors with SWUpdate, so I wanted to make sure that my version of cpio works with the cpio library that SWUpdate is using. However, I found that even cpio itself is not working as I expect it (but perhaps I have an incorrect understanding on how it should work):

>0< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM  ~/swupdate/images >  uname -a
Linux mbp-vmw-ub1 4.4.0-62-generic #83~14.04.1-Ubuntu SMP Wed Jan 18 18:10:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:31 PM  ~/swupdate/images >  which cpio
/bin/cpio
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:31 PM  ~/swupdate/images >  cpio --version
cpio (GNU cpio) 2.11
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Phil Nelson, David MacKenzie, John Oleynick,
and Sergey Poznyakoff.

>2< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM  ~/swupdate/images >  ls -l
total 192524
-rw-r--r-- 1 alain alain 121634816 Mar  6 23:17 g5-dev-image-imx6ul-var-dart.ext4
-rw-r--r-- 1 alain alain  75497472 Mar  6 23:17 g5-prod-image-imx6ul-var-dart.ext4
-rw-r--r-- 1 alain alain      1065 Mar  6 23:17 sw-description
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM  ~/swupdate/images >

>0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM  ~/swupdate/images >  ls -r | cpio -ov -H crc > ../cpio/with-crc.swu
sw-description
g5-prod-image-imx6ul-var-dart.ext4
g5-dev-image-imx6ul-var-dart.ext4
385028 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM  ~/swupdate/images >  ls -r | cpio -ov > ../cpio/no-crc.swu
sw-description
g5-prod-image-imx6ul-var-dart.ext4
g5-dev-image-imx6ul-var-dart.ext4
385027 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM  ~/swupdate/images >  cd ../cpio/
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM  ~/swupdate/cpio >  ls
no-crc.swu  with-crc.swu
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM  ~/swupdate/cpio >  cpio -t < no-crc.swu
sw-description
g5-prod-image-imx6ul-var-dart.ext4
g5-dev-image-imx6ul-var-dart.ext4
385027 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:24 PM  ~/swupdate/cpio >  cpio -t < with-crc.swu
sw-description
g5-prod-image-imx6ul-var-dart.ext4
g5-dev-image-imx6ul-var-dart.ext4
385028 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:24 PM  ~/swupdate/cpio >  cpio -t --only-verify-crc < no-crc.swu
sw-description
cpio: sw-description: checksum error (0x0, should be 0xf07392ec)
g5-prod-image-imx6ul-var-dart.ext4
cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error (0x0, should be 0xf07392ec)
g5-dev-image-imx6ul-var-dart.ext4
cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error (0x0, should be 0xf07392ec)
385027 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:24 PM  ~/swupdate/cpio >  cpio -t --only-verify-crc < with-crc.swu
sw-description
g5-prod-image-imx6ul-var-dart.ext4
cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error (0x117c24ad9, should be 0x17c24ad9)
g5-dev-image-imx6ul-var-dart.ext4
cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error (0x1bd77e6f4, should be 0xbd77e6f4)
385028 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM  ~/swupdate/cpio >  cpio -iv < no-crc.swu
sw-description
g5-prod-image-imx6ul-var-dart.ext4
g5-dev-image-imx6ul-var-dart.ext4
385027 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM  ~/swupdate/cpio >  rm sw-description g5*
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM  ~/swupdate/cpio >  cpio -iv < with-crc.swu
sw-description
cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error (0x117c24ad9, should be 0x17c24ad9)
g5-prod-image-imx6ul-var-dart.ext4
cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error (0x1bd77e6f4, should be 0xbd77e6f4)
g5-dev-image-imx6ul-var-dart.ext4
385028 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM  ~/swupdate/cpio >  ls
g5-dev-image-imx6ul-var-dart.ext4  g5-prod-image-imx6ul-var-dart.ext4  no-crc.swu  sw-description  with-crc.swu
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM  ~/swupdate/cpio >  diff g5-prod-image-imx6ul-var-dart.ext4 ../images/g5-prod-image-imx6ul-var-dart.ext4
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM  ~/swupdate/cpio >  diff g5-dev-image-imx6ul-var-dart.ext4 ../images/g5-dev-image-imx6ul-var-dart.ext4
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM  ~/swupdate/cpio >  diff sw-description ../images/sw-description
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM  ~/swupdate/cpio >  rm sw* g5*
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM  ~/swupdate/cpio >  ls
no-crc.swu  with-crc.swu
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM  ~/swupdate/cpio >  cpio -iv -H crc < with-crc.swu
sw-description
cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error (0x117c24ad9, should be 0x17c24ad9)
g5-prod-image-imx6ul-var-dart.ext4
cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error (0x1bd77e6f4, should be 0xbd77e6f4)
g5-dev-image-imx6ul-var-dart.ext4
385028 blocks
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM  ~/swupdate/cpio >  ls
g5-dev-image-imx6ul-var-dart.ext4  g5-prod-image-imx6ul-var-dart.ext4  no-crc.swu  sw-description  with-crc.swu
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM  ~/swupdate/cpio >  diff g5-prod-image-imx6ul-var-dart.ext4 ../images/g5-prod-image-imx6ul-var-dart.ext4
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM  ~/swupdate/cpio >  diff g5-dev-image-imx6ul-var-dart.ext4 ../images/g5-dev-image-imx6ul-var-dart.ext4
>0< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM  ~/swupdate/cpio >  diff sw-description ../images/sw-description


Note the following:

1. In swupdate.bbclass, I see that it uses the command '... cpio -ov -H crc ...' so assuming that the cpio library that SWUpdate uses is the same as what the cpio binary links with, it is not surprising that SWupdate gives the same checksum errors as I'm getting with the command-line (for the file with-crc.swu)

2. I can understand that if I don't generate a checksum, then checksum verification fails (for the file no-crc.swu)

3. In both cases (with or without checksum) cpio continues to extract the files. When I diff them, they are the exact same as the originals. However, SWUpdate refuses to extract the files if a checksum error occurs.

Please help.




okt...@gmail.com

unread,
Mar 7, 2017, 6:10:22 AM3/7/17
to swupdate
> However, I found that even cpio itself is not working as I expect it

See for example <https://bugzilla.redhat.com/show_bug.cgi?id=1415081>; the issue is not RHEL-related, but affects cpio on Ubuntu as well.

However, I have not seen SWUpdate to refuse to extract files from affected .swu image.

Message has been deleted

Stefano Babic

unread,
Mar 7, 2017, 10:12:20 AM3/7/17
to alain.j...@gmail.com, swupdate, okt...@gmail.com
On 07/03/2017 16:08, alain.j...@gmail.com wrote:
> Thanks but the bug you link to relates to files > 200 MB. As I show in my original post, my files are less than 200MB.
>
> Stefano, I forgot to mention that I'm running Swupdate v2016.07.0
>

There are not know issues regarding CPIO on any distributions together
with SWUpdate. Try to build with meta-swupdate - rather, it is not
possible to understand what is going wrong on your PC.

Best regards,
Stefano Babic

--
Meet DENX at the Embedded World Trade Show
14 Mar - 16 Mar 2017, Nuremberg Trade Fair Centre, Hall 4, Booth 581
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

Triacta

unread,
Mar 7, 2017, 11:09:47 AM3/7/17
to swupdate, sba...@denx.de
Hi Stefano,

1. a) Could you please run:

cpio --version

on your system and provide the output?

1. b) what library are you using to extract the files and check the checksum? Is it the same as the library that cpio links with?

1. c) Is there an configuration option to skip checksum verification?





2. I did build swupdate with meta-swupdate.

3. I used the bitbake devshell to find out which cpio the swupdate.bbclass line 162 [
    line = 'for i in ' + ' '.join(list_for_cpio) + '; do echo $i;done | cpio -ov -H crc >' + os.path.join(deploydir,d.getVar('IMAGE_NAME', True) + '.swu')
] is calling:

>0< alain@mbp-vmw-ub1 Tue Mar 07 10:28 AM  /media/alain/Yocto/var-mx6ul-mx7-yocto-jethro/build-fb >  bitbake g5-swu-image -c devshell
Loading cache: 100% |########################################################################################################################################################| ETA:  00:00:00
Loaded 2785 entries from dependency cache.
Parsing recipes: 100% |######################################################################################################################################################| Time: 00:00:00
Parsing of 2223 .bb files complete (2218 cached, 5 parsed). 2789 targets, 429 skipped, 5 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "imx6ul-var-dart"
DISTRO            = "fsl-imx-fb"
DISTRO_VERSION    = "4.1.15-1.2.0"
TUNE_FEATURES     = "arm armv7a vfp neon callconvention-hard cortexa7"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto        = "jethro:e08994ce953ff5ab49b260e7763a40bfad4285ca"
meta-oe
meta-multimedia   = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90"
meta-fsl-arm      = "HEAD:35b8b9bd9863de208ab60e33b55f10ee43e2619b"
meta-fsl-arm-extra = "HEAD:e200df91b70da254461c59082ddd5db0a3c415a2"
meta-fsl-demos    = "HEAD:2231e946e7a94d096394f2b2477e8184c9bbde7b"
meta-bsp
meta-sdk          = "HEAD:dfbc90ee74624ce3be636c8bd2a47114fa2b71aa"
meta-browser      = "HEAD:b6d46d69a261fe6bd7c1e9811dc2a9bbd0b79aeb"
meta-gnome
meta-networking
meta-python
meta-ruby
meta-filesystems  = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90"
meta-qt5          = "HEAD:d5536e34ec985c82b621448ab4325e5cbba38560"
meta-variscite-mx6ul-mx7 = "imx_4.1.15_ga-var01:ea7b3bea6b0cfb9a465df3140b261179d23789d3"
meta-triacta      = "swupdate:48c96cb98c01632daadf3c038434c66d1ac63121"
meta-webserver    = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90"
meta-swupdate     = "master:6cc053531bce76a1fe98b83e36b4a97ca9c672c3"

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
Currently 1 running tasks (95 of 95):
0: g5-swu-image-1.0-r0 do_devshell (pid 12031)
NOTE: Tasks Summary: Attempted 95 tasks of which 94 didn't need to be rerun and all succeeded.


>0< root@mbp-vmw-ub1 Tue Mar 07 10:29 AM  /media/alain/Yocto/var-mx6ul-mx7-yocto-jethro/build-fb/tmp/work/imx6ul_var_dart-poky-linux-gnueabi/g5-swu-image/1.0-r0/g5-swu-image >  which cpio
/bin/cpio
>0< root@mbp-vmw-ub1 Tue Mar 07 10:29 AM  /media/alain/Yocto/var-mx6ul-mx7-yocto-jethro/build-fb/tmp/work/imx6ul_var_dart-poky-linux-gnueabi/g5-swu-image/1.0-r0/g5-swu-image >  cpio --version
cpio (GNU cpio) 2.11
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Phil Nelson, David MacKenzie, John Oleynick,
and Sergey Poznyakoff.

Therefore swupdate.bbclass calls whatever cpio is in the PATH, and given that Yocto does not provide one, it is picked up from the system's /bin/cpio.

4. I provisioned a virtual server on Vultr.com with an Ubuntu 16.10 x64 from scratch. I ran the following commands:


alain@vultr1:~/swupdate/images$ which cpio
/bin/cpio
alain@vultr1:~/swupdate/images$ cpio --version
cpio (GNU cpio) 2.11
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Phil Nelson, David MacKenzie, John Oleynick,
and Sergey Poznyakoff.

Then, I tested to see if I can reproduce the mentioned cpio bug:

alain@vultr1:~/swupdate/images$ SIZES="1 2 4 8 16 32 64 128 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250"
alain@vultr1:~/swupdate/images$ for i in $SIZES; do
> dd if=/dev/urandom of=rand-$i bs=1M count=$i
> echo rand-$i | cpio --create --format=crc --verbose > rand-$i.cpio
> cpio --extract --only-verify-crc < rand-$i.cpio
> done
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00770667 s, 136 MB/s
rand-1
2049 blocks
2049 blocks
2+0 records in
2+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.0159372 s, 132 MB/s
rand-2
4097 blocks
4097 blocks
4+0 records in
4+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.0382708 s, 110 MB/s
rand-4
8193 blocks
8193 blocks
8+0 records in
8+0 records out
8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.0677005 s, 124 MB/s
rand-8
16385 blocks
16385 blocks
16+0 records in
16+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 0.114722 s, 146 MB/s
rand-16
32769 blocks
32769 blocks
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.240495 s, 140 MB/s
rand-32
65537 blocks
65537 blocks
64+0 records in
64+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 0.500194 s, 134 MB/s
rand-64
131073 blocks
cpio: rand-64: checksum error (0x1fdf3ccca, should be 0xfdf3ccca)
131073 blocks
128+0 records in
128+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 0.93671 s, 143 MB/s
rand-128
262145 blocks
cpio: rand-128: checksum error (0x3fbfe2b00, should be 0xfbfe2b00)
262145 blocks
10+0 records in
10+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 0.0651765 s, 161 MB/s
rand-10
20481 blocks
20481 blocks
20+0 records in
20+0 records out
20971520 bytes (21 MB, 20 MiB) copied, 0.14561 s, 144 MB/s
rand-20
40961 blocks
40961 blocks
30+0 records in
30+0 records out
31457280 bytes (31 MB, 30 MiB) copied, 0.209185 s, 150 MB/s
rand-30
61441 blocks
61441 blocks
40+0 records in
40+0 records out
41943040 bytes (42 MB, 40 MiB) copied, 0.302915 s, 138 MB/s
rand-40
81921 blocks
cpio: rand-40: checksum error (0x13ebb7a7e, should be 0x3ebb7a7e)
81921 blocks
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.356088 s, 147 MB/s
rand-50
102401 blocks
cpio: rand-50: checksum error (0x18e78f740, should be 0x8e78f740)
102401 blocks
60+0 records in
60+0 records out
62914560 bytes (63 MB, 60 MiB) copied, 0.423133 s, 149 MB/s
rand-60
122881 blocks
cpio: rand-60: checksum error (0x1de1634cc, should be 0xde1634cc)
122881 blocks
70+0 records in
70+0 records out
73400320 bytes (73 MB, 70 MiB) copied, 0.508893 s, 144 MB/s
rand-70
143361 blocks
cpio: rand-70: checksum error (0x22dcd28ff, should be 0x2dcd28ff)
143361 blocks
80+0 records in
80+0 records out
83886080 bytes (84 MB, 80 MiB) copied, 0.600626 s, 140 MB/s
rand-80
163841 blocks
cpio: rand-80: checksum error (0x27d72266e, should be 0x7d72266e)
163841 blocks
90+0 records in
90+0 records out
94371840 bytes (94 MB, 90 MiB) copied, 0.66256 s, 142 MB/s
rand-90
184321 blocks
cpio: rand-90: checksum error (0x2cd2f0fc0, should be 0xcd2f0fc0)
184321 blocks
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.70377 s, 149 MB/s
rand-100
204801 blocks
cpio: rand-100: checksum error (0x31ccfeb56, should be 0x1ccfeb56)
204801 blocks
110+0 records in
110+0 records out
115343360 bytes (115 MB, 110 MiB) copied, 0.868234 s, 133 MB/s
rand-110
225281 blocks
cpio: rand-110: checksum error (0x36c8e39f6, should be 0x6c8e39f6)
225281 blocks
120+0 records in
120+0 records out
125829120 bytes (126 MB, 120 MiB) copied, 0.858858 s, 147 MB/s
rand-120
245761 blocks
cpio: rand-120: checksum error (0x3bc4abd74, should be 0xbc4abd74)
245761 blocks
130+0 records in
130+0 records out
136314880 bytes (136 MB, 130 MiB) copied, 0.90325 s, 151 MB/s
rand-130
266241 blocks
cpio: rand-130: checksum error (0x40bf00766, should be 0xbf00766)
266241 blocks
140+0 records in
140+0 records out
146800640 bytes (147 MB, 140 MiB) copied, 1.01834 s, 144 MB/s
rand-140
286721 blocks
cpio: rand-140: checksum error (0x45b9fc59e, should be 0x5b9fc59e)
286721 blocks
150+0 records in
150+0 records out
157286400 bytes (157 MB, 150 MiB) copied, 1.05808 s, 149 MB/s
rand-150
307201 blocks
cpio: rand-150: checksum error (0x4ab540d93, should be 0xab540d93)
307201 blocks
160+0 records in
160+0 records out
167772160 bytes (168 MB, 160 MiB) copied, 1.14762 s, 146 MB/s
rand-160
327681 blocks
cpio: rand-160: checksum error (0x4faf421eb, should be 0xfaf421eb)
327681 blocks
170+0 records in
170+0 records out
178257920 bytes (178 MB, 170 MiB) copied, 1.17578 s, 152 MB/s
rand-170
348161 blocks
cpio: rand-170: checksum error (0x54ab0cbb1, should be 0x4ab0cbb1)
348161 blocks
180+0 records in
180+0 records out
188743680 bytes (189 MB, 180 MiB) copied, 1.27836 s, 148 MB/s
rand-180
368641 blocks
cpio: rand-180: checksum error (0x59a587384, should be 0x9a587384)
368641 blocks
190+0 records in
190+0 records out
199229440 bytes (199 MB, 190 MiB) copied, 1.40178 s, 142 MB/s
rand-190
389121 blocks
cpio: rand-190: checksum error (0x5ea39a3b6, should be 0xea39a3b6)
389121 blocks
200+0 records in
200+0 records out
209715200 bytes (210 MB, 200 MiB) copied, 1.41094 s, 149 MB/s
rand-200
409601 blocks
cpio: rand-200: checksum error (0x639c454d6, should be 0x39c454d6)
409601 blocks
210+0 records in
210+0 records out
220200960 bytes (220 MB, 210 MiB) copied, 1.48364 s, 148 MB/s
rand-210
430081 blocks
cpio: rand-210: checksum error (0x6897340c7, should be 0x897340c7)
430081 blocks
220+0 records in
220+0 records out
230686720 bytes (231 MB, 220 MiB) copied, 1.50253 s, 154 MB/s
rand-220
450561 blocks
cpio: rand-220: checksum error (0x6d923178a, should be 0xd923178a)
450561 blocks
230+0 records in
230+0 records out
241172480 bytes (241 MB, 230 MiB) copied, 1.6295 s, 148 MB/s
rand-230
471041 blocks
cpio: rand-230: checksum error (0x728cd911c, should be 0x28cd911c)
471041 blocks
240+0 records in
240+0 records out
251658240 bytes (252 MB, 240 MiB) copied, 1.64275 s, 153 MB/s
rand-240
491521 blocks
cpio: rand-240: checksum error (0x77884d2ca, should be 0x7884d2ca)
491521 blocks
250+0 records in
250+0 records out
262144000 bytes (262 MB, 250 MiB) copied, 1.70776 s, 154 MB/s
rand-250
512001 blocks
cpio: rand-250: checksum error (0x7c83383e1, should be 0xc83383e1)
512001 blocks
alain@vultr1:~/swupdate/images$ ls -l
total 7792844
-rw-r--r-- 1 alain alain   1048576 Mar  7 15:40 rand-1
-rw-r--r-- 1 alain alain   1049088 Mar  7 15:40 rand-1.cpio
-rw-r--r-- 1 alain alain  10485760 Mar  7 15:40 rand-10
-rw-r--r-- 1 alain alain  10486272 Mar  7 15:40 rand-10.cpio
-rw-r--r-- 1 alain alain 104857600 Mar  7 15:40 rand-100
-rw-r--r-- 1 alain alain 104858112 Mar  7 15:40 rand-100.cpio
-rw-r--r-- 1 alain alain 115343360 Mar  7 15:40 rand-110
-rw-r--r-- 1 alain alain 115343872 Mar  7 15:40 rand-110.cpio
-rw-r--r-- 1 alain alain 125829120 Mar  7 15:40 rand-120
-rw-r--r-- 1 alain alain 125829632 Mar  7 15:40 rand-120.cpio
-rw-r--r-- 1 alain alain 134217728 Mar  7 15:40 rand-128
-rw-r--r-- 1 alain alain 134218240 Mar  7 15:40 rand-128.cpio
-rw-r--r-- 1 alain alain 136314880 Mar  7 15:40 rand-130
-rw-r--r-- 1 alain alain 136315392 Mar  7 15:40 rand-130.cpio
-rw-r--r-- 1 alain alain 146800640 Mar  7 15:40 rand-140
-rw-r--r-- 1 alain alain 146801152 Mar  7 15:40 rand-140.cpio
-rw-r--r-- 1 alain alain 157286400 Mar  7 15:40 rand-150
-rw-r--r-- 1 alain alain 157286912 Mar  7 15:40 rand-150.cpio
-rw-r--r-- 1 alain alain  16777216 Mar  7 15:40 rand-16
-rw-r--r-- 1 alain alain  16777728 Mar  7 15:40 rand-16.cpio
-rw-r--r-- 1 alain alain 167772160 Mar  7 15:40 rand-160
-rw-r--r-- 1 alain alain 167772672 Mar  7 15:40 rand-160.cpio
-rw-r--r-- 1 alain alain 178257920 Mar  7 15:41 rand-170
-rw-r--r-- 1 alain alain 178258432 Mar  7 15:41 rand-170.cpio
-rw-r--r-- 1 alain alain 188743680 Mar  7 15:41 rand-180
-rw-r--r-- 1 alain alain 188744192 Mar  7 15:41 rand-180.cpio
-rw-r--r-- 1 alain alain 199229440 Mar  7 15:41 rand-190
-rw-r--r-- 1 alain alain 199229952 Mar  7 15:41 rand-190.cpio
-rw-r--r-- 1 alain alain   2097152 Mar  7 15:40 rand-2
-rw-r--r-- 1 alain alain   2097664 Mar  7 15:40 rand-2.cpio
-rw-r--r-- 1 alain alain  20971520 Mar  7 15:40 rand-20
-rw-r--r-- 1 alain alain  20972032 Mar  7 15:40 rand-20.cpio
-rw-r--r-- 1 alain alain 209715200 Mar  7 15:41 rand-200
-rw-r--r-- 1 alain alain 209715712 Mar  7 15:41 rand-200.cpio
-rw-r--r-- 1 alain alain 220200960 Mar  7 15:41 rand-210
-rw-r--r-- 1 alain alain 220201472 Mar  7 15:41 rand-210.cpio
-rw-r--r-- 1 alain alain 230686720 Mar  7 15:41 rand-220
-rw-r--r-- 1 alain alain 230687232 Mar  7 15:41 rand-220.cpio
-rw-r--r-- 1 alain alain 241172480 Mar  7 15:41 rand-230
-rw-r--r-- 1 alain alain 241172992 Mar  7 15:41 rand-230.cpio
-rw-r--r-- 1 alain alain 251658240 Mar  7 15:41 rand-240
-rw-r--r-- 1 alain alain 251658752 Mar  7 15:41 rand-240.cpio
-rw-r--r-- 1 alain alain 262144000 Mar  7 15:41 rand-250
-rw-r--r-- 1 alain alain 262144512 Mar  7 15:41 rand-250.cpio
-rw-r--r-- 1 alain alain  31457280 Mar  7 15:40 rand-30
-rw-r--r-- 1 alain alain  31457792 Mar  7 15:40 rand-30.cpio
-rw-r--r-- 1 alain alain  33554432 Mar  7 15:40 rand-32
-rw-r--r-- 1 alain alain  33554944 Mar  7 15:40 rand-32.cpio
-rw-r--r-- 1 alain alain   4194304 Mar  7 15:40 rand-4
-rw-r--r-- 1 alain alain   4194816 Mar  7 15:40 rand-4.cpio
-rw-r--r-- 1 alain alain  41943040 Mar  7 15:40 rand-40
-rw-r--r-- 1 alain alain  41943552 Mar  7 15:40 rand-40.cpio
-rw-r--r-- 1 alain alain  52428800 Mar  7 15:40 rand-50
-rw-r--r-- 1 alain alain  52429312 Mar  7 15:40 rand-50.cpio
-rw-r--r-- 1 alain alain  62914560 Mar  7 15:40 rand-60
-rw-r--r-- 1 alain alain  62915072 Mar  7 15:40 rand-60.cpio
-rw-r--r-- 1 alain alain  67108864 Mar  7 15:40 rand-64
-rw-r--r-- 1 alain alain  67109376 Mar  7 15:40 rand-64.cpio
-rw-r--r-- 1 alain alain  73400320 Mar  7 15:40 rand-70
-rw-r--r-- 1 alain alain  73400832 Mar  7 15:40 rand-70.cpio
-rw-r--r-- 1 alain alain   8388608 Mar  7 15:40 rand-8
-rw-r--r-- 1 alain alain   8389120 Mar  7 15:40 rand-8.cpio
-rw-r--r-- 1 alain alain  83886080 Mar  7 15:40 rand-80
-rw-r--r-- 1 alain alain  83886592 Mar  7 15:40 rand-80.cpio
-rw-r--r-- 1 alain alain  94371840 Mar  7 15:40 rand-90
-rw-r--r-- 1 alain alain  94372352 Mar  7 15:40 rand-90.cpio
alain@vultr1:~/swupdate/images$

I also tested the same above commands on my PC and got the exact same results.

So, both on my PC (Ubuntu 14.04 x64) and on a newly provisioned virtual server (Ubuntu 16.10 x64), it seems that cpio is the same version 2.11 and is behaving the same way with a checksum error when the file size is around 40MB.

Thanks,
Alain.

Stefano Babic

unread,
Mar 7, 2017, 11:14:37 AM3/7/17
to Triacta, swupdate, sba...@denx.de
On 07/03/2017 17:09, Triacta wrote:
> *Hi Stefano,*
> *
> *
> *1. a) Could you please run:*
> *
> *
> *cpio --version*
> *
> *
> *on your system and provide the output?*
> *


stefano@papero:~$ cpio --version
cpio (GNU cpio) 2.11
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Phil Nelson, David MacKenzie, John Oleynick,
and Sergey Poznyakoff.


But I have no idea what you want to prove...

Best regards,
Stefano Babic

> *
> *1. b) what library are you using to extract the files and check the
> checksum? Is it the same as the library that cpio links with?*
> *
> *
> *1. c) Is there an configuration option to skip checksum verification?*
>
>
>
>
>
> 2. I did build swupdate with meta-swupdate.
>
> 3. I used the bitbake devshell to find out which cpio the
> swupdate.bbclass line 162 [
> line = 'for i in ' + ' '.join(list_for_cpio) + '; do echo $i;done |
> *cpio -ov -H crc* >' + os.path.join(deploydir,d.getVar('IMAGE_NAME',
> True) + '.swu')
> ] is calling:
>
>>0< alain@mbp-vmw-ub1 Tue Mar 07 10:28 AM
> /media/alain/Yocto/var-mx6ul-mx7-yocto-jethro/build-fb > *bitbake
> g5-swu-image -c devshell*
> *meta-swupdate = "master:6cc053531bce76a1fe98b83e36b4a97ca9c672c3"*
>
> NOTE: Preparing RunQueue
> NOTE: Executing SetScene Tasks
> NOTE: Executing RunQueue Tasks
> Currently 1 running tasks (95 of 95):
> 0: g5-swu-image-1.0-r0 do_devshell (pid 12031)
> NOTE: Tasks Summary: Attempted 95 tasks of which 94 didn't need to be
> rerun and all succeeded.
>
>
>>0< root@mbp-vmw-ub1 Tue Mar 07 10:29 AM
> /media/alain/Yocto/var-mx6ul-mx7-yocto-jethro/build-fb/tmp/work/imx6ul_var_dart-poky-linux-gnueabi/g5-swu-image/1.0-r0/g5-swu-image
>> *which cpio*
> /bin/cpio
>>0< root@mbp-vmw-ub1 Tue Mar 07 10:29 AM
> /media/alain/Yocto/var-mx6ul-mx7-yocto-jethro/build-fb/tmp/work/imx6ul_var_dart-poky-linux-gnueabi/g5-swu-image/1.0-r0/g5-swu-image
>> *cpio --version*
> *cpio (GNU cpio) 2.11*
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Phil Nelson, David MacKenzie, John Oleynick,
> and Sergey Poznyakoff.
>
> Therefore swupdate.bbclass calls whatever cpio is in the PATH, and given
> that Yocto does not provide one, it is picked up from the system's
> /bin/cpio.
>
> 4. I provisioned a virtual server on Vultr.com with an Ubuntu 16.10 x64
> from scratch. I ran the following commands:
>
>
> alain@vultr1:~/swupdate/images$ *which cpio*
> /bin/cpio
> alain@vultr1:~/swupdate/images$ *cpio --version*
> *cpio (GNU cpio) 2.11*
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Phil Nelson, David MacKenzie, John Oleynick,
> and Sergey Poznyakoff.
>
> Then, I tested to see if I can reproduce the mentioned cpio bug:
>
> alain@vultr1:~/swupdate/images$ *SIZES="1 2 4 8 16 32 64 128 10 20 30 40
> 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230
> 240 250"*
> alain@vultr1:~/swupdate/images$ *for i in $SIZES; do*
>> *dd if=/dev/urandom of=rand-$i bs=1M count=$i*
>> *echo rand-$i | cpio --create --format=crc --verbose > rand-$i.cpio*
>> *cpio --extract --only-verify-crc < rand-$i.cpio*
>> *done*
> *cpio: rand-64: checksum error (0x1fdf3ccca, should be 0xfdf3ccca)*
> *cpio: rand-40: checksum error (0x13ebb7a7e, should be 0x3ebb7a7e)*
> sba...@denx.de <javascript:>
> =====================================================================
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To post to this group, send email to swup...@googlegroups.com
> <mailto:swup...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Triacta

unread,
Mar 7, 2017, 11:54:37 AM3/7/17
to swupdate, alain....@triacta.com, sba...@denx.de
I am not trying to prove anything. I am simply trying to make SWUpdate work in my setup.

It seems that the difference between cpio and swupdate is that cpio extracts the files even though it displays that there is a checksum error, but swupdate does not extract the files when it encounters a checksum error.

With cpio, even if it says there is a checksum error, when I compare the extracted file to the original file, there is no difference.

So, if the library you are using inside swupdate is the same as the one that cpio is using, perhaps this library has a bug that it doesn't calculate checksums properly, and incorrectly reports back to the caller that there was an error in the checksum.

In the case of cpio, the caller seems to be ignoring the checksum error and continuing with the extraction.
In the case of swupdate, the caller seems to be stopping if it gets a checksum error.

So, if I could replicate your setup where your version of cpio does actually generate the proper checksum, then my swupdate will properly verify the checksum and continue to extract it.

Another question is: have you tried images larger than 40MB ?

Stefano Babic

unread,
Mar 7, 2017, 12:11:10 PM3/7/17
to Triacta, swupdate, sba...@denx.de
On 07/03/2017 17:54, Triacta wrote:
> I am not trying to prove anything. I am simply trying to make SWUpdate
> work in my setup.
>
> It seems that the difference between cpio and swupdate is that cpio
> extracts the files even though it displays that there is a checksum
> error, but swupdate does not extract the files when it encounters a
> checksum error.
>
> With cpio, even if it says there is a checksum error, when I compare the
> extracted file to the original file, there is no difference.
>
> So, if the library you are using inside swupdate is the same as the one
> that cpio is using, perhaps this library has a bug that it doesn't
> calculate checksums properly, and incorrectly reports back to the caller
> that there was an error in the checksum.
>
> In the case of cpio, the caller seems to be ignoring the checksum error
> and continuing with the extraction.
> In the case of swupdate, the caller seems to be stopping if it gets a
> checksum error.
>
> So, if I could replicate your setup where your version of cpio does
> actually generate the proper checksum, then my swupdate will properly
> verify the checksum and continue to extract it.
>
> Another question is: have you tried images larger than 40MB ?
>

See log, file is quite 890MB:

stefano@papero:~/Projects/swupdate$ ./swupdate -Hpc:1.0 -v -i
tests/auto/boards/pc/test4/software_pc_test4.swu
Swupdate v2017.1.0

Licensed under GPLv2. See source distribution for detailed copyright
notices.

Searching for custom LUA handlers :[string "require
("swupdate_handlers")"]:1: module 'swupdate_handlers' not found:
no field package.preload['swupdate_handlers']
no file '/usr/local/share/lua/5.2/swupdate_handlers.lua'
no file '/usr/local/share/lua/5.2/swupdate_handlers/init.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers/init.lua'
no file '/usr/share/lua/5.2/swupdate_handlers.lua'
no file '/usr/share/lua/5.2/swupdate_handlers/init.lua'
no file './swupdate_handlers.lua'
no file '/usr/local/lib/lua/5.2/swupdate_handlers.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.2/swupdate_handlers.so'
no file '/usr/lib/lua/5.2/swupdate_handlers.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './swupdate_handlers.so'
Custom handlers not found, no error, skipping...

Running on pc Revision 1.0
Registered handlers:
archive
tar
flash
flash-hamming1
raw
rawfile
ubivol
ubipartition
lua
shellscript
preinstall
postinstall
remote
Main loop Daemon
[NOTIFY] : SWUPDATE running : [extract_sw_description] : Found file:
filename sw-description
size 291
checksum 0x4e01 VERIFIED

Version 0.1.0
[NOTIFY] : SWUPDATE running : [parse_hw_compatibility] : Accepted Hw
Revision : 1.0
[NOTIFY] : SWUPDATE running : [parse_scripts] : Found Script:
shellscript_logger.sh

[NOTIFY] : SWUPDATE running : [parse_files] : Found File :
IncrediblePBX13.2.iso --> /tmp/test (ROOTFS)

[NOTIFY] : SWUPDATE running : [check_hw_compatibility] : Hardware pc
Revision: 1.0
[NOTIFY] : SWUPDATE running : [check_hw_compatibility] : Hardware
compatibility verified
[NOTIFY] : SWUPDATE running : [cpio_scan] : Found file:
filename IncrediblePBX13.2.iso
size 890241024
REQUIRED

[NOTIFY] : SWUPDATE running : [cpio_scan] : Found file:
filename shellscript_logger.sh
size 261
REQUIRED

[NOTIFY] : SWUPDATE running : [extract_next_file] : Copied file:
filename shellscript_logger.sh
size 261
checksum 0x5476 VERIFIED

[NOTIFY] : SWUPDATE running : [execute_shell_script] : Calling shell
script /tmp/shellscript_logger.sh preinst: return with 0
[NOTIFY] : SWUPDATE running : [install_single_image] : Found installer
for stream IncrediblePBX13.2.iso rawfile
[NOTIFY] : SWUPDATE running : [install_raw_file] : Installing file
IncrediblePBX13.2.iso on /tmp/test

[NOTIFY] : SWUPDATE running : [execute_shell_script] : Calling shell
script /tmp/shellscript_logger.sh postinst: return with 0
Software updated successfully
Please reboot the device to start the new software
[NOTIFY] : SWUPDATE successful !


Best regards,
Stefano Babic

--
Meet DENX at the Embedded World Trade Show
14 Mar - 16 Mar 2017, Nuremberg Trade Fair Centre, Hall 4, Booth 581
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

Roman Kalashnikov

unread,
Aug 23, 2017, 6:29:14 PM8/23/17
to swupdate
Hi!
I agree, for example if raw image size larger then 2.147Gb swupdate read incorrect image size and can not verify checksum. It occurs because cpio have bug in file src/copyout.c function read_for_checksum getting incorrect file size type - intThis means file_size can be less then zero when your file size larger then 2Gb... It should have type off_t for correct storing file size. Also in same function should be:
off_t bytes_left;

вторник, 7 марта 2017 г., 7:45:56 UTC+3 пользователь Triacta написал:

Stefano Babic

unread,
Aug 24, 2017, 2:39:48 AM8/24/17
to Roman Kalashnikov, swupdate


On 24/08/2017 00:29, Roman Kalashnikov wrote:
> Hi!
> I agree, for example if raw image size larger then 2.147Gb swupdate read
> incorrect image size and can not verify checksum. It occurs because cpio
> have bug in file *src/copyout.c* function *read_for_checksum* getting
> incorrect file size type - *int*. This means *file_size* can be less
> then zero when your file size larger then 2Gb... It should have
> type *off_t*for correct storing file size. Also in same function should be:
> *off_t* bytes_left;
>
> вторник, 7 марта 2017 г., 7:45:56 UTC+3 пользователь Triacta написал:
>
> I am having checksum errors with SWUpdate, so I wanted to make sure
> that my version of cpio works with the cpio library that SWUpdate is
> using. However, I found that even cpio itself is not working as I
> expect it (but perhaps I have an incorrect understanding on how it
> should work):
>
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM ~/swupdate/images >
> *uname -a*
> Linux mbp-vmw-ub1 4.4.0-62-generic #83~14.04.1-Ubuntu SMP Wed Jan 18
> 18:10:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:31 PM ~/swupdate/images >
> *which cpio*
> /bin/cpio
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:31 PM ~/swupdate/images >
> *cpio --version*
> cpio (GNU cpio) 2.11
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html <http://gnu.org/licenses/gpl.html>>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Phil Nelson, David MacKenzie, John Oleynick,
> and Sergey Poznyakoff.
>
> >2< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM ~/swupdate/images > *ls -l*
> total 192524
> -rw-r--r-- 1 alain alain 121634816 Mar 6 23:17
> g5-dev-image-imx6ul-var-dart.ext4
> -rw-r--r-- 1 alain alain 75497472 Mar 6 23:17
> g5-prod-image-imx6ul-var-dart.ext4
> -rw-r--r-- 1 alain alain 1065 Mar 6 23:17 sw-description
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM ~/swupdate/images >
>
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM ~/swupdate/images > *ls
> -r | cpio -ov -H crc > ../cpio/with-crc.swu*
> sw-description
> g5-prod-image-imx6ul-var-dart.ext4
> g5-dev-image-imx6ul-var-dart.ext4
> 385028 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM ~/swupdate/images > *ls
> -r | cpio -ov > ../cpio/no-crc.swu*
> sw-description
> g5-prod-image-imx6ul-var-dart.ext4
> g5-dev-image-imx6ul-var-dart.ext4
> 385027 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM ~/swupdate/images > *cd
> ../cpio/*
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM ~/swupdate/cpio > *ls*
> no-crc.swu with-crc.swu
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:23 PM ~/swupdate/cpio > *cpio
> -t < no-crc.swu*
> sw-description
> g5-prod-image-imx6ul-var-dart.ext4
> g5-dev-image-imx6ul-var-dart.ext4
> 385027 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:24 PM ~/swupdate/cpio > *cpio
> -t < with-crc.swu*
> sw-description
> g5-prod-image-imx6ul-var-dart.ext4
> g5-dev-image-imx6ul-var-dart.ext4
> 385028 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:24 PM ~/swupdate/cpio > *cpio
> -t --only-verify-crc < no-crc.swu*
> sw-description
> cpio: sw-description: checksum error (0x0, should be 0xf07392ec)
> g5-prod-image-imx6ul-var-dart.ext4
> cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error (0x0,
> should be 0xf07392ec)
> g5-dev-image-imx6ul-var-dart.ext4
> cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error (0x0, should
> be 0xf07392ec)
> 385027 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:24 PM ~/swupdate/cpio > *cpio
> -t --only-verify-crc < with-crc.swu*
> sw-description
> g5-prod-image-imx6ul-var-dart.ext4
> cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error
> (0x117c24ad9, should be 0x17c24ad9)
> g5-dev-image-imx6ul-var-dart.ext4
> cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error
> (0x1bd77e6f4, should be 0xbd77e6f4)
> 385028 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM ~/swupdate/cpio > *cpio
> -iv < no-crc.swu*
> sw-description
> g5-prod-image-imx6ul-var-dart.ext4
> g5-dev-image-imx6ul-var-dart.ext4
> 385027 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM ~/swupdate/cpio > rm
> sw-description g5*
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM ~/swupdate/cpio > cpio
> -iv < with-crc.swu
> sw-description
> cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error
> (0x117c24ad9, should be 0x17c24ad9)
> g5-prod-image-imx6ul-var-dart.ext4
> cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error
> (0x1bd77e6f4, should be 0xbd77e6f4)
> g5-dev-image-imx6ul-var-dart.ext4
> 385028 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM ~/swupdate/cpio > *ls*
> g5-dev-image-imx6ul-var-dart.ext4
> g5-prod-image-imx6ul-var-dart.ext4 no-crc.swu sw-description
> with-crc.swu
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM ~/swupdate/cpio > *diff
> g5-prod-image-imx6ul-var-dart.ext4
> ../images/g5-prod-image-imx6ul-var-dart.ext4*
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:25 PM ~/swupdate/cpio > *diff
> g5-dev-image-imx6ul-var-dart.ext4
> ../images/g5-dev-image-imx6ul-var-dart.ext4*
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM ~/swupdate/cpio > *diff
> sw-description ../images/sw-description*
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM ~/swupdate/cpio > *rm
> sw* g5**
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM ~/swupdate/cpio > *ls*
> no-crc.swu with-crc.swu
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM ~/swupdate/cpio > *cpio
> -iv -H crc < with-crc.swu*
> sw-description
> cpio: g5-prod-image-imx6ul-var-dart.ext4: checksum error
> (0x117c24ad9, should be 0x17c24ad9)
> g5-prod-image-imx6ul-var-dart.ext4
> cpio: g5-dev-image-imx6ul-var-dart.ext4: checksum error
> (0x1bd77e6f4, should be 0xbd77e6f4)
> g5-dev-image-imx6ul-var-dart.ext4
> 385028 blocks
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM ~/swupdate/cpio > *ls*
> g5-dev-image-imx6ul-var-dart.ext4
> g5-prod-image-imx6ul-var-dart.ext4 no-crc.swu sw-description
> with-crc.swu
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM ~/swupdate/cpio > *diff
> g5-prod-image-imx6ul-var-dart.ext4
> ../images/g5-prod-image-imx6ul-var-dart.ext4*
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:26 PM ~/swupdate/cpio > *diff
> g5-dev-image-imx6ul-var-dart.ext4
> ../images/g5-dev-image-imx6ul-var-dart.ext4*
> >0< alain@mbp-vmw-ub1 Mon Mar 06 11:27 PM ~/swupdate/cpio > *diff
> sw-description ../images/sw-description*
>
>
> Note the following:
>
> 1. In swupdate.bbclass, I see that it uses the command '*... cpio
> -ov -H crc ...*' so assuming that the cpio library that SWUpdate
> uses is the same as what the cpio binary links with, it is not
> surprising that SWupdate gives the same checksum errors as I'm
> getting with the command-line (for the file with-crc.swu)
>
> 2. I can understand that if I don't generate a checksum, then
> checksum verification fails (for the file no-crc.swu)
>
> 3. In both cases (with or without checksum) cpio continues to
> extract the files. When I diff them, they are the exact same as the
> originals. However, SWUpdate refuses to extract the files if a
> checksum error occurs.
>
> Please help.
>
>

Check the ML archive this was already analyzed:

Bug analyses here:
https://groups.google.com/forum/#!topic/swupdate/ABFNVf9hYOo

Fix to cpio in meta-swupdate:
https://groups.google.com/forum/#!topic/swupdate/u3-7YxeW5wU

Patch to cpio ML:
http://lists.gnu.org/archive/html/bug-cpio/2017-07/index.html

Best regards,
Stefano Babic


--

Roman Kalashnikov

unread,
Aug 24, 2017, 2:55:54 AM8/24/17
to Stefano Babic, swupdate
It was reproduced on arch linux kernel 4.12 and cpio 2.12, also on ubuntu 16.10 kernel 4.8 the same error.
I was tried to use original source code from gnu.org and i was confused when found this error in latest original code (4.12).
Reply all
Reply to author
Forward
0 new messages