Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yocto - new machine

Tags:

yocto

I'm working with the meta-atmel layer of Yocto. I've created a new machine (call it sama5d4-custom-sd) & sama5d4-custom-sd.conf (currently a copy of sama5d4-xplained-sd.conf) contains:

#@TYPE: Machine
#@Name: SAMA5D4 Custom SD
#@DESCRIPTION: Machine configuration for SAMA5D4 Custom board

require include/sama5d4.inc

MACHINE_FEATURES = "apm alsa ext2 ext3 usbhost usbgadget screen touchscreen"
KERNEL_DEVICETREE = " \
        at91-sama5d4_xplained.dtb \
        "

IMAGE_FSTYPES += " tar.gz wic"

do_image_wic[depends] += "u-boot-at91:do_deploy"
WKS_FILE = "sdimage-bootpart.wks"
IMAGE_BOOT_FILES = "BOOT.BIN u-boot.bin uboot.env sama5d4_xplained.itb"

UBOOT_MACHINE ?= "sama5d4_xplained_mmc_defconfig"
UBOOT_ENTRYPOINT = "0x20008000"
UBOOT_LOADADDRESS = "0x20008000"
UBOOT_ENV_SIZE = "0x4000"

AT91BOOTSTRAP_MACHINE ?= "sama5d4_xplained"

# Needed for FIT
MACHINE_ESSENTIAL_EXTRA_RDEPENDS = " dt-overlay-at91"

MACHINEOVERRIDES =. "sama5d4-xplained-sd:"

As can be seen the last line has a MACHINEOVERRIDES. Without this BitBake fails as the kernel recipe has the following:

COMPATIBLE_MACHINE = "(sama5d2-xplained|sama5d2-xplained-sd|sama5d2-xplained-emmc|sama5d2-ptc-ek|sama5d2-ptc-ek-sd|sama5d27-som1-ek|sama5d27-som1-ek-sd|sama5d4-xplained|sama5d4-xplained-sd|sama5d4ek|sama5d3-xplained|sama5d3-xplained-sd|sama5d3xek|at91sam9x5ek|at91sam9m10g45ek|at91sam9rlek|sama5d2-icp-sd|sam9x60ek|sam9x60ek-sd|sama5d27-wlsom1-ek-sd)"

I'd appreciate if anyone could answer the following:

How does one now selectively build for both sama5d4-xplained-sd & sama5d4-custom-sd (I need to be able to build both). I realise I could modify each required recipes 'COMPATIBLE_MACHINE' line but is there a better way?

Thanks for looking!

like image 218
leo8382 Avatar asked Mar 09 '26 03:03

leo8382


1 Answers

For anyone interested this is how I solved the issue:

├── layer.conf
└── machine
    ├── include
    │   └── sama5d4-common.inc
    ├── sama5d4-custom-sd.conf
    └── sama5d4-xplained-sd.conf

The sama5d4-custom-sd.conf files contain:

#@TYPE: Machine
#@Name: Custom SD
#@DESCRIPTION: Machine configuration for custom board

require include/sama5d4-common.inc

MACHINEOVERRIDES =. "sama5d4-xplained-sd:"

sama5d4-xplained-sd.conf contains:

#@TYPE: Machine
#@Name: ATMEL SAMA5D4 Xplained Ultra SD
#@DESCRIPTION: Machine configuration for Atmel's evaluation board

require include/sama5d4-common.inc

The sama5d4-common.inc contains:

# Common elements for Xplained & custom boards

# Pickup original include
require ../../meta-atmel/conf/machine/include/sama5d4.inc

MACHINE_FEATURES = "apm alsa ext2 ext3 usbhost usbgadget screen touchscreen"

# Add WiFi
MACHINE_FEATURES += " wifi"

KERNEL_DEVICETREE = " \
        at91-sama5d4_xplained.dtb \
        "

IMAGE_FSTYPES += " wic wic.gz"

do_image_wic[depends] += "u-boot-at91:do_deploy"
WKS_FILE = "sdimage-bootpart.wks"
IMAGE_BOOT_FILES = "BOOT.BIN u-boot.bin uboot.env sama5d4_xplained.itb"

UBOOT_MACHINE ?= "sama5d4_xplained_mmc_defconfig"
UBOOT_ENTRYPOINT = "0x20008000"
UBOOT_LOADADDRESS = "0x20008000"
UBOOT_ENV_SIZE = "0x4000"

AT91BOOTSTRAP_MACHINE ?= "sama5d4_xplained"

# Needed for FIT
MACHINE_ESSENTIAL_EXTRA_RDEPENDS = " dt-overlay-at91"

Using this setup I can run:

MACHINE=sama5d4-xplained-sd bitbake microchip-graphics-image

or

MACHINE=sama5d4-custom-sd bitbake microchip-graphics-image

I can customize recipes (including devicetrees etc) to pull in board specfic files.

Hope this helps others!

like image 173
leo8382 Avatar answered Mar 11 '26 08:03

leo8382