dtc icon indicating copy to clipboard operation
dtc copied to clipboard

Compilation of invalid overlays

Open jimpo opened this issue 2 years ago • 0 comments

The dtc compiler allows compilation of DTS overlay files which fail when applied with FDT_ERR_NOTFOUND. I discovered this issue first with a Raspberry Pi overlay and reported the issue with instructions to reproduce in issue https://github.com/raspberrypi/firmware/issues/1718.

It only fails when the overlay is compiled with --symbols as the issue appears to be with overlay symbols which have stale phandle references after the original node phandle is overwritten by the overlay.

A minimal example to reproduce is:

File base.dts:

/dts-v1/;

/ {
	soc {
		minibt: bluetooth {
			compatible = "brcm,bcm43438-bt";
			max-speed = <0x70800>;
			status = "disabled";
		};
	};
};

File blah.dts:

/dts-v1/;
/plugin/;

/ {
	fragment@0 {
		target = <&minibt>;
		minibt_frag: __overlay__ {
		};
	};
};
% dtc --symbols -I dts -O dtb overlay.dts > blah.dtbo
% dtc --symbols -I dts -O dtb base.dts > base.dtb
% fdtoverlay -v -i base.dtb -o base-with-overlay.dtb blah.dtbo
input  = base.dtb
output = base-with-overlay.dtb
overlay[0] = blah.dtbo

Failed to apply 'blah.dtbo': FDT_ERR_NOTFOUND

jimpo avatar Apr 08 '22 21:04 jimpo