source: trunk/kernel/make.d/kernel.rul @ 562

Last change on this file since 562 was 562, checked in by dennis, 8 years ago

Merged branch/1.5 to trunk

  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1#
2#   vi: filetype=make:
3#
4#   2004.07.26  Brian Elliott Finley
5#   - added perl bit to change EXTRAVERSION automatically.
6#   2004.10.08  Brian Elliott Finley
7#   - add bit for yellow dog linux (YDL) kernel
8#   2005.07.12  Brian Elliott Finley
9#       - upgrade kernel version for x86_64 and ia64 to 2.6.10
10#         patch submitted by Erich Focht
11#
12# SVN Info:
13#       $Id: kernel.rul 562 2013-04-18 07:45:10Z dennis $
14#       $URL: https://subtrac.sara.nl/oss/svn/sali/trunk/make.d/kernel.rul $
15
16ifeq ($(ARCH),i386)
17        LINUX_VERSION = 3.1.4
18        LINUX_IMAGE = $(LINUX_DIR)/arch/i386/boot/bzImage
19        LINUX_TARGET = bzImage
20endif
21
22ifeq ($(ARCH),x86_64)
23        LINUX_VERSION = 3.8.2
24        LINUX_IMAGE = $(LINUX_DIR)/arch/x86_64/boot/bzImage
25        LINUX_TARGET = bzImage
26endif
27
28ifeq ($(ARCH),ppc64)
29        LINUX_VERSION = 2.6.36.4
30        LINUX_IMAGE = $(LINUX_DIR)/arch/powerpc/boot/zImage
31        LINUX_TARGET = zImage
32endif
33
34LINUX_DIR               := $(SRC_DIR)/linux-$(LINUX_VERSION)
35LINUX_TARBALL   := linux-$(LINUX_VERSION).tar.bz2
36LINUX_URL               := ftp://ftp.sara.nl/pub/sali/sources/$(LINUX_TARBALL)
37LINUX_INFO              := http://kernel.org
38LINUX_FIRMWARE_GIT := http://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
39
40LINUX_CONFIG    := $(KERNEL_PATCH_DIR)/linux.$(ARCH).config
41
42## names for kernel patch files can be of 2 forms:
43##  1) patches that apply to all architectures
44##       linux.all.XX<name>.patch
45##  2) patch applies to a subset of arches
46##    linux.<arch1>,<arch2>,...,<archN>.XX<name>.patch
47LINUX_PATCHES = $(sort $(shell find $(KERNEL_PATCH_DIR) \
48                                    -name "linux.$(ARCH).*.patch" -o \
49                                    -name "linux.all.*.patch" -o \
50                                    -name "linux.$(ARCH),*.*.patch" -o \
51                                    -name "linux.*,$(ARCH),*.*.patch" -o \
52                                    -name "linux.*,$(ARCH).*.patch"))
53ALL_SOURCE += $(SRC_DIR)/$(LINUX_TARBALL)
54
55PHONY += kernel_list_patches
56kernel_list_patches:
57        @echo $(LINUX_PATCHES)
58
59# install the kernel that autoinstall clients will boot from during
60# autoinstallation
61PHONY += install_kernel
62install_kernel: $(LINUX_IMAGE)
63        mkdir -p $(BOOT_BIN_DEST)
64        $(SI_INSTALL) -m 644 $(LINUX_IMAGE) \
65            $(BOOT_BIN_DEST)/kernel
66        $(SI_INSTALL) -m 644 $(LINUX_CONFIG) \
67            $(BOOT_BIN_DEST)/config
68
69# build the kernel that autoinstall clients will boot from during
70# autoinstallation
71PHONY += kernel
72kernel: $(LINUX_IMAGE) modules
73
74$(LINUX_IMAGE): $(SRC_DIR)/patched_kernel-stamp
75        $(MAKE) -j$(NCPUS) -C $(LINUX_DIR) $(LINUX_TARGET)
76
77PHONY += patched_kernel-stamp
78patched_kernel-stamp:   $(SRC_DIR)/patched_kernel-stamp
79
80$(SRC_DIR)/patched_kernel-stamp:        $(SRC_DIR)/$(LINUX_TARBALL) \
81                                        $(LINUX_CONFIG) $(LINUX_PATCHES)
82        rm -rf $(LINUX_DIR)
83        @echo -n Extracting kernel source...
84        (cd $(SRC_DIR) && tar xjf $(LINUX_TARBALL))
85        @echo done
86        @echo -n Adding extra firmwares from git...
87        cd $(LINUX_DIR) && \
88          $(foreach patch, $(LINUX_PATCHES), \
89            echo -n Applying `basename $(patch)`... && cat $(patch) | patch -s -p1 && echo done. &&) /bin/true
90        cp -a $(LINUX_CONFIG) $(LINUX_DIR)/.config
91        perl -pi -e "s/^EXTRAVERSION =\s*(\S*)\s*\n/EXTRAVERSION = \1-sali_v$(VERSION)\n/" $(LINUX_DIR)/Makefile
92        $(MAKE) -C $(LINUX_DIR) oldconfig
93        touch $(SRC_DIR)/patched_kernel-stamp
94
95PHONY += get_kernel_source
96get_kernel_source:      $(SRC_DIR)/$(LINUX_TARBALL)
97
98$(SRC_DIR)/$(LINUX_TARBALL):
99        [ -d $(SRC_DIR) ] || mkdir -p $(SRC_DIR)
100        $(GETSOURCE) $(LINUX_URL) $(SRC_DIR)
101        (cd $(SRC_DIR) && git clone $(LINUX_FIRMWARE_GIT))
102        (rm -rf $(SRC_DIR)/linux-firmware/.git* $(SRC_DIR)/linux-firmware/Makefile)
103        (rm -rf $(SRC_DIR)/linux-firmware/usbdux/*dux)
104        (find $(SRC_DIR)/linux-firmware -name "*.asm" |xargs rm -rf)
105        (rm -rf $(SRC_DIR)/linux-firmware/WHENCE $(SRC_DIR)/linux-firmware/WHENCE* $(SRC_DIR)/linux-firmware/LICENCE.*)
106
107PHONY += modules
108modules:        $(SRC_DIR)/modules_build-stamp
109
110$(SRC_DIR)/modules_build-stamp: $(LINUX_IMAGE)
111        $(MAKE) -j$(NCPUS) -C $(LINUX_DIR) modules
112        touch $(SRC_DIR)/modules_build-stamp
113
114PHONY += kernel_clean
115kernel_clean:
116        rm -rf $(LINUX_DIR)
117        rm -f $(SRC_DIR)/patched_kernel-stamp
118        rm -f $(SRC_DIR)/modules_build-stamp
Note: See TracBrowser for help on using the repository browser.