[OE-core] [PATCH] image_types: Ensure /init exists for cpio rootfs archives
Andrea Adami
andrea.adami at gmail.com
Thu Jan 5 00:05:02 UTC 2012
On Thu, Jan 5, 2012 at 12:49 AM, Andrea Adami <andrea.adami at gmail.com> wrote:
> On Wed, Jan 4, 2012 at 1:07 AM, Saul Wold <sgw at linux.intel.com> wrote:
>> On 12/28/2011 03:54 PM, Darren Hart wrote:
>>>
>>> <I sent this to the yocto list by mistake, forwarding here for comment>
>>>
>>> In order for the kernel to accept an initramfs as a rootfs,
>>> it must have /init - even if it is an empty file. Touch /init
>>> to ensure it exists for cpio and cpio.gz image types.
>>>
>>> When used with initrd and rootfs=/dev/ram0, this allows the
>>> cpio and cpio.gz images to be used as the rootfs.
>>>
>>> Signed-off-by: Darren Hart<dvhart at linux.intel.com>
>>> ---
>>> meta/classes/image_types.bbclass | 10 ++++++++--
>>> 1 files changed, 8 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/meta/classes/image_types.bbclass
>>> b/meta/classes/image_types.bbclass
>>> index 6893e38..ebff0ba 100644
>>> --- a/meta/classes/image_types.bbclass
>>> +++ b/meta/classes/image_types.bbclass
>>> @@ -110,8 +110,14 @@ IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS}&& tar -cvf
>>> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME
>>> IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS}&& tar -zcvf
>>> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ."
>>> IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS}&& tar -jcvf
>>> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ."
>>> IMAGE_CMD_tar.xz = "cd ${IMAGE_ROOTFS}&& tar --xz -cvf
>>> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.xz ."
>>> -IMAGE_CMD_cpio = "cd ${IMAGE_ROOTFS}&& (find . | cpio -o -H
>>> newc>${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)"
>>> -IMAGE_CMD_cpio.gz = "cd ${IMAGE_ROOTFS}&& (find . | cpio -o -H newc |
>>> gzip -c -9>${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz)"
>>> +IMAGE_CMD_cpio () {
>>> + touch ${IMAGE_ROOTFS}/init
>>> + cd ${IMAGE_ROOTFS}&& (find . | cpio -o -H
>>> newc>${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)
>>> +}
>>> +IMAGE_CMD_cpio.gz () {
>>> + touch ${IMAGE_ROOTFS}/init
>>> + cd ${IMAGE_ROOTFS}&& (find . | cpio -o -H newc | gzip -c
>>> -9>${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz)
>>> +}
>>> IMAGE_CMD_cpio.xz = "type cpio>/dev/null; cd ${IMAGE_ROOTFS}&& (find . |
>>> cpio -o -H newc | xz -c ${XZ_COMPRESSION_LEVEL}
>>> --check=${XZ_INTEGRITY_CHECK}>
>>> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.xz) ${EXTRA_IMAGECMD}"
>>> IMAGE_CMD_cpio.lzma = "type cpio>/dev/null; cd ${IMAGE_ROOTFS}&& (find .
>>> | cpio -o -H newc | xz --format=lzma -c ${XZ_COMPRESSION_LEVEL}
>>> --check=${XZ_INTEGRITY_CHECK}>${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.lzma)
>>> ${EXTRA_IMAGECMD}"
>>>
>>
>> This merged as is to OE-Core.
>>
>> Based on other emails, I will expect some update patch to address Andrea's
>> comments.
>>
>> Thanks
>> Sau!
>>
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core at lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
> hm.. something is going wrong... permission denied
>
>
> touch: cannot touch
> `/oe/oe-core/build/tmp-eglibc/work/poodle-oe-linux-gnueabi/initramfs-kexecboot-klibc-image-1.0-r0/rootfs/init':
> Permission denied
>
> Andrea
I'd say we have to test for the in-existence of the file instead of
blindly touching it.
Smthg like
if [! -e ${IMAGE_ROOTFS}/init]; then
touch ${IMAGE_ROOTFS}/init
fi
Now, repeating that block for all 4 cpio images is a bit ugly... better ideas?
Regards
Andrea
More information about the Openembedded-core
mailing list