________________________________________
From: Jan Kiszka <jan.k...@web.de>
Sent: Friday, August 2, 2024 8:03 PM
To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-...@googlegroups.com
Subject: Re: [PATCH] linux-custom: compile only those specified dtbs
On 02.08.24 13:41, 'Nicusor Huhulea' via isar-users wrote:
> The current implementation makes a full kernel build and that means it will
> compile all dtbs specified by the bsp makefile e.g arch/arm64/boot/dts/ti/Makefile
> Currently the required dtbs are given by the DTB_FILES.
>
> These changes are checking if the DTB_FILES is specified, compile only those
> and avoids compiling all the dtbs from the bsp directory. Otherwise build all dtbs
> specified by the kernel source.
> Preventing the automatic dtb builds is made by using target specific build
> commands e.g KERNEL_IMAGETYPE
> The compilation of the dtbs accepts the following formats e.g:
> a) full path from the architecture directory:
> arch/${ARCH}/boot/dts/bsp_dir/test.dts
> arch/${ARCH}/boot/dts/bsp_dir/test.dtb
> b) relative path from the dts directory: bsp_dir/test.dts
> c) device tree blob file: bsp_dir/test.dtb
> Compilation of the dtbs is somewhat similar to KERNEL_DEVICETREE from OE when
> it comes to declaring the path to the dts, but for now in the DTB_FILES variable
> only Device Tree Blobs(.dtb) needs to be declared due to the fact that is being used
> in do_copy_boot_files task.
Can you provide some numbers on how much can be saved this way? Time or
(I rather assume) space?
Yes, I can provide these numbers and the answers for all the other queries in the next update.
________________________________________
From: Kiszka, Jan (T CED) <jan.k...@siemens.com>
Sent: Friday, August 9, 2024 7:56 PM
To: Huhulea, Nicusor Liviu (DI CTO FDS CES LX SVCS); isar-...@googlegroups.com
Subject: Re: [PATCH] linux-custom: compile only those specified dtbs
On 09.08.24 12:59, 'Nicusor Huhulea' via isar-users wrote:
> The current implementation makes a full kernel build and that means it will
> compile all dtbs specified by the bsp makefile e.g arch/arm64/boot/dts/ti/Makefile
> Currently the required dtbs are given by the DTB_FILES.
>
> These changes are checking if the DTB_FILES is specified, compile only those
> and avoids compiling all the dtbs from the bsp directory. Otherwise build all dtbs
> specified by the kernel source.
> Preventing the automatic dtb builds is made by using target specific build
> commands e.g KERNEL_IMAGETYPE
Fairly subtle optimization. Can't we identify the default image(s) the
kernel would build and fill this automatically?
Yes, we can do that, but I don't think we want that because if there are multiple targets(image types) enabled
we wouldn't know what to choose. The reason being the difference between a full build and a specific target build.
So far I have identified 2 differences between a full build and a specific target build: one is the dtbs target and the
other one is the different image types that are produced in one build session. e.g: for arm the kernel might have the
configuration to build both zImage and Image.gz(full-build case) but we need only one image for deployment(specific target build).
However, building all of these images every time might not be necessary, which is where the KERNEL_IMAGETYPE comes into
the picture hence the reason for these changes.
> The compilation of the dtbs accepts the following formats e.g:
> Kernel Post 6.x:
> a) full path from the architecture directory:
> arch/${ARCH}/boot/dts/bsp_dir/test.dts
> arch/${ARCH}/boot/dts/bsp_dir/test.dtb
> b) relative path from the dts directory: bsp_dir/test.dts
> c) device tree blob file: bsp_dir/test.dtb
> Kernel Pre 6.x:
> The same as on Kernel Post 6.x but without the bsp_dir
>
> The differences when building a full build and when using a specific target
> build are:(tests were made on the machine phyboard-mira on 6.x and 4.x versions)
> specific target: Build needed 00:02:08, 2219688k disk space linux-phy 6.x
> full build: Build needed 00:02:14, 2271528k disk space linux-phy 6.x
> The time difference: the full build took 6s longer than the specific target build
> The disk space difference: the full build used 50.6MB more disk space than
> the specific target build.
That 50M is build-time space, right? What's the size difference on the
target?
Yes, 50M disk space. I don't have a phyboard-mira at my disposal, but I can
try on a iot2050 board to see the difference on the target.
> In conclusion the specific target build is slightly faster and uses less
> disk space.
>
> For now the DTB_FILES variable should accept only Device Tree Blobs(.dtb)
> because some areas still depends on it e.g: do_copy_boot_files, plugins
We are not yet using dtbo files (overlays) built by the kernel in any
projects I know, but those would no longer be built then, right?
Exactly, but these changes are still keeping the full-build case in place
As you said, because I haven't seen any dtbo files around I left this out for the moment
and because the changes were starting to be quite big.(can be treated as a follow up on this
as compiling the dtbo is in line with the dtb)
You are losing KERNEL_EXTRA_BUILDARGS.
These changes are some optimizations but after carefully inspecting these I saw that I need to fix some ${KERNEL_EXTRA_BUILDARGS} addition
and loosing in some areas.
Jan
Yes, indeed seems a lot of code but these changes were made having in mind fixing the compilation of those extra dtbs that were not
belonging to that specific target bsp. And the optimizations are just a side effect(maybe as a bonus), they are not on the foreground.
The reason because it's a lot of code is primarily because I wanted to keep the DTB_FILES declarations as is in the upper layers and bring
new features e.g full architecture path, etc. plus this handles a KERNEL Pre 6.x dtb builds