linux-raspberrypi: Change to Linux Yocto style kernel recipes

Yocto style recipes provide support for application of kernel
configuration fragments which is achieved with this change.

For further details see the Yocto Linux Kernel Development Manual

ref: http://www.yoctoproject.org/docs/1.6/kernel-dev/kernel-dev.html

In addition .bb files are simplified to take a SRCBRANCH which is
used by the SRC_URI set in linux-raspberrypi.inc and together with
the existing SRCREV define a checkout from the linux-raspberrypi
git repository.

A default configuration, defconfig, is provided as a baseline.
This is generated from bcmrpi_defconfig, as used in the existing
recipes, and so configuration options should be the same.

To change the kernel configuration a new configuration fragment
may be generated, as explained in the kernel development documentation
above, and this file then added to the SRC_URI via a .bbappend.

Added some minor refactoring and removed some useless code.

Change-Id: Ic72e14ec14ec3f042aeda0c6820f896be9c02e69
Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
This commit is contained in:
Alex J Lennon 2014-06-12 17:44:54 +01:00 committed by Andrei Gherzan
parent b6d899e4d2
commit 67a1c4eaaf
9 changed files with 3820 additions and 187 deletions

View File

@ -1,36 +1,27 @@
require linux.inc
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
inherit kernel
require recipes-kernel/linux/linux-yocto.inc
DESCRIPTION = "Linux Kernel for Raspberry Pi"
SECTION = "kernel"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
SRC_URI += " \
file://defconfig \
"
COMPATIBLE_MACHINE = "raspberrypi"
PV_append = "+git${SRCREV}"
# NOTE: For now we pull in the default config from the RPi kernel GIT tree.
KERNEL_DEFCONFIG = "bcmrpi_defconfig"
SRC_URI = " \
git://github.com/raspberrypi/linux.git;protocol=git;branch=${KBRANCH} \
file://sl030raspberrypii2ckernel.patch \
file://defconfig \
"
S = "${WORKDIR}/git"
# CMDLINE for raspberrypi
CMDLINE_raspberrypi = "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
UDEV_GE_141 ?= "1"
do_kernel_configme_prepend() {
install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
}
do_install_prepend() {
install -d ${D}/lib/firmware
}
CMDLINE ?= " \
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 \
root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
do_deploy_append() {
# Deploy cmdline.txt
install -d ${DEPLOYDIR}/bcm2835-bootfiles
echo "${CMDLINE}" > ${DEPLOYDIR}/bcm2835-bootfiles/cmdline.txt
}
COMPATIBLE_MACHINE = "raspberrypi"

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,4 @@
SRCREV = "1b49b450222df26e4abf7abb6d9302f72b2ed386"
SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.10.y \
file://sl030raspberrypii2ckernel.patch \
"
require linux-raspberrypi.inc
SRCREV = "1b49b450222df26e4abf7abb6d9302f72b2ed386"
KBRANCH = "rpi-3.10.y"

View File

@ -1,6 +1,4 @@
SRCREV = "f03cd5e1012d3fe8314a944879308cf0f3d9e29b"
SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.12.y \
file://sl030raspberrypii2ckernel.patch \
"
require linux-raspberrypi.inc
SRCREV = "f03cd5e1012d3fe8314a944879308cf0f3d9e29b"
KBRANCH = "rpi-3.12.y"

View File

@ -1,6 +1,4 @@
SRCREV = "377c82aa1d31b37f1096096b0e4c65beb0bc5c49"
SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.16.y \
file://sl030raspberrypii2ckernel.patch \
"
require linux-raspberrypi.inc
SRCREV = "377c82aa1d31b37f1096096b0e4c65beb0bc5c49"
KBRANCH = "rpi-3.16.y"

View File

@ -1,6 +1,4 @@
SRCREV = "ada8b4415ff44d535d63e4291a0eca733bc2ad0f"
SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.2.27 \
file://sl030raspberrypii2ckernel.patch \
"
require linux-raspberrypi.inc
SRCREV = "ada8b4415ff44d535d63e4291a0eca733bc2ad0f"
KBRANCH = "rpi-3.2.27"

View File

@ -1,6 +1,4 @@
SRCREV = "2a8d45ec0883e3cbdce920855b3461ac77308a5f"
SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.6.y \
file://sl030raspberrypii2ckernel.patch \
"
require linux-raspberrypi.inc
SRCREV = "2a8d45ec0883e3cbdce920855b3461ac77308a5f"
KBRANCH = "rpi-3.6.y"

View File

@ -1,6 +1,4 @@
SRCREV = "d996a1b91b2bf3dc06f4f4f822a56f4496457aa1"
SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.8.y \
file://sl030raspberrypii2ckernel.patch \
"
require linux-raspberrypi.inc
SRCREV = "d996a1b91b2bf3dc06f4f4f822a56f4496457aa1"
KBRANCH = "rpi-3.8.y"

View File

@ -1,132 +0,0 @@
DESCRIPTION = "Linux Kernel"
SECTION = "kernel"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
inherit kernel siteinfo
require recipes-kernel/linux/linux-yocto.inc
# Enable OABI compat for people stuck with obsolete userspace
ARM_KEEP_OABI ?= "1"
# Quirk for udev greater or equal 141
UDEV_GE_141 ?= "1"
# Set the verbosity of kernel messages during runtime
# You can define CMDLINE_DEBUG in your local.conf or distro.conf to override this behaviour
CMDLINE_DEBUG ?= '${@base_conditional("DISTRO_TYPE", "release", "quiet", "debug", d)}'
CMDLINE_append = " ${CMDLINE_DEBUG}"
# Set a variable in .configure
# $1 - Configure variable to be set
# $2 - value [n/y/value]
kernel_configure_variable() {
# Remove the config
CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;"
if test "$2" = "n"
then
echo "# CONFIG_$1 is not set" >> ${B}/.config
else
echo "CONFIG_$1=$2" >> ${B}/.config
fi
}
do_configure_prepend() {
# Clean .config
echo "" > ${B}/.config
CONF_SED_SCRIPT=""
# oabi / eabi support
if [ "${TARGET_OS}" = "linux-gnueabi" -o "${TARGET_OS}" = "linux-uclibceabi" ]; then
kernel_configure_variable AEABI y
if [ "${ARM_KEEP_OABI}" = "1" ] ; then
kernel_configure_variable OABI_COMPAT y
else
kernel_configure_variable OABI_COMPAT n
fi
else
kernel_configure_variable AEABI n
kernel_configure_variable OABI_COMPAT n
fi
# Set cmdline
kernel_configure_variable CMDLINE "\"${CMDLINE}\""
# Localversion
kernel_configure_variable LOCALVERSION "\"\""
kernel_configure_variable LOCALVERSION_AUTO n
# Udev quirks
# Newer versions of udev mandate that sysfs doesn't have deprecated entries
if [ "${UDEV_GE_141}" = "1" ] ; then
kernel_configure_variable SYSFS_DEPRECATED n
kernel_configure_variable SYSFS_DEPRECATED_V2 n
kernel_configure_variable HOTPLUG y
kernel_configure_variable UEVENT_HELPER_PATH "\"\""
kernel_configure_variable UNIX y
kernel_configure_variable SYSFS y
kernel_configure_variable PROC_FS y
kernel_configure_variable TMPFS y
kernel_configure_variable INOTIFY_USER y
kernel_configure_variable SIGNALFD y
kernel_configure_variable TMPFS_POSIX_ACL y
kernel_configure_variable BLK_DEV_BSG y
kernel_configure_variable DEVTMPFS y
kernel_configure_variable DEVTMPFS_MOUNT y
fi
# Newer inits like systemd need cgroup support
if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then
kernel_configure_variable CGROUP_SCHED y
kernel_configure_variable CGROUPS y
kernel_configure_variable CGROUP_NS y
kernel_configure_variable CGROUP_FREEZER y
kernel_configure_variable CGROUP_DEVICE y
kernel_configure_variable CPUSETS y
kernel_configure_variable PROC_PID_CPUSET y
kernel_configure_variable CGROUP_CPUACCT y
kernel_configure_variable RESOURCE_COUNTERS y
fi
# root-over-nfs-over-usb-eth support. Limited, but should cover some cases
# Enable this by setting a proper CMDLINE_NFSROOT_USB.
if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then
oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}"
kernel_configure_variable INET y
kernel_configure_variable IP_PNP y
kernel_configure_variable USB_GADGET y
kernel_configure_variable USB_GADGET_SELECTED y
kernel_configure_variable USB_ETH y
kernel_configure_variable NFS_FS y
kernel_configure_variable ROOT_NFS y
kernel_configure_variable ROOT_NFS y
kernel_configure_variable CMDLINE "\"${CMDLINE_NFSROOT_USB}\""
fi
# Activate CONFIG_LEGACY_PTYS
kernel_configure_variable LEGACY_PTYS y
# Keep this the last line
# Remove all modified configs and add the rest to .config
sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config'
yes '' | oe_runmake oldconfig
}
# Automatically depend on lzop-native if CONFIG_KERNEL_LZO is enabled
python () {
try:
defconfig = bb.fetch2.localpath('file://defconfig', d)
except bb.fetch2.FetchError:
return
try:
configfile = open(defconfig)
except IOError:
return
if 'CONFIG_KERNEL_LZO=y\n' in configfile.readlines():
depends = d.getVar('DEPENDS', False)
d.setVar('DEPENDS', depends + ' lzop-native')
}