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