summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/linux-at91_4.9.87.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-at91_4.9.87.bb')
-rw-r--r--recipes-kernel/linux/linux-at91_4.9.87.bb130
1 files changed, 130 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-at91_4.9.87.bb b/recipes-kernel/linux/linux-at91_4.9.87.bb
new file mode 100644
index 0000000..60685f0
--- /dev/null
+++ b/recipes-kernel/linux/linux-at91_4.9.87.bb
@@ -0,0 +1,130 @@
+SECTION = "kernel"
+DESCRIPTION = "Linux kernel for Atmel ARM SoCs (aka AT91)"
+SUMMARY = "Linux kernel for Atmel ARM SoCs (aka AT91)"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
+
+inherit kernel
+# mts class to build dtb and append to kernel image
+inherit linux-append-dtb
+
+
+RDEPENDS_kernel-base=""
+FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:"
+KERNEL_EXTRA_ARGS ="LOADADDR=0x20008000"
+
+PR = "r0"
+# PV = "4.9+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+SRCREV = "29796588eb6a4c89795baaea3035764d15d0e44a"
+
+KBRANCH = "linux-4.9-at91"
+SRC_URI = "git://github.com/linux4sam/linux-at91.git;protocol=git;branch=${KBRANCH}"
+SRC_URI += "file://defconfig"
+
+# gpio set single ended required device tree changes for pull-ups
+# file://linux-4.9-at91_gpio_set_single_ended.patch
+
+COMMON_PATCHES = "file://linux-4.9-pps-gpio.patch"
+
+# file://at91pinctrl_reprobe.patch
+
+
+SRC_URI_append_mtcdt = "\
+ ${COMMON_PATCHES} \
+ file://defconfig \
+ file://linux-4.9-mtcdt-device-tree.patch \
+ file://linux-4.9-add-num_accessory_ports-config-option.patch \
+ file://950-0090-OF-DT-Overlay-configfs-interface.patch \
+ file://linux-4.9-spidev_squack.patch \
+ "
+SRC_URI_append_mtrv1 = "\
+ ${COMMON_PATCHES} \
+ file://defconfig \
+ file://linux-4.9-mtrv1-device-tree.patch \
+ file://950-0090-OF-DT-Overlay-configfs-interface.patch \
+ file://linux-4.9-spidev_squack.patch \
+ "
+
+DTB_APPEND_mtcdt = "mtcdt"
+DTB_APPEND_mtrv1 = "mtrv1"
+
+python __anonymous () {
+ if d.getVar('UBOOT_FIT_IMAGE', True) == 'xyes':
+ d.appendVar('DEPENDS', ' u-boot-mkimage-native dtc-native')
+}
+
+do_deploy_append() {
+ if [ "${UBOOT_FIT_IMAGE}" = "xyes" ]; then
+ DTB_PATH="${B}/arch/${ARCH}/boot/dts/"
+ if [ ! -e "${DTB_PATH}" ]; then
+ DTB_PATH="${B}/arch/${ARCH}/boot/"
+ fi
+
+ if [ -e ${S}/arch/${ARCH}/boot/dts/${MACHINE}.its ]; then
+ cp ${S}/arch/${ARCH}/boot/dts/${MACHINE}*.its ${DTB_PATH}
+ cd ${DTB_PATH}
+ mkimage -f ${MACHINE}.its ${MACHINE}.itb
+ install -m 0644 ${MACHINE}.itb ${DEPLOYDIR}/${MACHINE}.itb
+ cd -
+ fi
+ fi
+}
+
+kernel_do_configure_append() {
+ rm -f ${B}/.scmversion ${S}/.scmversion
+ cd ${S}; git status; cd -
+}
+
+KERNEL_MODULE_AUTOLOAD += "atmel_usba_udc g_serial"
+KERNEL_MODULE_PACKAGE_SUFFIX=""
+
+COMPATIBLE_MACHINE = "(mtcdt|mtrv1)"
+
+pkg_preinst_kernel-image-uimage() {
+ set -x
+ mkdir -m 0755 /var/volatile/boot 2>/dev/null || true
+ ls /boot || true
+ ls -l /boot | true
+ rm -rf /boot
+ ln -sf /var/volatile/boot /boot 2>/dev/null || true
+}
+
+pkg_prerm_kernel-image-uimage() {
+ rm -rf /var/volatile/boot || true
+ rm -rf /boot || true
+}
+
+PACKAGES =+ "kernel-image-uimage-inst kernel-dt-bindings-dev"
+# Not sure how to get the name below generated automatically
+#KERNELVERSION = "4.9.87-linux4sam-5.8-dirty"
+KERNELVERSION = "${PV}"
+#KERNELVERSION2 = "4.9.87-linux4sam_5.8-dirty"
+KERNELVERSION2 = "${PV}"
+RDEPENDS_kernel-image-uimage-inst += "kernel-image-uimage-${KERNELVERSION}"
+ALLOW_EMPTY_kernel-image-uimage-inst = "1"
+
+pkg_postinst_kernel-image-uimage-inst() {
+ # Only installs all the kernel on the device (D is defined in bitbake)
+ if [[ -z "$D" ]] ; then
+ logger -s -p user.info -t opkg "Upgrading kernel ${PV} -- poweroff will create an unbootable device"
+ set -x
+ kernel_mtd="/dev/$(cat /proc/mtd | grep '\"uImage\"' | cut -d : -f 1)"
+ flash_erase ${kernel_mtd} 0 0
+ if nandwrite -p ${kernel_mtd} /boot/uImage-${KERNELVERSION2} ; then
+ echo 'Kernel image update is successful'
+ fi
+ set +x
+ fi
+}
+
+do_install_append() {
+ install -d -m 0755 ${D}${includedir}/linux
+ cp -a ${STAGING_KERNEL_DIR}/include/dt-bindings ${D}${includedir}/linux/
+ install -d -m 0755 ${STAGING_DIR_TARGET}/${includedir}/linux
+ cp -a ${STAGING_KERNEL_DIR}/include/dt-bindings ${STAGING_DIR_TARGET}/${includedir}/linux
+}
+
+FILES_kernel-dt-bindings-dev = "/usr/include/linux/dt-bindings"