From patchwork Mon Feb 7 11:52:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 12737208 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5C33C433F5 for ; Mon, 7 Feb 2022 13:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244281AbiBGNIo (ORCPT ); Mon, 7 Feb 2022 08:08:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1392158AbiBGMIf (ORCPT ); Mon, 7 Feb 2022 07:08:35 -0500 X-Greylist: delayed 510 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 07 Feb 2022 04:00:59 PST Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 037E5C014D38 for ; Mon, 7 Feb 2022 04:00:58 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id B875B32023EF; Mon, 7 Feb 2022 06:52:27 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 07 Feb 2022 06:52:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm1; bh=KG+wo0OK3gsN135WwnZ265e0wRbTaDjWBHKrYM2Gl38=; b=vAokf 8DlHBPOaqdljZVqelGm607Bxyx93JfPivu+WG7kAO36ZTo+iZWIF1Y04wy6mEPxi BmQH1zjgnVFv8s0jSnoJONYEpwZJmoC25vjG4OB13g72BqCnbSpq62gApznZSYc6 o3okCre83rrLFGzoypY+yQHa74vyUi2zI1I5HLPLHUlyvZbrLCynaoZurtSuIylx kdDr62b9m20wMDstnbHW2J0AGKA4tuFsqYvdjBY+fK8RmOwKq0kfyW+CHu3mZ7zX R8T55RFhYlUArjkRodLjQqbvsej1MnQkak07IO6sfaSIPEMZGwwod73xy/eTnxxX xtI/xON9PJ02dqdVA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=KG+wo0OK3gsN135WwnZ265e0wRbTa DjWBHKrYM2Gl38=; b=Fyg9ZKvPmJc6gnLfknb0ycxPWgWsd3dnd57mW1WYWWLBw zQsA+0/cEu+U3tCQ6cv+Pcme6UuDagzJk267OiFqWmxvhDqGsi9k9rs3eJCUZibD FibqNEUlfRQj9Cw/dYJumDi/y4eyZsfvqONm+GpXr6MdYZYwaCbv0J6eOFAjQo0s Ez+tPVwCVHUQ2g5ZUmUM/AtzoaALlAx/7tXj2SYgKcCVvMbFvq6e1cV2oZsh0OYV q9eRWbl5bStLm3IO2sxMU5qO6us/9ltM6w9JY3G22xUwX5YXDwP5Ev0YwIKEzOWP KlgsADRiyvNjcnkaAUjD2XuHlBkg/iQ/038k8ApdA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrheehgdefudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd dtnecuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhl hihgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepkeduffeikeejleduudfhffeije fhhfejhedtfeefjeejgfefjeevfffgueeguddvnecuffhomhgrihhnpehkvghrnhgvlhdr ohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Feb 2022 06:52:26 -0500 (EST) From: Jiaxun Yang To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, linux-kbuild@vger.kernel.org, Jiaxun Yang Subject: [RFC PATCH for-stable] kbuild: Define LINUX_VERSION_{MAJOR,PATCHLEVEL,SUBLEVEL} Date: Mon, 7 Feb 2022 11:52:12 +0000 Message-Id: <20220207115212.217744-1-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Since the SUBLEVEL overflowed LINUX_VERSION, we have no reliable way to tell the current SUBLEVEL in source code. This brings significant difficulties for backport works to deal with changes in stable releases. Define those macros so we can continue to get proper SUBLEVEL in source without breaking stable ABI by refining KERNEL_VERSION bit fields. Signed-off-by: Jiaxun Yang --- For some context: https://lore.kernel.org/backports/bb0ae37aa770e016463706d557fec1c5205bc6a9.camel@sipsolutions.net/T/#t --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 99d37c23495e..8132f81d94d8 100644 --- a/Makefile +++ b/Makefile @@ -1142,7 +1142,10 @@ endef define filechk_version.h (echo \#define LINUX_VERSION_CODE $(shell \ expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 255); \ - echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) + echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \ + echo \#define LINUX_VERSION_MAJOR $(VERSION); \ + echo \#define LINUX_VERSION_PATCHLEVEL $(PATCHLEVEL); \ + echo \#define LINUX_VERSION_SUBLEVEL $(SUBLEVEL);) endef $(version_h): $(srctree)/Makefile FORCE