diff options
author | Paul Barker <pbarker@konsulko.com> | 2020-11-25 14:36:13 +0000 |
---|---|---|
committer | Andrei Gherzan <andrei@gherzan.ro> | 2020-11-27 14:29:55 +0000 |
commit | 1c8ad80861f4882eb31c00e27dcc97b3cb786913 (patch) | |
tree | 88239d10b2ea65f33796249e0083a5cf0ef7d089 | |
parent | 26a888d669b2d73c251c9107bd7e9871751a1ab6 (diff) | |
download | meta-raspberrypi-1c8ad80861f4882eb31c00e27dcc97b3cb786913.tar.gz |
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>
-rw-r--r-- | recipes-kernel/linux/files/initramfs-image-bundle.cfg | 3 | ||||
-rw-r--r-- | recipes-kernel/linux/files/vc4graphics.cfg | 6 | ||||
-rw-r--r-- | recipes-kernel/linux/linux-raspberrypi.inc | 81 |
3 files changed, 14 insertions, 76 deletions
diff --git a/recipes-kernel/linux/files/initramfs-image-bundle.cfg b/recipes-kernel/linux/files/initramfs-image-bundle.cfg new file mode 100644 index 0000000..ea54003 --- /dev/null +++ b/recipes-kernel/linux/files/initramfs-image-bundle.cfg | |||
@@ -0,0 +1,3 @@ | |||
1 | CONFIG_OVERLAY_FS=y | ||
2 | CONFIG_SQUASHFS=y | ||
3 | CONFIG_UBIFS_FS=y | ||
diff --git a/recipes-kernel/linux/files/vc4graphics.cfg b/recipes-kernel/linux/files/vc4graphics.cfg new file mode 100644 index 0000000..0b4ba48 --- /dev/null +++ b/recipes-kernel/linux/files/vc4graphics.cfg | |||
@@ -0,0 +1,6 @@ | |||
1 | CONFIG_I2C_BCM2835=y | ||
2 | CONFIG_DRM=y | ||
3 | CONFIG_DRM_FBDEV_EMULATION=y | ||
4 | CONFIG_DRM_VC4=y | ||
5 | CONFIG_SND=y | ||
6 | CONFIG_SND_SOC=y | ||
diff --git a/recipes-kernel/linux/linux-raspberrypi.inc b/recipes-kernel/linux/linux-raspberrypi.inc index 5fa5889..fe5da69 100644 --- a/recipes-kernel/linux/linux-raspberrypi.inc +++ b/recipes-kernel/linux/linux-raspberrypi.inc | |||
@@ -11,7 +11,11 @@ PV = "${LINUX_VERSION}+git${SRCPV}" | |||
11 | inherit kernel siteinfo | 11 | inherit kernel siteinfo |
12 | require recipes-kernel/linux/linux-yocto.inc | 12 | require recipes-kernel/linux/linux-yocto.inc |
13 | 13 | ||
14 | SRC_URI += "file://rpi-kernel-misc.cfg" | 14 | SRC_URI += " \ |
15 | file://rpi-kernel-misc.cfg \ | ||
16 | ${@bb.utils.contains("INITRAMFS_IMAGE_BUNDLE", "1", "file://initramfs-image-bundle.cfg", "", d)} \ | ||
17 | ${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "file://vc4graphics.cfg", "", d)} \ | ||
18 | " | ||
15 | 19 | ||
16 | KCONFIG_MODE = "--alldefconfig" | 20 | KCONFIG_MODE = "--alldefconfig" |
17 | KBUILD_DEFCONFIG_raspberrypi0-wifi ?= "bcmrpi_defconfig" | 21 | KBUILD_DEFCONFIG_raspberrypi0-wifi ?= "bcmrpi_defconfig" |
@@ -48,81 +52,6 @@ KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", | |||
48 | # manually. This value unused if KERNEL_IMAGETYPE is not uImage. | 52 | # manually. This value unused if KERNEL_IMAGETYPE is not uImage. |
49 | KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000" | 53 | KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000" |
50 | 54 | ||
51 | # Set a variable in .configure | ||
52 | # $1 - Configure variable to be set | ||
53 | # $2 - value [n/y/value] | ||
54 | kernel_configure_variable() { | ||
55 | # Remove the config | ||
56 | CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" | ||
57 | if test "$2" = "n" | ||
58 | then | ||
59 | echo "# CONFIG_$1 is not set" >> ${B}/.config | ||
60 | else | ||
61 | echo "CONFIG_$1=$2" >> ${B}/.config | ||
62 | fi | ||
63 | } | ||
64 | |||
65 | config_setup() { | ||
66 | # From kernel.bbclass. Unfortunately, this is needed to support builds that | ||
67 | # use devtool. The reason is as follows: | ||
68 | # | ||
69 | # - In devtool builds, externalsrc.bbclass gets inherited and sets a list of | ||
70 | # SRCTREECOVEREDTASKS, which don't get run because they affect the source | ||
71 | # tree and, when using devtool, we want the developer's changes to be the | ||
72 | # single source of truth. kernel-yocto.bbclass adds do_kernel_configme to | ||
73 | # SRCTREECOVEREDTASKS, so it doesn't run in a devtool build., In a normal | ||
74 | # non-devtool build, do_kernel_configme creates ${B}.config. | ||
75 | # | ||
76 | # - Normally (e.g. in linux-yocto), it would be OK that do_kernel_configme | ||
77 | # doesn't run, because the first few lines of do_configure in kernel.bbclass | ||
78 | # populate ${B}.config from either ${S}.config (if it exists) for custom | ||
79 | # developer changes, or otherwise from ${WORDIR}/defconfig. | ||
80 | # | ||
81 | # - In linux-raspberrypi, we add do_configure_prepend, which tweaks | ||
82 | # ${B}.config. Since this runs *before* the kernel.bbclass do_configure, | ||
83 | # ${B}.config doesn't yet exist and we hit an error. Thus we need to move | ||
84 | # the logic from do_configure up to before our do_configure_prepend. Because | ||
85 | # we are copying only a portion of do_configure and not the whole thing, | ||
86 | # there is no clean way to do it using OE functionality, so we just | ||
87 | # copy-and-paste. | ||
88 | if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then | ||
89 | mv "${S}/.config" "${B}/.config" | ||
90 | fi | ||
91 | |||
92 | # Copy defconfig to .config if .config does not exist. This allows | ||
93 | # recipes to manage the .config themselves in do_configure_prepend(). | ||
94 | if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then | ||
95 | cp "${WORKDIR}/defconfig" "${B}/.config" | ||
96 | fi | ||
97 | } | ||
98 | |||
99 | do_configure_prepend() { | ||
100 | config_setup | ||
101 | |||
102 | mv -f ${B}/.config ${B}/.config.patched | ||
103 | CONF_SED_SCRIPT="" | ||
104 | |||
105 | if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then | ||
106 | kernel_configure_variable OVERLAY_FS y | ||
107 | kernel_configure_variable SQUASHFS y | ||
108 | kernel_configure_variable UBIFS_FS y | ||
109 | fi | ||
110 | |||
111 | # Activate the configuration options for VC4 | ||
112 | VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}" | ||
113 | if [ "${VC4GRAPHICS}" = "1" ]; then | ||
114 | kernel_configure_variable I2C_BCM2835 y | ||
115 | kernel_configure_variable DRM y | ||
116 | kernel_configure_variable DRM_FBDEV_EMULATION y | ||
117 | kernel_configure_variable DRM_VC4 y | ||
118 | fi | ||
119 | |||
120 | # Keep this the last line | ||
121 | # Remove all modified configs and add the rest to .config | ||
122 | sed -e "${CONF_SED_SCRIPT}" < '${B}/.config.patched' >> '${B}/.config' | ||
123 | rm -f ${B}/.config.patched | ||
124 | } | ||
125 | |||
126 | do_compile_append() { | 55 | do_compile_append() { |
127 | if [ "${SITEINFO_BITS}" = "64" ]; then | 56 | if [ "${SITEINFO_BITS}" = "64" ]; then |
128 | cc_extra=$(get_cc_option) | 57 | cc_extra=$(get_cc_option) |