Patrick Williams | 8b8bc41 | 2016-08-17 15:02:23 -0500 | [diff] [blame] | 1 | DESCRIPTION = "Linux Kernel" |
| 2 | SECTION = "kernel" |
| 3 | LICENSE = "GPLv2" |
| 4 | |
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" |
| 6 | |
| 7 | inherit kernel siteinfo |
| 8 | require recipes-kernel/linux/linux-yocto.inc |
| 9 | |
| 10 | # Enable OABI compat for people stuck with obsolete userspace |
| 11 | ARM_KEEP_OABI ?= "1" |
| 12 | |
| 13 | # Quirk for udev greater or equal 141 |
| 14 | UDEV_GE_141 ?= "1" |
| 15 | |
| 16 | # Set the verbosity of kernel messages during runtime |
| 17 | # You can define CMDLINE_DEBUG in your local.conf or distro.conf to override this behaviour |
| 18 | CMDLINE_DEBUG ?= '${@base_conditional("DISTRO_TYPE", "release", "quiet", "debug", d)}' |
| 19 | CMDLINE_append = " ${CMDLINE_DEBUG}" |
| 20 | |
| 21 | KERNEL_INITRAMFS ?= '${@base_conditional("INITRAMFS_IMAGE_BUNDLE", "1", "1", "", d)}' |
| 22 | |
| 23 | # Set a variable in .configure |
| 24 | # $1 - Configure variable to be set |
| 25 | # $2 - value [n/y/value] |
| 26 | kernel_configure_variable() { |
| 27 | # Remove the config |
| 28 | CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" |
| 29 | if test "$2" = "n" |
| 30 | then |
| 31 | echo "# CONFIG_$1 is not set" >> ${B}/.config |
| 32 | else |
| 33 | echo "CONFIG_$1=$2" >> ${B}/.config |
| 34 | fi |
| 35 | } |
| 36 | |
| 37 | do_configure_prepend() { |
| 38 | # Clean .config |
| 39 | echo "" > ${B}/.config |
| 40 | CONF_SED_SCRIPT="" |
| 41 | |
| 42 | # oabi / eabi support |
| 43 | kernel_configure_variable AEABI y |
| 44 | if [ "${ARM_KEEP_OABI}" = "1" ] ; then |
| 45 | kernel_configure_variable OABI_COMPAT y |
| 46 | else |
| 47 | kernel_configure_variable OABI_COMPAT n |
| 48 | fi |
| 49 | |
| 50 | # Set cmdline |
| 51 | kernel_configure_variable CMDLINE "\"${CMDLINE}\"" |
| 52 | |
| 53 | # Localversion |
| 54 | kernel_configure_variable LOCALVERSION "\"\"" |
| 55 | kernel_configure_variable LOCALVERSION_AUTO n |
| 56 | |
| 57 | # Udev quirks |
| 58 | # Newer versions of udev mandate that sysfs doesn't have deprecated entries |
| 59 | if [ "${UDEV_GE_141}" = "1" ] ; then |
| 60 | kernel_configure_variable SYSFS_DEPRECATED n |
| 61 | kernel_configure_variable SYSFS_DEPRECATED_V2 n |
| 62 | kernel_configure_variable HOTPLUG y |
| 63 | kernel_configure_variable UEVENT_HELPER_PATH "\"\"" |
| 64 | kernel_configure_variable UNIX y |
| 65 | kernel_configure_variable SYSFS y |
| 66 | kernel_configure_variable PROC_FS y |
| 67 | kernel_configure_variable TMPFS y |
| 68 | kernel_configure_variable INOTIFY_USER y |
| 69 | kernel_configure_variable SIGNALFD y |
| 70 | kernel_configure_variable TMPFS_POSIX_ACL y |
| 71 | kernel_configure_variable BLK_DEV_BSG y |
| 72 | kernel_configure_variable DEVTMPFS y |
| 73 | kernel_configure_variable DEVTMPFS_MOUNT y |
| 74 | fi |
| 75 | |
| 76 | # Newer inits like systemd need cgroup support |
| 77 | if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then |
| 78 | kernel_configure_variable CGROUP_SCHED y |
| 79 | kernel_configure_variable CGROUPS y |
| 80 | kernel_configure_variable CGROUP_NS y |
| 81 | kernel_configure_variable CGROUP_FREEZER y |
| 82 | kernel_configure_variable CGROUP_DEVICE y |
| 83 | kernel_configure_variable CPUSETS y |
| 84 | kernel_configure_variable PROC_PID_CPUSET y |
| 85 | kernel_configure_variable CGROUP_CPUACCT y |
| 86 | kernel_configure_variable RESOURCE_COUNTERS y |
| 87 | fi |
| 88 | |
| 89 | # root-over-nfs-over-usb-eth support. Limited, but should cover some cases |
| 90 | # Enable this by setting a proper CMDLINE_NFSROOT_USB. |
| 91 | if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then |
| 92 | oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}" |
| 93 | kernel_configure_variable INET y |
| 94 | kernel_configure_variable IP_PNP y |
| 95 | kernel_configure_variable USB_GADGET y |
| 96 | kernel_configure_variable USB_GADGET_SELECTED y |
| 97 | kernel_configure_variable USB_ETH y |
| 98 | kernel_configure_variable NFS_FS y |
| 99 | kernel_configure_variable ROOT_NFS y |
| 100 | kernel_configure_variable ROOT_NFS y |
| 101 | kernel_configure_variable CMDLINE "\"${CMDLINE_NFSROOT_USB}\"" |
| 102 | fi |
| 103 | if [ ! -z "${KERNEL_INITRAMFS}" ]; then |
| 104 | kernel_configure_variable BLK_DEV_INITRD y |
| 105 | kernel_configure_variable INITRAMFS_SOURCE "" |
| 106 | kernel_configure_variable RD_GZIP y |
| 107 | kernel_configure_variable OVERLAY_FS y |
| 108 | kernel_configure_variable SQUASHFS y |
| 109 | kernel_configure_variable UBIFS_FS y |
| 110 | fi |
| 111 | # Activate CONFIG_LEGACY_PTYS |
| 112 | kernel_configure_variable LEGACY_PTYS y |
| 113 | |
| 114 | # Keep this the last line |
| 115 | # Remove all modified configs and add the rest to .config |
| 116 | sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config' |
| 117 | |
| 118 | yes '' | oe_runmake oldconfig |
| 119 | } |
| 120 | |
| 121 | # Automatically depend on lzop-native if CONFIG_KERNEL_LZO is enabled |
| 122 | python () { |
| 123 | try: |
| 124 | defconfig = bb.fetch2.localpath('file://defconfig', d) |
| 125 | except bb.fetch2.FetchError: |
| 126 | return |
| 127 | |
| 128 | try: |
| 129 | configfile = open(defconfig) |
| 130 | except IOError: |
| 131 | return |
| 132 | |
| 133 | if 'CONFIG_KERNEL_LZO=y\n' in configfile.readlines(): |
| 134 | depends = d.getVar('DEPENDS', False) |
| 135 | d.setVar('DEPENDS', depends + ' lzop-native') |
| 136 | |
| 137 | configfile.close() |
| 138 | } |