summaryrefslogtreecommitdiffstats
path: root/make/kernel-headers.mk
diff options
context:
space:
mode:
Diffstat (limited to 'make/kernel-headers.mk')
-rw-r--r--make/kernel-headers.mk63
1 files changed, 63 insertions, 0 deletions
diff --git a/make/kernel-headers.mk b/make/kernel-headers.mk
new file mode 100644
index 000000000..7eebee821
--- /dev/null
+++ b/make/kernel-headers.mk
@@ -0,0 +1,63 @@
+#############################################################
+#
+# Setup the kernel headers. I include a generic package of
+# kernel headers here, so you shouldn't need to include your
+# own. Be aware these kernel headers _will_ get blown away
+# by a 'make clean' so don't put anything sacred in here...
+#
+#############################################################
+ifneq ($(filter $(TARGETS),kernel-headers),)
+
+LINUX_SITE:=http://www.uclibc.org/downloads/toolchain
+LINUX_SOURCE:=kernel-headers-2.4.21.tar.bz2
+LINUX_DIR:=$(BUILD_DIR)/linux
+
+LINUX_DIR=$(BUILD_DIR)/linux
+# Used by pcmcia-cs and others
+LINUX_SOURCE_DIR=$(LINUX_DIR)
+
+$(DL_DIR)/$(LINUX_SOURCE):
+ $(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE)
+
+$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
+ bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf -
+ touch $(LINUX_DIR)/.unpacked
+
+$(LINUX_DIR)/.configured: $(LINUX_DIR)/.unpacked
+ rm -f $(LINUX_DIR)/include/asm
+ @if [ "$(ARCH)" = "powerpc" ];then \
+ (cd $(LINUX_DIR)/include; ln -fs asm-ppc$(NOMMU) asm;) \
+ elif [ "$(ARCH)" = "mips" ];then \
+ (cd $(LINUX_DIR)/include; ln -fs asm-mips$(NOMMU) asm;) \
+ elif [ "$(TARGET_ARCH)" = "mipsel" ];then \
+ (cd $(LINUX_DIR)/include; ln -fs asm-mips$(NOMMU) asm;) \
+ elif [ "$(ARCH)" = "arm" ];then \
+ (cd $(LINUX_DIR)/include; ln -fs asm-arm$(NOMMU) asm; \
+ cd asm; \
+ if [ ! -L proc ] ; then \
+ ln -fs proc-armv proc; \
+ ln -fs arch-ebsa285 arch; fi); \
+ elif [ "$(ARCH)" = "cris" ];then \
+ (cd $(LINUX_DIR)/include; ln -fs asm-cris asm;) \
+ else \
+ (cd $(LINUX_DIR)/include; ln -fs asm-$(ARCH)$(NOMMU) asm;) \
+ fi
+ touch $(LINUX_DIR)/include/linux/autoconf.h;
+ echo "#define UTS_RELEASE \"2.4.21\"" > $(LINUX_DIR)/include/linux/version.h;
+ echo "#define LINUX_VERSION_CODE 132117" >> $(LINUX_DIR)/include/linux/version.h;
+ echo "#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))" >> \
+ $(LINUX_DIR)/include/linux/version.h;
+ touch $(LINUX_DIR)/.configured
+
+$(LINUX_KERNEL): $(LINUX_DIR)/.configured
+
+system-linux: $(LINUX_DIR)/.configured
+
+system-linux-clean: clean
+ rm -f $(LINUX_KERNEL)
+ rm -rf $(LINUX_DIR)
+
+system-linux-dirclean:
+ rm -rf $(LINUX_DIR)
+
+endif