[PATCH] imx: dts: tbs2910: add u-boot dtsi to shrink image size

Soeren Moch smoch at web.de
Fri Dec 6 20:26:27 CET 2019



On 06.12.19 19:43, Tom Rini wrote:
> On Fri, Dec 06, 2019 at 07:30:47PM +0100, Anatolij Gustschin wrote:
>
>> Use U-Boot specific board dtsi to remove some not used nodes and
>> properties. With this change applied considerable size reduction
>> has been observed:
>>
>>   $ ./tools/buildman/buildman -b tbs2910 -f tbs2910 || \
>>     ./tools/buildman/buildman -b tbs2910 -sS tbs2910
>>   ...
>>   Summary of 2 commits for 1 boards (1 thread, 12 jobs per thread)
>>   01: Merge branch '2019-12-05-master-imports'
>>          arm:  w+   tbs2910
>>   02: imx: dts: tbs2910: add u-boot dtsi to shrink image size
>>          arm: (for 1/1 boards) all -24448.0 text -24448.0
>>
>> Signed-off-by: Anatolij Gustschin <agust at denx.de>
>> ---
>> This patch was only build-tested, maybe this removes to much
>> and needs some tweaking. I'd appreciate if someone could test
>> it on actual hardware and finish the work, so we hopefully
>> can solve frequent CI build breakage caused by this target.
>>
>>  arch/arm/dts/imx6q-tbs2910-u-boot.dtsi | 219 +++++++++++++++++++++++++
>>  1 file changed, 219 insertions(+)
>>  create mode 100644 arch/arm/dts/imx6q-tbs2910-u-boot.dtsi
>>
>> diff --git a/arch/arm/dts/imx6q-tbs2910-u-boot.dtsi b/arch/arm/dts/imx6q-tbs2910-u-boot.dtsi
>> new file mode 100644
>> index 0000000000..3e9307f17f
>> --- /dev/null
>> +++ b/arch/arm/dts/imx6q-tbs2910-u-boot.dtsi
>> @@ -0,0 +1,219 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * U-Boot specific modifications for original tbs2910 DTS.
>> + * This drops not used nodes/properties to reduce the image size.
>> + */
>> +
>> +/ {
>> +	/delete-property/ model;
>> +	/delete-property/ compatible;
>> +
>> +	aliases {
>> +		/delete-property/ can0;
>> +		/delete-property/ can1;
>> +		/delete-property/ gpio3;
>> +		/delete-property/ gpio4;
>> +		/delete-property/ gpio5;
>> +		/delete-property/ ipu1;
>> +		/delete-property/ mmc3;
>> +		/delete-property/ spi0;
>> +		/delete-property/ spi1;
>> +		/delete-property/ spi2;
>> +		/delete-property/ spi3;
>> +		/delete-property/ spi4;
>> +		/delete-property/ serial2;
>> +		/delete-property/ serial3;
>> +		/delete-property/ serial4;
>> +		/delete-property/ video1;
>> +	};
>> +
>> +	/delete-node/ cpus;
>> +	/delete-node/ capture-subsystem;
>> +	/delete-node/ chosen;
>> +	/delete-node/ display-subsystem;
>> +	/delete-node/ fan;
>> +	/delete-node/ ir_recv;
>> +	/delete-node/ leds;
>> +	/delete-node/ memory;
>> +	/delete-node/ sound-sgtl5000;
>> +	/delete-node/ sound-spdif;
>> +
>> +	soc {
>> +		u-boot,dm-pre-reloc;
>> +		/delete-property/ ranges;
>> +		/delete-node/ timer at a00600;
>> +
>> +		aips-bus at 2000000 {
>> +			/delete-property/ ranges;
>> +			/delete-node/ aipstz at 207c000;
>> +			spba-bus at 2000000 {
>> +				/delete-property/ ranges;
>> +				/delete-node/ spba at 203c000;
>> +			};
>> +		};
>> +
>> +		aips-bus at 2100000 {
>> +			/delete-property/ ranges;
>> +			/delete-node/ aipstz at 217c000;
>> +			/delete-node/ mlb at 218c000;
>> +			/delete-node/ romcp at 21ac000;
>> +			/delete-node/ tzasc at 21d0000;
>> +			/delete-node/ tzasc at 21d4000;
>> +			/delete-node/ vdoa at 21e4000;
>> +		};
>> +	};
>> +};
>> +
>> +&anatop {
>> +	/delete-node/ regulator-1p1;
>> +	/delete-node/ regulator-2p5;
>> +	/delete-node/ regulator-3p0;
>> +	/delete-node/ regulator-vddcore;
>> +	/delete-node/ regulator-vddpu;
>> +	/delete-node/ regulator-vddsoc;
>> +};
>> +
>> +&sata {
>> +	/delete-property/ clocks;
>> +	/delete-property/ clock-names;
>> +	/delete-property/ interrupts;
>> +	/delete-property/ interrupts;
>> +	/delete-property/ fsl,transmit-level-mV;
>> +	/delete-property/ fsl,transmit-boost-mdB;
>> +	/delete-property/ fsl,transmit-atten-16ths;
>> +	/delete-property/ fsl,receive-eq-mdB;
>> +};
>> +
>> +&pcie {
>> +	/delete-property/ reg-names;
>> +	/delete-property/ device_type;
>> +	/delete-property/ bus-range;
>> +	/delete-property/ ranges;
>> +	/delete-property/ num-lanes;
>> +	/delete-property/ interrupts;
>> +	/delete-property/ interrupt-names;
>> +	/delete-property/ #interrupt-cells;
>> +	/delete-property/ interrupt-map-mask;
>> +	/delete-property/ interrupt-map;
>> +	/delete-property/ clocks;
>> +	/delete-property/ clock-names;
>> +};
>> +
>> +&uart1 {
>> +	/delete-property/ interrupts;
>> +	/delete-property/ clocks;
>> +	/delete-property/ clock-names;
>> +	/delete-property/ dmas;
>> +	/delete-property/ dma-names;
>> +};
>> +
>> +&uart2 {
>> +	/delete-property/ interrupts;
>> +	/delete-property/ clocks;
>> +	/delete-property/ clock-names;
>> +	/delete-property/ dmas;
>> +	/delete-property/ dma-names;
>> +};
>> +
>> +/delete-node/ &L2;
>> +/delete-node/ &asrc;
>> +/delete-node/ &audmux;
>> +/delete-node/ &can1;
>> +/delete-node/ &can2;
>> +/delete-node/ &crypto;
>> +/delete-node/ &dcic1;
>> +/delete-node/ &dcic2;
>> +/delete-node/ &dma_apbh;
>> +/delete-node/ &ecspi1;
>> +/delete-node/ &ecspi2;
>> +/delete-node/ &ecspi3;
>> +/delete-node/ &ecspi4;
>> +/delete-node/ &ecspi5;
>> +/delete-node/ &epit1;
>> +/delete-node/ &epit2;
>> +/delete-node/ &esai;
>> +/delete-node/ &gpt;
>> +/delete-node/ &gpio4;
>> +/delete-node/ &gpio5;
>> +/delete-node/ &gpio6;
>> +/delete-node/ &gpu_3d;
>> +/delete-node/ &gpu_2d;
>> +/delete-node/ &gpu_vg;
>> +/delete-node/ &gpmi;
>> +/delete-node/ &ipu2;
>> +/delete-node/ &kpp;
>> +/delete-node/ &ldb;
>> +/delete-node/ &mipi_csi;
>> +/delete-node/ &mmdc0;
>> +/delete-node/ &mmdc1;
>> +/delete-node/ &ocotp;
>> +/delete-node/ &ocram;
>> +/delete-node/ &pinctrl_gpio_fan;
>> +/delete-node/ &pinctrl_ir;
>> +/delete-node/ &pinctrl_gpio_leds;
>> +/delete-node/ &pinctrl_sgtl5000;
>> +/delete-node/ &pinctrl_spdif;
>> +/delete-node/ &pmu;
>> +/delete-node/ &pwm1;
>> +/delete-node/ &pwm2;
>> +/delete-node/ &pwm3;
>> +/delete-node/ &pwm4;
>> +/delete-node/ &sdma;
>> +/delete-node/ &reg_2p5v;
>> +/delete-node/ &sgtl5000;
>> +/delete-node/ &snvs;
>> +/delete-node/ &spdif;
>> +/delete-node/ &src;
>> +/delete-node/ &ssi1;
>> +/delete-node/ &ssi2;
>> +/delete-node/ &ssi3;
>> +/delete-node/ &tempmon;
>> +/delete-node/ &uart3;
>> +/delete-node/ &uart4;
>> +/delete-node/ &uart5;
>> +/delete-node/ &usbh2;
>> +/delete-node/ &usbh3;
>> +/delete-node/ &usdhc1;
>> +/delete-node/ &vpu;
>> +/delete-node/ &wdog2;
>> +/delete-node/ &weim;
>> +
>> +&gpr {
>> +	/delete-node/ ipu1_csi0_mux;
>> +	/delete-node/ ipu2_csi1_mux;
>> +};
>> +
>> +&gpc {
>> +	/delete-node/ pgc;
>> +};
>> +
>> +&hdmi {
>> +	/delete-node/ port at 2;
>> +	/delete-node/ port at 3;
>> +};
>> +
>> +&mipi_dsi {
>> +	ports {
>> +		/delete-node/ port at 2;
>> +		/delete-node/ port at 3;
>> +	};
>> +};
>> +
>> +&ipu1 {
>> +	u-boot,dm-pre-reloc;
>> +	/delete-property/ interrupts;
>> +	/delete-property/ clocks;
>> +	/delete-property/ clock-names;
>> +	/delete-property/ resets;
>> +	/delete-node/ port at 0;
>> +	/delete-node/ port at 1;
>> +
>> +	port at 2 {
>> +		/delete-node/ endpoint at 3;
>> +		/delete-node/ endpoint at 4;
>> +	};
>> +	port at 3 {
>> +		/delete-node/ endpoint at 3;
>> +		/delete-node/ endpoint at 4;
>> +	};
>> +};
Oh, most of the deleted properties and nodes are not defined in the
board dts, but in the soc dtsi instead.
So for me it would make more sense to also split the "delete dtsi" in a
board and soc part, if this really is the way to go.
> This gets an important conversation started.  Perhaps we should expand
> OF_SPL_REMOVE_PROPS for full U-Boot, with some gating symbol for the
> platforms that do want to pass through the full DT to the OS?
>
I also already looked at OF_SPL_REMOVE_PROPS, would make much sense to
have this for full u-boot. To duplicate each device tree with an almost
identical "delete dtsi" looks like a huge maintenance burden for me.

Maybe the build system can at least automatically remove disabled nodes
and nodes without compatible in enabled DM drivers. This would not help
for unneeded properties in enabled nodes, but probably automatically
give the biggest part of size reduction.

 Soeren



More information about the U-Boot mailing list