Freescale / meta-freescale

Layer containing NXP hardware support metadata
Other
172 stars 255 forks source link

kernel-module-imx-gpu-viv compile error with Yocto Zeus #192

Closed dv1 closed 4 years ago

dv1 commented 4 years ago

The same problem from https://github.com/Freescale/meta-freescale/issues/136 also appears when trying to build kernel-module-imx-gpu-viv Yocto Zeus:

| In file included from poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_linux.h:61,
|                  from poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_driver.c:61:
| poky/build/tmp/work-shared/imx6qdlsabresd/kernel-source/include/linux/module.h:132:6: error: 'init_module' specifies less restrictive attribute than its target 'gpu_init': 'cold' [-Werror=missing-attributes]
|   132 |  int init_module(void) __attribute__((alias(#initfn)));
|       |      ^~~~~~~~~~~
| poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_driver.c:1330:1: note: in expansion of macro 'module_init'
|  1330 | module_init(gpu_init);
|       | ^~~~~~~~~~~
| poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_driver.c:1287:19: note: 'init_module' target declared here
|  1287 | static int __init gpu_init(void)
|       |                   ^~~~~~~~
| In file included from poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_linux.h:61,
|                  from poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_driver.c:61:
| poky/build/tmp/work-shared/imx6qdlsabresd/kernel-source/include/linux/module.h:138:7: error: 'cleanup_module' specifies less restrictive attribute than its target 'gpu_exit': 'cold' [-Werror=missing-attributes]
|   138 |  void cleanup_module(void) __attribute__((alias(#exitfn)));
|       |       ^~~~~~~~~~~~~~
| poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_driver.c:1331:1: note: in expansion of macro 'module_exit'
|  1331 | module_exit(gpu_exit);
|       | ^~~~~~~~~~~
| poky/build/tmp/work/imx6qdlsabresd-poky-linux-gnueabi/kernel-module-imx-gpu-viv/6.2.4.p4.0-r0/git/src/hal/os/linux/kernel/gc_hal_kernel_driver.c:1318:20: note: 'cleanup_module' target declared here
|  1318 | static void __exit gpu_exit(void)
|       |                    ^~~~~~~~
| cc1: all warnings being treated as errors

I used this workaround:

diff --git a/hal/os/linux/kernel/gc_hal_kernel_driver.c b/hal/os/linux/kernel/gc_hal_kernel_driver.c
index 87f26e721773..52f829bc477e 100644
--- a/hal/os/linux/kernel/gc_hal_kernel_driver.c
+++ b/hal/os/linux/kernel/gc_hal_kernel_driver.c
@@ -1284,7 +1284,7 @@ static struct platform_driver gpu_driver = {
};
#endif /* USE_LINUX_PCIE */

-static int __init gpu_init(void)
+static int gpu_init(void)
{
    int ret = 0;

@@ -1315,7 +1315,7 @@ static int __init gpu_init(void)
    return 0;
}

-static void __exit gpu_exit(void)
+static void gpu_exit(void)
{
#if USE_LINUX_PCIE
    pci_unregister_driver(&gpu_driver);

Machine is imx6qdlsabresd.

otavio commented 4 years ago

@thochstein mind to take a look?

thochstein commented 4 years ago

Will do.

thochstein commented 4 years ago

Sorry, I got pulled away from this. I assume you are having a problem with linux-fslc-imx-4.9-1.0.x? I'm working on adapting the patches there.

thochstein commented 4 years ago

Note @otavio , the issue was reported against zeus. Will you handle that? Or do you want me to cherry pick?

zandrey commented 4 years ago

Hello guys!

Those patches are actually came into v4.4.188: fe5844365ec6c4d61838f289926f4d55da94d2fb and 2c34c215c1028f971af7cf8189c4f6237afdb90b

@thochstein I can make a PR with those patches instead - would be easier to track when linux-fslc-imx_4.9-1.0.x gets bumped up to 4.4.188. If you don't mind then I can do it.

-- andrey

zandrey commented 4 years ago

Hello guys!

Those patches are actually came into v4.4.188: fe5844365ec6c4d61838f289926f4d55da94d2fb and 2c34c215c1028f971af7cf8189c4f6237afdb90b

@thochstein I can make a PR with those patches instead - would be easier to track when linux-fslc-imx_4.9-1.0.x gets bumped up to 4.4.188. If you don't mind then I can do it.

-- andrey

For sure I meant 4.9.188! Links pointing to correct patches.

thochstein commented 4 years ago

Sounds good to me. Thanks @zandrey!