Skip to content

Instantly share code, notes, and snippets.

@netskink
Last active September 9, 2016 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netskink/8f94dc200dd5f9991dbb4890d94b8113 to your computer and use it in GitHub Desktop.
Save netskink/8f94dc200dd5f9991dbb4890d94b8113 to your computer and use it in GitHub Desktop.
step 1. try to get host to build. step 2. try to get the target to build which uses binaries from step 1. step 3. try to get an sdk to build which includes these binaries.
DESCRIPTION = "pcmx bitbake test application"
SUMMARY = "pcmx native, nativesdk and target build"
SECTION = "examples"
LICENSE = "CLOSED"
PR = "r0"
SRCREV = "${AUTOREV}"
SRCREV_FORMAT ?= "d3_d3v16_pcmx"
SRCREV_d3 ?= "${AUTOREV}"
SRCREV_d3v16 ?= "${AUTOREV}"
SRCREV_pcmx-native ?= "${AUTOREV}"
PV = "1.0.0+git${SRCPV}"
# My goal is to create a src dir like this
# git
# pcmx
# d3
# d3v16
#
# And have the cmake build kick off in the pcmx directory.
#
#
# This will create the dir structure above.
SRC_URI = " \
git://ssh@devsupport:22/tfs/DefaultCollection/jfdtesty/_git/d3;protocol=ssh;destsuffix=git/d3 \
git://ssh@devsupport:22/tfs/DefaultCollection/jfdtesty/_git/d3v16;protocol=ssh;destsuffix=git/d3v16 \
git://ssh@devsupport:22/tfs/DefaultCollection/jfdtesty/_git/pcmx;protocol=ssh;destsuffix=git/pcmx;branch=testy \
"
# this is used for copies and install
S = "${WORKDIR}/git/pcmx"
inherit native cmake
BBCLASSEXTEND = "native"
# this will be for image?
#DEPENDS_class-target = "pcmx-native"
PARALLEL_MAKE = ""
do_install() {
install -d ${D}${bindir}
install -m 0755 bin/*generator ${D}${bindir}
install -m 0755 bin/lfotool.bin ${D}${bindir}
}
# will this help?
# NO PACKAGE_CLASSES = "package_tar"
Notes on these variables.
BBCLASSEXTEND is in section 4.9 of Streif's book.
He says, its used to build variants of a recipe. One recipe to build for host and target. Host is native.
~bitbake builds the recipe for the target and then a second time for the native class.
This leads to me to believe it builds for the target first (which in my case will fail) and then for the host.
So, i'm thinking I need inherit native and not bbclassextend since I need this code to build for the host first.
Streif also talks about you can use VARIABLE_class-target and VARIABLE_class-native to provide different overrides
for host and native targets.
BBCLASSEXTEND in also in section 8.2.12 of Strief's book.
native is for build host.
native-sdk is for sdk.
From embedded linux development with yocto project
~The inherit directive allows specifying what functionality our receipe requires.
It enables us to provide default tasks for projects which use the inherited
functionality.
From using yocto project with beaglebone black
~Inherit works with .class files. If you inherit autotools this takes care
of configure, compile and install tasks.
From Embedded Linux projects using yocto project cookbook
All recipes inherit the base.bbclass class which provides:
do_fetch, do_unpack, do_configure, do_compile, do_install, do_package
From embedded linux projects using yocto project cookbook
~we can build for host by either providing a seperate javahelloworld-native recipe which "inherit native" class
or by using BBCLASSEXTEND and then providing _class-native and _class-target overrides to differentiate between
native and target functionality.
using :
----------
* conf/local.conf no reference to pcmx
* pcmx_%.bb
inherit cmake
BBCLASSEXTEND = "native"
* image file no reference to pcmx
results:
---------
$ bitbake orion-headless-image
$ bitbake -c populate_sdk orion-headless-image
<everything builds>
davis@smeagol:~/setup-scripts/build/tmp-glibc/sysroots$ find . -name lfotool.bin
<nothing>
davis@smeagol:~/setup-scripts/build/tmp-glibc/work$ find . -name lfotool.bin
<nothing>
"Makes sense, the code is in place but nothing requires it so its not built."
$ bitbake pcmx
<build fails. It looks like it is trying to build for target and when it tries to run the generators
during make it fails, since bin/abllib_metrics_header_generator is an executable built for the target.>
<the code is trying to be built in
'~/setup-scripts/build/tmp-glibc/work/corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build'
using :
----------
Based upon the information in the books, lets try this
* conf/local.conf no reference to pcmx
* pcmx_%.bb
inherit native cmake
* image file no reference to pcmx
results:
---------
$ bitbake pcmx
<build passes>
davis@smeagol:~/setup-scripts/build/tmp-glibc$ find . -name lfotool.bin
./sysroots/x86_64-linux/usr/bin/lfotool.bin
./work/x86_64-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/image/home/davis/setup-scripts/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/lfotool.bin
./work/x86_64-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build/bin/lfotool.bin
./work/x86_64-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/sysroot-destdir/home/davis/setup-scripts/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/lfotool.bin
This seems to me to be right. The tool is in the bin directory of sysroots and is ready to be used by the next build.
If I understand cmake correctly instead of building this on the target it will not build it. (ditto for the
generators) and it will simply be used during the build to generate the stage 2 source.
I tried to run the lfotool.bin and I could run it. So if the target make can find it in sysroot it should build.
$ bitbake -c populate_sdk orion-headless-image
<builds, but when I install the sdk lfotool is not in the sysroots dir. Makes sense.>
using :
----------
Based upon the information in the books, lets try this
* conf/local.conf no reference to pcmx
* pcmx_%.bb
BBCLASSEXTEND = "native"
DEPENDS_class-target="pcmx-native"
<inherit is not specified. bbclass is used instead to build a native and target build. The target build
requires the native build to be done first.>
* image file no reference to pcmx
results:
---------
$ bitbake pcmx
<fails. It attempts to build the host version first.>
<pcmx shows up as building in the HOST AND TARGET tree.>
davis@smeagol:~/setup-scripts/build/tmp-glibc/work$ find . -name pcmx
./x86_64-linux/pcmx-native/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/git/pcmx <---------- HOST
./corei7-64-oe-linux/pcmx <---------- TARGET
./corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/license-destdir/pcmx
./corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/git/pcmx
<looking closer. HOST tree has the git, image and temp subdirs. This is doubly odd. the configure step (cmake) is run>
<without actually doing a configure. Likewise for the compile. It fails during the install when it tries
<to do my custom do_install code.>
<looking closer at target tree. It only has git, licenese-destdri, sstate-build-populate_lic and temp tree
<no build tree. temp shows only do fetch, patch, do populate license. Has not started to configure or compile>
$ bitbake orion-headless-image
<works. As last time. pcmx is not specified by the image so it has no requirements to build.>
$ bitbake -c populate_sdk orion-headless-image
<I started this as I was examining the pcmx errors above. I went ahead let this finish before I started below.
It finished without error.>
DAMMIT. I removed the inherit line. Which had cmake. FSCK. Doing this again.
----------
Based upon the information in the books, lets try this
* conf/local.conf no reference to pcmx
* pcmx_%.bb
inherits = cmake
BBCLASSEXTEND = "native"
DEPENDS_class-target="pcmx-native"
results:
---------
$ bitbake pcmx
<it correctly builds the host first.>
davis@smeagol:~/setup-scripts/build/tmp-glibc$ find . -name lfotool.bin
./sysroots/x86_64-linux/usr/bin/lfotool.bin
./work/x86_64-linux/pcmx-native/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/image/home/davis/setup-scripts/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/lfotool.bin
./work/x86_64-linux/pcmx-native/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build/bin/lfotool.bin
./work/x86_64-linux/pcmx-native/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/sysroot-destdir/home/davis/setup-scripts/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/lfotool.bin
<the tool is in the x86_64 directory. its also in the sysroots dir in the proper place. ditto for the generators.>
davis@smeagol:~/setup-scripts/build/tmp-glibc$
find . -name abllib_metrics_header_generator
./sysroots/x86_64-linux/usr/bin/abllib_metrics_header_generator
./work/x86_64-linux/pcmx-native/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/image/home/davis/setup-scripts/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/abllib_metrics_header_generator
./work/x86_64-linux/pcmx-native/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build/bin/abllib_metrics_header_generator
./work/x86_64-linux/pcmx-native/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/sysroot-destdir/home/davis/setup-scripts/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/abllib_metrics_header_generator
<however the next build target is the pcmx-target. Happy Day its at least attempting to build.>
<But when i look at the build failure for pcmx-target, the log says it can't find the abblib_metrics_header_generator.
< Probably because its looking for the file in bin of its own subdir. This looks like a cmake error.>
| Generating abllib_metrics_defs.h
| cd /home/davis/setup-scripts/build/tmp-glibc/work/corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build/bin && /home/davis/setup-scripts/build/tmp-glibc/work/corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build/bin/abllib_metrics_header_generator /home/davis/setup-scripts/build/tmp-glibc/work/corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build/gen/abllib_metrics_defs
| /bin/sh: /home/davis/setup-scripts/build/tmp-glibc/work/corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build/bin/abllib_metrics_header_generator: No such file or directory
| src/CMakeFiles/abllib_metrics_header_generator.dir/build.make:98: recipe for target 'bin/abllib_metrics_header_generator' failed
| make[2]: *** [bin/abllib_metrics_header_generator] Error 127
| make[2]: *** Deleting file 'bin/abllib_metrics_header_generator'
| make[2]: Leaving directory '/home/davis/setup-scripts/build/tmp-glibc/work/corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build'
| CMakeFiles/Makefile2:395: recipe for target 'src/CMakeFiles/abllib_metrics_header_generator.dir/all' failed
| make[1]: *** [src/CMakeFiles/abllib_metrics_header_generator.dir/all] Error 2
| make[1]: Leaving directory '/home/davis/setup-scripts/build/tmp-glibc/work/corei7-64-oe-linux/pcmx/1.0.0+gitAUTOINC+d3_d3v16_pcmx-r0/build'
| Makefile:130: recipe for target 'all' failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment