mirror of
git://git.yoctoproject.org/meta-raspberrypi.git
synced 2025-07-19 21:09:03 +02:00
linux-raspberrypi: Convert dynamic config patching to config fragments
This allows us to drop all of the custom config patching in linux-raspberrypi.inc. It also allows the kernel config to be checked during the build for any discrepancies between the selected config options and the resulting .config file - this identified that `CONFIG_DRM_VC4` depends on `CONFIG_SND` and `CONFIG_SND_SOC`. Signed-off-by: Paul Barker <pbarker@konsulko.com>
This commit is contained in:
parent
26a888d669
commit
1c8ad80861
3
recipes-kernel/linux/files/initramfs-image-bundle.cfg
Normal file
3
recipes-kernel/linux/files/initramfs-image-bundle.cfg
Normal file
|
@ -0,0 +1,3 @@
|
|||
CONFIG_OVERLAY_FS=y
|
||||
CONFIG_SQUASHFS=y
|
||||
CONFIG_UBIFS_FS=y
|
6
recipes-kernel/linux/files/vc4graphics.cfg
Normal file
6
recipes-kernel/linux/files/vc4graphics.cfg
Normal file
|
@ -0,0 +1,6 @@
|
|||
CONFIG_I2C_BCM2835=y
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_FBDEV_EMULATION=y
|
||||
CONFIG_DRM_VC4=y
|
||||
CONFIG_SND=y
|
||||
CONFIG_SND_SOC=y
|
|
@ -11,7 +11,11 @@ PV = "${LINUX_VERSION}+git${SRCPV}"
|
|||
inherit kernel siteinfo
|
||||
require recipes-kernel/linux/linux-yocto.inc
|
||||
|
||||
SRC_URI += "file://rpi-kernel-misc.cfg"
|
||||
SRC_URI += " \
|
||||
file://rpi-kernel-misc.cfg \
|
||||
${@bb.utils.contains("INITRAMFS_IMAGE_BUNDLE", "1", "file://initramfs-image-bundle.cfg", "", d)} \
|
||||
${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "file://vc4graphics.cfg", "", d)} \
|
||||
"
|
||||
|
||||
KCONFIG_MODE = "--alldefconfig"
|
||||
KBUILD_DEFCONFIG_raspberrypi0-wifi ?= "bcmrpi_defconfig"
|
||||
|
@ -48,81 +52,6 @@ KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r",
|
|||
# manually. This value unused if KERNEL_IMAGETYPE is not uImage.
|
||||
KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000"
|
||||
|
||||
# Set a variable in .configure
|
||||
# $1 - Configure variable to be set
|
||||
# $2 - value [n/y/value]
|
||||
kernel_configure_variable() {
|
||||
# Remove the config
|
||||
CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;"
|
||||
if test "$2" = "n"
|
||||
then
|
||||
echo "# CONFIG_$1 is not set" >> ${B}/.config
|
||||
else
|
||||
echo "CONFIG_$1=$2" >> ${B}/.config
|
||||
fi
|
||||
}
|
||||
|
||||
config_setup() {
|
||||
# From kernel.bbclass. Unfortunately, this is needed to support builds that
|
||||
# use devtool. The reason is as follows:
|
||||
#
|
||||
# - In devtool builds, externalsrc.bbclass gets inherited and sets a list of
|
||||
# SRCTREECOVEREDTASKS, which don't get run because they affect the source
|
||||
# tree and, when using devtool, we want the developer's changes to be the
|
||||
# single source of truth. kernel-yocto.bbclass adds do_kernel_configme to
|
||||
# SRCTREECOVEREDTASKS, so it doesn't run in a devtool build., In a normal
|
||||
# non-devtool build, do_kernel_configme creates ${B}.config.
|
||||
#
|
||||
# - Normally (e.g. in linux-yocto), it would be OK that do_kernel_configme
|
||||
# doesn't run, because the first few lines of do_configure in kernel.bbclass
|
||||
# populate ${B}.config from either ${S}.config (if it exists) for custom
|
||||
# developer changes, or otherwise from ${WORDIR}/defconfig.
|
||||
#
|
||||
# - In linux-raspberrypi, we add do_configure_prepend, which tweaks
|
||||
# ${B}.config. Since this runs *before* the kernel.bbclass do_configure,
|
||||
# ${B}.config doesn't yet exist and we hit an error. Thus we need to move
|
||||
# the logic from do_configure up to before our do_configure_prepend. Because
|
||||
# we are copying only a portion of do_configure and not the whole thing,
|
||||
# there is no clean way to do it using OE functionality, so we just
|
||||
# copy-and-paste.
|
||||
if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
|
||||
mv "${S}/.config" "${B}/.config"
|
||||
fi
|
||||
|
||||
# Copy defconfig to .config if .config does not exist. This allows
|
||||
# recipes to manage the .config themselves in do_configure_prepend().
|
||||
if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
|
||||
cp "${WORKDIR}/defconfig" "${B}/.config"
|
||||
fi
|
||||
}
|
||||
|
||||
do_configure_prepend() {
|
||||
config_setup
|
||||
|
||||
mv -f ${B}/.config ${B}/.config.patched
|
||||
CONF_SED_SCRIPT=""
|
||||
|
||||
if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
|
||||
kernel_configure_variable OVERLAY_FS y
|
||||
kernel_configure_variable SQUASHFS y
|
||||
kernel_configure_variable UBIFS_FS y
|
||||
fi
|
||||
|
||||
# Activate the configuration options for VC4
|
||||
VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
|
||||
if [ "${VC4GRAPHICS}" = "1" ]; then
|
||||
kernel_configure_variable I2C_BCM2835 y
|
||||
kernel_configure_variable DRM y
|
||||
kernel_configure_variable DRM_FBDEV_EMULATION y
|
||||
kernel_configure_variable DRM_VC4 y
|
||||
fi
|
||||
|
||||
# Keep this the last line
|
||||
# Remove all modified configs and add the rest to .config
|
||||
sed -e "${CONF_SED_SCRIPT}" < '${B}/.config.patched' >> '${B}/.config'
|
||||
rm -f ${B}/.config.patched
|
||||
}
|
||||
|
||||
do_compile_append() {
|
||||
if [ "${SITEINFO_BITS}" = "64" ]; then
|
||||
cc_extra=$(get_cc_option)
|
||||
|
|
Loading…
Reference in New Issue
Block a user