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 | |
| 14 | KCONFIG_MODE = "--alldefconfig" |
| 15 | KBUILD_DEFCONFIG_raspberrypi0-wifi ?= "bcmrpi_defconfig" |
| 16 | KBUILD_DEFCONFIG_raspberrypi ?= "bcmrpi_defconfig" |
| 17 | KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig" |
| 18 | KBUILD_DEFCONFIG_raspberrypi3 ?= "bcm2709_defconfig" |
| 19 | KBUILD_DEFCONFIG_raspberrypi3-64 ?= "bcmrpi3_defconfig" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 20 | |
| 21 | # CMDLINE for raspberrypi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | CMDLINE ?= "dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 23 | |
| 24 | # Add the kernel debugger over console kernel command line option if enabled |
| 25 | CMDLINE_append = ' ${@base_conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}' |
| 26 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 27 | # Disable rpi logo on boot |
| 28 | CMDLINE_append += ' ${@base_conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}' |
| 29 | |
| 30 | # You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf |
| 31 | # to enable kernel debugging. |
| 32 | CMDLINE_DEBUG ?= "" |
| 33 | CMDLINE_append = " ${CMDLINE_DEBUG}" |
| 34 | |
| 35 | # Quirk for udev greater or equal 141 |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 36 | UDEV_GE_141 ?= "1" |
| 37 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 38 | # Enable OABI compat for people stuck with obsolete userspace |
| 39 | ARM_KEEP_OABI ?= "1" |
| 40 | |
| 41 | KERNEL_INITRAMFS ?= '${@base_conditional("INITRAMFS_IMAGE_BUNDLE", "1", "1", "", d)}' |
| 42 | |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 43 | KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}" |
| 44 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 45 | # A LOADADDR is needed when building a uImage format kernel. This value is not |
| 46 | # set by default in rpi-4.8.y and later branches so we need to provide it |
| 47 | # manually. This value unused if KERNEL_IMAGETYPE is not uImage. |
| 48 | KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000" |
| 49 | |
| 50 | # Set a variable in .configure |
| 51 | # $1 - Configure variable to be set |
| 52 | # $2 - value [n/y/value] |
| 53 | kernel_configure_variable() { |
| 54 | # Remove the config |
| 55 | CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" |
| 56 | if test "$2" = "n" |
| 57 | then |
| 58 | echo "# CONFIG_$1 is not set" >> ${B}/.config |
| 59 | else |
| 60 | echo "CONFIG_$1=$2" >> ${B}/.config |
| 61 | fi |
Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 62 | } |
| 63 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 64 | do_configure_prepend() { |
| 65 | mv -f ${B}/.config ${B}/.config.patched |
| 66 | CONF_SED_SCRIPT="" |
| 67 | |
| 68 | # oabi / eabi support |
| 69 | kernel_configure_variable AEABI y |
| 70 | if [ "${ARM_KEEP_OABI}" = "1" ] ; then |
| 71 | kernel_configure_variable OABI_COMPAT y |
| 72 | else |
| 73 | kernel_configure_variable OABI_COMPAT n |
| 74 | fi |
| 75 | |
| 76 | # Set cmdline |
| 77 | kernel_configure_variable CMDLINE "\"${CMDLINE}\"" |
| 78 | |
| 79 | # Localversion |
| 80 | kernel_configure_variable LOCALVERSION "\"\"" |
| 81 | kernel_configure_variable LOCALVERSION_AUTO n |
| 82 | |
| 83 | # Udev quirks |
| 84 | # Newer versions of udev mandate that sysfs doesn't have deprecated entries |
| 85 | if [ "${UDEV_GE_141}" = "1" ] ; then |
| 86 | kernel_configure_variable SYSFS_DEPRECATED n |
| 87 | kernel_configure_variable SYSFS_DEPRECATED_V2 n |
| 88 | kernel_configure_variable HOTPLUG y |
| 89 | kernel_configure_variable UEVENT_HELPER_PATH "\"\"" |
| 90 | kernel_configure_variable UNIX y |
| 91 | kernel_configure_variable SYSFS y |
| 92 | kernel_configure_variable PROC_FS y |
| 93 | kernel_configure_variable TMPFS y |
| 94 | kernel_configure_variable INOTIFY_USER y |
| 95 | kernel_configure_variable SIGNALFD y |
| 96 | kernel_configure_variable TMPFS_POSIX_ACL y |
| 97 | kernel_configure_variable BLK_DEV_BSG y |
| 98 | kernel_configure_variable DEVTMPFS y |
| 99 | kernel_configure_variable DEVTMPFS_MOUNT y |
| 100 | fi |
| 101 | |
| 102 | # Newer inits like systemd need cgroup support |
| 103 | if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then |
| 104 | kernel_configure_variable CGROUP_SCHED y |
| 105 | kernel_configure_variable CGROUPS y |
| 106 | kernel_configure_variable CGROUP_NS y |
| 107 | kernel_configure_variable CGROUP_FREEZER y |
| 108 | kernel_configure_variable CGROUP_DEVICE y |
| 109 | kernel_configure_variable CPUSETS y |
| 110 | kernel_configure_variable PROC_PID_CPUSET y |
| 111 | kernel_configure_variable CGROUP_CPUACCT y |
| 112 | kernel_configure_variable RESOURCE_COUNTERS y |
| 113 | fi |
| 114 | |
| 115 | # root-over-nfs-over-usb-eth support. Limited, but should cover some cases |
| 116 | # Enable this by setting a proper CMDLINE_NFSROOT_USB. |
| 117 | if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then |
| 118 | oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}" |
| 119 | kernel_configure_variable INET y |
| 120 | kernel_configure_variable IP_PNP y |
| 121 | kernel_configure_variable USB_GADGET y |
| 122 | kernel_configure_variable USB_GADGET_SELECTED y |
| 123 | kernel_configure_variable USB_ETH y |
| 124 | kernel_configure_variable NFS_FS y |
| 125 | kernel_configure_variable ROOT_NFS y |
| 126 | kernel_configure_variable ROOT_NFS y |
| 127 | kernel_configure_variable CMDLINE "\"${CMDLINE_NFSROOT_USB}\"" |
| 128 | fi |
| 129 | if [ ! -z "${KERNEL_INITRAMFS}" ]; then |
| 130 | kernel_configure_variable BLK_DEV_INITRD y |
| 131 | kernel_configure_variable INITRAMFS_SOURCE "" |
| 132 | kernel_configure_variable RD_GZIP y |
| 133 | kernel_configure_variable OVERLAY_FS y |
| 134 | kernel_configure_variable SQUASHFS y |
| 135 | kernel_configure_variable UBIFS_FS y |
| 136 | fi |
| 137 | # Activate CONFIG_LEGACY_PTYS |
| 138 | kernel_configure_variable LEGACY_PTYS y |
| 139 | # this module is built externally via drbd-utils |
| 140 | kernel_configure_variable BLK_DEV_DRBD n |
| 141 | |
| 142 | # Activate the configuration options for VC4 |
| 143 | VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}" |
| 144 | if [ ${VC4GRAPHICS} = "1" ]; then |
| 145 | kernel_configure_variable I2C_BCM2835 y |
| 146 | kernel_configure_variable DRM y |
| 147 | kernel_configure_variable DRM_FBDEV_EMULATION y |
| 148 | kernel_configure_variable DRM_VC4 y |
| 149 | fi |
| 150 | |
| 151 | # Keep this the last line |
| 152 | # Remove all modified configs and add the rest to .config |
| 153 | sed -e "${CONF_SED_SCRIPT}" < '${B}/.config.patched' >> '${B}/.config' |
| 154 | rm -f ${B}/.config.patched |
| 155 | |
| 156 | yes '' | oe_runmake oldconfig |
| 157 | } |
| 158 | |
| 159 | do_compile_append_raspberrypi3-64() { |
| 160 | cc_extra=$(get_cc_option) |
| 161 | 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] | 162 | } |
| 163 | |
| 164 | do_install_prepend() { |
| 165 | install -d ${D}/lib/firmware |
| 166 | } |
| 167 | |
| 168 | do_deploy_append() { |
| 169 | # Deploy cmdline.txt |
| 170 | install -d ${DEPLOYDIR}/bcm2835-bootfiles |
| 171 | PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}" |
| 172 | if [ ${PITFT} = "1" ]; then |
| 173 | PITFT_PARAMS="fbcon=map:10 fbcon=font:VGA8x8" |
| 174 | fi |
| 175 | echo "${CMDLINE}${PITFT_PARAMS}" > ${DEPLOYDIR}/bcm2835-bootfiles/cmdline.txt |
| 176 | } |