minor changes
[openwrt.git] / obsolete-buildroot / make / linux.mk
1 #############################################################
2 #
3 # Linux kernel targets
4 #
5 # Note: If you have any patches to apply, create the directory
6 # sources/kernel-patches and put your patches in there and number
7 # them in the order you wish to apply them... i.e.
8 #
9 # sources/kernel-patches/001-my-special-stuff.bz2
10 # sources/kernel-patches/003-gcc-Os.bz2
11 # sources/kernel-patches/004_no-warnings.bz2
12 # sources/kernel-patches/030-lowlatency-mini.bz2
13 # sources/kernel-patches/031-lowlatency-fixes-5.bz2
14 # sources/kernel-patches/099-shutup.bz2
15 # etc...
16 #
17 # these patches will all be applied by the patch-kernel.sh
18 # script (which will also abort the build if it finds rejects)
19 # -Erik
20 #
21 #############################################################
22 ifneq ($(filter $(TARGETS),linux),)
23
24 # Version of Linux to download and then apply patches to
25 DOWNLOAD_LINUX_VERSION=2.4.25
26 # Version of Linux AFTER patches
27 LINUX_VERSION=2.4.26-pre5-erik
28
29 LINUX_FORMAT=bzImage
30 #LINUX_FORMAT=images/zImage.prep
31 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
32 -e 's/mipsel/mips/' \
33 -e 's/powerpc/ppc/' \
34 -e 's/sh[234]/sh/' \
35 )
36 LINUX_BINLOC=arch/$(LINUX_KARCH)/boot/$(LINUX_FORMAT)
37
38 LINUX_DIR=$(BUILD_DIR)/linux-$(LINUX_VERSION)
39 LINUX_SOURCE=linux-$(DOWNLOAD_LINUX_VERSION).tar.bz2
40 LINUX_SITE=ftp://ftp.kernel.org/pub/linux/kernel/v2.4
41 LINUX_KCONFIG=$(SOURCE_DIR)/linux.config
42 LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel
43 # Used by pcmcia-cs and others
44 LINUX_SOURCE_DIR=$(LINUX_DIR)
45
46
47 $(DL_DIR)/$(LINUX_SOURCE):
48 $(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE)
49
50 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
51 mkdir -p $(LINUX_DIR) $(TOOL_BUILD_DIR)
52 rm -rf $(LINUX_DIR)
53 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf -
54 ifneq ($(DOWNLOAD_LINUX_VERSION),$(LINUX_VERSION))
55 # Rename the dir from the downloaded version to the AFTER patch version
56 mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX_VERSION) $(BUILD_DIR)/linux-$(LINUX_VERSION)
57 endif
58 mkdir -p $(SOURCE_DIR)/kernel-patches
59 $(SOURCE_DIR)/patch-kernel.sh $(LINUX_DIR) $(SOURCE_DIR)/kernel-patches
60 -(cd $(TOOL_BUILD_DIR); ln -sf $(LINUX_DIR) linux)
61 touch $(LINUX_DIR)/.unpacked
62
63 $(LINUX_KCONFIG):
64 @if [ ! -f "$(LINUX_KCONFIG)" ] ; then \
65 echo ""; \
66 echo "You should create a .config for your kernel"; \
67 echo "and install it as $(LINUX_KCONFIG)"; \
68 echo ""; \
69 sleep 5; \
70 fi;
71
72 $(LINUX_DIR)/.configured $(BUILD_DIR)/linux/.configured: $(LINUX_DIR)/.unpacked $(LINUX_KCONFIG)
73 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/Makefile
74 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
75 $(MAKE) -C $(LINUX_DIR) oldconfig include/linux/version.h
76 touch $(LINUX_DIR)/.configured
77
78 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
79 $(MAKE) -C $(LINUX_DIR) dep
80 touch $(LINUX_DIR)/.depend_done
81
82 $(LINUX_DIR)/$(LINUX_BINLOC): $(LINUX_DIR)/.depend_done
83 $(MAKE) -C $(LINUX_DIR) $(LINUX_FORMAT)
84 $(MAKE) -C $(LINUX_DIR) modules
85
86 $(LINUX_KERNEL): $(LINUX_DIR)/$(LINUX_BINLOC)
87 cp -fa $(LINUX_DIR)/$(LINUX_BINLOC) $(LINUX_KERNEL)
88 touch -c $(LINUX_KERNEL)
89
90 $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/modules.dep: $(LINUX_KERNEL)
91 rm -rf $(TARGET_DIR)/lib/modules
92 rm -f $(TARGET_DIR)/sbin/cardmgr
93 $(MAKE) -C $(LINUX_DIR) INSTALL_MOD_PATH=$(TARGET_DIR) modules_install
94 (cd $(TARGET_DIR)/lib/modules; ln -s $(LINUX_VERSION)/kernel/drivers .)
95
96 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
97 mkdir -p $(STAGING_DIR)/include
98 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
99 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
100
101 linux: $(STAGING_DIR)/include/linux/version.h $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/modules.dep
102
103 linux-source: $(DL_DIR)/$(LINUX_SOURCE)
104
105 # This has been renamed so we do _NOT_ by default run this on 'make clean'
106 linuxclean: clean
107 rm -f $(LINUX_KERNEL)
108 -$(MAKE) -C $(LINUX_DIR) clean
109
110 linux-dirclean:
111 rm -rf $(LINUX_DIR)
112
113 endif
This page took 0.055497 seconds and 5 git commands to generate.