0

I am working on a Yocto Linux project and all is working fine, but I have one annoying problem. I have cloned a copy of Linux Kernel in my machine and I have pointed the attached bb file to it (branch and the latest revision). It works fine but like this every time I change something I have to commit my changes first. Is there a way to configure the bb file so it only points to the repository without bothering about the branch and revision? enter image description here

SUMMARY = "Mainline kernel package"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"

inherit kernel

DEPENDS += "lzop"

SRC_URI = "git:///home/dand/myFolder/firmware_linux;protocol=file;branch=cc-4.19"

#SRCREV = "a9aa91b7b589d633ed687306be0bd06173ba595b"
SRCREV = "${AUTOREV}"

S = "${WORKDIR}/git"

# The kernel class expects a defconfig in ${WORKDIR}, so tell it which one to use
DEFAULT_KERNEL_DEFCONFIG_arm     = "multi_v7_defconfig"
DEFAULT_KERNEL_DEFCONFIG_aarch64 = "defconfig"
DEFAULT_KERNEL_DEFCONFIG_x86     = "i386_defconfig"
DEFAULT_KERNEL_DEFCONFIG_x86_64  = "x86_64_defconfig"
KERNEL_DEFCONFIG ?= "${DEFAULT_KERNEL_DEFCONFIG}"

# enable support for device tree overlays
EXTRA_OEMAKE += "DTC_FLAGS=-@"

# Pick up configured default configurations from the linux source tree
do_configure_prepend() {
    if [ -n "${KERNEL_DEFCONFIG}" ]; then
        cp ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${B}/.config
    fi
}

# Set git commit version from yocto repo
do_configure_append() {
    ${S}/scripts/config --disable LOCALVERSION_AUTO --set-str LOCALVERSION -${DISTRO_VERSION}
}

# install devicetree blobs where those are configured
RRECOMMENDS_kernel-image += "kernel-devicetree"

I have looked everywhere around the internet.

RAA
  • 23
  • 4
  • You cold try adding `do_fetch[nostamp] = "1"` to the recipe, to indicate to always fetch the source fresh instead of using some cached version. – skandigraun Aug 02 '23 at 11:45
  • Does it matter where about the recipe I add the do_fetch[nostamp] = "1" or do I need to comment out any of the existing lines? – RAA Aug 02 '23 at 11:50
  • Just add it as a new line anywhere, no need to change anything else, and give it a go. Alternatively if it doesn't work on its own, maybe you should switch to using [`externalsrc`](https://docs.yoctoproject.org/ref-manual/classes.html#externalsrc) class instead of the git fetcher. That wouldn't fetch based on revision/commit, just grab the content of a folder. – skandigraun Aug 02 '23 at 11:52
  • do_fetch[nostamp] = "1" didn't work on its own. I had a look at externalsrc, it seems to be the right solution however I am new to Linux and didn't understand it quite well. – RAA Aug 02 '23 at 12:54
  • Basically change `inherit kernel` to `inherit kernel externalsrc`, comment out `SRC_URI` and `S` lines, and add `EXTERNALSRC = "/home/dand/myFolder/firmware_linux"` (the path of your source tree), and see what happens when you try to build. (I think this would work, though possible you would still need the "nostamp" flag from my first comment) – skandigraun Aug 02 '23 at 13:04
  • That worked quite well. FYI, I kept the do_fetch[nostamp] = "1" in the recipe as well. Many thanks, – RAA Aug 02 '23 at 13:56

1 Answers1

0

You need to use AUTOREV for SRCREV, see the following: https://docs.yoctoproject.org/dev-manual/packages.html#automatically-incrementing-a-package-version-number

In an other question there is a solution for it also: https://stackoverflow.com/a/38372518/19516062

Livius
  • 198
  • 4