I'm compiling third-party kernel modules. Their build system goes to /usr/src/linux-headers-[version] (of a custom kernel chroot) and runs make from there.

I want to find out, which files - sources and headers - have been used for the compilation, and which have not. Standard scripts/Makefile.build creates *.d files for each compiled source, and I'd like to use that... but these files are deleted after short processing. (That is rule_cc_o_c definition in Makefile.build.)

What could be a way to collect these files with minimal modifications to the standard build system?

1 Answer 1


Try using libtrashcan. After compiling it and installing, preload the library to your process.

For example, the following will create a test file and then try to remove it, but because of libtrashcan the unlink system call will be replaced by a move, so the file will end up in ~/Trash:

export LD_PRELOAD=/usr/local/lib/libtrash.so.3.3
touch testfile
rm testfile

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .