From e3e20300d40e0d3577d0d25af151c9d4b69cf44b Mon Sep 17 00:00:00 2001 From: Jeremy Grosser Date: Thu, 18 Oct 2018 13:35:23 +0000 Subject: lego-ev3: Add support for LEGO Mindstorms EV3 (AM1808) Thanks for the feedback! Updated patch below. Changes: - Change SERIAL_CONSOLE to new SERIAL_CONSOLES format. - Move SPL_BINARY variable into lego-ev3 machine config - Check for KERNEL_DEVICETREE_BUNDLE before uImage manipulation. - Fix line wrapping errors introduced by MUA Signed-off-by: Jeremy Grosser Signed-off-by: Denys Dmytriyenko --- conf/machine/lego-ev3.conf | 22 ++++++++++++++++++++++ recipes-bsp/u-boot/u-boot-ti.inc | 1 + recipes-kernel/linux/bundle-devicetree.inc | 26 ++++++++++++++++++++++++++ recipes-kernel/linux/linux-ti-staging_4.14.bb | 1 + 4 files changed, 50 insertions(+) create mode 100644 conf/machine/lego-ev3.conf create mode 100644 recipes-kernel/linux/bundle-devicetree.inc diff --git a/conf/machine/lego-ev3.conf b/conf/machine/lego-ev3.conf new file mode 100644 index 00000000..5c425221 --- /dev/null +++ b/conf/machine/lego-ev3.conf @@ -0,0 +1,22 @@ +#@TYPE: Machine +#@NAME: LEGO Mindstorms EV3 +#@DESCRIPTION: Machine configuration for the LEGO Mindstorms EV3 + +require conf/machine/include/davinci.inc +require conf/machine/include/omapl138.inc + +UBOOT_MACHINE = "legoev3_config" +UBOOT_SUFFIX = "bin" +UBOOT_ENTRYPOINT = "0xC0008000" +UBOOT_LOADADDRESS = "0xC0008000" +SPL_BINARY = "" + +KERNEL_DEVICETREE = "da850-lego-ev3.dtb" +KERNEL_IMAGETYPES = "uImage" +KERNEL_DEVICETREE_BUNDLE = "1" +SERIAL_CONSOLES = "115200;ttyS1" + +IMAGE_FSTYPES += " wic" +WKS_FILE = "sdimage-bootpart.wks" +WIC_CREATE_EXTRA_ARGS += " --no-fstab-update" +IMAGE_BOOT_FILES = "${KERNEL_IMAGETYPES}" diff --git a/recipes-bsp/u-boot/u-boot-ti.inc b/recipes-bsp/u-boot/u-boot-ti.inc index d3267be1..62f04f7c 100644 --- a/recipes-bsp/u-boot/u-boot-ti.inc +++ b/recipes-bsp/u-boot/u-boot-ti.inc @@ -55,6 +55,7 @@ export TI_SECURE_DEV_PKG SPL_UART_BINARY = "u-boot-spl.bin" SPL_UART_BINARY_keystone = "" SPL_UART_BINARY_k3 = "" +SPL_UART_BINARY_lego-ev3 = "" SPL_UART_IMAGE ?= "${SPL_UART_BINARY}-${MACHINE}-${PV}-${PR}" SPL_UART_SYMLINK ?= "${SPL_UART_BINARY}-${MACHINE}" diff --git a/recipes-kernel/linux/bundle-devicetree.inc b/recipes-kernel/linux/bundle-devicetree.inc new file mode 100644 index 00000000..4d450374 --- /dev/null +++ b/recipes-kernel/linux/bundle-devicetree.inc @@ -0,0 +1,26 @@ +# Upstream kernel-devicetree.bbclass only supports bundling the DTB with +# zImage. The factory u-boot on lego-ev3 EEPROM only supports uImage, so we +# append the DTB to the final uImage here. + +do_deploy_append() { + if [ "${KERNEL_DEVICETREE_BUNDLE}" = "1" ]; then + install -d ${DEPLOYDIR} + for dtbf in ${KERNEL_DEVICETREE}; do + dtb=`normalize_dtb "$dtbf"` + dtb_ext=${dtb##*.} + dtb_base_name=`basename $dtb .$dtb_ext` + for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do + if [ "$type" = "uImage" ]; then + cat ${D}/${KERNEL_IMAGEDEST}/$type \ + ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \ + > ${DEPLOYDIR}/$type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin + ln -sf $type-$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext.bin \ + ${DEPLOYDIR}/$type-$dtb_base_name-${KERNEL_DTB_LINK_NAME}.$dtb_ext.bin + cat ${D}/${KERNEL_IMAGEDEST}/$type \ + ${DEPLOYDIR}/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext \ + > ${DEPLOYDIR}/$type + fi + done + done + fi +} diff --git a/recipes-kernel/linux/linux-ti-staging_4.14.bb b/recipes-kernel/linux/linux-ti-staging_4.14.bb index 5ee206ec..13b94ffe 100644 --- a/recipes-kernel/linux/linux-ti-staging_4.14.bb +++ b/recipes-kernel/linux/linux-ti-staging_4.14.bb @@ -8,6 +8,7 @@ inherit kernel require recipes-kernel/linux/setup-defconfig.inc require recipes-kernel/linux/cmem.inc require recipes-kernel/linux/ti-uio.inc +require recipes-kernel/linux/bundle-devicetree.inc # Look in the generic major.minor directory for files FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-4.14:" -- cgit v1.2.3-54-g00ecf