[OE-core] [PATCH v3 7/8] image: create symlinks needed for merged /usr

Valluri, Amarnath amarnath.valluri at intel.com
Tue Jun 13 12:32:31 UTC 2017


On Tue, 2017-06-13 at 08:05 +0000, Peter Kjellerstedt wrote:
> > 
> > -----Original Message-----
> > From: openembedded-core-bounces at lists.openembedded.org
> > [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf
> > Of
> > Amarnath Valluri
> > Sent: den 13 juni 2017 08:53
> > To: openembedded-core at lists.openembedded.org
> > Subject: [OE-core] [PATCH v3 7/8] image: create symlinks needed for
> > merged /usr
> > 
> > Prepare the symlinks required for merged /usr at the time of rootfs
> > creation.
> > 
> > The links created in rootfs are:
> > /bin --> /usr/sbin
> > /sbin --> /usr/sbin
> > /lib --> /usr/lib
> > /lib64 --> /usr/lib64
> > 
> > We cannot make these symlinks as part of 'base-files' or some other
> > package.
> > Because at rootfs creation, installation of the package(say kernel)
> > that depends
> > on these root folders/links fails, if package manager installs this
> > package
> > prior to base-files.
> > 
> > These symbolic links in top level folder should present as long as
> Change "should" to "should be".
> 
> > 
> >  - kerenl tools use /lib/{module,firmware}
> Change "kerenl" to "kernel".
> 
> > 
> >  - shell scripts uses "#!/bin/sh"
> > 
> > Signed-off-by: Amarnath Valluri <amarnath.valluri at intel.com>
> > ---
> >  meta/classes/image.bbclass | 23 +++++++++++++++++++++++
> >  1 file changed, 23 insertions(+)
> > 
> > diff --git a/meta/classes/image.bbclass
> > b/meta/classes/image.bbclass
> > index 85f6b9a..f08e3e1 100644
> > --- a/meta/classes/image.bbclass
> > +++ b/meta/classes/image.bbclass
> > @@ -617,3 +617,26 @@ do_bundle_initramfs () {
> >  	:
> >  }
> >  addtask bundle_initramfs after do_image_complete
> > +
> > +# Prepare the root links to point to the /usr counterparts.
> In the function below:
> * You do not need to specify -m 0755 to install, it is the default.
> * Change all "/${var}" to "${var}".
> 
> > 
> > +create_merged_usr_symlinks() {
> > +    install -m 0755 -d ${IMAGE_ROOTFS}/${base_bindir}
> > +    install -m 0755 -d ${IMAGE_ROOTFS}/${base_sbindir}
> > +    install -m 0755 -d ${IMAGE_ROOTFS}/${base_libdir}
> You can combine these three installs into one. Saves two forks.
> 
> > 
> > +    lnr ${IMAGE_ROOTFS}${base_bindir} ${IMAGE_ROOTFS}/bin
> > +    lnr ${IMAGE_ROOTFS}${base_sbindir} ${IMAGE_ROOTFS}/sbin
> > +    lnr ${IMAGE_ROOTFS}${base_libdir} ${IMAGE_ROOTFS}/${baselib}
> > +
> > +    if [ "${nonarch_base_libdir}" != "${base_libdir}" ]; then
> Why do you check "${nonarch_base_libdir}" != "${base_libdir}" when
> you do not check the other three above?
Our intention here is to create /lib -> ${noarch_base_libdir}. This
might already been crated in the previous call : 
    lnr ${IMAGE_ROOTFS}${base_libdir} ${IMAGE_ROOTFS}/${baselib}

because, for non-multilib builds both ${nonarch_base_libdir} and
${base_libdir} points to ${exec_prefix}/lib.

The condition can be rephrased to:
   if [ "${baselib}" != "lib" ]

This case does not apply for other two links., ie., /bin, /sbin.

- Amarnath


More information about the Openembedded-core mailing list