4

I am trying to build the latest Linux kernel (GitHub) using a Oracel VM and a 18.04.1-Ubuntu image.

I installed the need packages and probably even more. Here is a part of the packages I installed:

sudo apt-get update
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc bison flex libelf-def kernel-package

The full list can be found here.

I ran the following commands in the linux folder after cloning the repository from GitHub.

$ cp /boot/config-$(uname -r) .config

$ make menuconfig
scripts/kconfig/mconf  Kconfig
.config:1118:warning: symbol value 'm' invalid for NF_CT_PROTO_GRE
.config:1923:warning: symbol value 'm' invalid for NET_DEVLINK
.config:7865:warning: symbol value 'm' invalid for ASHMEM
.config:8724:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
.config:8725:warning: symbol value 'm' invalid for ANDROID_BINDERFS


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

I save and exited menuconfig. And finally make leads to the following error.

$ make -j2
Makefile:608: include/config/auto.conf: No such file or directory
Makefile:660: include/config/auto.conf.cmd: No such file or directory
  HOSTCC  scripts/kconfig/conf.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --syncconfig Kconfig

*** Error during sync of the configuration.

scripts/kconfig/Makefile:73: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 1
Makefile:562: recipe for target 'syncconfig' failed
make[1]: *** [syncconfig] Error 2
Makefile:678: recipe for target 'include/config/auto.conf.cmd' failed
make: *** [include/config/auto.conf.cmd] Error 2
make: *** Deleting file 'include/config/auto.conf.cmd'

Looks like make is expecting some additional configuration files include/config/auto.conf. Does anyone have a clue for me.

Thanks!

Nawin
  • 63
  • 1
  • 7
  • `git clean -xdf; export ARCH=...; cp /boot/config-$(uname -r) .config; make olddefconfig; make -j2` – 0andriy Sep 03 '19 at 20:18
  • Nope, not working `$ make olddefconfig Makefile:555: arch/.../Makefile: No such file or directory make: *** No rule to make target 'arch/.../Makefile'. Stop.` – Nawin Sep 04 '19 at 18:36
  • Of course. Instead of `...` you **have to** apply the architecture you want to build for. – 0andriy Sep 04 '19 at 19:54
  • So I tried the described process with `export ARCH=x86_64` which still was leading to `Makefile:608: include/config/auto.conf: No such file or directory scripts/kconfig/conf --syncconfig Kconfig *** Error during sync of the configuration. `. – Nawin Sep 05 '19 at 17:59
  • `export ARCH=ia64` also did not work, but I already get errors during `make olddefconfig`. – Nawin Sep 05 '19 at 18:01
  • `$ make olddefconfig ./arch/ia64/scripts/check-segrel.S: Assembler messages: ./arch/ia64/scripts/check-segrel.S:2: Error: unknown pseudo-op: `.rodata' ./arch/ia64/scripts/check-segrel.S:3: Error: no such instruction: `data4 @segrel(start)' objdump: '/tmp/out8220': No such file objdump: section '.rodata' mentioned in a -j option, but not found in any input file ./arch/ia64/scripts/toolchain-flags: 20: [: !=: unexpected operator ./arch/ia64/scripts/check-text-align.S: Assembler messages:` – Nawin Sep 05 '19 at 18:01

1 Answers1

4

Trying to compile kernel 5.6.3 as non-root, I ran into this exact problem. Running the suggestion from Oandiy's comment

git clean -xdf

revealed that I had files in my source tree that were owned by root and could not be deleted. Looking in my history I found,

sudo make localmodconfig  # DO NOT DO THIS

which had installed files, as root, in include/config/* and include/generated/autoconf.h.

To see if you have the same problem, run

sudo find . -uid 0

or just look at the error messages of git clean -xdf (there shouldn't be any).

After deleting all files and directories owned by root, I recovered from this deadlock with:

unset ARCH
cp .config ../config.backup  # If you still have this.
git clean -xdf               # No errors (this also deletes .config)
cp ../config.backup .config  # Or generate a new one *).
make olddefconfig            # Printed at the end: 'No change to .config'

Note that I needed to clear ARCH from my environment.

After this I went on as usual,

VERSION=5.6.3                # I have checked out tag v5.6.3 **)
FLAVOUR=lowlatlocxhci        # Or whatever you want to call your kernel.
make -j8 deb-pkg LOCALVERSION=-$FLAVOUR
sudo dpkg -i ../linux-headers-$VERSION-${FLAVOUR}_$VERSION-$FLAVOUR-1_amd64.deb ../linux-image-$VERSION-${FLAVOUR}_$VERSION-${FLAVOUR}-1_amd64.deb

The last command fails to compile virtualbox kernel modules at the moment, but I don't care about those, and those errors can be ignored (as long as you don't use virtual box).

*) The .config used was prepared by booting to a kernel with everything (ie, a dist. kernel), copying its config from /boot to the source tree and running make localmodconfig after making sure all kernel modules that I needed where loaded (by running those applications that cause such modules to be loaded). And finally running make menuconfig to turn off CONFIG_DEBUG_INFO in this kernel and to turn a few things that are normally built into the kernel into modules as well (which I needed for some reason).

**) My git tree has been prepared with:

VERSION=5.6.3
FLAVOUR=lowlatlocxhci
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-$VERSION-$FLAVOUR-$VERSION-$FLAVOUR
cd linux-$VERSION-$FLAVOUR-$VERSION-$FLAVOUR
git checkout -b test_$FLAVOUR v$VERSION
# Make manual changes here, and commit as usual.
Carlo Wood
  • 5,648
  • 2
  • 35
  • 47