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