summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/devicetree.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/devicetree.bbclass')
-rw-r--r--meta/classes-recipe/devicetree.bbclass24
1 files changed, 17 insertions, 7 deletions
diff --git a/meta/classes-recipe/devicetree.bbclass b/meta/classes-recipe/devicetree.bbclass
index bd50d7fa1d..ce9d008aac 100644
--- a/meta/classes-recipe/devicetree.bbclass
+++ b/meta/classes-recipe/devicetree.bbclass
@@ -40,7 +40,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
40SYSROOT_DIRS += "/boot/devicetree" 40SYSROOT_DIRS += "/boot/devicetree"
41FILES:${PN} = "/boot/devicetree/*.dtb /boot/devicetree/*.dtbo" 41FILES:${PN} = "/boot/devicetree/*.dtb /boot/devicetree/*.dtbo"
42 42
43S = "${WORKDIR}" 43S = "${UNPACKDIR}"
44B = "${WORKDIR}/build" 44B = "${WORKDIR}/build"
45 45
46# Default kernel includes, these represent what are normally used for in-kernel 46# Default kernel includes, these represent what are normally used for in-kernel
@@ -108,7 +108,11 @@ def devicetree_compile(dtspath, includes, d):
108 ppargs.append("-I{0}".format(i)) 108 ppargs.append("-I{0}".format(i))
109 ppargs += ["-o", "{0}.pp".format(dts), dtspath] 109 ppargs += ["-o", "{0}.pp".format(dts), dtspath]
110 bb.note("Running {0}".format(" ".join(ppargs))) 110 bb.note("Running {0}".format(" ".join(ppargs)))
111 subprocess.run(ppargs, check = True) 111 try:
112 subprocess.run(ppargs, check=True, capture_output=True)
113 except subprocess.CalledProcessError as e:
114 bb.fatal(f"Command '{' '.join(ppargs)}' failed with return code {e.returncode}\nstdout: {e.stdout.decode()}\nstderr: {e.stderr.decode()}\ndtspath: {os.path.abspath(dtspath)}")
115
112 116
113 # determine if the file is an overlay or not (using the preprocessed file) 117 # determine if the file is an overlay or not (using the preprocessed file)
114 isoverlay = devicetree_source_is_overlay("{0}.pp".format(dts)) 118 isoverlay = devicetree_source_is_overlay("{0}.pp".format(dts))
@@ -124,7 +128,11 @@ def devicetree_compile(dtspath, includes, d):
124 dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")] 128 dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")]
125 dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)] 129 dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)]
126 bb.note("Running {0}".format(" ".join(dtcargs))) 130 bb.note("Running {0}".format(" ".join(dtcargs)))
127 subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 131 try:
132 subprocess.run(dtcargs, check=True, capture_output=True)
133 except subprocess.CalledProcessError as e:
134 bb.fatal(f"Command '{' '.join(dtcargs)}' failed with return code {e.returncode}\nstdout: {e.stdout.decode()}\nstderr: {e.stderr.decode()}\ndtname: {dtname}")
135
128 136
129python devicetree_do_compile() { 137python devicetree_do_compile() {
130 import re 138 import re
@@ -143,14 +151,16 @@ python devicetree_do_compile() {
143} 151}
144 152
145devicetree_do_install() { 153devicetree_do_install() {
146 for DTB_FILE in `ls *.dtb *.dtbo`; do 154 for dtb_file in *.dtb *.dtbo; do
147 install -Dm 0644 ${B}/${DTB_FILE} ${D}/boot/devicetree/${DTB_FILE} 155 [ -e "$dtb_file" ] || continue
156 install -Dm 0644 "${B}/$dtb_file" "${D}/boot/devicetree/$dtb_file"
148 done 157 done
149} 158}
150 159
151devicetree_do_deploy() { 160devicetree_do_deploy() {
152 for DTB_FILE in `ls *.dtb *.dtbo`; do 161 for dtb_file in *.dtb *.dtbo; do
153 install -Dm 0644 ${B}/${DTB_FILE} ${DEPLOYDIR}/devicetree/${DTB_FILE} 162 [ -e "$dtb_file" ] || continue
163 install -Dm 0644 "${B}/$dtb_file" "${DEPLOYDIR}/devicetree/$dtb_file"
154 done 164 done
155} 165}
156addtask deploy before do_build after do_install 166addtask deploy before do_build after do_install