FSEmbedded / buildroot-fus

F&S Buildroot
Other
0 stars 1 forks source link

cpu type in BR2_ROOTFS_POST_BUILD_SCRIPT seems to depend of script arguments #2

Open brenkem opened 6 months ago

brenkem commented 6 months ago

After changing the configuration of my buildroot project I noticed that the system image creation failed because of maybe [1] with the following result:

>>>   Executing post-image script board/f+s/common/post-image.sh
sed: board/f+s/MINIMAL_Template_CONFIG/genimage.cfg.template.imx8mp.std kann nicht gelesen werden: Datei oder Verzeichnis nicht gefunden
INFO: cmd: "mkdir -p "/home/brenkem/git/FIRMWARE_BUILD_TEMPLATE_PICOCOREMX8MP/output/build/genimage.tmp"" (stderr):
INFO: cmd: "rm -rf "/home/brenkem/git/FIRMWARE_BUILD_TEMPLATE_PICOCOREMX8MP/output/build/genimage.tmp"/*" (stderr):
INFO: cmd: "mkdir -p "/home/brenkem/git/FIRMWARE_BUILD_TEMPLATE_PICOCOREMX8MP/output/images"" (stderr):

If the sysimg creation is depending of the hostname definition in the buildroot configuration to define the target cpu variant, it seems not to be a good option. Maybe we should implement something like [3] to detect the cpu variant.

[1]:

diff --git a/configs/fsimx8mp_min_pico_defconfig b/configs/fsimx8mp_min_pico_defconfig
index fa82983c8..161a22eba 100644
--- a/configs/fsimx8mp_min_pico_defconfig
+++ b/configs/fsimx8mp_min_pico_defconfig
-BR2_TARGET_GENERIC_HOSTNAME="fsimx8mp"
+BR2_TARGET_GENERIC_HOSTNAME="MINIMAL_Template_CONFIG"

[2]:

diff --git a/board/f+s/common/post-image.sh b/board/f+s/common/post-image.sh
index 1dd8bda5b..589f9f0fb 100755
--- a/board/f+s/common/post-image.sh
+++ b/board/f+s/common/post-image.sh
@@ -55,6 +55,18 @@ uboot_image()
-               board/f+s/$2/$(genimage_type) > ${GENIMAGE_CFG}
+               board/f+s/$(arch_type)/$(genimage_type) > ${GENIMAGE_CFG}

[3]: diff --git a/board/f+s/common/post-image.sh b/board/f+s/common/post-image.sh

index 1dd8bda5b..589f9f0fb 100755
--- a/board/f+s/common/post-image.sh
+++ b/board/f+s/common/post-image.sh
@@ -55,6 +55,18 @@ uboot_image()
        fi
 }

+arch_type()
+{
+       if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
+               echo "fsimx8m"
+       elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=y$" ${BR2_CONFIG}; then
+               echo "fsimx8mm"
+       elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MP=y$" ${BR2_CONFIG}; then
+               echo "fsimx8mp"
+       elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X=y$" ${BR2_CONFIG}; then
+               echo "fsimx8x"
+       fi
+}
brenkem commented 6 months ago

There is also a issue then a custom device tree is used including a device tree source include file, e.g.:

-BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="picocoremx8mpr2.dts"
+BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="picocoremx8mpr2.dts picocoremx8mp.dtsi"

In this case, the system image building script will try to build the system image including "picocoremx8mp.dtb" from the include file "picocoremx8mp.dtsi".

This can be solved by excluding dtsi files from the device tree list:

diff --git a/board/f+s/common/post-image.sh b/board/f+s/common/post-image.sh
index 589f9f0fb..7ddffe2d6 100755
--- a/board/f+s/common/post-image.sh
+++ b/board/f+s/common/post-image.sh
@@ -23,7 +23,7 @@ freertos_sample_list()
 #
 dtb_list()
 {
-       local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_[A-Z \+ | \. \+ | \/a-z0-9 \-]*_DTS_[A-Z \+ | \. \+ | \/a-z0-9 \-]*="\([A-Z \+ | \. \+ | \/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+       local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_[A-Z \+ | \. \+ | \/a-z0-9 \-]*_DTS_[A-Z \+ | \. \+ | \/a-z0-9 \-]*="\([A-Z \+ | \. \+ | \/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG} | sed -n 's/\ .*.dtsi//p')"