@@ -14,8 +14,20 @@ include conf/machine/include/arm/armv7a/tune-cortexa8.inc
IMAGE_FSTYPES += "tar.bz2 jffs2 wic wic.bmap"
EXTRA_IMAGECMD:jffs2 = "-lnp "
WKS_FILE ?= "beaglebone-yocto.wks"
-MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-image kernel-devicetree"
-do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot virtual/bootloader:do_deploy"
+
+# Setting this variable to "1" switches from zImage kernel to FIT image kernel
+FIT_IMAGE_KERNEL ?= "0"
+
+# Note: This is redundant if wic creates a separate /boot partition
+MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "${@'linux-yocto-fitimage' if d.getVar('FIT_IMAGE_KERNEL') == '1' else 'kernel-image kernel-devicetree'}"
+
+KERNEL_CLASSES += "${@'kernel-fit-extra-artifacts' if d.getVar('FIT_IMAGE_KERNEL') == '1' else ''}"
+do_image_wic[depends] += "\
+ mtools-native:do_populate_sysroot \
+ dosfstools-native:do_populate_sysroot \
+ virtual/bootloader:do_deploy \
+ ${@'linux-yocto-fitimage:do_deploy' if d.getVar('FIT_IMAGE_KERNEL') == '1' else ''} \
+"
SERIAL_CONSOLES ?= "115200;ttyS0 115200;ttyO0 115200;ttyAMA0"
@@ -26,15 +38,28 @@ KERNEL_IMAGETYPE = "zImage"
DTB_FILES = "am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb"
KERNEL_DEVICETREE = '${@' '.join('ti/omap/%s' % d for d in '${DTB_FILES}'.split())}'
+# Configure the image.bbclass to depend on the fitImage instead of only
+# the kernel to ensure the fitImage is built with the image
+KERNEL_DEPLOY_DEPEND = "${@'linux-yocto-fitimage:do_deploy' if d.getVar('FIT_IMAGE_KERNEL') == '1' else 'virtual/kernel:do_deploy'}"
+
PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
SPL_BINARY = "MLO"
UBOOT_SUFFIX = "img"
UBOOT_MACHINE = "am335x_evm_defconfig"
+UBOOT_ENTRYPOINT = "0x80008000"
+UBOOT_LOADADDRESS = "0x80008000"
+UBOOT_DTB_LOADADDRESS = "0x88000000"
+UBOOT_DTBO_LOADADDRESS = "0x88080000"
+UBOOT_RD_LOADADDRESS = "0x89000000"
+UBOOT_RD_ENTRYPOINT = "0x89000000"
MACHINE_FEATURES = "usbgadget usbhost vfat alsa"
-IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} ${SPL_BINARY} ${KERNEL_IMAGETYPE} ${DTB_FILES}"
+# Configure wic to create a /boot partition with either zImage or fitImage
+IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} ${SPL_BINARY} \
+ ${@'fitImage' if d.getVar('FIT_IMAGE_KERNEL') == '1' else '${KERNEL_IMAGETYPE} ${DTB_FILES}'} \
+"
# support runqemu
EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"