[OE-core] [PATCH] image_types: preserve rootfs if mkext234fs() fails

Andre McCurdy armccurdy at gmail.com
Tue Dec 19 21:19:09 UTC 2017


On Tue, Dec 19, 2017 at 12:54 PM, Tom Rini <trini at konsulko.com> wrote:
> On Tue, Dec 19, 2017 at 12:11:48PM -0800, Saul Wold wrote:
>> We have seen more failures, but have not been able to directly reproduce
>> it maybe svaing the rootfs and it contains some content that is tripping
>> up the e2fsprogs mkfs.ext4 populate_rootfs() function
>>
>> Signed-off-by: Saul Wold <sgw at linux.intel.com>
>> ---
>>  meta/classes/image_types.bbclass | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
>> index 9188bed4197..6b4f39ed274 100644
>> --- a/meta/classes/image_types.bbclass
>> +++ b/meta/classes/image_types.bbclass
>> @@ -86,9 +86,14 @@ oe_mkext234fs () {
>>       bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024"
>>       dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
>>       bbdebug 1 "Actual Rootfs size:  `du -s ${IMAGE_ROOTFS}`"
>> -     bbdebug 1 "Actual Partion size: `ls -s ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
>> +     bbdebug 1 "Actual Partion size: `ls -l ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype`"
>>       bbdebug 1 Executing "mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}"
>>       mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
>> +     if [ $? -ne 0 ]; then
>> +             tmp_saved_rootfs=`mktemp -d -p /tmp saved_rootfs.XXXXX`
>> +             cp -r ${IMAGE_ROOTFS} $tmp_saved_rootfs
>> +     fi
>
> Wouldn't it be better to just fail on error here, rather than dump stuff
> to /tmp ?

It already does fail with an error. Saving the state is temporary
additional debug to help understand why.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=12304



More information about the Openembedded-core mailing list