Skip to contentSkip to conversation

svn commit: trunk/buildroot/package: alsa-lib

Buildroot In review ulf at uclibc.org 4 participants 9 messages Jul 23, 2007 – Aug 20, 2007 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Author: ulf
Date: 2007-07-23 00:54:13 -0700 (Mon, 23 Jul 2007) New Revision: 19196

Log:
Add alsa-lib package

Added:
trunk/buildroot/package/alsa-lib/
trunk/buildroot/package/alsa-lib/Config.in
trunk/buildroot/package/alsa-lib/alsa-lib.mk

Modified:
trunk/buildroot/package/Config.in

Changeset:
Modified: trunk/buildroot/package/Config.in
===================================================================

buildroot/package/Config.in +1 -0
@@ -246,6 +246,7 @@
 	  Support for audio libraries and applications
 
 if BR2_AUDIO_SUPPORT
+source "package/alsa-lib/Config.in"
 source "package/asterisk/Config.in"
 source "package/aumix/Config.in"
 source "package/libid3tag/Config.in"

Added: trunk/buildroot/package/alsa-lib/Config.in
===================================================================

buildroot/package/alsa-lib/Config.in +8 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_ALSA_LIB
+	bool "alsa-lib"
+	default n
+	help
+	  The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
+	  functionality to the Linux operating system.
+
+	  http://www.alsa-project.org/

Added: trunk/buildroot/package/alsa-lib/alsa-lib.mk
===================================================================

buildroot/package/alsa-lib/alsa-lib.mk +74 -0

74 lines not on this page · raw message

#1 lore raw
Quoted 66 lines · ulf at uclibc.org

Author: ulf
Date: 2007-07-23 00:54:13 -0700 (Mon, 23 Jul 2007) New Revision: 19196

Log:
Add alsa-lib package

Added:
trunk/buildroot/package/alsa-lib/
trunk/buildroot/package/alsa-lib/Config.in
trunk/buildroot/package/alsa-lib/alsa-lib.mk

Modified:
trunk/buildroot/package/Config.in

Changeset:
Modified: trunk/buildroot/package/Config.in
===================================================================

buildroot/package/Config.in +0 -0
@@ -246,6 +246,7 @@
 	  Support for audio libraries and applications
 

if BR2_AUDIO_SUPPORT
+source "package/alsa-lib/Config.in"
source "package/asterisk/Config.in"
source "package/aumix/Config.in"
source "package/libid3tag/Config.in"

Added: trunk/buildroot/package/alsa-lib/Config.in
===================================================================

buildroot/package/alsa-lib/Config.in +8 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_ALSA_LIB
+	bool "alsa-lib"
+	default n
+	help
+	  The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
+	  functionality to the Linux operating system.
+
+	  http://www.alsa-project.org/

Added: trunk/buildroot/package/alsa-lib/alsa-lib.mk
===================================================================

buildroot/package/alsa-lib/alsa-lib.mk +17 -0
@@ -0,0 +1,74 @@
+#############################################################
+#
+# alsa-lib
+#
+#############################################################
+ALSA_LIB_VER:=1.0.14a
+ALSA_LIB_SOURCE:=alsa-lib-$(ALSA_LIB_VER).tar.bz2
+ALSA_LIB_SITE:=ftp://ftp.alsa-project.org/pub/lib
+ALSA_LIB_DIR:=$(BUILD_DIR)/alsa-lib-$(ALSA_LIB_VER)
+ALSA_LIB_CAT:=$(BZCAT)
+ALSA_LIB_BINARY:=libasound.so.2.0.0
+ALSA_LIB_TARGET_BINARY:=usr/lib/$(ALSA_LIB_BINARY)
+
+$(DL_DIR)/$(ALSA_LIB_SOURCE):
+	$(WGET) -P $(DL_DIR) $(ALSA_LIB_SITE)/$(ALSA_LIB_SOURCE)
+
+$(ALSA_LIB_DIR)/.unpacked: $(DL_DIR)/$(ALSA_LIB_SOURCE)

buildroot/package/alsa-lib/alsa-lib.mk line 27

Quoted 10 lines
buildroot/package/alsa-lib/alsa-lib.mk +10 -0
+	$(ALSA_LIB_CAT) $(DL_DIR)/$(ALSA_LIB_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+	toolchain/patch-kernel.sh $(ALSA_LIB_DIR) package/alsa-lib/ alsa-lib-$(ALSA_LIB_VER)\*.patch*
+	$(CONFIG_UPDATE) $(ALSA_LIB_DIR)
+	@touch $@
+
+$(ALSA_LIB_DIR)/.configured: $(ALSA_LIB_DIR)/.unpacked
+	(cd $(ALSA_LIB_DIR); rm -rf config.cache; \
+		$(TARGET_CONFIGURE_OPTS) \
+		CFLAGS="$(TARGET_CFLAGS)" \
+		LDFLAGS="$(TARGET_LDFLAGS)" \

NO!

You forgot to pass TARGET_CONFIGURE_ARGS

buildroot/package/alsa-lib/alsa-lib.mk line 39

Quoted 12 lines
buildroot/package/alsa-lib/alsa-lib.mk +12 -0
+		./configure \
+		--target=$(GNU_TARGET_NAME) \
+		--host=$(GNU_TARGET_NAME) \
+		--build=$(GNU_HOST_NAME) \
+		--prefix=/usr \
+		--sysconfdir=/etc \
+		--enable-shared \
+		--enable-static \
+		--disable-docs \
+		$(DISABLE_NLS) \
+	);
+	@touch $@

I object to hide such trivia away.

Quoted 5 lines
buildroot/package/alsa-lib/alsa-lib.mk +5 -0
+
+$(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY): $(ALSA_LIB_DIR)/.configured
+	$(MAKE) -C $(ALSA_LIB_DIR)
+	@touch -c $@
+

buildroot/package/alsa-lib/alsa-lib.mk line 54

Quoted 10 lines
buildroot/package/alsa-lib/alsa-lib.mk +10 -0
+$(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY): $(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY)
+	$(MAKE) DESTDIR=$(STAGING_DIR) -C $(ALSA_LIB_DIR) install
+	@touch -c $@
+
+$(TARGET_DIR)/$(ALSA_LIB_TARGET_BINARY): $(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY)
+	@mkdir -p $(TARGET_DIR)/usr/share/alsa
+	@mkdir -p $(TARGET_DIR)/usr/lib/alsa-lib
+	cp -dpf  $(STAGING_DIR)/lib/libasound.so*  $(TARGET_DIR)/usr/lib/
+	cp -rdpf $(STAGING_DIR)/usr/share/alsa/*   $(TARGET_DIR)/usr/share/alsa/
+	cp -rdpf $(STAGING_DIR)/usr/lib/alsa-lib/* $(TARGET_DIR)/usr/lib/alsa-lib/

install(1) would be cleaner, especially if you consider that it's a new package.

#2 lore raw
Quoted 18 lines

+$(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY): $(ALSA_LIB_DIR)/.configured

buildroot/package/alsa-lib/alsa-lib.mk line 54

Quoted 13 lines
buildroot/package/alsa-lib/alsa-lib.mk +13 -0
+	$(MAKE) -C $(ALSA_LIB_DIR)
+	@touch -c $@
+
+$(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY): $(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY)
+	$(MAKE) DESTDIR=$(STAGING_DIR) -C $(ALSA_LIB_DIR) install
+	@touch -c $@
+
+$(TARGET_DIR)/$(ALSA_LIB_TARGET_BINARY): $(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY)
+	@mkdir -p $(TARGET_DIR)/usr/share/alsa
+	@mkdir -p $(TARGET_DIR)/usr/lib/alsa-lib
+	cp -dpf  $(STAGING_DIR)/lib/libasound.so*  $(TARGET_DIR)/usr/lib/
+	cp -rdpf $(STAGING_DIR)/usr/share/alsa/*   $(TARGET_DIR)/usr/share/alsa/
+	cp -rdpf $(STAGING_DIR)/usr/lib/alsa-lib/* $(TARGET_DIR)/usr/lib/alsa-lib/

install(1) would be cleaner, especially if you consider that it's a new package.

make install is done on the staging dir.
I think the reason for not doing make install on the target dir is that it will add a lot of other stuff which is not wanted on an embedded system.
It is a matter of taste if you "install and remove", or just copy the *needed* stuff.
Have to discuss with Someone Else(tm) if you insist.

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at uclibc.org
http://busybox.net/mailman/listinfo/buildroot

#3 lore raw
Quoted 19 lines · Ulf Samuelsson
Quoted 18 lines

+$(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY): $(ALSA_LIB_DIR)/.configured

buildroot/package/alsa-lib/alsa-lib.mk line 54

Quoted 13 lines
buildroot/package/alsa-lib/alsa-lib.mk +13 -0
+	$(MAKE) -C $(ALSA_LIB_DIR)
+	@touch -c $@
+
+$(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY): $(ALSA_LIB_DIR)/src/.libs/$(ALSA_LIB_BINARY)
+	$(MAKE) DESTDIR=$(STAGING_DIR) -C $(ALSA_LIB_DIR) install
+	@touch -c $@
+
+$(TARGET_DIR)/$(ALSA_LIB_TARGET_BINARY): $(STAGING_DIR)/$(ALSA_LIB_TARGET_BINARY)
+	@mkdir -p $(TARGET_DIR)/usr/share/alsa
+	@mkdir -p $(TARGET_DIR)/usr/lib/alsa-lib
+	cp -dpf  $(STAGING_DIR)/lib/libasound.so*  $(TARGET_DIR)/usr/lib/
+	cp -rdpf $(STAGING_DIR)/usr/share/alsa/*   $(TARGET_DIR)/usr/share/alsa/
+	cp -rdpf $(STAGING_DIR)/usr/lib/alsa-lib/* $(TARGET_DIR)/usr/lib/alsa-lib/

install(1) would be cleaner, especially if you consider that it's a new package.

Quoted 1 line

make install is done on the staging dir.

make install != install(1)
man install
$(INSTALL) -D /thisfile /thatfile /there/newdir
or something like that.

Quoted 3 lines

I think the reason for not doing make install on the target dir is that it will add a lot of other stuff which is not wanted on an embedded system.

This is unrelated but true, yes :)

Quoted 2 lines

It is a matter of taste if you "install and remove", or just copy the *needed* stuff.

I prefer to just copy the needed stuff.

Quoted 1 line

Have to discuss with Someone Else(tm) if you insist.

Just using install(1) for new packages -- and eventually gradually fixing old ones -- is sufficient. We can easily either use busybox's install or have our own in buildroot to circumvent eventual buggy incarnations on the host. This would also help the MacOS10 folks, i'd say.

#4 lore raw
Quoted 20 lines
Quoted 3 lines

make install is done on the staging dir.

make install != install(1)
man install
$(INSTALL) -D /thisfile /thatfile /there/newdir
or something like that.

Quoted 3 lines

I think the reason for not doing make install on the target dir is that it will add a lot of other stuff which is not wanted on an embedded system.

This is unrelated but true, yes :)

Quoted 2 lines

It is a matter of taste if you "install and remove", or just copy the *needed* stuff.

I prefer to just copy the needed stuff.

Quoted 7 lines
Quoted 1 line

Have to discuss with Someone Else(tm) if you insist.

Just using install(1) for new packages -- and eventually gradually fixing old ones -- is sufficient. We can easily either use busybox's install or have our own in buildroot to circumvent eventual buggy incarnations on the host. This would also help the MacOS10 folks, i'd say.

OK, I'll look into it, but I guess the x86 test will take priority for the moment...

Best Regards
Ulf Samuelsson

#5 lore raw
In reply to Bernhard Fischer
Quoted 1 line · Bernhard Fischer

On Mon, Jul 23, 2007 at 03:18:05PM +0200, Ulf Samuelsson wrote:

<cut alsa-lib patch and use of install instead of cp>

Quoted 5 lines

Just using install(1) for new packages -- and eventually gradually fixing old ones -- is sufficient. We can easily either use busybox's install or have our own in buildroot to circumvent eventual buggy incarnations on the host. This would also help the MacOS10 folks, i'd say.

FYI

IIRC the install shipped with buildroot is buggy (they might have fixed it). It had a bug when it would not unlink the old file before writing the new.

Pretty funny trying to upgrade libc then; Busybox would truncate the file to 0 bytes and then try to copy in the new one, never being able to complete that job because of missing libc.

Signature · 7 lines
With kind regards,

Hans-Christian Egtvedt, siv.ing. (M.Sc.)
Applications Engineer - AVR32 System Solutions - Atmel Norway
-- 
Mvh
Hans-Christian Egtvedt

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 12 lines · Hans-Christian Egtvedt
Quoted 1 line · Bernhard Fischer

On Mon, Jul 23, 2007 at 03:18:05PM +0200, Ulf Samuelsson wrote:

<cut alsa-lib patch and use of install instead of cp>

Quoted 5 lines

Just using install(1) for new packages -- and eventually gradually fixing old ones -- is sufficient. We can easily either use busybox's install or have our own in buildroot to circumvent eventual buggy incarnations on the host. This would also help the MacOS10 folks, i'd say.

Quoted 5 lines

FYI

IIRC the install shipped with buildroot is buggy (they might have fixed it). It had a bug when it would not unlink the old file before writing the new.

$ echo BAR > foo
$ echo FOO > new
$ ./busybox install new foo
[]
open("new", O_RDONLY)                   = 3
open("foo", O_WRONLY|O_CREAT|O_EXCL, 0100644) = -1 EEXIST (File exists)
unlink("foo")                           = 0
open("foo", O_WRONLY|O_CREAT|O_EXCL, 0100644) = 4
read(3, "FOO\n", 8192)                  = 4
write(4, "FOO\n", 4)                    = 4
read(3, "", 8192)                       = 0
close(4)                                = 0
close(3)                                = 0

So it looks like "they" fixed it.

#8 lore raw

RFC 1/1 Building linux kernel in $(PROJECT_BUILD_DIR)

Proposed fix to allow each project to build its own linux kernel in $(PROJECT_BUILD_DIR) == project_build_dir/<project>

Basic approach is to unpack the linux header source in "$(TOOL_BUILD_DIR)" instead of in "$(BUILD_DIR)"
Patches are applied (some depending on BR2_<xxx>) as in current trunk,

Each board can add additional patches by defining KERNEL_HEADERS_PATCH_DIR to point at the directory with additional patches (That patch just applied to get rid of AVR32 patches in toolchain/kernel-headers).

Headers are still installed in "$(TOOL_BUILD_DIR)/linux" The kernel-headers source tree is unpacked once per toolchain.

The target/linux build (modules and kernel) will unpack a second linux source tree in "$(PROJECT_BUILD_DIR)". This source tree is generated once per *project*.

Since this is a fresh unpack, the same patches as were applied to the kernel-headers are applied to "$(PROJECT_BUILD_DIR)/linux-*".

A common linux source tree for all projects is not possible, since different boards can require different patches to be applied. There is a significant risk that the linux build breaks if patches for one project are applied on top of patches for another project in the same source tree.

With a single source, you therefore will have to remove the linux source tree each time you work on a new project.
With a separate source, you can move between projects without removing the linux source directory.

The patch is also include it as an attachement, due to linewrap.

Tested this on x86/Atmel targets.

Comments?

Index: toolchain/kernel-headers/kernel-headers-new.makefile
===================================================================
--- toolchain/kernel-headers/kernel-headers-new.makefile (revision
19588)
+++ toolchain/kernel-headers/kernel-headers-new.makefile (arbetskopia)
@@ -13,7 +13,7 @@
LINUX_HEADERS_SITE:=http://www.kernel.org/pub/linux/kernel/v2.6/ LINUX_HEADERS_SOURCE:=linux-$(LINUX_HEADERS_VERSION).tar.bz2 LINUX_HEADERS_CAT:=$(BZCAT)
-LINUX_HEADERS_UNPACK_DIR:=$(BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION) +LINUX_HEADERS_UNPACK_DIR:= $(TOOL_BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux LINUX_HEADERS_IS_KERNEL=y
endif
@@ -28,7 +28,7 @@
LINUX_HEADERS_SITE:=http://www.kernel.org/pub/linux/kernel/v2.6/ LINUX_HEADERS_SOURCE:=linux-$(LINUX_HEADERS_VERSION).tar.bz2 LINUX_HEADERS_CAT:=$(BZCAT)
-LINUX_HEADERS_UNPACK_DIR:=$(BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION) +LINUX_HEADERS_UNPACK_DIR:= $(TOOL_BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux LINUX_HEADERS_IS_KERNEL=y
endif
@@ -43,7 +43,7 @@
LINUX_HEADERS_SITE:=http://www.kernel.org/pub/linux/kernel/v2.6/ LINUX_HEADERS_SOURCE:=linux-$(LINUX_HEADERS_VERSION).tar.bz2 LINUX_HEADERS_CAT:=$(BZCAT)
-LINUX_HEADERS_UNPACK_DIR:=$(BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION) +LINUX_HEADERS_UNPACK_DIR:= $(TOOL_BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux LINUX_HEADERS_IS_KERNEL=y
endif
@@ -56,8 +56,8 @@
$(LINUX_HEADERS_UNPACK_DIR)/.unpacked:
$(DL_DIR)/$(LINUX_HEADERS_SOURCE)
@echo "*** Using kernel-headers generated from kernel source" rm -rf $(LINUX_HEADERS_DIR)
- [ -d $(BUILD_DIR) ] || $(INSTALL) -d $(BUILD_DIR)
- $(LINUX_HEADERS_CAT) $(DL_DIR)/$(LINUX_HEADERS_SOURCE) | tar -C
$(BUILD_DIR) $(TAR_OPTIONS) -
+ [ -d $(TOOL_BUILD_DIR) ] || $(INSTALL) -d $(TOOL_BUILD_DIR)
+ $(LINUX_HEADERS_CAT) $(DL_DIR)/$(LINUX_HEADERS_SOURCE) | tar -C
$(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
touch $@

$(LINUX_HEADERS_UNPACK_DIR)/.patched:
$(LINUX_HEADERS_UNPACK_DIR)/.unpacked

kernel-headers/kernel-headers.mk +1 -0
Index: toolchain/kernel-headers/kernel-headers.mk
===================================================================
@@ -37,5 +37,6 @@
 
 kernel-headers-dirclean:
 	rm -rf $(LINUX_HEADERS_DIR)
+	rm -rf $(LINUX_HEADERS_UNPACK_DIR)
 
 .PHONY: kernel-headers
linux/Makefile.in +4 -2
Index: target/linux/Makefile.in
===================================================================
@@ -68,7 +68,7 @@
 endif
 
 # Version of Linux AFTER patches
-LINUX26_DIR=$(BUILD_DIR)/linux-$(LINUX26_VERSION)
+LINUX26_DIR=$(PROJECT_BUILD_DIR)/linux-$(LINUX26_VERSION)
 
 # for packages that need it
 LINUX_VERSION:=$(LINUX_VERSION)
@@ -76,7 +76,9 @@
 LINUX_KERNEL=$(LINUX26_KERNEL)
 
 # kernel patches
+ifeq ($(strip $(LINUX26_PATCH_DIR)),)
 LINUX26_PATCH_DIR=$(BR2_BOARD_PATH)/kernel-patches/
+endif
 __LINUX26_NO_PIC=-fPIC -fpic -DPIC
 LINUX26_MAKE_FLAGS = HOSTCC="$(HOSTCC)" HOSTCFLAGS=$(HOSTCFLAGS) \
 	ARCH=$(KERNEL_ARCH) \
@@ -96,20 +98,38 @@
 ifneq ($(strip $(LINUX26_VERSION)),$(strip $(LINUX_HEADERS_VERSION)))
 $(DL_DIR)/$(LINUX26_SOURCE):
 	 $(WGET) -P $(DL_DIR) $(LINUX26_SITE)/$(LINUX26_SOURCE)
+endif # ($(LINUX26_VERSION),$(LINUX_HEADERS_VERSION))
 
 $(LINUX26_DIR)/.unpacked: $(DL_DIR)/$(LINUX26_SOURCE)
 	rm -rf $(LINUX26_DIR)
-	$(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C $(BUILD_DIR)

$(TAR_OPTIONS) -
+ $(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C
$(PROJECT_BUILD_DIR) $(TAR_OPTIONS) -
ifneq ($(DOWNLOAD_LINUX26_VERSION),$(LINUX26_VERSION))
# Rename the dir from the downloaded version to the AFTER patch
version
- mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION) $(LINUX26_DIR)
+ mv -f $(PROJECT_BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION)
$(LINUX26_DIR)
endif
touch $@

$(LINUX26_DIR)/.patched: $(LINUX26_DIR)/.unpacked
- toolchain/patch-kernel.sh $(LINUX26_DIR) $(LINUX26_PATCH_DIR) \*.patch
+ toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers \
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+ifeq ($(BR2_KERNEL_HEADERS_IPMI),y)
+ toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers/ipmi
\
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_KERNEL_HEADERS_LZMA),y)
+ toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers/lzma
\
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_KERNEL_HEADERS_PATCH_DIR),y)
+ toolchain/patch-kernel.sh $(LINUX26_DIR) $(KERNEL_HEADERS_PATCH_DIR) \
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_PACKAGE_OPENSWAN),y)
+ toolchain/patch-kernel.sh $(LINUX_HEADERS_UNPACK_DIR) package/openswan
\
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ toolchain/patch-kernel.sh $(LINUX26_DIR) $(LINUX26_PATCH_DIR)
linux-$(LINUX26_VERSION)\*.patch
touch $@
-endif # ($(LINUX26_VERSION),$(LINUX_HEADERS_VERSION))

$(LINUX26_DIR)/.configured: $(LINUX26_DIR)/.patched $(LINUX26_KCONFIG)
cp -dpf $(LINUX26_KCONFIG) $(LINUX26_DIR)/.config

Best Regards
Ulf Samuelsson

-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-bsp.patch
Type: text/x-patch
Size: 5155 bytes
Desc: not available
Url : http://busybox.net/lists/buildroot/attachments/20070820/f89b5bb9/attachment-0001.bin

#9 lore raw

[Buildroot] [RFC] Building linux kernel in $(PROJECT_BUILD_DIR)

Quoted 84 lines · Ulf Samuelsson

Proposed fix to allow each project to build its own linux kernel in $(PROJECT_BUILD_DIR) == project_build_dir/<project>

Basic approach is to unpack the linux header source in "$(TOOL_BUILD_DIR)" instead of in "$(BUILD_DIR)"
Patches are applied (some depending on BR2_<xxx>) as in current trunk,

Each board can add additional patches by defining KERNEL_HEADERS_PATCH_DIR to point at the directory with additional patches (That patch just applied to get rid of AVR32 patches in toolchain/kernel-headers).

Headers are still installed in "$(TOOL_BUILD_DIR)/linux" The kernel-headers source tree is unpacked once per toolchain.

The target/linux build (modules and kernel) will unpack a second linux source tree in "$(PROJECT_BUILD_DIR)". This source tree is generated once per *project*.

Since this is a fresh unpack, the same patches as were applied to the kernel-headers are applied to "$(PROJECT_BUILD_DIR)/linux-*".

A common linux source tree for all projects is not possible, since different boards can require different patches to be applied. There is a significant risk that the linux build breaks if patches for one project are applied on top of patches for another project in the same source tree.

With a single source, you therefore will have to remove the linux source tree each time you work on a new project.
With a separate source, you can move between projects without removing the linux source directory.

The patch is also include it as an attachement, due to linewrap.

Tested this on x86/Atmel targets.

Comments?

Index: toolchain/kernel-headers/kernel-headers-new.makefile
===================================================================
--- toolchain/kernel-headers/kernel-headers-new.makefile (revision
19588)
+++ toolchain/kernel-headers/kernel-headers-new.makefile (arbetskopia)

(quoted diff) +0 -0
@@ -13,7 +13,7 @@

LINUX_HEADERS_SITE:=http://www.kernel.org/pub/linux/kernel/v2.6/ LINUX_HEADERS_SOURCE:=linux-$(LINUX_HEADERS_VERSION).tar.bz2 LINUX_HEADERS_CAT:=$(BZCAT)

(quoted diff) +1 -1
-LINUX_HEADERS_UNPACK_DIR:=$(BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
+LINUX_HEADERS_UNPACK_DIR:=

$(TOOL_BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
LINUX_HEADERS_IS_KERNEL=y
endif

(quoted diff) +0 -0
@@ -28,7 +28,7 @@

LINUX_HEADERS_SITE:=http://www.kernel.org/pub/linux/kernel/v2.6/ LINUX_HEADERS_SOURCE:=linux-$(LINUX_HEADERS_VERSION).tar.bz2 LINUX_HEADERS_CAT:=$(BZCAT)

(quoted diff) +1 -1
-LINUX_HEADERS_UNPACK_DIR:=$(BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
+LINUX_HEADERS_UNPACK_DIR:=

$(TOOL_BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
LINUX_HEADERS_IS_KERNEL=y
endif

(quoted diff) +0 -0
@@ -43,7 +43,7 @@

LINUX_HEADERS_SITE:=http://www.kernel.org/pub/linux/kernel/v2.6/ LINUX_HEADERS_SOURCE:=linux-$(LINUX_HEADERS_VERSION).tar.bz2 LINUX_HEADERS_CAT:=$(BZCAT)

(quoted diff) +1 -1
-LINUX_HEADERS_UNPACK_DIR:=$(BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
+LINUX_HEADERS_UNPACK_DIR:=

$(TOOL_BUILD_DIR)/linux-$(LINUX_HEADERS_VERSION)
LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
LINUX_HEADERS_IS_KERNEL=y
endif

(quoted diff) +0 -0
@@ -56,8 +56,8 @@

$(LINUX_HEADERS_UNPACK_DIR)/.unpacked:
$(DL_DIR)/$(LINUX_HEADERS_SOURCE)

	@echo "*** Using kernel-headers generated from kernel source"
	rm -rf $(LINUX_HEADERS_DIR)
(quoted diff) +0 -2
-	[ -d $(BUILD_DIR) ] || $(INSTALL) -d $(BUILD_DIR)
-	$(LINUX_HEADERS_CAT) $(DL_DIR)/$(LINUX_HEADERS_SOURCE) | tar -C

$(BUILD_DIR) $(TAR_OPTIONS) -

Review

Quoted 1 line
(quoted diff) +1 -0
+	[ -d $(TOOL_BUILD_DIR) ] || $(INSTALL) -d $(TOOL_BUILD_DIR)

I think that the TOOL_BUILD_DIR will already exist now.
To verify, set BR2_JLEVEL=1 and execute a toplevel
make -j 64
If it is not yet created at this stage, just adding a dependency to that dir should be sufficient (we already have a rule for it, IIRC).

Quoted 82 lines
(quoted diff) +1 -0
+	$(LINUX_HEADERS_CAT) $(DL_DIR)/$(LINUX_HEADERS_SOURCE) | tar -C

$(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
touch $@

$(LINUX_HEADERS_UNPACK_DIR)/.patched:
$(LINUX_HEADERS_UNPACK_DIR)/.unpacked
Index: toolchain/kernel-headers/kernel-headers.mk
===================================================================

kernel-headers/kernel-headers.mk +0 -0
@@ -37,5 +37,6 @@
 

kernel-headers-dirclean:

	rm -rf $(LINUX_HEADERS_DIR)
kernel-headers/kernel-headers.mk +1 -0
+	rm -rf $(LINUX_HEADERS_UNPACK_DIR)

.PHONY: kernel-headers
Index: target/linux/Makefile.in
===================================================================

linux/Makefile.in +0 -0
@@ -68,7 +68,7 @@

endif

# Version of Linux AFTER patches

linux/Makefile.in +1 -1
-LINUX26_DIR=$(BUILD_DIR)/linux-$(LINUX26_VERSION)
+LINUX26_DIR=$(PROJECT_BUILD_DIR)/linux-$(LINUX26_VERSION)
# for packages that need it
LINUX_VERSION:=$(LINUX_VERSION)
linux/Makefile.in +1 -0
@@ -76,7 +76,9 @@
 LINUX_KERNEL=$(LINUX26_KERNEL)
 
 # kernel patches
+ifeq ($(strip $(LINUX26_PATCH_DIR)),)

LINUX26_PATCH_DIR=$(BR2_BOARD_PATH)/kernel-patches/ +endif
__LINUX26_NO_PIC=-fPIC -fpic -DPIC

LINUX26_MAKE_FLAGS = HOSTCC="$(HOSTCC)" HOSTCFLAGS=$(HOSTCFLAGS) \
	ARCH=$(KERNEL_ARCH) \
linux/Makefile.in +0 -0
@@ -96,20 +98,38 @@
 ifneq ($(strip $(LINUX26_VERSION)),$(strip $(LINUX_HEADERS_VERSION)))

$(DL_DIR)/$(LINUX26_SOURCE):

	 $(WGET) -P $(DL_DIR) $(LINUX26_SITE)/$(LINUX26_SOURCE)

+endif # ($(LINUX26_VERSION),$(LINUX_HEADERS_VERSION))

$(LINUX26_DIR)/.unpacked: $(DL_DIR)/$(LINUX26_SOURCE)

	rm -rf $(LINUX26_DIR)
linux/Makefile.in +0 -1
-	$(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C $(BUILD_DIR)

$(TAR_OPTIONS) -

linux/Makefile.in +1 -0
+	$(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C

$(PROJECT_BUILD_DIR) $(TAR_OPTIONS) -
ifneq ($(DOWNLOAD_LINUX26_VERSION),$(LINUX26_VERSION))
# Rename the dir from the downloaded version to the AFTER patch
version

linux/Makefile.in +1 -1
-	mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION) $(LINUX26_DIR)
+	mv -f $(PROJECT_BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION)

$(LINUX26_DIR)
endif
touch $@

$(LINUX26_DIR)/.patched: $(LINUX26_DIR)/.unpacked

linux/Makefile.in +4 -1
-	toolchain/patch-kernel.sh $(LINUX26_DIR) $(LINUX26_PATCH_DIR) \*.patch
+	toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers \
+		linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+ifeq ($(BR2_KERNEL_HEADERS_IPMI),y)
+	toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers/ipmi

\

linux/Makefile.in +4 -0
+		linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_KERNEL_HEADERS_LZMA),y)
+	toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers/lzma

\

linux/Makefile.in +8 -0
+		linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_KERNEL_HEADERS_PATCH_DIR),y)
+	toolchain/patch-kernel.sh $(LINUX26_DIR) $(KERNEL_HEADERS_PATCH_DIR) \
+		linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_PACKAGE_OPENSWAN),y)
+	toolchain/patch-kernel.sh $(LINUX_HEADERS_UNPACK_DIR) package/openswan

\

linux/Makefile.in

Quoted 3 lines
linux/Makefile.in +3 -0
+		linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+	toolchain/patch-kernel.sh $(LINUX26_DIR) $(LINUX26_PATCH_DIR)

Hardcoding these is very, very ugly.

Quoted 7 lines

linux-$(LINUX26_VERSION)\*.patch
touch $@
-endif # ($(LINUX26_VERSION),$(LINUX_HEADERS_VERSION))

$(LINUX26_DIR)/.configured: $(LINUX26_DIR)/.patched $(LINUX26_KCONFIG)

	cp -dpf $(LINUX26_KCONFIG) $(LINUX26_DIR)/.config

Did you test this with the old, deprecated headers, with new headers == src and new-headers != src ?

If so, then please apply with abovementioned fix for the mkdir.

thanks,