From 4dc75cedf738989c606766c4090f27da3a7d5cfd Mon Sep 17 00:00:00 2001 From: Francois Muller Date: Thu, 5 Feb 2015 14:07:00 +0100 Subject: devicetree: Add minimal support with RPi bootloader [RPi DT info] https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md#part-3-using-device-trees-on-raspberry-pi RPi bootloader detects a DT-ready kernel by checking for a specific trailer in kernel.img. Using latest raspberrypi/firmware (firmware.inc) enables this check ability. Using latest raspberrypi/tools (rpi-mkimage.bb) gives access to mkknlimg for adding the required trailer to kernel image. If KERNEL_DEVICETREE is filled in, the trailer is added to the kernel image before kernel install task. While creating the SDCard image, this modified kernel is put on boot partition (as kernel.img) as well as DeviceTree blobs (.dtb files). If KERNEL_DEVICETREE is empty, this new process isn't operated, legacy one does. KERNEL_DEVICETREE for RPi is really supported only starting from linux-rapsberry 3.18+ kernels, so as for now it defaults to empty (in machine config file). Change-Id: Ifea71bbda729b8f3c47be7ba0ba03be5ad2ceeaa Signed-off-by: Francois Muller --- classes/sdcard_image-rpi.bbclass | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'classes') diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass index 71b6477..63cd62a 100644 --- a/classes/sdcard_image-rpi.bbclass +++ b/classes/sdcard_image-rpi.bbclass @@ -50,7 +50,7 @@ IMAGE_DEPENDS_rpi-sdimg = " \ dosfstools-native \ virtual/kernel \ ${IMAGE_BOOTLOADER} \ - ${@base_contains("KERNEL_IMAGETYPE", "uImage", "u-boot", "",d)} \ + ${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'u-boot', '',d)} \ " # SD card image name @@ -99,12 +99,23 @@ IMAGE_CMD_rpi-sdimg () { mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/ case "${KERNEL_IMAGETYPE}" in "uImage") - mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.img ::kernel.img - mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage - ;; + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.img ::kernel.img + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage + ;; *) - mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::kernel.img - ;; + if test -n "${KERNEL_DEVICETREE}"; then + for DTB in ${KERNEL_DEVICETREE}; do + if echo ${DTB} | grep -q '/dts/'; then + bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used." + DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'` + fi + DTB_BASE_NAME=`basename ${DTB} .dtb` + + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::${DTB_BASE_NAME}.dtb + done + fi + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::kernel.img + ;; esac if [ -n ${FATPAYLOAD} ] ; then -- cgit v1.2.3-54-g00ecf