Skip to content

DKMS build error using manually built kernel (ARM64 SBC) #100

@tecandrew

Description

@tecandrew

Issue initially came up when attempting to build and DKMS complained about not being able to find it's kernel headers.

andrest@firefly:~/workspace/xtrx/images/sources/build$ sudo /usr/sbin/dkms build -m xtrx -v "0.0.1-2"
Error! Your kernel headers for kernel 4.4.194-59119-g968ba5005831 cannot be found.
Please install the linux-headers-4.4.194-59119-g968ba5005831 package,
or use the --kernelsourcedir option to tell DKMS where it's located

I found and installed the headers, and though the build step proceeds it encounters an odd error.

andrest@firefly:~/workspace/xtrx/images/sources/build$ sudo /usr/sbin/dkms build -m xtrx -v "0.0.1-2" --kernelsourcedir /usr/src/linux-headers-4.4.194-g968ba5005831

Preparing kernel 4.4.194-59119-g968ba5005831 for module build:
(This is not compiling a kernel, just preparing kernel symbols)
Storing current .config to be restored when complete
Running Generic preparation routine
make mrproper......(bad exit status: 2)
Warning: using /usr/src/linux-headers-4.4.194-g968ba5005831/.config
(I hope this is the correct config for this kernel)
make oldconfig...
make prepare-all......(bad exit status: 2)

Building module:
cleaning build area....
make -j6 KERNELRELEASE=4.4.194-59119-g968ba5005831 -C /usr/src/linux-headers-4.4.194-g968ba5005831 M=/var/lib/dkms/xtrx/0.0.1-2/build....(bad exit status: 2)
ERROR (dkms apport): binary package for xtrx: 0.0.1-2 not found
Error! Bad return status for module build on kernel: 4.4.194-59119-g968ba5005831 (aarch64)
Consult /var/lib/dkms/xtrx/0.0.1-2/build/make.log for more information.

Contents from the make.log

DKMS make.log for xtrx-0.0.1-2 for kernel 4.4.194-59119-g968ba5005831 (aarch64)
Tue Mar  2 23:47:05 UTC 2021
make: Entering directory '/usr/src/linux-headers-4.4.194-g968ba5005831'
  LD      /var/lib/dkms/xtrx/0.0.1-2/build/built-in.o
  CC [M]  /var/lib/dkms/xtrx/0.0.1-2/build/xtrx.o
/bin/sh: 1: ./scripts/recordmcount: Exec format error
scripts/Makefile.build:283: recipe for target '/var/lib/dkms/xtrx/0.0.1-2/build/xtrx.o' failed
make[1]: *** [/var/lib/dkms/xtrx/0.0.1-2/build/xtrx.o] Error 2
make[1]: *** Deleting file '/var/lib/dkms/xtrx/0.0.1-2/build/xtrx.o'
Makefile:1479: recipe for target '_module_/var/lib/dkms/xtrx/0.0.1-2/build' failed
make: *** [_module_/var/lib/dkms/xtrx/0.0.1-2/build] Error 2
make: Leaving directory '/usr/src/linux-headers-4.4.194-g968ba5005831'

I'm using an ARM64 SBC (Firefly-RK3399) so it seems I have to rebuild the necessary files from source, including this.

Result from manually building the driver:

andrest@firefly:~/workspace/xtrx/images/sources/xtrx_linux_pcie_drv$ make
make -C /lib/modules/4.4.194-59119-g968ba5005831/build M=/home/andrest/workspace/xtrx/images/sources/xtrx_linux_pcie_drv modules
make[1]: *** /lib/modules/4.4.194-59119-g968ba5005831/build: No such file or directory.  Stop.
Makefile:10: recipe for target 'modules' failed
make: *** [modules] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions