/[kernel]/branches/kernel-image-2.6.11/Makefile
ViewVC logotype

Contents of /branches/kernel-image-2.6.11/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3204 - (hide annotations) (download)
Sat May 21 01:32:51 2005 UTC (8 years, 1 month ago) by jurij-guest
Original Path: branches/kernel-image-2.6.11/debian/rules.subarch
File size: 6477 byte(s)
Implemented arch/subarch-specific patches and
updated README and TODO files accordingly.
1 jurij-guest 3146 #
2     # This Makefile executes the unpack/build/binary targets for a single
3     # subarch, which is passed in the subarch variable. Empty subarch
4     # variable means that we are building for an arch without the subarch.
5     # Additionally, variables version, abiname and ktver are
6     # expected to be available (need to be exported from the parent process).
7     # It is possible to override the flavours by setting the flavours
8     # variable.
9     #
10     SHELL := sh -e
11     debver := $(version)-$(abiname)
12     uver := $(subst .,_,$(version))
13     debnum := -$(abiname)
14     kbpkg := kernel-kbuild-$(version)-$(abiname)
15 jurij-guest 3204 # This will eventually have to be changed to a command, applying
16     # the debian's patches from the local tree (arch/patches?)
17 jurij-guest 3146 kpatch := /usr/src/kernel-patches/all/$(version)/apply/debian $(version)-$(ktver)
18     DEBIAN_UPSTREAM_VERSION := $(version)
19     ifeq (,$(DEB_HOST_ARCH))
20     DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
21     DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
22     endif
23     export version debnum DEBIAN_UPSTREAM_VERSION
24    
25 jurij-guest 3198 karch := $(DEB_HOST_ARCH)
26     #
27     # Build the list of common config files to be included
28     #
29 jurij-guest 3146 ifeq ($(subarch),none)
30     basedir := arch/$(karch)
31 jurij-guest 3203 append :=
32 jurij-guest 3146 else
33     basedir := arch/$(karch)/$(subarch)
34 jurij-guest 3203 append := -$(subarch)
35 jurij-guest 3146 endif
36 jurij-guest 3198 default := $(basedir)/config.default
37     configs := $(notdir $(wildcard $(basedir)/config.*))
38     configs := $(filter-out config.common config.default, $(configs))
39     tkdir := kernel-source-$(version)
40     kdir := kernel-source-$(version)-$(subarch)
41 jurij-guest 3146 ifndef flavours
42     flavours := $(patsubst config.%,%,$(configs))
43     endif
44     build_prefix := build-$(subarch)-
45 jurij-guest 3203
46 jurij-guest 3146 -include $(basedir)/Makefile.inc
47 jurij-guest 3203
48 jurij-guest 3146 #
49     # Here we construct the command lines for different make-kpkg
50     # calls (build, kernel-image, kernel-headers) based on the values
51     # of variables defined so far and provided by the arch/subarch
52     # in Makefile.inc. Note that $$i in these expressions is going to
53     # become a reference to the shell variable $i, which is expected
54     # to have the current flavour. This is slightly evil, but saves
55     # a lot of grief.
56     #
57     kpkg_headers_cmd := HEADER_CLEAN_HOOK='$(CURDIR)/header-install-$(subarch)'
58 jurij-guest 3203 kpkg_headers_cmd += make-kpkg --append-to-version $(debnum)$(append)
59 jurij-guest 3146 kpkg_build_cmd := make-kpkg --append-to-version $(debnum)-$$i
60     ifdef added_patches
61     kpkg_headers_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches))
62     kpkg_build_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches))
63     endif
64     ifdef build_subarch
65     kpkg_build_cmd += --subarch $$i
66     endif
67     ifdef headers_subarch
68     kpkg_headers_cmd += --subarch $(headers_subarch)
69     endif
70     ifdef build_makeflags
71     kpkg_build_cmd := MAKEFLAGS=$(build_makeflags) $(kpkg_build_cmd)
72     endif
73     kpkg_image_cmd := $(kpkg_build_cmd) --initrd kernel_image
74     kpkg_build_cmd += build
75     kpkg_headers_cmd += kernel-headers
76     ifndef headers_dirs
77     headers_dirs = $(karch)
78     endif
79 jurij-guest 3198 ifneq (no,$(include_common_config))
80     ccommon := arch/config.common
81     endif
82     ccommon += arch/$(karch)/config.common arch/$(karch)/$(subarch)/config.common
83 jurij-guest 3201 bdirs := $(addprefix build-$(subarch)-, $(flavours))
84 jurij-guest 3146 #
85     # TODO:
86     # * Check that make oldconfig does not actually
87     # change the config file. If it does, something
88     # is wrong (missing/extra options, etc).
89     #
90     unpack: unpack-stamp-$(subarch)
91 jurij-guest 3201 unpack-stamp-$(subarch): $(configs) header-install-$(subarch) $(bdirs)
92     # We remove the configs just in case
93 jurij-guest 3146 rm -f $(configs)
94     touch unpack-stamp-$(subarch)
95     #
96     # TODO:
97     # * Implement optional stripping of the kernel
98     # (for sparc).
99     # * Check that it is really ok to call --subarch
100     # with the name of the flavour. For mips which
101     # is another --subarch user it should be fine.
102     #
103     build: build-stamp-$(subarch)
104     build-stamp-$(subarch): unpack-stamp-$(subarch)
105     dh_testdir
106     PATH=$$PWD/bin:$$PATH; \
107     for i in $(flavours); do \
108     cd build-$(subarch)-$$i; \
109     $(kpkg_build_cmd); \
110     cd ..; \
111     done
112     touch build-stamp-$(subarch)
113    
114     binary-indep: build
115     binary-arch: build
116     dh_testdir
117     dh_clean -k
118     dh_installdirs
119    
120     cd $(kdir); $(kpkg_headers_cmd)
121     #
122     # Hmm, is it right to just cat all the debian/files
123     # together? Need to check it out...
124     #
125     cat $(kdir)/debian/files >> debian/files
126    
127     for i in $(flavours); do \
128     cp -al build-$(subarch)-$$i install-$$i; \
129     cd install-$$i; \
130     $(kpkg_image_cmd); \
131     cd ..; \
132     cat install-$$i/debian/files >> debian/files; \
133     rm -rf install-$$i ; \
134     done
135     mv *.deb ..
136    
137     binary: binary-indep binary-arch
138    
139     header-install-$(subarch): header-install.in
140     sed -e 's,@kbpkg@,$(kbpkg),g' \
141     -e 's,@ksource_dir@,$(CURDIR)/$(kdir),g' \
142     -e 's,@headers_dirs@,$(headers_dirs),g' \
143     -e 's,@headers_extra@,$(headers_extra),g' \
144     header-install.in > header-install-$(subarch)
145     chmod u+x header-install-$(subarch)
146 jurij-guest 3198 #
147     # The way to make the correct package names is to make a
148     # subarch-specific post-install script...
149     #
150 jurij-guest 3203 post-install-$(subarch): post-install.in
151 jurij-guest 3146 sed -e 's,@initrd_modules@,$(initrd_modules),' \
152 jurij-guest 3203 -e 's,@append_subarch@,$(append),' \
153     post-install.in > post-install-$(subarch)
154 jurij-guest 3146 #
155     # Generates the kernel config file for a subarch by merging
156     # the arch-independent config file (arch/config.common),
157     # arch-specific config file (arch/$(karch)/config.common),
158     # and subarch specific one (arch/$(karch)/config.subarch).
159     # It is possible to avoid the inclusion of the arch-indep
160     # config file by setting include_common_config = no in the
161 jurij-guest 3198 # arch/$(karch)/Makefile.inc.
162 jurij-guest 3146 #
163     config.%:
164 jurij-guest 3198 @echo "Generating configuration file $@:"
165     rm -f $@
166     for i in $(ccommon); do \
167     if [ -f $${i} ]; then \
168     cat $${i} >> $@; \
169     fi; \
170     done
171     # Flavour config file must be present
172     cat $(basedir)/$@ >> $@
173 jurij-guest 3146 #
174     # TODO: subarch specific patches
175     #
176 jurij-guest 3203 $(kdir): post-install-$(subarch)
177 jurij-guest 3146 dh_testdir
178     tar jxf /usr/src/$(tkdir).tar.bz2
179     mkdir -p $(tkdir)/debian
180     cp debian/changelog $(tkdir)/debian
181     cp debian/control $(tkdir)/debian
182     cp debian/copyright $(tkdir)/debian
183     cp $(default) $(tkdir)/.config
184     touch $(tkdir)/debian/official
185 jurij-guest 3203 install post-install-$(subarch) $(tkdir)/debian/post-install
186 jurij-guest 3146 cd $(tkdir) && $(kpatch)
187 jurij-guest 3204 # Arch/subarch-specific patches
188     if [ -d $(basedir)/patches ] && \
189     [ -s $(basedir)/patches/list ]; then \
190     cd $(tkdir); \
191     for i in $$(cat ../$(basedir)/patches/list); do \
192     patch -p1 < ../$(basedir)/patches/$${i}; \
193     done; \
194     fi
195 jurij-guest 3146 mv $(tkdir) $@
196    
197 jurij-guest 3201 build-%: $(kdir)
198     if [ ! -d $@ ]; then \
199     cp -al $(kdir) $@; \
200     cp config.$(subst build-$(subarch)-,,$@) $@/.config; \
201     fi
202    
203 jurij-guest 3146 .PHONY: build unpack binary-indep binary-arch binary

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5