[vbox-dev] Fix for Kernel 5.x

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at vt.edu
Sun Jun 2 15:46:47 UTC 2019

On Sun, 02 Jun 2019 08:48:15 +0100, S?rgio Basto said:

> 'SUBDIRS' will be removed after Linux 5.3
> Please use 'M=' or 'KBUILD_EXTMOD' instead

> -  ifeq ($(shell if grep '"[432]\.' $(KERN_DIR)/include/linux/version.h > /dev/null 2>&1; then echo yes; fi),yes)
> +  ifeq ($(shell if grep '"[98765432]\.' $(KERN_DIR)/include/linux/version.h /dev/null 2>&1; then echo yes; fi),yes)

I submitted a more correct patch back in March, which did the right thing
and changed all the SUBDIRS= to M=, though I admit I didn't go near this
script (I only adressed the actual kernel module tree that ends up in

I admit not even being sure what this code used to be trying to do, or why
this patch seems to work for you.  Hint:   It's looking for "any number other than a 1,
followed by a period".   At least in my kernel tree, what I have is:

[/usr/src/linux-next] cat include/generated/uapi/linux/version.h 
#define LINUX_VERSION_CODE 328192
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

Which means that neither [432]\. or [2-9]\. is ever going to match. What's
in the version.h file your script is trying to work with?

I'm not sure what version.h this script is looking at, but unless there's a
'1.' and no other digits followed by a period anywhere in the file, it's going
to find it.

Hint:  (a) your patch will mysteriously break if we ever get to an 11.0
kernel, and (b) It doesn't DTRT in distinguishing between a 2.4.X and a 2.6.X
kernel, which is what actually matters for SUBDIRS/M.

M= has been supported for forever.

commit 0126be38d98815d25d9ec4573541ed4315bf6a88
Author: Masahiro Yamada <yamada.masahiro at socionext.com>
Date:   Wed Nov 21 00:04:18 2018 +0900

    kbuild: announce removal of SUBDIRS if used
    SUBDIRS has been kept as a backward compatibility since
    commit ("[PATCH] kbuild: external module support") in 2002.

In other words, since the 2.6.0 kernel.  If somebody is trying to build
VirtualBox on a 2.4 or earlier kernel, this is the *least* of their problems.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20190602/9af2f532/attachment.sig>

More information about the vbox-dev mailing list