[OE-core] [PATCH] image_types: Ensure /init exists for cpio rootfs archives
Andrea Adami
andrea.adami at gmail.com
Tue Jan 3 14:57:01 UTC 2012
On Sat, Dec 31, 2011 at 12:18 AM, Darren Hart <dvhart at linux.intel.com> wrote:
>
>
> On 12/30/2011 12:25 AM, Andrea Adami wrote:
>> On Thu, Dec 29, 2011 at 12:54 AM, Darren Hart <darren.hart at intel.com> 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.
>>
>> Why didn't you add the init to cpio.xz and cpio.lzma?
>> Any special reason?
>
> No reason, just missed them I guess. I can resent with them included if
> we agree this is a reasonable approach.
Darren,
I'm not sure this is the best approach.
Thinking about *bootables* cpio, I can imagine two types:
- barebone, whithout shell, libc, no init
- generic: with shell and some utils
The first case is usually a custom-purpose rootfs (think about
kexecboot cpio's) and the recipe takes care of creating the init
symlink
e.g.
pkg_postinst_${PN} () {
ln -sf ${bindir}/kexecboot $D/init
}
The second case, with bigger images, implies we are populating the
rootfs with glibc, eglibc, uclibc or klibc: I'd say it's up to those
recipes to provide a valid init.
FWIW we can imagine to pile up multiple initramfs and surely we have
to specify the init only for the first, the one in the in-kernel
embedded initramfs.
Just my thoughts
Regards
Andrea
>
> --
> Darren
>
>>
>>>
>>> When used with initrd and rootfs=/dev/ram0, this allows the
>>> cpio and cpio.gz images to be used as the rootfs.
>>
>> Sure, and "...If all else fails, rdinit=/bin/sh "
>>
>>>
>>> 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}"
>>>
>>> --
>>> 1.7.6.4
>>>
>>> _______________________________________________
>>> yocto mailing list
>>> yocto at yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>>>
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core at lists.openembedded.org
>>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>>
>> Regards
>>
>> Andrea Adami
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core at lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
> --
> Darren Hart
> Intel Open Source Technology Center
> Yocto Project - Linux Kernel
More information about the Openembedded-core
mailing list