In Yocto, Linux kernel configuration is not accepting the configuration from meta layer - yocto

I have written a panel driver and now converted into a meta layer. I have created the meta layer using devtool and configuration is stored in xxx-fragment.cfg
In xxx-fragment.cfg file, I set the config CONFIG_xxxx to Y i.e.
CONFIG_xxxx=Y
Unfortunately, I get the following error. Could someone kindly point me reason for the error?
WARNING: linux-imx-5.10.35+abcbdcbc-.4 do_kernel_configcheck: [kernel config]: specified values did not make it into the kernel's final configuration:
[NOTE]: 'CONFIG_xxxx' last val (y) and .config val (n) do not match
[INFO]: CONFIG_xxxx : n ## .config: 4363 :configs//./xxx-fragment.cfg (y)
[INFO]: raw config text:
config CONFIG_xxxx
tristate "xxxx"
depends on OF && DRM_MIPI_DSI && DRM && DRM_PANEL && HAS_IOMEM
help
Say Y here if you want to enable support for xxxxxxx
Config 'CONFIG_xxxx' has the following Direct dependencies (CONFIG_xxxx=y):
OF(=y) && DRM_MIPI_DSI(=y) && DRM(=y) && DRM_PANEL(=y) && HAS_IOMEM(=y)
Parent dependencies are:
OF [y] DRM [y] DRM_PANEL [y] HAS_IOMEM [y] DRM_MIPI_DSI [y]

Related

Yocto: how to configure an out-of-tree kernel module recipe that uses "inherit module"?

I have written a simple inherit module recipe to build a third-party out-of-tree kernel module called u-dma-buf:
SUMMARY = "User space mappable DMA Buffer"
DESCRIPTION = "${SUMMARY}"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=bebf0492502927bef0741aa04d1f35f5"
inherit module
SRC_URI = "git://github.com/ikwzm/udmabuf.git"
SRCREV = "9b943d49abc9c92a464e4c71e83d1c479ebbf80e"
S = "${WORKDIR}/git"
RPROVIDES_${PN} += "kernel-module-u-dma-buf"
This works correctly and generates the module file /lib/modules/[version]/extra/u-dma-buf.ko in the image.
However, looking at the docs there is an option that can be enabled: CONFIG_U_DMA_BUF_MGR that is disabled by default. If I can somehow enable this, then I can expect to find /lib/modules/[version]/extra/u-dma-buf-mgr.ko in the image also.
The project has a Kconfig file. Does bitbake have support for integrating Kbuild configuration outside of the kernel tree? If so, how do I hook into this and enable CONFIG_U_DMA_BUF_MGR? And if not, what's my best option, other than patching the Kconfig file to change the default to "y"? (EDIT: this probably won't work, as kernel sources need to be modified to incorporate Kbuild anyway - so probably a dead end unless it's a specific feature of bitbake I haven't encountered yet).
I see that the upstream Makefile also has the option CONFIG_U_DMA_BUF_MGR=m that could be used to enable this feature outside of Kbuild. I'm not sure how to pass that to the make command line though - would I need to write a custom do_compile task? Looking at the module.bbclass code, I can't see any provision for passing such an option to oe_runmake. Should I just copy/paste module_do_compile() from module.bbclass and add CONFIG_U_DMA_BUF_MGR=m? Is that the best way to do this?
So my question is, given I'm using inherit module, what is the proper way to enable this configuration option, given the recipe I have?
According to the Yocto kernel development docs:
If your module Makefile uses a different variable, you might want to override the do_compile step
That suggests to me that the correct and intended course of action in this case is to copy/paste module_do_compile() as a do_compile() override, and modify accordingly (add CONFIG_U_DMA_BUF_MGR=m):
do_compile() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR} \
KERNEL_VERSION=${KERNEL_VERSION} \
CC="${KERNEL_CC}" LD="${KERNEL_LD}" \
AR="${KERNEL_AR}" \
O=${STAGING_KERNEL_BUILDDIR} \
KBUILD_EXTRA_SYMBOLS="${KBUILD_EXTRA_SYMBOLS}" \
CONFIG_U_DMA_BUF_MGR=m \
${MAKE_TARGETS}
}
Additionally, add the new module to RPROVIDES_${PN}:
RPROVIDES_${PN} += "kernel-module-u-dma-buf kernel-module-u-dma-buf-mgr"

u-boot bbappend causes file system corruption

I need to configure u-boot to boot immediately (disabling the press key to interrupt prompt) for a yocto build.
I've added the following bbappend to do so:
# u-boot_%.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot:"
SRC_URI_append_edge = " \
file://disable-boot-delay.cfg \
"
where disable-boot-delay.cfg looks like this:
CONFIG_AUTOBOOT_KEYED=y
CONFIG_AUTOBOOT_KEYED_CTRLC=n
CONFIG_BOOTDELAY=-2
This successfully disables the boot prompt, but also causes the FAT partition that u-boot is installed on to become corrupt:
$ # without above bbappend
$ dosfsck /dev/mapper/loop0p1
fsck.fat 4.1 (2017-01-24)
/dev/mapper/loop0p1: 49 files, 6510/20431 clusters
$ # with above bbappend
$ dosfsck /dev/mapper/loop0p1
fsck.fat 4.1 (2017-01-24)
/OVERLAYS/.
Bad short file name (.).
1) Drop file
2) Rename file
3) Auto-rename
4) Keep it
? 4
/OVERLAYS/..
Bad short file name (..).
1) Drop file
2) Rename file
3) Auto-rename
4) Keep it
? 4
/dev/mapper/loop0p1: 49 files, 6510/20431 clusters
I'm massively, massively confused as to how this change could be causing file system corruption.
Environment:
Yocto Warrior (2.7)
meta-raspberrypi (warrior branch)
RPI_USE_U_BOOT = "1"
Diffing workdir/build/.config with and without the above append:
229c229
< CONFIG_BOOTDELAY=2
---
> CONFIG_BOOTDELAY=-2
306c306,311
< # CONFIG_AUTOBOOT_KEYED is not set
---
> CONFIG_AUTOBOOT_KEYED=y
> CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds\n"
> # CONFIG_AUTOBOOT_ENCRYPTION is not set
> CONFIG_AUTOBOOT_DELAY_STR=""
> CONFIG_AUTOBOOT_STOP_STR=""
> # CONFIG_AUTOBOOT_KEYED_CTRLC is not set

Using PREMIRRORS in Bitbake configuration

How do I use PREMIRRORS in Bitbake local configurations or recipes?
I want to provide my own download locations for some slow or inaccessible third-party URLs, but the official PREMIRRORS documentation is vague and lacks examples.
Note: These results are based on experimentation with Yocto 2.3, but probably apply to 2.5 as well.
A simple example
Suppose that your recipe file contains this target URL:
SRC_URI = "http://download.example.com:8080/foo/bar/baz-1.0.tar.gz"
Then in your local.conf, you can define your custom download location as:
PREMIRRORS_prepend = "http://download\.example\.com:8080/.* http://my-mirror.example.com/copies/\n"
In this default case (with no special placeholders) Bitbake does not include the additional /foo/bar path elements, and instead tries to download just the filename from http://my-mirror.example.com/copies/baz-1.0.tar.gz
Advanced examples
These samples use special predefined placeholders, which are detailed in the next section.
HTTP/HTTPS with same file structure
Recipe: SRC_URI = "https://example.com:1234/foo/bar.zip"
Setting: PREMIRRORS_prepend = "http(s)?://example\.com(:\d+)?/.* http://mirror.local/PATH\n"
Attempts: http://mirror.local/foo/bar.zip
HTTP/HTTPS with flat structure
Recipe: SRC_URI = "https://example.com:1234/foo/bar.zip"
Setting: PREMIRRORS_prepend = "http(s)?://example\.com(:\d+)?/.* http://mirror.local/MIRRORNAME\n"
Attempts: http://mirror.local/example.com.1234.foo.bar.zip
Just switch the hostname
Recipe: SRC_URI = "ftp://example.com:1234/foo/bar.zip"
Setting: PREMIRRORS_prepend = "(\w+)://example\.com(:\d+)?/.* TYPE://mirror.local/PATH\n"
Attempts: ftp://mirrors.local/foo/bar.zip
Placeholders in replacement URI
PREMIRRORS parses all matched URIs and provides five special placeholder values in the target URI. Supposing the matched URI is http://host.example.com:1234/foo/bar/baz.txt:
TYPE https
HOST host.example.com%3A1234
PATH foo/bar/baz.txt
BASENAME baz.txt
MIRRORNAME host.example.com.1234.foo.bar.baz.txt
Altering the PREMIRRORS variable
The PREMIRRORS variable consists of series of lines (separated by \n) each with a regular expression to match a URI, and then a replacement string, with both portions separated by a space.
Bitbake tries them in order of appearance, and you generally want your private mirrors to take priority, so prepend onto PREMIRRORS, ex:
PREMIRRORS_prepend = "http://original/location/.* http://alternate/location/\n"
What file should I edit?
You can add entries to PREMIRRORS inside your bitbake recipes, but it is not recommended, since a major use of PREMIRRORS is for people reusing your recipe in some other context or location.
Instead, you can put it inside your local.conf file in an existing build directory. Alternately, edit the source template which Poky script use when creating a new local.conf in a fresh build-directory.
Other questions
What about SOURCE_MIRROR_URL?
The SOURCE_MIRROR_URL is a quick way to add a series of PREMIRROR entries for all supported protocols. For example, this setting:
INHERIT += "own-mirrors"
SOURCE_MIRROR_URL = "TYPE://mirror.local/PATH"
is the same as writing:
PREMIRRORS_prepend = "\
cvs://.*/.* TYPE://mirror.local/PATH \
svn://.*/.* TYPE://mirror.local/PATH \
git://.*/.* TYPE://mirror.local/PATH \
gitsm://.*/.* TYPE://mirror.local/PATH \
hg://.*/.* TYPE://mirror.local/PATH \
bzr://.*/.* TYPE://mirror.local/PATH \
p4://.*/.* TYPE://mirror.local/PATH \
osc://.*/.* TYPE://mirror.local/PATH \
https?$://.*/.* TYPE://mirror.local/PATH \
ftp://.*/.* TYPE://mirror.local/PATH \
npm://.*/?.* TYPE://mirror.local/PATH \
"
It seems the INHERIT+SOURCE_MIRROR_URL directives will still work if used in your local.conf (as opposed to a particular recipe.) However, Bitbake will emit warnings, so it may not be the intended use-case. Ex:
WARNING: Invalid protocol in PREMIRRORS: ('cvs://.*/.*', 'TYPE://mirror.local/PATH')
How can I check and debug my settings?
The -D debug flag will cause bitbake to emit information about what URLs it attempts to download from. You can also use -C do_fetch, which will force it to try the fetch step and re-download anything needed for the given recipe.
bitbake -D -C do_fetch software-recipe-name-here
Here's some example debug output, showing the PREMIRROR URL it attempts to access:
DEBUG: some-software-1.0 do_fetch: Trying PREMIRRORS
DEBUG: some-software-1.0 do_fetch: Fetcher accessed the network with the command /usr/bin/env wget -t 2 -T 30 -nv --passive-ftp --no-check-certificate -P /home/user/build_foo/DL_DIR 'http://mirror.local/path/to/the/filename.ext
If you need to experiment and run bitbake many times, it will be faster to temporarily put your new PREMIRRORS_prepend directive into a particular test-recipe, as opposed to modifying the local.conf. This is because Bitbake won't need to re-parse all the other recipes whenever you change it.
What if I want to isolate a port-number, e.g. http://host:123/foo?
Apparently there's no easy way to get the 123 on its own. While PREMIRRORS allows you to match with regular expressions, it does not seem to support using captured text from the match inside the replacement URI.
The port number is present inside HOST and MIRRORNAME, but there's no standard mechanism to split those values apart.
Fllow up. What if I want to isolate a port-number, e.g. http://host:123/foo?
Maybe you can use captured.
like:
org: "http://somewhere.org:1234/somedir1/somedir2/somefile_1.2.3.tar.gz"
reg: "http://somewhere.org(:\d+)?/.*"
sub: "http://somewhere2.org\1/somedir3"
result: "http://somewhere2.org:1234/somedir3/somefile_1.2.3.tar.gz"

Buildroot Config Option for applying custom patch

I am new to buildroot and working to build Linaro with buildroot ..I have multiple fragment kernel config files and specified that in buildroot defconfig.
I have specified a custom kernel patches directory with BR2_LINUX_PATCH_DIR .
I dont have some of the config flags not set which are supposed to be there in the .config files..so i suspect that the Patches are applied successfully..so i tried giving a non existing location as Linux Patch dir and it does not give any error..
Is there anything other than giving value to BR2_LINUX_PATCH_DIR and what should be the format of the dir structure...in buildroot manual it says it should be
Package_name/patch name..For linux what should be the package name? It should be the same with which linux dir is created.for example for me it is linux-custom
Plz suggest and guide me in this.
Thanks in Advance
The option is named BR2_LINUX_KERNEL_PATCH, there is nothing named BR2_LINUX_PATCH_DIR. It applies all patches listed in this option (if those are files), or all files named *.patch if what's given in this option is a directory. See the code in linux/linux.mk:
define LINUX_APPLY_LOCAL_PATCHES
for p in $(filter-out ftp://% http://% https://%,$(LINUX_PATCHES)) ; do \
if test -d $$p ; then \
$(APPLY_PATCHES) $(#D) $$p \*.patch || exit 1 ; \
else \
$(APPLY_PATCHES) $(#D) `dirname $$p` `basename $$p` || exit 1; \
fi \
done
endef
Also, I would recommend that you watch the output of Buildroot: it shows everything it is doing, especially it lists the patches it applied. Look at the line >>> linux .... Patching, which is the marker for the beginning of the patching step of the linux package.

Detecting the platform in rpm .spec file

I have a .spec file to build rpm for Fedora, CentOS and Oracle Linux. I need to install a post-uninstall trigger for the kernel package. To achieve that for Oracle Linux, I need to put something like this in my spec file:
%triggerpostun -- kernel-uek
%(cat %{SOURCE1001})
On CentOS, the package is called kernel, and on Fedora it is called kernel-core. My question is, how do I specify the trigger in my spec file in a portable way (so that it works on all of these target platforms), without any duplication?
EDIT: Some information about what I have tried - I tried putting the following in my spec file:
%if 0%{?fedora}
%triggerpostun -- kernel-core
%else
%if 0%{?ol7}
%triggerpostun -- kernel-uek
%else
%triggerpostun -- kernel
%endif
%endif
%(cat %{SOURCE1006})
But on CentOS, this gives me a trigger like this:
triggerpostun scriptlet (using /bin/sh) -- kernel-uek
for filename in /boot/*.ksplice-updates*; do
if [[ -h $filename && ! -e $filename ]]; then
rm $filename
fi
done
which is wrong because the correct package name on CentOS is kernel.
I am complete noob to packaging, so let me know if you need more context to provide suggestion.
I assume the multiple %else are causing problems. I would define the conditions this way:
%if 0%{?fedora}
%define kernelpkgname kernel-core
%endif
%if 0%{?ol7}
%define kernelpkgname kernel-uek
%endif
%if 0%{?rhel} >= 6
%define kernelpkgname kernel
%endif
Then use kernelpkgname variable in the triggerpostun.
%postun
....
%triggerpostun -- %{kernelpkgname}
cat %{SOURCE1006}