diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-12-16 17:11:34 -0800 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2019-01-08 18:21:44 -0500 |
commit | 1a4b7ee28bf7413af6513fb45ad0d0736048f866 (patch) | |
tree | 79f6d8ea698cab8f2eaf4f54b793d2ca7a1451ce /poky/meta/classes/devicetree.bbclass | |
parent | 5b9ede0403237c7dace972affa65cf64a1aadd0e (diff) | |
download | talos-openbmc-1a4b7ee28bf7413af6513fb45ad0d0736048f866.tar.gz talos-openbmc-1a4b7ee28bf7413af6513fb45ad0d0736048f866.zip |
reset upstream subtrees to yocto 2.6
Reset the following subtrees on thud HEAD:
poky: 87e3a9739d
meta-openembedded: 6094ae18c8
meta-security: 31dc4e7532
meta-raspberrypi: a48743dc36
meta-xilinx: c42016e2e6
Also re-apply backports that didn't make it into thud:
poky:
17726d0 systemd-systemctl-native: handle Install wildcards
meta-openembedded:
4321a5d libtinyxml2: update to 7.0.1
042f0a3 libcereal: Add native and nativesdk classes
e23284f libcereal: Allow empty package
030e8d4 rsyslog: curl-less build with fmhttp PACKAGECONFIG
179a1b9 gtest: update to 1.8.1
Squashed OpenBMC subtree compatibility updates:
meta-aspeed:
Brad Bishop (1):
aspeed: add yocto 2.6 compatibility
meta-ibm:
Brad Bishop (1):
ibm: prepare for yocto 2.6
meta-ingrasys:
Brad Bishop (1):
ingrasys: set layer compatibility to yocto 2.6
meta-openpower:
Brad Bishop (1):
openpower: set layer compatibility to yocto 2.6
meta-phosphor:
Brad Bishop (3):
phosphor: set layer compatibility to thud
phosphor: libgpg-error: drop patches
phosphor: react to fitimage artifact rename
Ed Tanous (4):
Dropbear: upgrade options for latest upgrade
yocto2.6: update openssl options
busybox: remove upstream watchdog patch
systemd: Rebase CONFIG_CGROUP_BPF patch
Change-Id: I7b1fe71cca880d0372a82d94b5fd785323e3a9e7
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/classes/devicetree.bbclass')
-rw-r--r-- | poky/meta/classes/devicetree.bbclass | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/poky/meta/classes/devicetree.bbclass b/poky/meta/classes/devicetree.bbclass new file mode 100644 index 000000000..8fe5a5ed7 --- /dev/null +++ b/poky/meta/classes/devicetree.bbclass @@ -0,0 +1,143 @@ +# This bbclass implements device tree compliation for user provided device tree +# sources. The compilation of the device tree sources is the same as the kernel +# device tree compilation process, this includes being able to include sources +# from the kernel such as soc dtsi files or header files such as gpio.h. In +# addition to device trees this bbclass also handles compilation of device tree +# overlays. +# +# The output of this class behaves similar to how kernel-devicetree.bbclass +# operates in that the output files are installed into /boot/devicetree. +# However this class on purpose separates the deployed device trees into the +# 'devicetree' subdirectory. This prevents clashes with the kernel-devicetree +# output. Additionally the device trees are populated into the sysroot for +# access via the sysroot from within other recipes. + +SECTION ?= "bsp" + +# The default inclusion of kernel device tree includes and headers means that +# device trees built with them are at least GPLv2 (and in some cases dual +# licensed). Default to GPLv2 if the recipe does not specify a license. +LICENSE ?= "GPLv2" +LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS += "dtc-native" + +inherit deploy kernel-arch + +COMPATIBLE_MACHINE ?= "^$" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +SYSROOT_DIRS += "/boot/devicetree" +FILES_${PN} = "/boot/devicetree/*.dtb /boot/devicetree/*.dtbo" + +S = "${WORKDIR}" +B = "${WORKDIR}/build" + +# Default kernel includes, these represent what are normally used for in-kernel +# sources. +KERNEL_INCLUDE ??= " \ + ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts \ + ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/* \ + ${STAGING_KERNEL_DIR}/scripts/dtc/include-prefixes \ + " + +DT_INCLUDE[doc] = "Search paths to be made available to both the device tree compiler and preprocessor for inclusion." +DT_INCLUDE ?= "${DT_FILES_PATH} ${KERNEL_INCLUDE}" +DT_FILES_PATH[doc] = "Defaults to source directory, can be used to select dts files that are not in source (e.g. generated)." +DT_FILES_PATH ?= "${S}" + +DT_PADDING_SIZE[doc] = "Size of padding on the device tree blob, used as extra space typically for additional properties during boot." +DT_PADDING_SIZE ??= "0x3000" +DT_RESERVED_MAP[doc] = "Number of reserved map entires." +DT_RESERVED_MAP ??= "8" +DT_BOOT_CPU[doc] = "The boot cpu, defaults to 0" +DT_BOOT_CPU ??= "0" + +DTC_FLAGS ?= "-R ${DT_RESERVED_MAP} -b ${DT_BOOT_CPU}" +DTC_PPFLAGS ?= "-nostdinc -undef -D__DTS__ -x assembler-with-cpp" +DTC_BFLAGS ?= "-p ${DT_PADDING_SIZE}" +DTC_OFLAGS ?= "-p 0 -@ -H epapr" + +python () { + if d.getVar("KERNEL_INCLUDE"): + # auto add dependency on kernel tree, but only if kernel include paths + # are specified. + d.appendVarFlag("do_compile", "depends", " virtual/kernel:do_configure") +} + +def expand_includes(varname, d): + import glob + includes = set() + # expand all includes with glob + for i in (d.getVar(varname) or "").split(): + for g in glob.glob(i): + if os.path.isdir(g): # only add directories to include path + includes.add(g) + return includes + +def devicetree_source_is_overlay(path): + # determine if a dts file is an overlay by checking if it uses "/plugin/;" + with open(path, "r") as f: + for i in f: + if i.startswith("/plugin/;"): + return True + return False + +def devicetree_compile(dtspath, includes, d): + import subprocess + dts = os.path.basename(dtspath) + dtname = os.path.splitext(dts)[0] + bb.note("Processing {0} [{1}]".format(dtname, dts)) + + # preprocess + ppargs = d.getVar("BUILD_CPP").split() + ppargs += (d.getVar("DTC_PPFLAGS") or "").split() + for i in includes: + ppargs.append("-I{0}".format(i)) + ppargs += ["-o", "{0}.pp".format(dts), dtspath] + bb.note("Running {0}".format(" ".join(ppargs))) + subprocess.run(ppargs, check = True) + + # determine if the file is an overlay or not (using the preprocessed file) + isoverlay = devicetree_source_is_overlay("{0}.pp".format(dts)) + + # compile + dtcargs = ["dtc"] + (d.getVar("DTC_FLAGS") or "").split() + if isoverlay: + dtcargs += (d.getVar("DTC_OFLAGS") or "").split() + else: + dtcargs += (d.getVar("DTC_BFLAGS") or "").split() + for i in includes: + dtcargs += ["-i", i] + dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")] + dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)] + bb.note("Running {0}".format(" ".join(dtcargs))) + subprocess.run(dtcargs, check = True) + +python devicetree_do_compile() { + includes = expand_includes("DT_INCLUDE", d) + listpath = d.getVar("DT_FILES_PATH") + for dts in os.listdir(listpath): + if not dts.endswith(".dts"): + continue # skip non-.dts files + dtspath = os.path.join(listpath, dts) + devicetree_compile(dtspath, includes, d) +} + +devicetree_do_install() { + for DTB_FILE in `ls *.dtb *.dtbo`; do + install -Dm 0644 ${B}/${DTB_FILE} ${D}/boot/devicetree/${DTB_FILE} + done +} + +devicetree_do_deploy() { + for DTB_FILE in `ls *.dtb *.dtbo`; do + install -Dm 0644 ${B}/${DTB_FILE} ${DEPLOYDIR}/devicetree/${DTB_FILE} + done +} +addtask deploy before do_build after do_install + +EXPORT_FUNCTIONS do_compile do_install do_deploy + |