Skip to contentSkip to conversation

etherlab

DISCUSSION Daniele Lugli 3 participants 17 messages Jan 17, 2024 – Jan 26, 2024

lore
Share & tools
lore
#0 lore raw

Hi all,

I am trying to add an EtherLAB Ethercat master to my target.

I added a new recipes-etherlab directory at the same level of other working recipes:

recipes-etherlab
|

+-etherlab
|
+-etherlab_0.1.bb
|
+-files
|
+-ethercat

The ethercat directory is from https://gitlab.com/etherlab.org/ethercat.git

etherlab_0.1.bb says:

DESCRIPTION = "EtherLAB Ethercat master"

LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" LICENSE = "GPLv2"

S = "${WORKDIR}/etherlab/ethercat"

FILES:${PN} = "\
/etc/init.d/ethercat \
/etc/sysconfig/ethercat \
${libdir}/libethercat.so.1.1.0 \
${libdir}/libethercat.so.1.1 \
${libdir}/libethercat.so.1 \
${bindir}/ethercat"

do_compile() {
autoreconf
sh configure --sysconfdir=/etc --enable-igb
make
}

do_install() {
install -d ${D}${bindir}/
install -d ${D}${libdir}/
install -d ${D}/etc/init.d/
install -m 0755 ${S}/lib/.libs/libethercat.so.1.0.0 ${D}${libdir}/libethercat.so.1.0.0 install -m 0755 ${S}/tool/ethercat ${D}${bindir}/ethercat
install -m 0755 ${S}/script/init.d/ethercat.in ${D}/etc/init.d/ethercat ln -s libethercat.so.1.1.0 ${D}${libdir}/libethercat.so.1.1
ln -s libethercat.so.1.1 ${D}${libdir}/libethercat.so.1
}

Last, I added

IMAGE_INSTALL += "etherlab"

to mytest-image.bb

Now, bitbake mytest-image complains:

/home/vboxuser/yocto/poky/build/tmp/work/corei7-64-poky-linux/etherlab/0.1/temp/run.do_compile.5355: 141: autoreconf: not found

The build configuration is

BB_VERSION           = "2.6.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "intel-corei7-64"
DISTRO               = "poky"
DISTRO_VERSION       = "4.3.2"
TUNE_FEATURES        = "m64 corei7"
TARGET_FPU           = ""
meta
meta-poky
meta-yocto-bsp       = "nanbield:f768ffb8916feb6542fcbe3e946cbf30e247b151" meta-oe              = "nanbield:2da6e1b0e43a8993fd422fee3f83940100b59f4c" meta-intel           = "nanbield:039e45e21d2973fc3ce318a25beceae348e4428a" meta-mytest          = "<unknown>:<unknown>"

and I have tools-sdk among my IMAGE_FEATURES.

Thank you in advance for any hint.

--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )

#1 lore raw
Quoted 60 lines · Daniele Lugli

Hi all,

I am trying to add an EtherLAB Ethercat master to my target.

I added a new recipes-etherlab directory at the same level of other working recipes:

recipes-etherlab
|

  +-etherlab
       |
   +-etherlab_0.1.bb
   |
   +-files
       |
   +-ethercat

The ethercat directory is from
https://gitlab.com/etherlab.org/ethercat.git

etherlab_0.1.bb says:

DESCRIPTION = "EtherLAB Ethercat master"

LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" LICENSE = "GPLv2"

S = "${WORKDIR}/etherlab/ethercat"

FILES:${PN} = "\
        /etc/init.d/ethercat \
        /etc/sysconfig/ethercat \
        ${libdir}/libethercat.so.1.1.0 \
        ${libdir}/libethercat.so.1.1 \
        ${libdir}/libethercat.so.1 \
        ${bindir}/ethercat"
do_compile() {
                autoreconf
                sh configure --sysconfdir=/etc --enable-igb
                make
}
do_install() {
                install -d ${D}${bindir}/
                install -d ${D}${libdir}/
                install -d ${D}/etc/init.d/
                install -m 0755 ${S}/lib/.libs/libethercat.so.1.0.0
${D}${libdir}/libethercat.so.1.0.0
                install -m 0755 ${S}/tool/ethercat ${D}${bindir}/ethercat
                install -m 0755 ${S}/script/init.d/ethercat.in
${D}/etc/init.d/ethercat
                ln -s libethercat.so.1.1.0 ${D}${libdir}/libethercat.so.1.1
                ln -s libethercat.so.1.1 ${D}${libdir}/libethercat.so.1
}

Last, I added

Quoted 9 lines

IMAGE_INSTALL += "etherlab"

to mytest-image.bb

Now, bitbake mytest-image complains:

/home/vboxuser/yocto/poky/build/tmp/work/corei7-64-poky-linux/etherlab/0.1/temp/run.do_compile.5355:
141: autoreconf: not found

Please add line: inherit autoconf which will pull necessary auto* tools

Quoted 34 lines

The build configuration is

BB_VERSION           = "2.6.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "intel-corei7-64"
DISTRO               = "poky"
DISTRO_VERSION       = "4.3.2"
TUNE_FEATURES        = "m64 corei7"
TARGET_FPU           = ""
meta
meta-poky
meta-yocto-bsp       = "nanbield:f768ffb8916feb6542fcbe3e946cbf30e247b151"
meta-oe              = "nanbield:2da6e1b0e43a8993fd422fee3f83940100b59f4c"
meta-intel           = "nanbield:039e45e21d2973fc3ce318a25beceae348e4428a"
meta-mytest          = "<unknown>:<unknown>"

and I have tools-sdk among my IMAGE_FEATURES.

Thank you in advance for any hint.

--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com
www.linkedin.com/in/daniele-lugli

Quoted 11 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#62180):
https://lists.yoctoproject.org/g/yocto/message/62180
Mute This Topic: https://lists.yoctoproject.org/mt/103796912/900721
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

BR,

marek

Signature · 10 lines
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
#2 lore raw

Hi Marek, and thank you for your reply.

Adding line "inherit autotools" (not "autoconf") in my recipe solved that problem. (I also had to put the sources of etherlab as a tgz and not as a plain directory)

I am now facing a different problem: the configure command complains

error: kernel 6.5 not available for 8139too driver!

As I don't need 8139too, I changed the configure arguments to

sh configure --sysconfdir=/etc --enable-igb --disable-8139too

This works if I build etherlab out of poky, but has no effect inside do_compile: I still get the same "not available" error.

My impression is that my do_compile isn't executed at all, and somehow "configure" is executed without my parameters. Is this possible?

Best regards,

--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )

#3 lore raw

Hi Daniele,

Quoted 7 lines · Daniele Lugli

Hi Marek, and thank you for your reply.

Adding line "inherit autotools" (not "autoconf") in my recipe solved that problem.
(I also had to put the sources of etherlab as a tgz and not as a plain directory)

Quoted 7 lines

I am now facing a different problem: the configure command complains

error: kernel 6.5 not available for 8139too driver!

As I don't need 8139too, I changed the configure arguments to

sh configure --sysconfdir=/etc --enable-igb --disable-8139too

I've used devtool (you can find more in the poky manual) to create a base recipe then with a few tweaks I can build it.
Please name this as ethercat_git.bb with content:
LICENSE = "GPL-2.0-only & LGPL-2.1-only & Unknown" LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \

file://COPYING.LESSER;md5=4fbd65380cdd255951079008b364516c \

file://devices/e1000/LICENSE;md5=e2643b73e47fa4b29cdfad24ee42bed6"

DEPENDS += "pkgconfig-native"
RDEPENDS:${PN} += "bash"

SRC_URI = "git:// gitlab.com/etherlab.org/ethercat.git;protocol=https;branch=master"

# Modify these as desired
PV = "1.6.0-rc1+git${SRCPV}"
SRCREV = "420e6150f55b71b97a84c64831f4928e0859a0e9"

S = "${WORKDIR}/git"

inherit autotools

EXTRA_OECONF = "--enable-igb --disable-8139too --with-linux-dir=${STAGING_KERNEL_BUILDDIR} --disable-igb"

FILES:${PN} += "${datadir}/*"

Hope this helps.

Quoted 10 lines

This works if I build etherlab out of poky, but has no effect inside
do_compile: I still get the same "not available" error.

My impression is that my do_compile isn't executed at all, and somehow "configure" is executed without my parameters. Is this possible?

Best regards,

Quoted 10 lines

--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com
www.linkedin.com/in/daniele-lugli

BR,

marek

Signature · 10 lines
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
#4 lore raw
Quoted 1 line · Marek Belisko via lists.yoctoproject.org

LICENSE = "GPL-2.0-only & LGPL-2.1-only & Unknown"

Obviously you need to fix the Unknown at some point.

Quoted 1 line

DEPENDS += "pkgconfig-native"

Idiomatically, inherit pkgconfig is preferred.

Quoted 1 line

EXTRA_OECONF = "--enable-igb --disable-8139too --with-linux-dir=${STAGING_KERNEL_BUILDDIR} --disable-igb"

You’re enabling and disabling igb, pick one.

Quoted 1 line

FILES:${PN} += "${datadir}/*"

This catch-all is overly keen and can cause incorrect packaging. It’s best to name explicit directories.

Quoted 3 lines

This works if I build etherlab out of poky, but has no effect inside do_compile: I still get the same "not available" error.

My impression is that my do_compile isn't executed at all, and somehow "configure" is executed without my parameters. Is this possible?

Not really. Are you sure the “not available” message is from the 8139too driver, and not something else? Sharing the complete log.do_configure and log.do_compile (depending on where it actually breaks) would help debug this.

Ross

#5 lore raw

Thank you Marek and Ross.

@Ross: I had a look into log.do_configure and found

checking for Linux kernel sources... /usr/src/linux-headers-6.5.0-14-generic (Kernel 6.5)

but these are from the host, my target kernel is a 6.1 with PREEMPT_RT ! Also it suggests to look into config.log, where I find

$ ../ethercat/configure --build=x86_64-linux --host=x86_64-poky-linux --target=x86_64-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/vboxuser/yocto/poky/build/tmp/work/corei7-64-poky-linux/etherlab/0.1/recipe-sysroot --disable-static

so in fact my arguments aren't there.

--------

I tried the recipe from Marek (leaving --enable-igb and removing --disable-igb as suggested by Ross) and I got

| checking for kernel for igb driver... configure: error: kernel 6.1 not available for igb driver!

An internet search shows that the intel igb driver failing to build with several recent kernels 6.x seems known, and not related to yocto. So I gave up igb and settled for the generic driver with the following modification:

EXTRA_OECONF = "--enable-generic --disable-igb --disable-8139too --with-linux-dir=${STAGING_KERNEL_BUILDDIR}"

This way, bitbake completes without errors and I am able to test my image.

When I try to start the ethercat master with

/etc/init.d/ethercat start

I get:

Start EtherCAT master 1.6.0-rc1 modprobe: FATAL: Module ec_master not found in directory /lib/modules/6.1.59-rt16-intel-pk-preempt-rt failed

and in fact there is no ec_master.ko in /lib/modules (nor anywhere else).

If I understand correctly https://docs.yoctoproject.org/ref-manual/classes.html#autotools, the inherited autotools run configure behind the scenes. But the Etherlab installation instructions are:

./bootstrap
./configure { with args as needed }
make all modules
make modules_install install
depmod

bootstrap just contains an "autoreconf -i" which, according to the doc, is also automatically run behind the scenes. Arguments for configure are supplied through EXTRA_OECONF and are OK
make modules and make modules_install are probably not run.

I see from the doc that there is also an EXTRA_OEMAKE variable which should pass additional arguments to make. So I try:

EXTRA_OEMAKE = "all modules"

but so bitbake fails. I see in log.do_compile:

/home/vboxuser/yocto/poky/build/tmp/work-shared/intel-corei7-64/kernel-source/scripts/Makefile.build:44: /home/vboxuser/yocto/poky/build/tmp/work/corei7-64-poky-linux/ethercat/1.6.0-rc1+git/build/../git/Makefile: No such file or directory

I also see a worrying warning:

warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-poky-linux-gcc (GCC) 13.2.0 You are using:           gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Why is it using the compiler from the host? How can I add the custom make commands and depmod?

Thank you in advance for your replies.

--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )

#6 lore raw
Quoted 5 lines · Daniele Lugli via Lists.Yoctoproject.Org

Thank you Marek and Ross.
@Ross: I had a look into log.do_configure and found
checking for Linux kernel sources... /usr/src/linux-headers-6.5.0-14-generic (Kernel 6.5) but these are from the host, my target kernel is a 6.1 with PREEMPT_RT !

That would be a big problem yes.

Quoted 2 lines

An internet search shows that the intel igb driver failing to build with several recent kernels 6.x seems known, and not related to yocto. So I gave up igb and settled for the generic driver with the following modification:
EXTRA_OECONF = "--enable-generic --disable-igb --disable-8139too --with-linux-dir=${STAGING_KERNEL_BUILDDIR}"

That seems right.

Quoted 5 lines

Start EtherCAT master 1.6.0-rc1 modprobe: FATAL: Module ec_master not found in directory /lib/modules/6.1.59-rt16-intel-pk-preempt-rt failed
and in fact there is no ec_master.ko in /lib/modules (nor anywhere else).
If I understand correctly https://docs.yoctoproject.org/ref-manual/classes.html#autotools, the inherited autotools run configure behind the scenes. But the Etherlab installation instructions are:
./bootstrap
./configure { with args as needed }

Quoted 8 lines

make all modules
make modules_install install
depmod
bootstrap just contains an "autoreconf -i" which, according to the doc, is also automatically run behind the scenes.
Arguments for configure are supplied through EXTRA_OECONF and are OK
make modules and make modules_install are probably not run.
I see from the doc that there is also an EXTRA_OEMAKE variable which should pass additional arguments to make. So I try:
EXTRA_OEMAKE = "all modules"

That is used to pass to _every_ make invocation, which isn’t what you want.

Quoted 3 lines

The kernel was built by: x86_64-poky-linux-gcc (GCC) 13.2.0
You are using: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Why is it using the compiler from the host?

Because Makefiles are hard, kernel makefiles even harder. Especially when someone is trying to be clever and wrap the kbuild infrastructure inside autotools.

You _might_ find it easier to write two recipes: one that builds the userspace code and one that builds the kernel module.

The userspace one is basically what you’ve already written, but change —with-linux-dir=… to —disable-kernel.

Then create a new recipe that has the same SRC_URI but inherits module and tells that what makefile to use (EXTRA_OEMAKE += “-f Makefile.kbuild). This might then build the module using the standard kernel tooling fine and that should force it to use the correct compiler.

Ross

#7 lore raw
Quoted 3 lines · Ross Burton

Especially when someone is trying to be clever and wrap the kbuild infrastructure inside autotools.

Not me :)

Thank you very much, Ross. Now I have an ethercat-userspace.bb recipe with --disable-kernel, and the following ethercat-kernel.bb:

LICENSE = "GPL-2.0-only & LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING.LESSER;md5=4fbd65380cdd255951079008b364516c \
file://devices/e1000/LICENSE;md5=e2643b73e47fa4b29cdfad24ee42bed6"

DEPENDS += "pkgconfig-native"
RDEPENDS:${PN} += "bash"

SRC_URI = "git://gitlab.com/etherlab.org/ethercat.git;protocol=https;branch=master"

PV = "1.6.0-rc1+git${SRCPV}"
SRCREV = "420e6150f55b71b97a84c64831f4928e0859a0e9"

S = "${WORKDIR}/git"

inherit autotools
inherit module

EXTRA_OECONF = "--enable-generic --disable-igb --disable-8139too --with-linux-dir=${STAGING_KERNEL_BUILDDIR}"

EXTRA_OEMAKE += "-f Makefile.kbuild"

FILES:${PN} += "${datadir}/*"

which fails, and in log.do_compile I find:

ERROR: oe_runmake failed
WARNING: exit code 1 from a shell command.
make: Makefile.kbuild: No such file or directory
make: *** No rule to make target 'Makefile.kbuild'.  Stop.

but a poky/build/tmp/work/intel_corei7_64-poky-linux/ethercat-kernel/1.6.0-rc1+git/git/Makefile.kbuild does exist, and

bitbake-getvar -r ethercat-kernel S

says

S="/home/vboxuser/yocto/poky/build/tmp/work/intel_corei7_64-poky-linux/ethercat-kernel/1.6.0-rc1+git/git"

so it seems to be in the right place.

(By the way, I also find a yocto/poky/build/tmp/ work/corei7-64-poky-linux/ethercat-userspace/1.6.0-rc1+git/git/Makefile.kbuild don't know why, and why is it in corei7-64-poky-linux instead of intel_corei7_64-poky-linux)

--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )

#8 lore raw

Hi all,

Is there a way to have autotools available in the recipe, but without automatically executing configure and make?

So I could have my own invocations of make, make modules, make modules_install etc

Thank you
--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )

#9 lore raw
Quoted 6 lines · Daniele Lugli via lists.yoctoproject.org

Hi all,

Is there a way to have autotools available in the recipe, but without automatically executing configure and make?

So I could have my own invocations of make, make modules, make modules_install etc

Yes:

inherit autotools

do_compile() {

  # this replaces the do_compile from autotools. You can run it by calling autotools_do_compile.
}

Ross

#10 lore raw

Interesting. I see from the doc ( https://docs.yoctoproject.org/ref-manual/classes.html?highlight=autotools#autotools ) that the autotools class also runs, "behind the scenes", a do_configure and a do_install. That's all or are there any more? Can I also replace these by writing my own do_configure and do_install?

Thank you
--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )

#11 lore raw
Quoted 5 lines · Daniele Lugli via Lists.Yoctoproject.Org

Interesting. I see from the doc (https://docs.yoctoproject.org/ref-manual/classes.html?highlight=autotools#autotools) that the autotools class also runs, "behind the scenes", a do_configure and a do_install. That's all or are there any more? Can I also replace these by writing my own do_configure and do_install?

If you don’t want to run the autotools then don’t inherit autotools. Maybe sharing your WIP recipes would be useful?

Ross

#12 lore raw

I would like to have autotools available but to decide myself how to use them.

Here is mytest-image.bb:

# Adapted from the meta-intel layer

require recipes-core/images/core-image-minimal.bb

# Skip processing of this recipe if linux-intel-rt is not explicitly specified as the # PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying

# to build multiple virtual/kernel providers.
python () {
if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt":
raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it")
}

DESCRIPTION = "Small image capable of booting a device with a test suite and \
tools for real-time use. It includes the full meta-toolchain, development \
headers and libraries to form a standalone SDK."

DEPENDS += " linux-intel-rt linux-libc-headers"

IMAGE_FEATURES += "dev-pkgs tools-sdk tools-debug eclipse-debug tools-profile tools-testapps debug-tweaks"

#IMAGE_FEATURES += "keyboard" non disponibile
#IMAGE_FEATURES += "ldconfig" non disponibile
#IMAGE_FEATURES += "x11-sato"

IMAGE_INSTALL += "rt-tests hwlatdetect kernel-dev kernel-devsrc" IMAGE_INSTALL += "keymaps"
IMAGE_INSTALL += "vim"
IMAGE_INSTALL += "emacs"
IMAGE_INSTALL += "nano"
IMAGE_INSTALL += "cmake"

# 240118
IMAGE_INSTALL:append = " kernel-dev"
IMAGE_INSTALL:append = " kernel-devsrc"
IMAGE_INSTALL:append = " kernel-modules"

IMAGE_INSTALL += "simple-rt"
IMAGE_INSTALL += "italian"
IMAGE_INSTALL += "ethercat-userspace"
IMAGE_INSTALL += "ethercat-kernel"

LICENSE = "MIT"

Here is ethercat-kernel.bb:

LICENSE = "GPL-2.0-only & LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING.LESSER;md5=4fbd65380cdd255951079008b364516c \
file://devices/e1000/LICENSE;md5=e2643b73e47fa4b29cdfad24ee42bed6"

DEPENDS += "pkgconfig-native"
RDEPENDS:${PN} += "bash"

SRC_URI = "git://gitlab.com/etherlab.org/ethercat.git;protocol=https;branch=master"

# Modify these as desired
PV = "1.6.0-rc1+git${SRCPV}"
SRCREV = "420e6150f55b71b97a84c64831f4928e0859a0e9"

S = "${WORKDIR}/git"

inherit autotools
inherit module

EXTRA_OECONF = "--sysconfdir=/etc --enable-generic --disable-igb --disable-8139too --with-linux-dir=${STAGING_KERNEL_BUILDDIR}" EXTRA_OEMAKE += "-f Makefile"

#do_configure() {

# sh ./bootstrap
# sh ./configure --sysconfdir=/etc --disable-8139too --disable-igb --with-linux-dir=${STAGING_KERNEL_BUILDDIR}
#}

#do_compile() {

# make all
# make modules
#}

#do_install() {

# make modules_install
# make install
# depmod
#}

FILES:${PN} += "${datadir}/*"

Here is my local.conf (#comments removed):

MACHINE ?= "intel-corei7-64"

DISTRO ?= "poky"

EXTRA_IMAGE_FEATURES ?= "debug-tweaks"

USER_CLASSES ?= "buildstats"

PATCHRESOLVE = "noop"

BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
HALT,${TMPDIR},100M,1K \
HALT,${DL_DIR},100M,1K \
HALT,${SSTATE_DIR},100M,1K \
HALT,/tmp,10M,1K"

CONF_VERSION = "2"

PREFERRED_PROVIDER_virtual/kernel = "linux-intel-rt"

EXTRA_IMAGE_FEATURES:append = " tools-sdk dev-pkgs "

WKS_FILE = "image-installer.wks.in"
IMAGE_FSTYPES:append = " ext4"
IMAGE_TYPEDEP:wic = "ext4"
INITRD_IMAGE_LIVE="core-image-minimal-initramfs"
do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"
do_rootfs[depends] += "virtual/kernel:do_deploy"
IMAGE_BOOT_FILES:append = "\
${KERNEL_IMAGETYPE} \
microcode.cpio \
${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.rootfs.ext4;rootfs.img \
${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', 'grub-efi-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', '${IMAGE_ROOTFS}/boot/EFI/BOOT/grub.cfg;EFI/BOOT/grub.cfg', '', d)} \
${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', 'systemd-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/loader.conf;loader/loader.conf ', '', d)} \
${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/entries/boot.conf;loader/entries/boot.conf', '', d)} "

Thank you

--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )

#14 lore raw
Quoted 3 lines · Daniele Lugli via lists.yoctoproject.org

On Thu, Jan 25, 2024 at 01:03 PM, Daniele Lugli wrote:
I would like to have autotools available but to decide myself how to use them. Not possible?

Absolutely possible, the class source shows that it provides default do_configure/do_compile/do_install implementations.

Ross

#15 lore raw
In reply to Daniele Lugli
Quoted 10 lines · Daniele Lugli via Lists.Yoctoproject.Org

which fails, and in log.do_compile I find:
ERROR: oe_runmake failed
WARNING: exit code 1 from a shell command.
make: Makefile.kbuild: No such file or directory
make: *** No rule to make target 'Makefile.kbuild'. Stop.
but a poky/build/tmp/work/intel_corei7_64-poky-linux/ethercat-kernel/1.6.0-rc1+git/git/Makefile.kbuild does exist, and bitbake-getvar -r ethercat-kernel S
says S="/home/vboxuser/yocto/poky/build/tmp/work/intel_corei7_64-poky-linux/ethercat-kernel/1.6.0-rc1+git/git" so it seems to be in the right place.

Ah, yes. That would be because autotools recipes run in $(B) by default, not $(S). So you’ll want to do -f ${S}/Makefile.kbuild.

(that’s how autotools expects to work, you run everything from the build directory if you’re doing out-of-tree builds)

Quoted 2 lines

(By the way, I also find a yocto/poky/build/tmp/work/corei7-64-poky-linux/ethercat-userspace/1.6.0-rc1+git/git/Makefile.kbuild don't know why, and why is it in corei7-64-poky-linux instead of intel_corei7_64-poky-linux)

Because the default package architecture (and thus the work directory name) is the tune not the machine. Only truly machine-specific recipes need to be machine-specific.

Ross

#16 lore raw

Hi Ross, thank you for your reply.

I tried

...
inherit autotools
inherit module

EXTRA_OECONF = "--sysconfdir=/etc --enable-generic --disable-igb --disable-8139too --with-linux-dir=${STAGING_KERNEL_BUILDDIR}" EXTRA_OEMAKE += "-f ${S}/Makefile.kbuild"
...

and now Makefile.kbuild is found.
The error is now:

| make -C "" M="" INSTALL_MOD_DIR="" modules
| make: the '-C' option requires a non-empty string argument

Makefile.kbuild contains

KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_srcdir)" INSTALL_MOD_DIR= "$(INSTALL_MOD_DIR)"

modules:
$(KBUILD) modules

so the problem is that these variables are empty.

As there is also a Makefile, containing references to Makefile.kbuild, I also tried with

EXTRA_OEMAKE += "-f Makefile"

(the default ${B} should be good here because Makefile doesn't come out of git, it is created by configure)

and now I get

| ../../git/lib/domain.c:38:10: fatal error: stdio.h: No such file or directory

and a bunch of similar errors.
--
Daniele Lugli
General Logic srl
Viale Curreno, 41
10133 Torino
Italy
tel +39 329 3933041
www.general-logic.com ( http://www.general-logic.com/ ) www.linkedin.com/in/daniele- lugli ( http://www.linkedin.com/in/daniele-lugli )