Message ID | 1351729065-31324-1-git-send-email-sagaert.johan@skynet.be |
---|---|
State | Rejected |
Headers | show |
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
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@busybox.net [mailto:buildroot-bounces@busybox.net] Namens Arnout Vandecappelle Verzonden: donderdag 1 november 2012 2:08 Aan: Sagaert Johan CC: buildroot@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
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
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@free-electrons.com] Verzonden: donderdag 1 november 2012 10:19 Aan: Sagaert Johan CC: 'Arnout Vandecappelle'; buildroot@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
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
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
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(+)