From patchwork Tue Nov 22 14:39:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 24411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2249762wrr; Tue, 22 Nov 2022 06:50:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4XXFR2iXXGWQV3m8pz0wCbkWxc8SmS9U/ZYKiymNYQj5KamFdH/GKiFxVOQLxa7kQCWs1S X-Received: by 2002:a17:906:3ac1:b0:78d:36d8:1814 with SMTP id z1-20020a1709063ac100b0078d36d81814mr19380378ejd.99.1669128641143; Tue, 22 Nov 2022 06:50:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669128641; cv=none; d=google.com; s=arc-20160816; b=bFjkXEstq6e6GLAL1xkliCL3l0wlord+JviJkeQ8munjSOhmvVraT3PjNmwYm9QNb9 uGYodR+LZBfs/tKKuczhXXSSHn5jJ9OLhs+I6a7lB819l/qrtTkkCXFMxOod/hn/1Wby k+98bHE5pceb68spDVSURksD9n+F8GGuCEP1n1OcZAthW0sKp3aH7R1cSW18/fexsBIg xojF7lUrQunNzcsss411fOVBxYSzu8EOvQzsZ5SZuorGYA1dSACJe93EJPXSZsKxPQZx Exre6Yun1Qp/C59+3wmsqcuqM79VqvfIRKdBnfq7mmhPp8NeRWVKuv1gCT5ZoYQVAzYE h7lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UVUDqVEazN3+mFLG/PP0FKJc6Iuvvj4PFkbd3g7wpOk=; b=AiOnK2fYxd3ryK37JnY0DBnF+Ofip326KsniY2Awgs80+hrnM5wTJ2WA5Dz2UWBaSA f60h89en1yCwauYL+bHgEIjX28udhaN3xr5/9yn/SQ1Ws/h82mKs2fO7CNOkGN3TBJhT RFhE+ZeS+WabL7cXU0hgFAtkTVFUXFmY6Fd60cudSHYfStr+CBBRs5wUc6pcU5risv/i qv46AvZsGdIxTZRrI/TkKe1V+wBthKhrLXrfCjcNM+TuHS7T0IqIN1t5HU1Psrrgtl5L YnIA4fbmMUllHeJp3FqJ+fRhAfr/8m/+M0RifVnnOMLn2vM76URUbpv+ylJ5cjO3zYe0 4ZDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T1UzJAAq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a0564021e9100b0046627848e1fsi13965594edf.630.2022.11.22.06.50.12; Tue, 22 Nov 2022 06:50:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T1UzJAAq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232660AbiKVOjO (ORCPT + 99 others); Tue, 22 Nov 2022 09:39:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232738AbiKVOjL (ORCPT ); Tue, 22 Nov 2022 09:39:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A9834387A; Tue, 22 Nov 2022 06:39:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC2B861731; Tue, 22 Nov 2022 14:39:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBA1FC433D6; Tue, 22 Nov 2022 14:39:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669127949; bh=I3jJNAP9ZLch/e8adpMqIVPvk8KRS4yFg2lWfNILhjg=; h=From:To:Cc:Subject:Date:From; b=T1UzJAAqt+v+4ejnYmUHMqsOuC6IH3EjiaZO+A4MwdEKgfQcqUYoZapo8tRgI6PZQ Rq4smgDoWP93yQjDB3YwT4qtSuJXbflyMXRNH0jxmh0rrLMsnJ8has26f/oYp4N/+T TEl54sk9lyrE+1//7xB9CGcgIUIS8mkHLj8rfhGbwnjKV1yT+eKVoSisL7HHFXgrTI SNxKNZBi+tRn0Ytk+OYTFEl0Ukgf19ZlzvIJ5XlZk0dKGMRAwihagS3N7ZK7SutgKg 2kslH3IhqTW9j2Lbhugw3fje8Sk22BKLrRt83Kl5SqQi2WrhiCwcmSKUFRSGc20Dmw OI5HM3AJ/Jw7Q== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Masahiro Yamada , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Michal Simek , Thomas Gleixner Subject: [PATCH] kbuild: fix "cat: .version: No such file or directory" Date: Tue, 22 Nov 2022 23:39:02 +0900 Message-Id: <20221122143902.272330-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750208234219127428?= X-GMAIL-MSGID: =?utf-8?q?1750208234219127428?= Since commit 2df8220cc511 ("kbuild: build init/built-in.a just once"), the .version file is not touched at all when KBUILD_BUILD_VERSION is given. If KBUILD_BUILD_VERSION is specified and the .version file is missing (for example right after 'make mrproper'), "No such file or director" is shown. Even if the .version exists, it is irrelevant to the version of the current build. $ make -j$(nproc) KBUILD_BUILD_VERSION=100 mrproper defconfig all [ snip ] BUILD arch/x86/boot/bzImage cat: .version: No such file or directory Kernel: arch/x86/boot/bzImage is ready (#) Show KBUILD_BUILD_VERSION if it is given. Fixes: 2df8220cc511 ("kbuild: build init/built-in.a just once") Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- arch/microblaze/Makefile | 4 ++-- arch/x86/boot/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile index 3f8a86c4336a..02e6be9c5b0d 100644 --- a/arch/microblaze/Makefile +++ b/arch/microblaze/Makefile @@ -67,12 +67,12 @@ linux.bin.ub linux.bin.gz: linux.bin linux.bin: vmlinux linux.bin linux.bin.gz linux.bin.ub: $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ - @echo 'Kernel: $(boot)/$@ is ready' ' (#'`cat .version`')' + @echo 'Kernel: $(boot)/$@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')' PHONY += simpleImage.$(DTB) simpleImage.$(DTB): vmlinux $(Q)$(MAKE) $(build)=$(boot) $(addprefix $(boot)/$@., ub unstrip strip) - @echo 'Kernel: $(boot)/$@ is ready' ' (#'`cat .version`')' + @echo 'Kernel: $(boot)/$@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')' define archhelp echo '* linux.bin - Create raw binary' diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 9860ca5979f8..9e38ffaadb5d 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -83,7 +83,7 @@ cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \ $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE $(call if_changed,image) - @$(kecho) 'Kernel: $@ is ready' ' (#'`cat .version`')' + @$(kecho) 'Kernel: $@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')' OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE