sophgo / linux-riscv

Linux kernel stable tree
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
Other
23 stars 47 forks source link

Linker error on mcu.c with some specific config #104

Open clandmeter opened 6 months ago

clandmeter commented 6 months ago

After applying sophgo_mango_normal_defconfig on top of our alpine linux edge kernel im receiving the following linker error. It seems to happen only on some specific config cases but im not sure which ones. This is based on commit: beafa8820ba0ea1e8aab84c4ebb0c907f828c963 With the following config: https://sprunge.us/PP7uUK

>>> linux-sophgo: Build kernel
  SYNC    include/config/auto.conf
  GEN     Makefile
  GEN     Makefile
  CALL    /home/clandmeter/aports/testing/linux-sophgo/src/linux-riscv-beafa8820ba0ea1e8aab84c4ebb0c907f828c963/scripts/checksyscalls.sh
  UPD     init/utsversion-tmp.h
  CC      init/version.o
  AR      init/built-in.a
  AR      built-in.a
  AR      vmlinux.a
  LD      vmlinux.o
  OBJCOPY modules.builtin.modinfo
  GEN     modules.builtin
  MODPOST Module.symvers
  UPD     include/generated/utsversion.h
  CC      init/version-timestamp.o
  LD      .tmp_vmlinux.kallsyms1
ld: drivers/soc/sophgo/umcu/mcu.o: in function `.L0 ':
mcu.c:(.text+0xf3e): undefined reference to `devm_hwmon_device_register_with_info'
make[1]: *** [/home/clandmeter/aports/testing/linux-sophgo/src/linux-riscv-beafa8820ba0ea1e8aab84c4ebb0c907f828c963/scripts/Makefile.vmlinux:34: vmlinux] Error 1
make: *** [/home/clandmeter/aports/testing/linux-sophgo/src/linux-riscv-beafa8820ba0ea1e8aab84c4ebb0c907f828c963/Makefile:1255: vmlinux] Error 2
make: *** Waiting for unfinished jobs....
>>> ERROR: linux-sophgo: build failed
clandmeter commented 6 months ago

Looks like CONFIG_HWMON cannot be build as module. Changing it to Y fixes the linker issue.

skeuchel commented 6 months ago

I ran into something similar with CONFIG_I2C. Essentially umcu/mcu.o is always compiled in, so its dependencies also need to be compiled in and cannot be built as modules.

skeuchel commented 6 months ago

About the commit https://github.com/sophgo/linux-riscv/commit/beafa8820ba0ea1e8aab84c4ebb0c907f828c963 you mentioned. I did not find that kernel to be very stable. Under load, it would just randomly kill processes like sshd or nix. I had the impression it was related to scheduling or numa balancing. The commit https://github.com/sophgo/linux-riscv/commit/a8d746b9fd5376ff18fb5e87e1939c3a757f1093 from the master branch works much better for me. The only thing that does not seem to work with that branch is access to the onboard flash.

clandmeter commented 6 months ago

The dev branch is more stable IIUC, this is also where they base the firmware on in CI. The master branch is based on 6.8, not sure it has the same amount of changes and tests (docs would be appreciated). I have tried master but it gave me issues which cpu's not coming online, but that could have been a config issue. FWIW, for me https://github.com/sophgo/linux-riscv/commit/beafa8820ba0ea1e8aab84c4ebb0c907f828c963 works okish, although the nvme gives problems and sometimes stalles, I think upgarding the nvme could make a difference.