Skip to contentSkip to conversation

du giving non-integer result?

meta-raspberrypi Trevor Woerner 8 participants 12 messages Sep 7, 2015 – Oct 21, 2015

lore
Share & tools
lore
#0 lore raw

I can't explain why, but when I build "core-image-minimal" for MACHINE=raspberrpi2 I get the following SD creation error:

ERROR: Error: The image creation script '/z/layerindex-master/raspi2/tmp/work/raspberrypi2-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.rpi-sdimg' returned 2:
expr: non-integer argument
WARNING:
/z/layerindex-master/raspi2/tmp/work/raspberrypi2-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.rpi-sdimg:1 exit 2 from
ROOTFS_SIZE_ALIGNED=$(expr 12288.0 + 4096 - 1)

Looking at meta-raspberrypi/classes/sdcard_image-rpi.bbclass, line 83:

    ROOTFS_SIZE_ALIGNED=$(expr ${ROOTFS_SIZE} +

${IMAGE_ROOTFS_ALIGNMENT} - 1)

which looks like the offending line. ROOTFS_SIZE seems to come from the line immediately above:

    ROOTFS_SIZE=`du -bks ${SDIMG_ROOTFS} | awk '{print $1}'`

But 'du' doesn't return non-integer values, does it? When I invoke the host's 'du' I get the correct value:

du -bks
/z/layerindex-master/raspi2/tmp/deploy/images/raspberrypi2/core-image-minimal-raspberrypi2-20150906234844.rootfs.ext3 | awk '{print $1}'

    12288

Does anyone have any idea why the ".0" is getting tacked on?

Best regards,
Trevor

#1 lore raw
Quoted 6 lines · Trevor Woerner

I can't explain why, but when I build "core-image-minimal" for MACHINE=raspberrpi2 I get the following SD creation error:

which shell do you use for /bin/sh

Quoted 37 lines

ERROR: Error: The image creation script '/z/layerindex-master/raspi2/tmp/work/raspberrypi2-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.rpi-sdimg' returned 2:
expr: non-integer argument
WARNING:
/z/layerindex-master/raspi2/tmp/work/raspberrypi2-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.rpi-sdimg:1 exit 2 from

     ROOTFS_SIZE_ALIGNED=$(expr 12288.0 + 4096 - 1)

Looking at meta-raspberrypi/classes/sdcard_image-rpi.bbclass, line 83:

   ROOTFS_SIZE_ALIGNED=$(expr ${ROOTFS_SIZE} +

${IMAGE_ROOTFS_ALIGNMENT} - 1)

which looks like the offending line. ROOTFS_SIZE seems to come from the line immediately above:

   ROOTFS_SIZE=`du -bks ${SDIMG_ROOTFS} | awk '{print $1}'`

But 'du' doesn't return non-integer values, does it? When I invoke the host's 'du' I get the correct value:

du -bks
/z/layerindex-master/raspi2/tmp/deploy/images/raspberrypi2/core-image-minimal-raspberrypi2-20150906234844.rootfs.ext3 | awk '{print $1}'
12288

Does anyone have any idea why the ".0" is getting tacked on?

Best regards,
Trevor
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#2 lore raw
Quoted 6 lines · Khem Raj
Quoted 5 lines · Trevor Woerner

I can't explain why, but when I build "core-image-minimal" for MACHINE=raspberrpi2 I get the following SD creation error:

which shell do you use for /bin/sh

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Nov 22  2014 /bin/sh -> bash
$ /bin/bash --version
GNU bash, version 4.2.53(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2011 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.

#3 lore raw

I saw such behavior in 'expr' when I upgraded bash 3.1 - it started printing floats instead of integers. You can solve it using awk's OFMT: awk '{OFMT="%.0f";print $1}'

Michael

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Trevor Woerner
Sent: Monday, September 07, 2015 10:40 AM
To: Khem Raj
Cc: [email protected]
Subject: Re: [yocto] [meta-raspberrypi] du giving non-integer result?

Quoted 6 lines · Khem Raj
Quoted 5 lines · Trevor Woerner

I can't explain why, but when I build "core-image-minimal" for MACHINE=raspberrpi2 I get the following SD creation error:

which shell do you use for /bin/sh

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Nov 22  2014 /bin/sh -> bash
$ /bin/bash --version
GNU bash, version 4.2.53(1)-release (x86_64-suse-linux-gnu) Copyright (C) 2011 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. --
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#6 lore raw
In reply to Trevor Woerner

From the feedback, it looks like I'm the only one seeing this issue. That's okay, but I'll update this issue with new information in case it's useful to others. Today I also had some other strangeness with the "make sd card image" portion of a build, this time for cubietruck (meta-sunxi):

ERROR: Error: The image creation script '/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg' returned 1:
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.0606e-05 s, 0.0 kB/s
expr: non-integer argument
WARNING:
/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg:1 exit 1 from
parted -s
/z/tmp/build/tmp/deploy/images/cubietruck/core-image-minimal-cubietruck-20150910182624.rootfs.sunxi-sdimg unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ 2048)
$(expr ${BOOT_SPACE_ALIGNED} \+ 2048 \+ 10240.0)

Not only am I getting the floating point again, but it looks like "BOOT_SPACE_ALIGNED" isn't getting expanded!

The frustrating part is that simply rerunning "bitbake core-image-minimal" fixes the problem. The second time it completes without error.

#7 lore raw
Quoted 24 lines · Trevor Woerner

From the feedback, it looks like I'm the only one seeing this issue. That's okay, but I'll update this issue with new information in case it's useful to others. Today I also had some other strangeness with the "make sd card image" portion of a build, this time for cubietruck (meta-sunxi):

ERROR: Error: The image creation script '/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg' returned 1:
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.0606e-05 s, 0.0 kB/s
expr: non-integer argument
WARNING:
/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg:1 exit 1 from
parted -s
/z/tmp/build/tmp/deploy/images/cubietruck/core-image-minimal-cubietruck-20150910182624.rootfs.sunxi-sdimg unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ 2048)
$(expr ${BOOT_SPACE_ALIGNED} \+ 2048 \+ 10240.0)

Quoted 7 lines

Not only am I getting the floating point again, but it looks like "BOOT_SPACE_ALIGNED" isn't getting expanded!

The frustrating part is that simply rerunning "bitbake core-image-minimal" fixes the problem. The second time it completes without error.
--

I sent a patch to openembedded-core mailing list for ROOTFS_SIZE not
being an integer.
It seems http://git.openembedded.org/openembedded-core/commit/?id=af37bb8ae71c4f932e2126bb620b3fb2b11cc466
results in ROOTFS_SIZE now being set as a bitbake variable.
meta-raspberrypi will need to be updated to not have a conflicting
ROOTFS_SIZE variable as ${ROOTFS_SIZE} is being substituted by bitbake
instead of the shell there.

Regards,
Jonathan

#8 lore raw
Quoted 33 lines · Jonathan Liu
Quoted 24 lines · Trevor Woerner

From the feedback, it looks like I'm the only one seeing this issue. That's okay, but I'll update this issue with new information in case it's useful to others. Today I also had some other strangeness with the "make sd card image" portion of a build, this time for cubietruck (meta-sunxi):

ERROR: Error: The image creation script '/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg' returned 1:
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.0606e-05 s, 0.0 kB/s
expr: non-integer argument
WARNING:
/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg:1 exit 1 from
parted -s
/z/tmp/build/tmp/deploy/images/cubietruck/core-image-minimal-cubietruck-20150910182624.rootfs.sunxi-sdimg unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ 2048)
$(expr ${BOOT_SPACE_ALIGNED} \+ 2048 \+ 10240.0)

Quoted 7 lines

Not only am I getting the floating point again, but it looks like "BOOT_SPACE_ALIGNED" isn't getting expanded!

The frustrating part is that simply rerunning "bitbake core-image-minimal" fixes the problem. The second time it completes without error.
--

Quoted 7 lines

I sent a patch to openembedded-core mailing list for ROOTFS_SIZE not
being an integer.
It seems http://git.openembedded.org/openembedded-core/commit/?id=af37bb8ae71c4f932e2126bb620b3fb2b11cc466
results in ROOTFS_SIZE now being set as a bitbake variable.
meta-raspberrypi will need to be updated to not have a conflicting
ROOTFS_SIZE variable as ${ROOTFS_SIZE} is being substituted by bitbake
instead of the shell there.

Hi guys,

I'm testing and reviewing this as we speak. As well, it would be a good idea to drop the sd card generation class for good and replace it completely by wic support.

Something to be done. Wnat to pick this up? I know that there were people around testing wic and we had configuration too.

Regards,

--
Andrei Gherzan

#9 lore raw
Quoted 40 lines · Andrei Gherzan
Quoted 32 lines · Jonathan Liu
Quoted 24 lines · Trevor Woerner

From the feedback, it looks like I'm the only one seeing this issue. That's okay, but I'll update this issue with new information in case it's useful to others. Today I also had some other strangeness with the "make sd card image" portion of a build, this time for cubietruck (meta-sunxi):

ERROR: Error: The image creation script '/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg' returned 1:
0+0 records in
0+0 records out
0 bytes (0 B) copied, 3.0606e-05 s, 0.0 kB/s
expr: non-integer argument
WARNING:
/z/tmp/build/tmp/work/cubietruck-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sunxi-sdimg:1 exit 1 from
parted -s
/z/tmp/build/tmp/deploy/images/cubietruck/core-image-minimal-cubietruck-20150910182624.rootfs.sunxi-sdimg unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ 2048)
$(expr ${BOOT_SPACE_ALIGNED} \+ 2048 \+ 10240.0)

Quoted 7 lines

Not only am I getting the floating point again, but it looks like "BOOT_SPACE_ALIGNED" isn't getting expanded!

The frustrating part is that simply rerunning "bitbake core-image-minimal" fixes the problem. The second time it completes without error.
--

Quoted 7 lines

I sent a patch to openembedded-core mailing list for ROOTFS_SIZE not
being an integer.
It seems http://git.openembedded.org/openembedded-core/commit/?id=af37bb8ae71c4f932e2126bb620b3fb2b11cc466
results in ROOTFS_SIZE now being set as a bitbake variable.
meta-raspberrypi will need to be updated to not have a conflicting
ROOTFS_SIZE variable as ${ROOTFS_SIZE} is being substituted by bitbake
instead of the shell there.

Quoted 7 lines

Hi guys,

I'm testing and reviewing this as we speak. As well, it would be a good idea to drop the sd card generation class for good and replace it completely by wic support.

Something to be done. Wnat to pick this up? I know that there were people around testing wic and we had configuration too.

Jonathan's patch does work for me, and it was premature of me to put [meta-raspberrypi] in the subject line since I saw this same failure on other BSPs (and other people reported even more failures on other BSPs). But it wouldn't hurt to move to wic either. It's probably about time I started using it anyway :-)

#10 lore raw
In reply to Andrei Gherzan

On my 'to do' list is pulling together the fs partitions into a single SD card image file that can be copied in-one using a Windows tool (such as Win32 Disk Imager) - primarily because my build machine is off-site. I've seen a few recipes along those lines (I'm on a BeagleBone), but perhaps wic is a better way to go. Can wic create a single card image?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Andrei Gherzan
Sent: 23 September 2015 21:13
To: Jonathan Liu
Cc: [email protected]
Subject: Re: [yocto] [meta-raspberrypi] du giving non-integer result?

....

Hi guys,

I'm testing and reviewing this as we speak. As well, it would be a good idea to drop the sd card generation class for good and replace it completely by wic support.

Something to be done. Wnat to pick this up? I know that there were people around testing wic and we had configuration too.

Regards,

--
Andrei Gherzan
--

#4 lore raw
In reply to Michael Fainstein
Quoted 2 lines · Michael Fainstein

I saw such behavior in 'expr' when I upgraded bash 3.1 - it started

printing floats instead of integers.

Quoted 4 lines

You can solve it using awk's OFMT: awk '{OFMT="%.0f";print $1}'

Michael

This worked for me, but it needed one small tweak... Need to add +0 so that awk actually applies the format.

You can solve it using awk's OFMT: awk '{OFMT="%.0f";print $1+0}'

Thanks Michael!

#5 lore raw

Why not printf?

[geckos@csi24 ~]$ echo 1.0 | awk '{ printf("%d\n", $1); }' 1

Cheers,
- dhs

2015-09-25 11:12 GMT-03:00 Dave Wolaver <[email protected]>:

Quoted 26 lines
Quoted 2 lines · Michael Fainstein

I saw such behavior in 'expr' when I upgraded bash 3.1 - it started

printing floats instead of integers.

Quoted 4 lines

You can solve it using awk's OFMT: awk '{OFMT="%.0f";print $1}'

Michael

This worked for me, but it needed one small tweak... Need to add +0 so that awk actually applies the format.

You can solve it using awk's OFMT: awk '{OFMT="%.0f";print $1+0}'

Thanks Michael!

--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Signature · 2 lines
*"Do or do not. There is no try"*
  *Yoda Master*
#11 lore raw
In reply to Colin Helliwell
Quoted 6 lines · Colin Helliwell

On my 'to do' list is pulling together the fs partitions into a single SD card image file that can be copied in-one using a Windows tool (such as Win32 Disk Imager) - primarily because my build machine is off-site. I've seen a few recipes along those lines (I'm on a BeagleBone), but perhaps wic is a better way to go. Can wic create a single card image?

Yes it can.
http://www.yoctoproject.org/docs/1.8/mega-manual/mega-manual.html#creating-partitioned-images

Quoted 16 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Andrei Gherzan
Sent: 23 September 2015 21:13
To: Jonathan Liu
Cc: [email protected]
Subject: Re: [yocto] [meta-raspberrypi] du giving non-integer result?

....

Hi guys,

I'm testing and reviewing this as we speak. As well, it would be a good idea to drop the sd card generation class for good and replace it completely by wic support.

Quoted 10 lines

Something to be done. Wnat to pick this up? I know that there were people around testing wic and we had configuration too.

Regards,

--
Andrei Gherzan
--

--
Andrei Gherzan