From 693c297a195b5196cb2fd317057ab32b5926dbb9 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Mon, 12 May 2025 09:37:31 +0200 Subject: imx-vpu-hantro: fix build with gcc 15 Change from deprecated K&R function declaration and definitions to ANSI C style. GCC 15 by default no longer accepts it: | decoder_sw/software/test/common/md5_sink.c:68:3: error: too many | arguments to function 'MD5Init'; expected 0, have 1 | 68 | MD5Init(&inst->ctx); With C23 bool, true and false are built in keywords and cannot be redefined. Fixes build error: | ../inc/basetype.h:71:9: error: cannot use keyword 'false' as enumeration constant | 71 | false = 0, Signed-off-by: Max Krummenacher --- ...asetype.h-make-header-compatible-with-c23.patch | 38 +++++++++ .../0001-test-md5-convert-to-ansi-c.patch | 90 ++++++++++++++++++++++ .../imx-vpu-hantro/imx-vpu-hantro_1.36.0.bb | 6 +- 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-basetype.h-make-header-compatible-with-c23.patch create mode 100644 recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-test-md5-convert-to-ansi-c.patch diff --git a/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-basetype.h-make-header-compatible-with-c23.patch b/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-basetype.h-make-header-compatible-with-c23.patch new file mode 100644 index 000000000..bbfec172a --- /dev/null +++ b/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-basetype.h-make-header-compatible-with-c23.patch @@ -0,0 +1,38 @@ +From e39a6602817e4221ae09ac3d520ca6a0d94814dc Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Wed, 7 May 2025 16:13:38 +0000 +Subject: [PATCH] basetype.h: make header compatible with c23 + +With C23 bool, true and false are built in keywords and cannot be +redefined. + +Upstream-Status: Pending +Signed-off-by: Max Krummenacher +--- + h1_encoder/software/inc/basetype.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/h1_encoder/software/inc/basetype.h b/h1_encoder/software/inc/basetype.h +index 55e46a195b3b..6655ec54481b 100755 +--- a/h1_encoder/software/inc/basetype.h ++++ b/h1_encoder/software/inc/basetype.h +@@ -66,12 +66,16 @@ typedef size_t ptr_t; + #define PRT_PTR "x" + #endif + ++#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L ++/* bool, true and false are keywords. */ ++#else + #ifndef __cplusplus + typedef enum { + false = 0, + true = 1 + } bool; + #endif ++#endif + + #else /* __symbian__ or __win__ or whatever, customize it to suit well */ + +-- +2.42.0 + diff --git a/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-test-md5-convert-to-ansi-c.patch b/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-test-md5-convert-to-ansi-c.patch new file mode 100644 index 000000000..da1af2b9c --- /dev/null +++ b/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro/0001-test-md5-convert-to-ansi-c.patch @@ -0,0 +1,90 @@ +From 0c5bdd12a6f3ba73e605656828bf429966a997ef Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Wed, 7 May 2025 13:25:26 +0000 +Subject: [PATCH] test: md5: convert to ansi c + +GCC 15 no longer likes this K&R style function declarations. + +Upstream-Status: Pending +Signed-off-by: Max Krummenacher +--- + decoder_sw/software/test/common/swhw/md5.c | 15 +++++---------- + decoder_sw/software/test/common/swhw/md5.h | 8 ++++---- + 2 files changed, 9 insertions(+), 14 deletions(-) + +diff --git a/decoder_sw/software/test/common/swhw/md5.c b/decoder_sw/software/test/common/swhw/md5.c +index c3334bf751fd..20014fbdf268 100755 +--- a/decoder_sw/software/test/common/swhw/md5.c ++++ b/decoder_sw/software/test/common/swhw/md5.c +@@ -42,8 +42,7 @@ + /* + * Note: this code is harmless on little-endian machines. + */ +-void ByteReverse(buf, longs) unsigned char *buf; +-unsigned longs; ++void ByteReverse(unsigned char *buf, unsigned longs) + { + uint32 t; + do { +@@ -59,7 +58,7 @@ unsigned longs; + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +-void MD5Init(ctx) struct MD5Context *ctx; ++void MD5Init(struct MD5Context *ctx) + { + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; +@@ -74,9 +73,7 @@ void MD5Init(ctx) struct MD5Context *ctx; + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +-void MD5Update(ctx, buf, len) struct MD5Context *ctx; +-unsigned char *buf; +-unsigned len; ++void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len) + { + uint32 t; + +@@ -124,8 +121,7 @@ unsigned len; + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +-void MD5Final(digest, ctx) unsigned char digest[16]; +-struct MD5Context *ctx; ++void MD5Final(unsigned char digest[16], struct MD5Context *ctx) + { + unsigned count; + unsigned char *p; +@@ -186,8 +182,7 @@ struct MD5Context *ctx; + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +-void MD5Transform(buf, in) uint32 buf[4]; +-uint32 in[16]; ++void MD5Transform(uint32 buf[4], uint32 in[16]) + { + register uint32 a, b, c, d; + +diff --git a/decoder_sw/software/test/common/swhw/md5.h b/decoder_sw/software/test/common/swhw/md5.h +index 516400236606..c1d773093b66 100755 +--- a/decoder_sw/software/test/common/swhw/md5.h ++++ b/decoder_sw/software/test/common/swhw/md5.h +@@ -76,10 +76,10 @@ struct MD5Context { + unsigned char in[64]; + }; + +-extern void MD5Init(); +-extern void MD5Update(); +-extern void MD5Final(); +-extern void MD5Transform(); ++extern void MD5Init(struct MD5Context *ctx); ++extern void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len); ++extern void MD5Final(unsigned char digest[16], struct MD5Context *ctx); ++extern void MD5Transform(uint32 buf[4], uint32 in[16]); + + /* + * This is needed to make RSAREF happy on some MS-DOS compilers. +-- +2.42.0 + diff --git a/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro_1.36.0.bb b/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro_1.36.0.bb index 645d25544..3a171942f 100644 --- a/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro_1.36.0.bb +++ b/recipes-bsp/imx-vpu-hantro/imx-vpu-hantro_1.36.0.bb @@ -6,7 +6,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=c0fb372b5d7f12181de23ef480f225f3" PROVIDES = "virtual/imxvpu" -SRC_URI = "${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true" +SRC_URI = " \ + ${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true \ + file://0001-test-md5-convert-to-ansi-c.patch \ + file://0001-basetype.h-make-header-compatible-with-c23.patch \ +" IMX_SRCREV_ABBREV = "194a305" SRC_URI[sha256sum] = "0ef1fb5c6653c08f2d2812c72dedf3e8beb091dd5b3d70d6e26f41bac4ebffa7" -- cgit v1.2.3-54-g00ecf From dc129ca65213d3dea3c8ab7ba5d6016605b44e7b Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Mon, 12 May 2025 09:37:47 +0200 Subject: imx-vpu-hantro-vc: fix build with gcc 15 GCC 15 by default uses C23 as the standard. With C23 bool, true and false are built in keywords and cannot be redefined. Fixes build of imx-vpu-hantro-daemon: | ...imx-vpu-hantro-daemon/1.5.0/recipe-sysroot/usr/include/hantro_VC8000E_enc/base_type.h:73:3: error: cannot use keyword 'false' as enumeration constant | 73 | false = HANTRO_FALSE, Signed-off-by: Max Krummenacher --- ...se_type.h-make-header-compatible-with-c23.patch | 39 ++++++++++++++++++++++ .../imx-vpu-hantro-vc/imx-vpu-hantro-vc_1.10.1.bb | 5 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc/0001-base_type.h-make-header-compatible-with-c23.patch diff --git a/recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc/0001-base_type.h-make-header-compatible-with-c23.patch b/recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc/0001-base_type.h-make-header-compatible-with-c23.patch new file mode 100644 index 000000000..8d017ab71 --- /dev/null +++ b/recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc/0001-base_type.h-make-header-compatible-with-c23.patch @@ -0,0 +1,39 @@ +From e7f6097c9e7cb30f130502cc4804e1a1b01342de Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Wed, 7 May 2025 16:13:38 +0000 +Subject: [PATCH] base_type.h: make header compatible with c23 + +With C23 bool, true and false are built in keywords and cannot be +redefined. + +Upstream-Status: Pending +Signed-off-by: Max Krummenacher +--- + usr/include/hantro_VC8000E_enc/base_type.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/usr/include/hantro_VC8000E_enc/base_type.h b/usr/include/hantro_VC8000E_enc/base_type.h +index 282fc81b8eba..af4212eed2bd 100755 +--- a/usr/include/hantro_VC8000E_enc/base_type.h ++++ b/usr/include/hantro_VC8000E_enc/base_type.h +@@ -67,6 +67,9 @@ typedef unsigned int UInt; + #define HANTRO_FALSE 0 + #define HANTRO_TRUE 1 + ++#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L ++/* bool, true and false are keywords. */ ++#else + #ifndef bool + typedef enum + { +@@ -74,6 +77,7 @@ typedef enum + true = HANTRO_TRUE + } bool; + #endif ++#endif + + enum + { +-- +2.42.0 + diff --git a/recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc_1.10.1.bb b/recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc_1.10.1.bb index 2e4718c9d..5aaf92c5f 100644 --- a/recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc_1.10.1.bb +++ b/recipes-bsp/imx-vpu-hantro-vc/imx-vpu-hantro-vc_1.10.1.bb @@ -6,7 +6,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=ca53281cc0caa7e320d4945a896fb837" inherit fsl-eula-unpack -SRC_URI = "${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true" +SRC_URI = " \ + ${FSL_MIRROR}/${BP}-${IMX_SRCREV_ABBREV}.bin;fsl-eula=true \ + file://0001-base_type.h-make-header-compatible-with-c23.patch \ +" IMX_SRCREV_ABBREV = "c0244a1" SRC_URI[sha256sum] = "713ba375f25490727fcc62bab5d5508f74de03204b4c153464b696b652c5c7df" -- cgit v1.2.3-54-g00ecf From f5516c2fcd6217bf83736326e78b14cf64282e3a Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Mon, 12 May 2025 09:37:52 +0200 Subject: linux-imx-headers: make uapi ipu.h, pxp_dma.h compatible with c23 standard In C23 bool, false and true are reserved keywords. Make ipu.h, pxp_dma.h uapi include file compatible with C23 standard. The ipu.h header is i.e. used in the imx-gst1.0-plugin code. If building with GCC 15 the build fails. FAILED: libs/libgstfsl-1.0.so.0.0.0.p/v4l2_core_gstimxv4l2.c.o ...imx-gst1.0-plugin/4.9.2+git/recipe-sysroot/usr/include/imx/linux/ipu.h:32:23: error: 'bool' cannot be defined via 'typedef' 32 | typedef unsigned char bool; That pxp_dma.h is affected was found with grep. A configuration which actually includes the file is yet to be found. Signed-off-by: Max Krummenacher --- ...-mxc-make-uapi-ipu.h-pxp_dma.h-compatible.patch | 54 ++++++++++++++++++++++ recipes-kernel/linux/linux-imx-headers_6.6.bb | 5 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 recipes-kernel/linux/linux-imx-headers/0001-video-fbdev-mxc-make-uapi-ipu.h-pxp_dma.h-compatible.patch diff --git a/recipes-kernel/linux/linux-imx-headers/0001-video-fbdev-mxc-make-uapi-ipu.h-pxp_dma.h-compatible.patch b/recipes-kernel/linux/linux-imx-headers/0001-video-fbdev-mxc-make-uapi-ipu.h-pxp_dma.h-compatible.patch new file mode 100644 index 000000000..1750d6247 --- /dev/null +++ b/recipes-kernel/linux/linux-imx-headers/0001-video-fbdev-mxc-make-uapi-ipu.h-pxp_dma.h-compatible.patch @@ -0,0 +1,54 @@ +From a5bcb18b42cfc0485397da9f48be6a73de86dfac Mon Sep 17 00:00:00 2001 +From: Max Krummenacher +Date: Sat, 10 May 2025 14:21:35 +0200 +Subject: [PATCH] video: fbdev: mxc: make uapi ipu.h, pxp_dma.h compatible with + c23 standard + +In C23 standard bool, false, true are reserved keywords. +Make ipu.h, pxp_dma.h uapi include file compatible with C23 standard. + +Upstream-Status: Pending +Signed-off-by: Max Krummenacher +--- + include/uapi/linux/ipu.h | 4 ++++ + include/uapi/linux/pxp_dma.h | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/include/uapi/linux/ipu.h b/include/uapi/linux/ipu.h +index c92f292bcc9d..a7b60730bbd4 100644 +--- a/include/uapi/linux/ipu.h ++++ b/include/uapi/linux/ipu.h +@@ -29,9 +29,13 @@ + #include + + #ifndef __KERNEL__ ++#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L ++/* bool, true and false are keywords. */ ++#else + #ifndef __cplusplus + typedef unsigned char bool; + #endif ++#endif + #define irqreturn_t int + #define dma_addr_t int + #define uint32_t unsigned int +diff --git a/include/uapi/linux/pxp_dma.h b/include/uapi/linux/pxp_dma.h +index 9b5228504095..e2deff07516d 100644 +--- a/include/uapi/linux/pxp_dma.h ++++ b/include/uapi/linux/pxp_dma.h +@@ -25,8 +25,12 @@ + + #ifndef __KERNEL__ + typedef unsigned long dma_addr_t; ++#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L ++/* bool, true and false are keywords. */ ++#else + typedef unsigned char bool; + #endif ++#endif + + /* PXP Pixel format definitions */ + /* Four-character-code (FOURCC) */ +-- +2.42.0 + diff --git a/recipes-kernel/linux/linux-imx-headers_6.6.bb b/recipes-kernel/linux/linux-imx-headers_6.6.bb index dbf4442c2..41c337c4b 100644 --- a/recipes-kernel/linux/linux-imx-headers_6.6.bb +++ b/recipes-kernel/linux/linux-imx-headers_6.6.bb @@ -7,7 +7,10 @@ New headers are installed in ${includedir}/imx." LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" -SRC_URI = "git://github.com/nxp-imx/linux-imx.git;protocol=https;branch=${SRCBRANCH}" +SRC_URI = " \ + git://github.com/nxp-imx/linux-imx.git;protocol=https;branch=${SRCBRANCH} \ + file://0001-video-fbdev-mxc-make-uapi-ipu.h-pxp_dma.h-compatible.patch \ +" SRCBRANCH = "lf-6.6.y" LOCALVERSION = "-6.6.52-2.2.0" SRCREV = "e0f9e2afd4cff3f02d71891244b4aa5899dfc786" -- cgit v1.2.3-54-g00ecf