[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#744904: KBUILD_OUTPUT setting not respected for (at least) one component of "make deb-pkg"



Package: linux-source-3.2               
Version: 3.2.54-2

When attempting to build a kernel package with "make deb-pkg" and specifying KBUILD_OUTPUT, the build process (attempts to) write to the source directory rather than the build directory, at some point during the make process.

I am attempting to build a clean amd64/x86_64 kernel directly from the Debian-provided source, with only the EXTRAVERSION and KBUILD_OUTPUT variables set directly in the top-level Makefile (and also KBUILD_VERBOSE=1 on the command line for the log below, in an attempt to get more information).  The source resides on a read-only filesystem; the output directory is (obviously) on a read-write filesystem.  The initial steps of "make menuconfig" and "make" succeed without error, but "make deb-pkg" fails when it cannot write a particular file into the read-only filesystem.  The last several lines of output from the make are copied below (-j16 specified to the make command in this instance):

make -f /path/to/source/linux-3.2.54-custom/scripts/Makefile.fwinst obj=firmware __fw_modinst
  /bin/bash /path/to/source/linux-3.2.54-custom/scripts/depmod.sh /sbin/depmod 3.2.54-custom
make[3]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
set -e; : '  CHK     include/linux/version.h'; mkdir -p include/linux/;         (echo \#define LINUX_VERSION_CODE 197174; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) < /path/to/source/linux-3.2.54-custom/Makefile > include/linux/version.h.tmp; if [ -r include/linux/version.h ] && cmp -s include/linux/version.h include/linux/version.h.tmp; then rm -f include/linux/version.h.tmp; else : '  UPD     include/linux/version.h'; mv -f include/linux/version.h.tmp include/linux/version.h; fi
/bin/sh: 1: cannot create include/linux/version.h.tmp: Read-only file system
make[4]: *** [include/linux/version.h] Error 2
make[3]: *** [all] Error 2
make[2]: *** [deb-pkg] Error 2
make[1]: *** [deb-pkg] Error 2
make: *** [sub-make] Error 2

Apparently, somewhere in the kbuild process, KBUILD_OUTPUT is not being passed along correctly, and this particular component of the build process is being run from the source directory (since the "> include/linux/version.h.tmp" portion is whatseems to be failing).

Additional details from my own investigation:

- When I build from a non-read-only filesystem and without KBUILD_OUTPUT specified, the build process completes normally and the kernel package works as expected.

- I inserted a "pwd" command into the "filechk" definition (in scripts/KBuild.include) to verify that the working directory had not been changed in that particular instance where the make failed -- and indeed it had not.

- Kernel version 3.13.7 (again, the version directly from the Debian-provided source) builds cleanly when the source is on a read-only filesystem and KBUILD_OUTPUT is set.  Comparing the build logs, I see the following from the 3.13.7 build (keeping in mind that version.h has been moved between kernel versions):

make -f /path/to/source/test-linux-3.13.7/scripts/Makefile.fwinst obj=firmware __fw_modinst
  /bin/bash /path/to/source/test-linux-3.13.7/scripts/depmod.sh /sbin/depmod 3.13.7-custom ""
make[3]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
make -C /path/to/output_directory/test-linux-3.13.7 \
    KBUILD_SRC=/path/to/source/test-linux-3.13.7 \
    KBUILD_EXTMOD="" -f /path/to/source/test-linux-3.13.7/Makefile \
    headers_check
set -e; : '  CHK     include/generated/uapi/linux/version.h'; mkdir -p include/generated/uapi/linux/;   (echo \#define LINUX_VERSION_CODE 199943; echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) < /path/to/source/test-linux-3.13.7/Makefile > include/generated/uapi/linux/version.h.tmp; if [ -r include/generated/uapi/linux/version.h ] && cmp -s include/generated/uapi/linux/version.h include/generated/uapi/linux/version.h.tmp; then rm -f include/generated/uapi/linux/version.h.tmp; else : '  UPD     include/generated/uapi/linux/version.h'; mv -f include/generated/uapi/linux/version.h.tmp include/generated/uapi/linux/version.h; fi
make -f /path/to/source/test-linux-3.13.7/scripts/Makefile.build obj=scripts/basic
[...continues...]

It appears as if the 3.2.54 version doesn't have that "make -C /path/to/output_directory/ [etc.]" command in the sequence.  However, in my exploration of the comparative source trees for the two kernel versions, I haven't managed to figure out the exact path by which that point is reached, so I can't suggest a fix.

Thanks.

Reply to: