Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 1 | DESCRIPTION = "Linux Kernel for Raspberry Pi" |
| 2 | SECTION = "kernel" |
| 3 | LICENSE = "GPLv2" |
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" |
| 5 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 6 | COMPATIBLE_MACHINE = "^rpi$" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 7 | |
| 8 | PE = "1" |
| 9 | PV = "${LINUX_VERSION}+git${SRCPV}" |
| 10 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 11 | inherit kernel siteinfo |
| 12 | require recipes-kernel/linux/linux-yocto.inc |
| 13 | |
Brad Bishop | 9392c69 | 2018-09-07 15:37:17 +0100 | [diff] [blame] | 14 | SRC_URI += "file://rpi-kernel-misc.cfg" |
| 15 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 16 | KCONFIG_MODE = "--alldefconfig" |
| 17 | KBUILD_DEFCONFIG_raspberrypi0-wifi ?= "bcmrpi_defconfig" |
| 18 | KBUILD_DEFCONFIG_raspberrypi ?= "bcmrpi_defconfig" |
| 19 | KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig" |
| 20 | KBUILD_DEFCONFIG_raspberrypi3 ?= "bcm2709_defconfig" |
| 21 | KBUILD_DEFCONFIG_raspberrypi3-64 ?= "bcmrpi3_defconfig" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 22 | |
| 23 | # CMDLINE for raspberrypi |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 24 | SERIAL = "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}" |
| 25 | CMDLINE ?= "dwc_otg.lpm_enable=0 ${SERIAL} root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 26 | |
| 27 | # Add the kernel debugger over console kernel command line option if enabled |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 28 | CMDLINE_append = ' ${@oe.utils.conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}' |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 29 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 30 | # Disable rpi logo on boot |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 31 | CMDLINE_append += ' ${@oe.utils.conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}' |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 32 | |
| 33 | # You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf |
| 34 | # to enable kernel debugging. |
| 35 | CMDLINE_DEBUG ?= "" |
| 36 | CMDLINE_append = " ${CMDLINE_DEBUG}" |
| 37 | |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 38 | KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}" |
| 39 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 40 | # A LOADADDR is needed when building a uImage format kernel. This value is not |
| 41 | # set by default in rpi-4.8.y and later branches so we need to provide it |
| 42 | # manually. This value unused if KERNEL_IMAGETYPE is not uImage. |
| 43 | KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000" |
| 44 | |
| 45 | # Set a variable in .configure |
| 46 | # $1 - Configure variable to be set |
| 47 | # $2 - value [n/y/value] |
| 48 | kernel_configure_variable() { |
| 49 | # Remove the config |
| 50 | CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" |
| 51 | if test "$2" = "n" |
| 52 | then |
| 53 | echo "# CONFIG_$1 is not set" >> ${B}/.config |
| 54 | else |
| 55 | echo "CONFIG_$1=$2" >> ${B}/.config |
| 56 | fi |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 57 | } |
| 58 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 59 | config_setup() { |
| 60 | # From kernel.bbclass. Unfortunately, this is needed to support builds that |
| 61 | # use devtool. The reason is as follows: |
| 62 | # |
| 63 | # - In devtool builds, externalsrc.bbclass gets inherited and sets a list of |
| 64 | # SRCTREECOVEREDTASKS, which don't get run because they affect the source |
| 65 | # tree and, when using devtool, we want the developer's changes to be the |
| 66 | # single source of truth. kernel-yocto.bbclass adds do_kernel_configme to |
| 67 | # SRCTREECOVEREDTASKS, so it doesn't run in a devtool build., In a normal |
| 68 | # non-devtool build, do_kernel_configme creates ${B}.config. |
| 69 | # |
| 70 | # - Normally (e.g. in linux-yocto), it would be OK that do_kernel_configme |
| 71 | # doesn't run, because the first few lines of do_configure in kernel.bbclass |
| 72 | # populate ${B}.config from either ${S}.config (if it exists) for custom |
| 73 | # developer changes, or otherwise from ${WORDIR}/defconfig. |
| 74 | # |
| 75 | # - In linux-raspberrypi, we add do_configure_prepend, which tweaks |
| 76 | # ${B}.config. Since this runs *before* the kernel.bbclass do_configure, |
| 77 | # ${B}.config doesn't yet exist and we hit an error. Thus we need to move |
| 78 | # the logic from do_configure up to before our do_configure_prepend. Because |
| 79 | # we are copying only a portion of do_configure and not the whole thing, |
| 80 | # there is no clean way to do it using OE functionality, so we just |
| 81 | # copy-and-paste. |
| 82 | if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then |
| 83 | mv "${S}/.config" "${B}/.config" |
| 84 | fi |
| 85 | |
| 86 | # Copy defconfig to .config if .config does not exist. This allows |
| 87 | # recipes to manage the .config themselves in do_configure_prepend(). |
| 88 | if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then |
| 89 | cp "${WORKDIR}/defconfig" "${B}/.config" |
| 90 | fi |
| 91 | } |
| 92 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 93 | do_configure_prepend() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 94 | config_setup |
| 95 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 96 | mv -f ${B}/.config ${B}/.config.patched |
| 97 | CONF_SED_SCRIPT="" |
| 98 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 99 | # Localversion |
| 100 | kernel_configure_variable LOCALVERSION "\"\"" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 101 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 102 | if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 103 | kernel_configure_variable OVERLAY_FS y |
| 104 | kernel_configure_variable SQUASHFS y |
| 105 | kernel_configure_variable UBIFS_FS y |
| 106 | fi |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 107 | |
| 108 | # Activate the configuration options for VC4 |
| 109 | VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 110 | if [ "${VC4GRAPHICS}" = "1" ]; then |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 111 | kernel_configure_variable I2C_BCM2835 y |
| 112 | kernel_configure_variable DRM y |
| 113 | kernel_configure_variable DRM_FBDEV_EMULATION y |
| 114 | kernel_configure_variable DRM_VC4 y |
| 115 | fi |
| 116 | |
| 117 | # Keep this the last line |
| 118 | # Remove all modified configs and add the rest to .config |
| 119 | sed -e "${CONF_SED_SCRIPT}" < '${B}/.config.patched' >> '${B}/.config' |
| 120 | rm -f ${B}/.config.patched |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | do_compile_append_raspberrypi3-64() { |
| 124 | cc_extra=$(get_cc_option) |
| 125 | oe_runmake dtbs CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 126 | } |
| 127 | |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 128 | do_deploy_append() { |
| 129 | # Deploy cmdline.txt |
| 130 | install -d ${DEPLOYDIR}/bcm2835-bootfiles |
| 131 | PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}" |
| 132 | if [ ${PITFT} = "1" ]; then |
| 133 | PITFT_PARAMS="fbcon=map:10 fbcon=font:VGA8x8" |
| 134 | fi |
| 135 | echo "${CMDLINE}${PITFT_PARAMS}" > ${DEPLOYDIR}/bcm2835-bootfiles/cmdline.txt |
| 136 | } |