Building ONL for kernel 3 and 5

68 views
Skip to first unread message

Ali Modarresi

unread,
Sep 13, 2020, 12:37:15 AM9/13/20
to opennetworklinux

I have built ONL for kernel 4 and AS5912-54x board and it works perfectly. But when I am trying to build ONL for kernel 3 and 5 I am getting errors of building fan kernel module. Here are the logs:

For kernel 3:

rm -rf lib

ARCH=x86_64 /home/ali/ONL/OpenNetworkLinux/tools/scripts/kmodbuild.sh "onl-kernel-3.16-lts-x86-64-all:amd64" "x86-64-accton-as5912-54x-leds.c x86-64-accton-as5912-54x-psu.c x86-64-accton-as5912-54x-fan.c x86-64-accton-as5912-54x-cpld.c" ""onl/accton/x86-64-accton-as5912-54x"" ""

make[1]: Entering directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-3.16-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-3.16-lts-x86-64-all/mbuilds'

  CC [M]  /tmp/tmp.xT8lZTHtdr/x86-64-accton-as5912-54x-leds.o

  Building modules, stage 2.

  MODPOST 1 modules

WARNING: "as5912_54x_cpld_write" [/tmp/tmp.xT8lZTHtdr/x86-64-accton-as5912-54x-leds.ko] undefined!

WARNING: "as5912_54x_cpld_read" [/tmp/tmp.xT8lZTHtdr/x86-64-accton-as5912-54x-leds.ko] undefined!

  CC      /tmp/tmp.xT8lZTHtdr/x86-64-accton-as5912-54x-leds.mod.o

  LD [M]  /tmp/tmp.xT8lZTHtdr/x86-64-accton-as5912-54x-leds.ko

make[1]: Leaving directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-3.16-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-3.16-lts-x86-64-all/mbuilds'

make[1]: Entering directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-3.16-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-3.16-lts-x86-64-all/mbuilds'

  INSTALL /tmp/tmp.xT8lZTHtdr/x86-64-accton-as5912-54x-leds.ko

  DEPMOD  3.16.76-OpenNetworkLinux

depmod: WARNING: could not open /home/ali/ONL/OpenNetworkLinux/packages/platforms/accton/x86-64/as5912-54x/modules/builds/lib/modules/3.16.76-OpenNetworkLinux/modules.order: No such file or directory

depmod: WARNING: /home/ali/ONL/OpenNetworkLinux/packages/platforms/accton/x86-64/as5912-54x/modules/builds/lib/modules/3.16.76-OpenNetworkLinux/onl/accton/x86-64-accton-as5912-54x/x86-64-accton-as5912-54x-leds.ko needs unknown symbol as5912_54x_cpld_write

depmod: WARNING: /home/ali/ONL/OpenNetworkLinux/packages/platforms/accton/x86-64/as5912-54x/modules/builds/lib/modules/3.16.76-OpenNetworkLinux/onl/accton/x86-64-accton-as5912-54x/x86-64-accton-as5912-54x-leds.ko needs unknown symbol as5912_54x_cpld_read

depmod: WARNING: could not open /home/ali/ONL/OpenNetworkLinux/packages/platforms/accton/x86-64/as5912-54x/modules/builds/lib/modules/3.16.76-OpenNetworkLinux/modules.builtin: No such file or directory

make[1]: Leaving directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-3.16-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-3.16-lts-x86-64-all/mbuilds'

make[1]: Entering directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-3.16-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-3.16-lts-x86-64-all/mbuilds'

  CC [M]  /tmp/tmp.CX9zBfvrdy/x86-64-accton-as5912-54x-psu.o

/tmp/tmp.CX9zBfvrdy/x86-64-accton-as5912-54x-psu.c: In function 'as5912_54x_psu_probe':

/tmp/tmp.CX9zBfvrdy/x86-64-accton-as5912-54x-psu.c:157:5: error: implicit declaration of function 'hwmon_device_register_with_info' [-Werror=implicit-function-declaration]

     data->hwmon_dev = hwmon_device_register_with_info(&client->dev, "as5912_54x_psu",

     ^

/tmp/tmp.CX9zBfvrdy/x86-64-accton-as5912-54x-psu.c:157:21: warning: assignment makes pointer from integer without a cast

     data->hwmon_dev = hwmon_device_register_with_info(&client->dev, "as5912_54x_psu",

                     ^

cc1: some warnings being treated as errors

scripts/Makefile.build:263: recipe for target '/tmp/tmp.CX9zBfvrdy/x86-64-accton-as5912-54x-psu.o' failed

make[2]: *** [/tmp/tmp.CX9zBfvrdy/x86-64-accton-as5912-54x-psu.o] Error 1

Makefile:1352: recipe for target '_module_/tmp/tmp.CX9zBfvrdy' failed

make[1]: *** [_module_/tmp/tmp.CX9zBfvrdy] Error 2

make[1]: Leaving directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-3.16-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-3.16-lts-x86-64-all/mbuilds'

/home/ali/ONL/OpenNetworkLinux/make/kmodule.mk:28: recipe for target 'modules' failed

make: *** [modules] Error 2

 

 

 

 

 

For kernel 5:

 

rm -rf lib

ARCH=x86_64 /home/ali/ONL/OpenNetworkLinux/tools/scripts/kmodbuild.sh "onl-kernel-5.4-lts-x86-64-all:amd64" "x86-64-accton-as5912-54x-leds.c x86-64-accton-as5912-54x-psu.c x86-64-accton-as5912-54x-fan.c x86-64-accton-as5912-54x-cpld.c" ""onl/accton/x86-64-accton-as5912-54x"" ""

make[1]: Entering directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-5.4-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-5.4-lts-x86-64-all/mbuilds'

  CC [M]  /tmp/tmp.IUiiLLLnDc/x86-64-accton-as5912-54x-leds.o

  Building modules, stage 2.

  MODPOST 1 modules

ERROR: "as5912_54x_cpld_write" [/tmp/tmp.IUiiLLLnDc/x86-64-accton-as5912-54x-leds.ko] undefined!

ERROR: "as5912_54x_cpld_read" [/tmp/tmp.IUiiLLLnDc/x86-64-accton-as5912-54x-leds.ko] undefined!

scripts/Makefile.modpost:93: recipe for target '__modpost' failed

make[2]: *** [__modpost] Error 1

Makefile:1604: recipe for target 'modules' failed

make[1]: *** [modules] Error 2

make[1]: Leaving directory '/home/ali/ONL/OpenNetworkLinux/REPO/jessie/extracts/onl-kernel-5.4-lts-x86-64-all_amd64/usr/share/onl/packages/amd64/onl-kernel-5.4-lts-x86-64-all/mbuilds'

/home/ali/ONL/OpenNetworkLinux/make/kmodule

 

 

 

The question is if ONL supports kernel 3 and 5, why I am getting these errors?  And if ONL is not supporting kernel 3 and 5 why they are in the ONL github repository?

CommitThis

unread,
Sep 13, 2020, 5:26:33 AM9/13/20
to opennetworklinux
Hi Ali,

ONL supports kernels 3 and 5 fine, it's just that the platform doesn't -- the kernel module that ships with the as5912-54x is only set up for kernel 4.14.
How are you building this or have you changed anything? I'm assuming you've altered the platform config to change the kernel?


Ali Modarresi

unread,
Sep 14, 2020, 1:30:12 AM9/14/20
to opennetworklinux
Hi
Thanks for the answer.
I am working with as5912-54x and my software depends on kernel 3. Is there any way that I can build these kernel modules for kernel 3 and even kernel 5?
I have changed Makefile of kernel modules in order to build them for kernel 3 and 5.

CommitThis

unread,
Sep 14, 2020, 7:23:57 AM9/14/20
to opennetworklinux

I'm no Linux kernel expert, but, it appears as though some of the symbols used by the kernel module (kernel 4) don't exist in kernel 3:

Compare https://elixir.bootlin.com/linux/v4.14/source/include/linux/hwmon.h
With https://elixir.bootlin.com/linux/v3.16/source/include/linux/hwmon.h

With the offending symbol being exactly the ones the build is complaining about:

/tmp/tmp.LYpr33MZmU/x86-64-accton-as5912-54x-psu.c:157:23: error: implicit declaration of function 'hwmon_device_register_with_info' [-Werror=implicit-function-declaration]
     data->hwmon_dev = hwmon_device_register_with_info(&client->dev, "as5912_54x_psu",

Its "implicitly declared" because it hasn't been declared anywhere else (it doesn't exist). 

As far as building for kernel 5, I did have a go at building the platform (ONLPv1, kernel 5.4, debian stretch), saw the same error as you did and couldn't see anything obvious that would fix it. It is possible there are more differences in the kernel sources that could cause this. I think kernel 5 support was only added recently so not entirely sure how well supported it is.

Ali Modarresi

unread,
Sep 16, 2020, 12:19:47 AM9/16/20
to opennetworklinux
So if I am right by default there is no fan kernel module in kernel 3 and 5 for AS5912. If we want to have that, we have to do something with the code. Right?
Do you have another solution for this problem?

CommitThis

unread,
Sep 18, 2020, 6:28:33 AM9/18/20
to opennetworklinux

I am not sure what you would have to do with the code, perhaps you could ask Accton? I would be grasping at straws for a solution, sorry.
Reply all
Reply to author
Forward
0 new messages