X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/7c79debf2cb44333e52025ee5b276c2c5d2c99c0..d38e13b12b10060e210d7c5ace366cc82eaf9da9:/include/kernel-build.mk diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 665f0ff74..06f4ce772 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -4,6 +4,7 @@ # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # +include $(INCLUDE_DIR)/host.mk -include $(INCLUDE_DIR)/modules-$(KERNEL).mk LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2 @@ -17,6 +18,15 @@ KERNEL_IPKG:=$(KERNEL_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEAS TARGETS += $(KERNEL_IPKG) INSTALL_TARGETS += $(KERNEL_IPKG) +LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \ + -e 's/mipsel/mips/' \ + -e 's/mipseb/mips/' \ + -e 's/powerpc/ppc/' \ + -e 's/sh[234]/sh/' \ + -e 's/armeb/arm/' \ +) + + $(TARGETS): $(PACKAGE_DIR) $(PACKAGE_DIR): @@ -28,7 +38,7 @@ $(DL_DIR)/$(LINUX_SOURCE): $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) -mkdir -p $(KERNEL_BUILD_DIR) - bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS) - + bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS) touch $@ ifeq ($(KERNEL),2.4) @@ -63,7 +73,7 @@ else endif $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.linux-compile pkg-install ramdisk-config - $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) + $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) $(KERNELNAME) $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@ @@ -71,8 +81,8 @@ $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux $(LINUX_DIR)/.modules_done: rm -rf $(KERNEL_BUILD_DIR)/modules - $(MAKE) -C "$(LINUX_DIR)" CC="$(KERNEL_CC)" CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) modules - $(MAKE) -C "$(LINUX_DIR)" CC="$(KERNEL_CC)" CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) DEPMOD=true INSTALL_MOD_PATH=$(KERNEL_BUILD_DIR)/modules modules_install + $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) modules + $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) DEPMOD=true INSTALL_MOD_PATH=$(KERNEL_BUILD_DIR)/modules modules_install touch $(LINUX_DIR)/.modules_done modules: $(LINUX_DIR)/.modules_done @@ -82,7 +92,6 @@ $(LINUX_DIR)/.linux-compile: @rm -f $(BUILD_DIR)/linux ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux @$(MAKE) modules - @$(MAKE) packages touch $@ $(KERNEL_IPKG): @@ -99,6 +108,7 @@ $(TOPDIR)/.kernel.mk: $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL)/Makefile echo "CONFIG_KERNEL:=$(KERNEL)" >> $@ echo "CONFIG_LINUX_VERSION:=$(LINUX_VERSION)" >> $@ echo "CONFIG_LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@ + echo "CONFIG_LINUX_KARCH:=$(LINUX_KARCH)" >> $@ pkg-install: FORCE @for pkg in $(INSTALL_TARGETS); do \ @@ -110,6 +120,7 @@ prepare: $(LINUX_DIR)/.configured @mkdir -p $(LINUX_DIR) $(PACKAGE_DIR) compile: prepare $(LINUX_DIR)/.linux-compile + @$(MAKE) packages install: compile $(LINUX_KERNEL)