Create a symbolic link to the target kernel directory.
PATCH 1/1 Create a symbolic link to the target kernel directory.
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.
--- Makefile | 1 + linux/linux.mk | 2 ++ 2 files changed, 3 insertions(+)
Makefile +1 -0
@@ -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)
linux/linux.mk +2 -0
@@ -219,6 +219,8 @@ define LINUX_BUILD_CMDS fi $(LINUX_BUILD_DTB) $(LINUX_APPEND_DTB) + rm -f targetkernel + ln -s $(LINUX_DIR) targetkernel endef
Signature · 1 line
1.8.0
PATCH 1/1 Create a symbolic link to the target kernel directory.
Quoted 3 lines · Sagaert Johan
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
Signature · 6 lines
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
PATCH 1/1 Create a symbolic link to the target kernel directory.
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.
Quoted 3 lines · Sagaert Johan
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
Signature · 9 lines
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
PATCH 1/1 Create a symbolic link to the target kernel directory.
Quoted 3 lines · Sagaert Johan
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
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 Create a symbolic link to the target kernel directory. example
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.
Quoted 3 lines · Sagaert Johan
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
PATCH 1/1 Create a symbolic link to the target kernel directory. example
Dear Sagaert Johan,
Quoted 1 line · Sagaert Johan
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
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com