Cross-building Kernel packages for linux-headers adds x86 binaries

Carlos Eduardo de Paula me at
Mon Apr 12 15:11:14 BST 2021

I've been cross-building .deb Kernel packages and recently tried to
build an external module using dkms

I saw an error that the build process complained about fixdep and
later modpost. When I looked into it they were x86 binaries and not
riscv ones. I believe the cross-build process doesn't add these as
target binaries.

My build command is: make CROSS_COMPILE=riscv64-unknown-linux-gnu-
ARCH=riscv INSTALL_MOD_STRIP=1 -j`nproc` bindeb-pkg

❯ file scripts/basic/fixdep
scripts/basic/fixdep: ELF 64-bit LSB pie executable, x86-64, version 1
(SYSV), dynamically linked, interpreter /lib64/,
BuildID[sha1]=fc5b93fa068bb02ca6fa1f1e2eeb99fa74a19c84, for GNU/Linux
3.2.0, not stripped

Then I tried to rebuild them using "sudo make scripts" in
/usr/src/linux-headers-$(uname -r) and got:

❯ sudo make scripts
  SYNC    include/config/auto.conf.cmd
scripts/kconfig/conf: 30: Syntax error: "(" unexpected
make[2]: *** [scripts/kconfig/Makefile:71: syncconfig] Error 2
make[1]: *** [Makefile:602: syncconfig] Error 2
make: *** [Makefile:710: include/config/auto.conf.cmd] Error 2

In the end I've cloned the full Kernel tree and built the scripts
manually, replacing them in the
/usr/src/linux-headers-$(uname -r). It worked.

Any tips on having the correct arch binaries in the linux-headers
package or what could be wrong in the rebuild "make scripts" command?

Carlos Eduardo de Paula
me at

More information about the linux-riscv mailing list