Closed mad-jsanjuan closed 1 year ago
I tried to repdroduce this issue on Debian 10 and got the following:
The linux headers package is also split into two directories.
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ ls -al /usr/src/
total 16
drwxr-xr-x 4 root root 4096 Nov 10 11:56 .
drwxr-xr-x 14 root root 4096 Nov 10 11:15 ..
lrwxrwxrwx 1 root root 38 Nov 10 11:56 linux -> /usr/src/linux-headers-4.19.0-22-amd64
drwxr-xr-x 4 root root 4096 Nov 10 11:21 linux-headers-4.19.0-22-amd64
drwxr-xr-x 4 root root 4096 Nov 10 12:28 linux-headers-4.19.0-22-common
lrwxrwxrwx 1 root root 24 Sep 29 02:47 linux-kbuild-4.19 -> ../lib/linux-kbuild-4.19
The .kernelsettings
created gets some values but these are not the ones that should have been extracted from the kernel's Makefile. It seems it reads CC and LD from the make default environment:
$ sudo make --trace -C /usr/src/linux-headers-4.19.0-22-amd64 --no-print-directory -f /opt/menlinux/BUILD/MDIS/TPL/kernelsettings.mak KERNEL_SETTINGS_FILE=/tmp/.kernelsettings
KERNELVERSION =
/opt/menlinux/BUILD/MDIS/TPL/kernelsettings.mak:40: target 'getsettings_for_mdis' does not exist
echo "KERNEL_CC := cc" > /tmp/.kernelsettings
echo "KERNEL_LD := ld" >> /tmp/.kernelsettings
echo "KERNEL_CFLAGS := " >> /tmp/.kernelsettings
echo "KERNEL_LDFLAGS := " >> /tmp/.kernelsettings
echo "KERNEL_ARCH := " >> /tmp/.kernelsettings
$ cat /usr/src/linux-headers-4.19.0-22-common/Makefile | grep ^CC
CC = clang
CC = $(CROSS_COMPILE)gcc
CC_VERSION_TEXT = $(shell $(CC) --version | head -n 1)
As shown above, KERNEL_CC should have got either clang
or gcc
but not cc
. However, when inspecting make's environment we get CC = cc
:
$ make -p | grep ^CC
make: *** No targets specified and no makefile found. Stop.
CC = cc
Another note from the investigation. We could have Debian 11 work in the same way it does in Debian 10 by letting make get environment variables with -e
option. This would not be the initial intention of .kernelsettings
as it should read those from the Kernel's Makefile but may help debugging this issue.
From a Debian 11 run:
$ sudo make -e -C /usr/src/linux-headers-5.10.0-19-amd64 --no-print-directory -f /media/tests/MDIS_Test/MDIS_Compilation/13MD05-90_Install/BUILD/MDIS/TPL/kernelsettings.mak KERNEL_SETTINGS_FILE=.kernelsettings
echo "KERNEL_CC := cc" > .kernelsettings
echo "KERNEL_LD := ld" >> .kernelsettings
echo "KERNEL_CFLAGS := " >> .kernelsettings
echo "KERNEL_LDFLAGS := " >> .kernelsettings
echo "KERNEL_ARCH := " >> .kernelsettings
see also #249
The kernel headers in debian 11 are split into two directories:
/lib/modules/$(uname -r)/build/Makefile
Make variables coming from the included
/usr/src/linux-headers-5.10.0-19-common/Makefile
do not get exported to the upper levelkernelsettings.mak
so the .kernelsettings file gets empty values.This is a summary on how to reproduce this issue:
Here is an expample on how this works in Ubuntu: