All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory.
@ 2012-11-01  0:17 Sagaert Johan
  2012-11-01  1:07 ` Arnout Vandecappelle
  0 siblings, 1 reply; 6+ messages in thread
From: Sagaert Johan @ 2012-11-01  0:17 UTC (permalink / raw)
  To: buildroot


This symbolic link makes it easier when building kernel modules.
The makefile for a module no longer has to point to the full directory name of the kernel but can use this symbolic link instead.
You no longer need to edit the path to the kernel tree in the module's makefiles when changing your target kernel version.

Signed-off-by: Sagaert Johan <sagaert.johan@skynet.be>
---
 Makefile       | 1 +
 linux/linux.mk | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 0128839..8356aeb 100644
--- a/Makefile
+++ b/Makefile
@@ -668,6 +668,7 @@ ifeq ($(O),output)
 	rm -rf $(O)
 endif
 	rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.auto.deps
+	rm -f targetkernel 
 
 cross: $(BASE_TARGETS)
 
diff --git a/linux/linux.mk b/linux/linux.mk
index c4bdf90..4541081 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -219,6 +219,8 @@ define LINUX_BUILD_CMDS
 	fi
 	$(LINUX_BUILD_DTB)
 	$(LINUX_APPEND_DTB)
+	rm -f targetkernel
+	ln -s $(LINUX_DIR) targetkernel
 endef
 
 
-- 
1.8.0

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

* [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory.
  2012-11-01  0:17 [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory Sagaert Johan
@ 2012-11-01  1:07 ` Arnout Vandecappelle
  2012-11-01  1:14   ` Sagaert Johan
  0 siblings, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2012-11-01  1:07 UTC (permalink / raw)
  To: buildroot

On 11/01/12 01:17, Sagaert Johan wrote:
> This symbolic link makes it easier when building kernel modules.
> The makefile for a module no longer has to point to the full directory name of the kernel but can use this symbolic link instead.
> You no longer need to edit the path to the kernel tree in the module's makefiles when changing your target kernel version.

  I don't see the point...  What's wrong with passing KERNELDIR=$(LINUX_DIR) to
the sub-make in the .mk file?  Cfr. lttng-modules.

  Regards,
  Arnout
-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory.
  2012-11-01  1:07 ` Arnout Vandecappelle
@ 2012-11-01  1:14   ` Sagaert Johan
  2012-11-01  9:19     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Sagaert Johan @ 2012-11-01  1:14 UTC (permalink / raw)
  To: buildroot

 
Hi Arnout

I always build modules outside of the buildroot system.
Is there another (fast ) way ? I don't like to wait 20 seconds for buildroot tarring the rootfs. 

Johan

-----Oorspronkelijk bericht-----
Van: buildroot-bounces at busybox.net [mailto:buildroot-bounces at busybox.net] Namens Arnout Vandecappelle
Verzonden: donderdag 1 november 2012 2:08
Aan: Sagaert Johan
CC: buildroot at busybox.net
Onderwerp: Re: [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory.

On 11/01/12 01:17, Sagaert Johan wrote:
> This symbolic link makes it easier when building kernel modules.
> The makefile for a module no longer has to point to the full directory name of the kernel but can use this symbolic link instead.
> You no longer need to edit the path to the kernel tree in the module's makefiles when changing your target kernel version.

  I don't see the point...  What's wrong with passing KERNELDIR=$(LINUX_DIR) to the sub-make in the .mk file?  Cfr. lttng-modules.

  Regards,
  Arnout
-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F _______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory.
  2012-11-01  1:14   ` Sagaert Johan
@ 2012-11-01  9:19     ` Thomas Petazzoni
  2012-11-01 19:10       ` [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory. example Sagaert Johan
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2012-11-01  9:19 UTC (permalink / raw)
  To: buildroot


On Thu, 1 Nov 2012 02:14:35 +0100, Sagaert Johan wrote:

> I always build modules outside of the buildroot system.
> Is there another (fast ) way ? I don't like to wait 20 seconds for
> buildroot tarring the rootfs. 

I don't see the relation between waiting 20 seconds for Buildroot to
tar the rootfs and the patch you're posting. Care to explain?

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory. example
  2012-11-01  9:19     ` Thomas Petazzoni
@ 2012-11-01 19:10       ` Sagaert Johan
  2012-11-01 22:24         ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Sagaert Johan @ 2012-11-01 19:10 UTC (permalink / raw)
  To: buildroot

Hi

An example makefile explains it all :

With my patch I can write a makefile for my kernel modules like this:

MODULENAME := digitalio

obj-m += $(MODULENAME).o

KERNELDIR=/home/buildroot12git/targetkernel

all:$(MODULENAME).ko

$(MODULENAME).ko:$(MODULENAME).c
	make -C $(KERNELDIR) SUBDIRS=$(PWD) modules CC=arm-linux-gcc LD=arm-linux-ld ARCH=arm

.PHONY clean:
	make -C $(KERNELDIR) M=$(PWD) clean




Without the symbolic link I had to use this makefile, and change it everytime I used another kernel version.

MODULENAME := digitalio

obj-m += $(MODULENAME).o

KERNELDIR=/home/buildroot12git/output/build/linux-76e10d158efb6d4516018846f60c2ab5501900bc

all:$(MODULENAME).ko

$(MODULENAME).ko:$(MODULENAME).c
	make -C $(KERNELDIR) SUBDIRS=$(PWD) modules CC=arm-linux-gcc LD=arm-linux-ld ARCH=arm

.PHONY clean:
	make -C $(KERNELDIR) M=$(PWD) clean 


As I onderstood from Arnout, I could build the module from within buildroot (making use of the buildroot vars) but this not an
option while still developing a module. Every buildroot make would also force a regeneration of the rootfs tar, and this takes a
serious ammount of time with a large rootfs.
So I develop it outside the build system and use the symlink to the kernel I have selected.

Regards, Johan

-----Oorspronkelijk bericht-----
Van: Thomas Petazzoni [mailto:thomas.petazzoni at free-electrons.com] 
Verzonden: donderdag 1 november 2012 10:19
Aan: Sagaert Johan
CC: 'Arnout Vandecappelle'; buildroot at busybox.net
Onderwerp: Re: [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory.


On Thu, 1 Nov 2012 02:14:35 +0100, Sagaert Johan wrote:

> I always build modules outside of the buildroot system.
> Is there another (fast ) way ? I don't like to wait 20 seconds for 
> buildroot tarring the rootfs.

I don't see the relation between waiting 20 seconds for Buildroot to tar the rootfs and the patch you're posting. Care to explain?

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory. example
  2012-11-01 19:10       ` [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory. example Sagaert Johan
@ 2012-11-01 22:24         ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2012-11-01 22:24 UTC (permalink / raw)
  To: buildroot

Dear Sagaert Johan,

On Thu, 1 Nov 2012 20:10:26 +0100, Sagaert Johan wrote:

> KERNELDIR=/home/buildroot12git/output/build/linux-76e10d158efb6d4516018846f60c2ab5501900bc

Turn this into:

KERNELDIR=$(shell ls -1 /home/buildroot12git/output/build/linux-[0-9a-f]*)

or, if you want something cleaner, add a <pkg>-show-builddir target for
all packages in pkg-generic.mk (we could probably get this patch
upstream), and do:

KERNELDIR=($shell make -C /home/buildroot12git/ linux-show-builddir)

And voil?.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

end of thread, other threads:[~2012-11-01 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01  0:17 [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory Sagaert Johan
2012-11-01  1:07 ` Arnout Vandecappelle
2012-11-01  1:14   ` Sagaert Johan
2012-11-01  9:19     ` Thomas Petazzoni
2012-11-01 19:10       ` [Buildroot] [PATCH 1/1] Create a symbolic link to the target kernel directory. example Sagaert Johan
2012-11-01 22:24         ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.