1 -include $(INCLUDE_DIR)/modules-$(KERNEL).mk
3 LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
4 LINUX_SITE=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
5 http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
6 http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
7 http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
9 KERNEL_IDIR:=$(KERNEL_BUILD_DIR)/kernel-ipkg
10 KERNEL_IPKG:=$(KERNEL_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk
11 INSTALL_TARGETS += $(KERNEL_IPKG)
13 $(TARGETS): $(PACKAGE_DIR)
21 $(DL_DIR)/$(LINUX_SOURCE):
23 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
25 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
26 -mkdir -p $(KERNEL_BUILD_DIR)
27 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS) -
31 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
32 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
33 $(LINUX_DIR)/Makefile \
34 $(LINUX_DIR)/arch/*/Makefile
35 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
36 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/compile.h include/linux/version.h
39 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
40 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) dep
43 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
45 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
46 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) oldconfig prepare scripts
50 ramdisk-config: $(LINUX_DIR)/.configured FORCE
51 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
52 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
53 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
54 echo 'CONFIG_INITRAMFS_SOURCE="../../root"' >> $(LINUX_DIR)/.config
55 echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config
56 echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config
57 mkdir -p $(BUILD_DIR)/root/etc/init.d
58 $(CP) ../generic-2.6/files/init $(BUILD_DIR)/root/
60 rm -f $(BUILD_DIR)/root/init $(BUILD_DIR)/root/etc/init.d/S00initramfs
61 echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
64 $(LINUX_DIR)/vmlinux: $(STAMP_DIR)/.linux-compile pkg-install ramdisk-config
65 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH)
67 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
68 $(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
69 touch -c $(LINUX_KERNEL)
71 $(LINUX_DIR)/.modules_done:
72 rm -rf $(KERNEL_BUILD_DIR)/modules
73 $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH="$(TARGET_PATH)" modules
74 $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" DEPMOD=true INSTALL_MOD_PATH=$(KERNEL_BUILD_DIR)/modules modules_install
75 touch $(LINUX_DIR)/.modules_done
77 $(STAMP_DIR)/.linux-compile:
78 @$(MAKE) $(LINUX_DIR)/.modules_done $(TARGETS) $(KERNEL_IPKG)
79 ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
84 mkdir -p $(KERNEL_IDIR)/etc
85 $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH)
86 if [ -f ./config/$(BOARD).modules ]; then \
87 cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
89 $(IPKG_BUILD) $(KERNEL_IDIR) $(KERNEL_BUILD_DIR)
92 echo "BOARD:=$(BOARD)" > $@
93 echo "LINUX_VERSION:=$(LINUX_VERSION)" >> $@
94 echo "LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@
97 @{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG) install $(INSTALL_TARGETS) || true; }
99 source: $(DL_DIR)/$(LINUX_SOURCE)
100 prepare: $(LINUX_DIR)/.configured
101 @mkdir -p $(STAMP_DIR) $(PACKAGE_DIR)
103 compile: prepare $(STAMP_DIR)/.linux-compile
105 install: compile $(LINUX_KERNEL)
108 rm -f $(STAMP_DIR)/.linux-compile
109 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
110 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
111 $(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
112 rm -f $(LINUX_KERNEL)
116 if [ -f $(LINUX_KERNEL) ]; then \
119 $(MAKE) compile $(MAKE_TRACE)
122 rm -f $(STAMP_DIR)/.linux-compile
123 rm -rf $(KERNEL_BUILD_DIR)