From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3F4BC15802E for ; Wed, 26 Jun 2024 19:09:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EAC6BE2ACA; Wed, 26 Jun 2024 19:09:29 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7B396E2AAD for ; Wed, 26 Jun 2024 19:09:29 +0000 (UTC) Message-ID: Date: Wed, 26 Jun 2024 21:09:25 +0200 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US, nl-NL To: gentoo-dev@lists.gentoo.org From: Andrew Nowa Ammerlaan Subject: [gentoo-dev] [PATCH] kernel-build.eclass: identify dist-kernels, and warn users Autocrypt: addr=andrewammerlaan@gentoo.org; keydata= xsBNBF3n3cUBCAC6uoDZ0XzaO29l8AzUblXQ5rxZI7nbGEnfFqjEQCK3oEXxsDa9Ez1myx3M ir53Vyx64Iz1Bq/TOS/PttgguPpiLggCpTTD2vavp5SwFmg272+P8bUJVJF2mMRm0OR/YPiA B5dNfcoLqKIj+ZMOtrZ72B7agkUn+iDt8lB2fZ7XhfZMyQBXICYSe+EiJ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gIbDBYhBAb/U0G9gF2wvH0HpqGfY2zU7bzR BQJlNiHABQkJL3d7AAoJEKGfY2zU7bzRjDwH/1fp/87km2YYVgrfP1aWLjAA/TwcEVycRJQQ S9Q6xuzgD5AYhjzBSONoN46cwf+gla6xndY0lCawsZN7whtJ/DhqSZEfL0HgHkJ6T8FCXexf n1s6XmIAxqIrMmfsuOkAPLJIHzAAGzQX8DXcRSj1cIDUpa1Uy7ncVvI4EzJBRtJVJXIbl+53 NGauXU8ZuprPYkMSPuW3eHATFc0F5DhmlFUXh+HYYK+2QTO73TENMhngkrYcw63je5bRp/+f 72XFKlf1gXHK1ivg8nYueyUfrxZTBGKagusOiQeOao2I1uYcHoFhPYJrQWePMyZiYyB6PR0K DR4B/Ulo3v0eBXaaYzo= Organization: Gentoo Linux Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: 629b864f-158d-417c-b6ef-f1f6bb4eb4c4 X-Archives-Hash: d509dd751443b22296cb70f749235668 Part of https://github.com/gentoo/gentoo/pull/37281 From c88eee66089333fbcee6377b5f580e70a4ec2a8c Mon Sep 17 00:00:00 2001 From: Andrew Ammerlaan Date: Mon, 24 Jun 2024 22:18:46 +0200 Subject: [PATCH] kernel-build.eclass: identify dist-kernels, and warn users Many, many, new users at some point make the mistake of running "make ...." in the source directory of a distribution kernel. This returns a vague error due to the absence of the kernel source files: make[2]: *** No rule to make target 'arch/x86/entry/syscalls/syscall_32.tbl', needed by 'arch/x86/include/generated/uapi/asm/unistd_32.h'. Stop. make[1]: *** [arch/x86/Makefile:248: archheaders] Error 2 make: *** [Makefile:234: __sub-make] Error 2 Here we append to the kernel Makefile a warning that should make it more clear what is going wrong. "$(shell [ -t 0 ] && echo 1)" is a trick to show this warning when an user is executing "make" from their shell, but not when they are compiling out-of-tree kernel modules (which is the reason we need to install these makefiles to begin with). We also add a "dist-kernel" file containing the package atom of the ebuild that installed this kernel. This makes it possible for ebuilds/eclasses or whatever other tools to check if a kernel is a Gentoo distribution kernel. This identifier will be overwritten in gentoo-kernel-bin.ebuild. Signed-off-by: Andrew Ammerlaan --- eclass/kernel-build.eclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass index 7922638be6e1c..86c7cd4a172d5 100644 --- a/eclass/kernel-build.eclass +++ b/eclass/kernel-build.eclass @@ -382,6 +382,22 @@ kernel-build_src_install() { local module_ver module_ver=$(<"${relfile}") || die + # warn when trying to "make" a dist-kernel + cat <<-EOF >> "${ED}${kernel_dir}/Makefile" || die + + _GENTOO_IS_USER_SHELL:=\$(shell [ -t 0 ] && echo 1) + ifdef _GENTOO_IS_USER_SHELL + \$(warning !!!! WARNING !!!!) + \$(warning This kernel was configured and installed by the package manager.) + \$(warning "make" should not be run manually here.) + \$(warning See also: https://wiki.gentoo.org/wiki/Project:Distribution_Kernel) + \$(warning See also: https://wiki.gentoo.org/wiki/Kernel/Configuration) + \$(warning !!!! WARNING !!!!) + endif + EOF + # add a dist-kernel identifier file + echo "${CATEGORY}/${PF}:${SLOT}" > "${ED}${kernel_dir}/dist-kernel" || die + # fix source tree and build dir symlinks dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/build" dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/source"