Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC] linux: Make CONFIG_LOCALVERSION_AUTO work with OVERRIDE_SRCDIR
@ 2022-07-06 21:06 Florian Fainelli
  2022-07-18 13:01 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2022-07-06 21:06 UTC (permalink / raw)
  To: buildroot; +Cc: Florian Fainelli, Thomas Petazzoni, mmayer, yann.morin.1998

Linux is able to generate an automic version based upon the git tree
that is being used which is very useful for making sure that the kernel
being used is truly the one that we intend to be using.

When using LINUX_OVERRIDE_SRCDIR however, since we do not rsync the .git
folder, all of the necessary information for scripts/setlocalversion to
compute the exact version and git commit id is lost.

Add a post rsync hook that copies it over in order to allow 'git
rev-parse' to work and produce an usable version.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 linux/linux.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index 322ccabbd9f7..a19a215187fd 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -131,6 +131,14 @@ define LINUX_FIXUP_CONFIG_PAHOLE_CHECK
 endef
 endif
 
+ifneq ($(LINUX_OVERRIDE_SRCDIR),)
+define LINUX_LOCALVERSION_AUTO_FIXUP
+	if [ -d $(SRCDIR)/.git ]; then \
+		rsync -au --chmod=u=rwX,go=rX $(call qstrip,$(SRCDIR)/.git)/ $(@D); \
+	fi;
+endef
+endif
+
 # If host-uboot-tools is selected by the user, assume it is needed to
 # create a custom image
 ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS),y)
@@ -145,6 +153,8 @@ LINUX_POST_EXTRACT_HOOKS += LINUX_XTENSA_OVERLAY_EXTRACT
 LINUX_EXTRA_DOWNLOADS += $(ARCH_XTENSA_OVERLAY_URL)
 endif
 
+LINUX_POST_RSYNC_HOOKS += LINUX_LOCALVERSION_AUTO_FIXUP
+
 # We don't want to run depmod after installing the kernel. It's done in a
 # target-finalize hook, to encompass modules installed by packages.
 # Disable building host tools with -Werror: newer gcc versions can be
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-18 23:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-06 21:06 [Buildroot] [RFC] linux: Make CONFIG_LOCALVERSION_AUTO work with OVERRIDE_SRCDIR Florian Fainelli
2022-07-18 13:01 ` Thomas Petazzoni via buildroot
2022-07-18 20:21   ` Yann E. MORIN
2022-07-18 23:05     ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox