0
votes

I'm a Yocto newbie in Taiwan and my Yocto is base on NXP fsl.

I need to modify recipe(fsl-inmage-auto.bb) to add file into rootfs lib folder, like:

/home/eric/libtest.1.0.so --add to--> EVK SD card (/lib/)

Then "bitbake fsl-image-auto" to build image.

I tried some method but now still didn't work. my code is shown below:

#------------ Test copy file from ~ to rootfs /lib ------------
LICENSE = "CLOSED"

SRC_URI = "file:///home/eric/*"
do_install(){
    install -m 0644 ${S}/home/eric/liberictest.so ${D}/lib/
}
#-----------------

I tried install and cp cmd, but these method did not work... So what method can do this?

Sorry for my question and thanks.

3
To use external resource to build a Yocto image, you need to use externalsrc as explained in manualNayfe

3 Answers

0
votes

Thanks Nayfe & danlor, Now I can add(copy)/touch files into other Yocto rootfs, my recipe is shown below:

# Test copy a file to rootfs - WPI Eric Fan

DESCRIPTION = "Hello World eric test"
LICENSE = "CLOSED"
PV = "0.9453"
PR = "r0.9487"

#my test envirement WORKDIR="/home/eric/s32v_yocto_bsp/build_s32v234evb/tmp/work/aarch64-fsl-linux/eric0.9453-r0.9487/"

do_install(){
    install -d lib/erictest/94539487
    install -m 0644 /home/eric/liberictest.so lib/
    touch lib/libtouchtest.so
    cp --no-preserve=ownership /home/eric/libericcptest.so lib/
}

Now I tried to do the same thing on my real Yocto project(fsl-image-auto), but it didn't work and have some error message...


ERROR: linux-s32-4.14-r0 do_package: QA Issue: linux-s32: Files/directories were installed but not shipped in any package: /lib/libericcptest.so Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install. linux-s32: 1 installed and not shipped files. [installed-vs-shipped]

ERROR: linux-s32-4.14-r0 do_package: Fatal QA errors found, failing task.

ERROR: linux-s32-4.14-r0 do_package: Function failed: do_package

ERROR: Logfile of failure stored in: /home/eric.fan/s32v_yocto_bsp/build_s32v234evb/tmp/work/s32v234evb-fsl-linux/linux-s32/4.14-r0/temp/log.do_package.5942

ERROR: Task (/home/eric.fan/s32v_yocto_bsp/sources/meta-alb/recipes-kernel/linux/linux-s32_4.14.bb:do_package) failed with exit code '1'

0
votes

You need to modify the image, not its recipe at all.

You're missing the install -d ${D}/lib/ before install -m 0644 ${S}/home/eric/liberictest.so ${D}/lib/.

0
votes

Thanks for danlor & Nayfe, I studied Yocto reference manual, and completed my recipe. Below is my last recipe:


DESCRIPTION = "Copy ko & so files into rootfs"
SECTION = "libs"

LICENSE = "CLOSED"

PACKAGE_ARCH = "${MACHINE_ARCH}"

SRC_URI += "\
file://ffmpeg/libavcodec.so \
file://ffmpeg/libavdevice.so \
file://ffmpeg/libavfilter.so \
file://ffmpeg/libavformat.so \
file://ffmpeg/libavutil.so \
file://ffmpeg/libswresample.so \
file://ffmpeg/libswscale.so \
file://opencv/libopencv_calib3d.so.3.1 \
file://opencv/libopencv_core.so.3.1 \
file://opencv/libopencv_features2d.so.3.1 \
file://opencv/libopencv_flann.so.3.1 \
file://opencv/libopencv_highgui.so.3.1 \
file://opencv/libopencv_imgcodecs.so.3.1 \
file://opencv/libopencv_imgproc.so.3.1 \
file://opencv/libopencv_ml.so.3.1 \
file://opencv/libopencv_objdetect.so.3.1 \
file://opencv/libopencv_photo.so.3.1 \
file://opencv/libopencv_shape.so.3.1 \
file://opencv/libopencv_stitching.so.3.1 \
file://opencv/libopencv_superres.so.3.1 \
file://opencv/libopencv_videoio.so.3.1 \
file://opencv/libopencv_video.so.3.1 \
file://opencv/libopencv_videostab.so.3.1 \
"

do_install () {
install -d ${D}/${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libavcodec.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libavdevice.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libavfilter.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libavformat.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libavutil.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libavutil.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libswresample.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/ffmpeg/libswscale.so ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_calib3d.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_core.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_features2d.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_flann.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_highgui.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_imgcodecs.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_imgproc.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_ml.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_objdetect.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_photo.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_shape.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_stitching.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_superres.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_videoio.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_video.so.3.1 ${D}${base_libdir}/
install -m 755 ${WORKDIR}/opencv/libopencv_videostab.so.3.1 ${D}${base_libdir}/
}

FILES_SOLIBSDEV = ""
FILES_${PN} += " \
/* \
${base_libdir}/*.so \
${base_libdir}/*.so.* \
"

INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"

INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN} += "already-stripped"
INSANE_SKIP_${PN} += "dev-so"
#For dev packages only
INSANE_SKIP_${PN}-dev = "ldflags"

COMPATIBLE_MACHINE = "(s32v234evb)"

This recipe can work normally and this issue is resloved...