]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
kernel: Ensure an initramfs is added if configured
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 21 Feb 2019 16:00:02 +0000 (16:00 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Feb 2019 10:42:56 +0000 (10:42 +0000)
If ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio does not exist,
nor any of the compressed variants, nothing is copied to kernel build's
./usr directory.

The code does not fail, but silently proceeds without a bundled initramfs.

Change to fail and tell the user something is wrong.

Also, if an initramfs is found, contrary to the comments, it does not stop
at the first uncompressed/compressed cpio image found. Instead it keeps
processing all so the last is used. Fix this to behave as per the comments.

[YOCTO #12909]

(Patch by Leon Woestenberg)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/kernel.bbclass

index c0889bd3ee4a0d8adab273e0817dbf3be73d3007..a5b1df1b0dce88b4193e183f05b3a69ee3e427db 100644 (file)
@@ -224,9 +224,11 @@ copy_initramfs() {
                                break
                                ;;
                        esac
+                       break
                fi
        done
-       echo "Finished copy of initramfs into ./usr"
+       # Verify that the above loop found a initramfs, fail otherwise
+       [ -f ${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio ] && echo "Finished copy of initramfs into ./usr" || die "Could not find any ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio{.gz|.lz4|.lzo|.lzma|.xz) for bundling; INITRAMFS_IMAGE_NAME might be wrong."
 }
 
 do_bundle_initramfs () {