blob: da36ca7d57c336de1b0229515963138a176801ac [file] [log] [blame]
Patrick Williams8b8bc412016-08-17 15:02:23 -05001DESCRIPTION = "Linux Kernel for Raspberry Pi"
2SECTION = "kernel"
3LICENSE = "GPLv2"
4LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
5
Brad Bishopd7bf8c12018-02-25 22:55:05 -05006COMPATIBLE_MACHINE = "^rpi$"
Patrick Williams8b8bc412016-08-17 15:02:23 -05007
8PE = "1"
9PV = "${LINUX_VERSION}+git${SRCPV}"
10
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011inherit kernel siteinfo
12require recipes-kernel/linux/linux-yocto.inc
13
14KCONFIG_MODE = "--alldefconfig"
15KBUILD_DEFCONFIG_raspberrypi0-wifi ?= "bcmrpi_defconfig"
16KBUILD_DEFCONFIG_raspberrypi ?= "bcmrpi_defconfig"
17KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig"
18KBUILD_DEFCONFIG_raspberrypi3 ?= "bcm2709_defconfig"
19KBUILD_DEFCONFIG_raspberrypi3-64 ?= "bcmrpi3_defconfig"
Patrick Williams8b8bc412016-08-17 15:02:23 -050020
21# CMDLINE for raspberrypi
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022CMDLINE ?= "dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
Patrick Williams8b8bc412016-08-17 15:02:23 -050023
24# Add the kernel debugger over console kernel command line option if enabled
25CMDLINE_append = ' ${@base_conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}'
26
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027# Disable rpi logo on boot
28CMDLINE_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.
32CMDLINE_DEBUG ?= ""
33CMDLINE_append = " ${CMDLINE_DEBUG}"
34
35# Quirk for udev greater or equal 141
Patrick Williams8b8bc412016-08-17 15:02:23 -050036UDEV_GE_141 ?= "1"
37
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038# Enable OABI compat for people stuck with obsolete userspace
39ARM_KEEP_OABI ?= "1"
40
41KERNEL_INITRAMFS ?= '${@base_conditional("INITRAMFS_IMAGE_BUNDLE", "1", "1", "", d)}'
42
Patrick Williams8b8bc412016-08-17 15:02:23 -050043KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}"
44
Brad Bishopd7bf8c12018-02-25 22:55:05 -050045# 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.
48KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000"
49
50# Set a variable in .configure
51# $1 - Configure variable to be set
52# $2 - value [n/y/value]
53kernel_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 Williams8b8bc412016-08-17 15:02:23 -050062}
63
Brad Bishopd7bf8c12018-02-25 22:55:05 -050064do_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
159do_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 Williams8b8bc412016-08-17 15:02:23 -0500162}
163
164do_install_prepend() {
165 install -d ${D}/lib/firmware
166}
167
168do_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}