Error compiling kernel

Heya,
I’ve got a problem compiling a new kernel with the suggested docker tooling. I’m compiling from starfive-tech/linux and get the following error:

In file included from arch/riscv/kernel/signal.c:16:0:
arch/riscv/kernel/signal.c: In function 'setup_rt_frame':
./arch/riscv/include/asm/vdso.h:31:42: error: '__vdso_rt_sigreturn_offset' undeclared (first use in this function); did you mean '__user_rt_sigreturn'?
  (void __user *)((unsigned long)(base) + __vdso_##name##_offset)
                                          ^
arch/riscv/kernel/signal.c:197:28: note: in expansion of macro 'VDSO_SYMBOL'
  regs->ra = (unsigned long)VDSO_SYMBOL(
                            ^~~~~~~~~~~
./arch/riscv/include/asm/vdso.h:31:42: note: each undeclared identifier is reported only once for each function it appears in
  (void __user *)((unsigned long)(base) + __vdso_##name##_offset)
                                          ^
arch/riscv/kernel/signal.c:197:28: note: in expansion of macro 'VDSO_SYMBOL'
  regs->ra = (unsigned long)VDSO_SYMBOL(
                            ^~~~~~~~~~~
scripts/Makefile.build:277: recipe for target 'arch/riscv/kernel/signal.o' failed
make[2]: *** [arch/riscv/kernel/signal.o] Error 1
scripts/Makefile.build:540: recipe for target 'arch/riscv/kernel' failed
make[1]: *** [arch/riscv/kernel] Error 2
Makefile:1868: recipe for target 'arch/riscv' failed
make: *** [arch/riscv] Error 2

Hi,
I tried building it now just to make sure, and it still works via the build_kernel.sh script, is there anything you changed ?

1 Like

When I use the vanilla build_kernel.sh script it just gives:

sh: 1: ./scripts/cc-version.sh: Permission denied
scripts/Kconfig.include:44: Sorry, this compiler is not supported.
scripts/kconfig/Makefile:94: recipe for target 'starfive_visionfive2_defconfig' failed
make[1]: *** [starfive_visionfive2_defconfig] Error 1
Makefile:616: recipe for target 'starfive_visionfive2_defconfig' failed
make: *** [starfive_visionfive2_defconfig] Error 2
Error: exit status 2

There’s just a lot of stuff in linux/scripts that is not chmod +x’ed.

The I do:

chmod +x mnt/linux/scripts/remove-stale-files
chmod +x mnt/linux/scripts/*.sh

And run “shell.sh builld_kernel.sh” and I get the above error.

I’ve rebuilt the container, but the behavior is the same.

I’m not sure how this happens as I’m unable to reproduce it.
Do note that the build_*.sh scripts removes the cloned directory before running git clone, to make sure it is at a predictable state. This means that any changes you make between runs will be reverted. If you want to make changes, either comment out some of those rows in the script or run some of the manually, or add the modifications inside the script.

Can you start the container first, then launch the build script ?
./shell.sh and then inside the container do build_kernel.sh
You’ll know that you’re inside the container when the prompt changes to something like this root@d440dc6ff673:/mnt#

Nope, according to visionfive2-docker/build_kernel.sh at main · kng/visionfive2-docker · GitHub it doesn’t remove the old checkout. Git will just display an error and the script will continue.

It’s the same error from inside the container.

Try these steps.

when you build the container, the inside of it has a mnt directory that’s empty.
when you build the different components, it fetches the sources for each, then builds it somewhere within that mnt directory.

In my experience with that docker/podman, after running many times, it never fails on me.

You must skipped a step somewhere.

The reason I showed this to you wasn’t to make you build a bonding module. It’s to show you a way of consistently accessing/changing something using make menuconfig, then rebuilding the kernel or modules in a way that doesn’t error out or veer away to far to error out. I hope it helps.