4 WEEK := $(shell date +%Y%W)
5 RELEASE := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }')
6 REVISION := $(shell echo "$(RELEASE)" | sed 's/\(.*\)-maemo\(.*\)/.10bfs\2/')
7 EXTRAVERSION := EXTRAVERSION=-bfs4
10 FLASHER_PACKAGE := kernel-bfs-flasher
11 #SOURCE_PACKAGE := $(PACKAGE)-source
12 KERNEL_PACKAGE := $(PACKAGE)-bfs
13 BOOTIMG_PACKAGE := $(PACKAGE)-bfs-bootimg
14 MODULES_PACKAGE := $(PACKAGE)-bfs-modules
15 HEADERS_PACKAGE := $(PACKAGE)-bfs-headers
16 KBUILD_PACKAGE := $(PACKAGE)-bfs-kbuild
17 LIBC_PACKAGE := linux-kernel-bfs-headers
19 BUILDTMP := $(CURDIR)/debian/build
20 #KSRC := $(BUILDTMP)/$(PACKAGE)
22 export KBUILD_OUTPUT = $(BUILDTMP)
24 DEFCONFIG := rx51power_defconfig
25 KVER = $(shell cat $(BUILDTMP)/include/config/kernel.release 2> /dev/null)
26 ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
27 INCLUDE_HEADERS_ARCH = asm-$(ARCH) config linux
28 INCLUDE_HEADERS = asm-$(ARCH) linux acpi asm-generic crypto drm Kbuild keys math-emu media mtd net pcmcia rdma rxrpc scsi sound video xen
29 RM_SCRIPTS = bloat-o-meter show_delta
30 DEBUG_MODULES = oprofile.ko
33 ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
34 PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \
35 sed -e 's/.*parallel=\([0-9]\+\).*/\1/')
36 ifeq ($(DEB_BUILD_OPTIONS),$(PARALLEL_JOBS))
37 PARALLEL_JOBS := $(shell if [ -f /proc/cpuinfo ]; \
38 then echo `cat /proc/cpuinfo | grep 'processor' | wc -l`; \
41 NJOBS := -j$(PARALLEL_JOBS)
46 #$(MAKE) mrproper KBUILD_OUTPUT=$(CURDIR)
49 QUILT_PATCHES=debian/patches quilt push -a -q || test $$? = 2
50 cp debian/$(DEFCONFIG) arch/arm/configs/
52 uudecode debian/u-boot.bin.gz.b64 -o - | gunzip -dc > debian/u-boot.bin
53 dd if=debian/u-boot.bin of=debian/u-boot.pad bs=262144 count=1 conv=sync
54 cd $(KSRC) && $(MAKE) $(EXTRAVERSION) $(DEFCONFIG)
57 kernel-stamp: configure-stamp
58 echo "compile $(PRODUCT) kernel"
59 cd $(KSRC) && $(MAKE) $(NJOBS) $(EXTRAVERSION) zImage
60 mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n kernel-bfs -d $(BUILDTMP)/arch/arm/boot/zImage $(BUILDTMP)/arch/arm/boot/uImage
61 #cat /usr/lib/u-boot/u-boot.bin.0x38000/u-boot.bin.0x38000 $(BUILDTMP)/arch/arm/boot/uImage > debian/uImage
62 cat debian/u-boot.pad $(BUILDTMP)/arch/arm/boot/uImage > debian/uImage
65 modules-stamp: configure-stamp
66 echo "compile $(PRODUCT) kernel modules"
67 cd $(KSRC) && $(MAKE) $(NJOBS) $(EXTRAVERSION) modules
68 $(MAKE) -C $(KSRC) M=debian/joikuspot EXTRAVERSION=$(EXTRAVERSION) modules
71 modules-extra: configure-stamp
72 echo "compile $(PRODUCT) kernel EXTRA modules"
74 patch -p1 < $(CURDIR)/debian/modules-extra_config.patch && \
75 $(MAKE) $(EXTRAVERSION) oldconfig modules && \
76 patch -p1 -R < $(CURDIR)/debian/modules-extra_config.patch && \
77 $(MAKE) $(EXTRAVERSION) oldconfig
79 headers: kernel-stamp modules-stamp
87 -rm -f scripts/basic/{docproc,fixdep,hash} scripts/kconfig/mconf scripts/kconfig/*.o scripts/kconfig/lxdialog/*.o
88 rm -f modules/modversions.h modules/ksyms.ver debian/files conf.vars scripts/cramfs/cramfsck \
89 scripts/cramfs/mkcramfs applied_patches debian/buildinfo stamp-* .config* \
90 debian/$(FLASHER_PACKAGE).postinst debian/$(MODULES_PACKAGE).postinst debian/$(MODULES_PACKAGE).postrm
94 -rm debian/u-boot.bin debian/u-boot.pad debian/uImage
97 QUILT_PATCHES=debian/patches quilt pop -a -q -R || test $$? = 2
98 -rm arch/arm/configs/$(DEFCONFIG)
108 install -d -m 755 $(CURDIR)/debian/$(KERNEL_PACKAGE)/boot
109 fiasco-gen -o $(CURDIR)/debian/$(KERNEL_PACKAGE)/boot/zImage-$(RELEASE).fiasco -g \
110 -k debian/uImage -v $(RELEASE)
111 # -k $(BUILDTMP)/arch/arm/boot/zImage -v $(RELEASE)
112 chmod 644 $(CURDIR)/debian/$(KERNEL_PACKAGE)/boot/zImage-$(RELEASE).fiasco
119 install -d -m 755 $(CURDIR)/debian/$(BOOTIMG_PACKAGE)/boot
120 install -c -m 644 $(BUILDTMP)/arch/arm/boot/zImage $(CURDIR)/debian/$(BOOTIMG_PACKAGE)/boot/zImage-$(RELEASE)
121 chmod 644 $(CURDIR)/debian/$(BOOTIMG_PACKAGE)/boot/zImage-$(RELEASE)
127 mkdir -p $(CURDIR)/debian/$(MODULES_PACKAGE)/lib/modules/$(KVER)
128 for f in $$(find $(BUILDTMP) -name "*.ko"); do \
129 install -c -m 644 $$f $(CURDIR)/debian/$(MODULES_PACKAGE)/lib/modules/$(KVER)/$$(basename $$f); \
130 strip --remove-section=.comment --remove-section=.note --strip-unneeded $(CURDIR)/debian/$(MODULES_PACKAGE)/lib/modules/$(KVER)/$$(basename $$f); \
132 #ln -sf $(KVER) $(CURDIR)/debian/$(MODULES_PACKAGE)/lib/modules/current
139 install -d -m755 $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/
140 install -p -o root -g root -m 644 $(BUILDTMP)/.config $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/
141 install -p -o root -g root -m 644 $(KSRC)/Makefile $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/
142 install -p -o root -g root -m 644 $(BUILDTMP)/Module.symvers $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/
143 cd $(BUILDTMP) && install -p -o root -g root -m 644 -D include/config/auto.conf \
144 $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/include/config/auto.conf
146 find arch/$(ARCH) $(foreach dir,$(INCLUDE_HEADERS),include/$(dir)) -name '*.h' \
147 -exec install -D -m644 {} $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/{} \;
149 find $(foreach dir,$(INCLUDE_HEADERS_ARCH),include/$(dir)) -name '*.h' \
150 -exec install -D -m644 {} $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/{} \;
152 find ./ -path "./debian" -prune -o -path "./.pc" -prune -o \( -name Makefile -or -name Kbuild -or -name Kconfig\* \) \
153 -exec install -D -m644 {} $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/{} \;
155 ln -sf asm-$(ARCH) $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/include/asm
157 rm -rf $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/scripts
158 ln -sf ../$(KBUILD_PACKAGE)/scripts $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)
160 # cp -a $(KSRC)/include/asm-$(ARCH)/arch \
161 # $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/include/asm-$(ARCH)
163 cp $(BUILDTMP)/arch/$(ARCH)/kernel/asm-offsets.s \
164 $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(HEADERS_PACKAGE)/arch/$(ARCH)/kernel
165 #install /lib/modules symlink
166 install -d -m 755 $(CURDIR)/debian/$(HEADERS_PACKAGE)/lib/modules/$(KVER)/
167 ln -sf /usr/src/$(HEADERS_PACKAGE) $(CURDIR)/debian/$(HEADERS_PACKAGE)/lib/modules/$(KVER)/build
169 install -d $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(KBUILD_PACKAGE)
170 cp -a $(KSRC)/scripts $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(KBUILD_PACKAGE)
171 cp -a $(BUILDTMP)/scripts $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(KBUILD_PACKAGE)
173 cd $(CURDIR)/debian/$(HEADERS_PACKAGE)/usr/src/$(KBUILD_PACKAGE)/scripts && \
174 ( rm -f $(RM_SCRIPTS); chmod a-x mkcompile_h )
175 find $(CURDIR)/debian/$(HEADERS_PACKAGE) -name ".gitignore" -exec rm {} \;
177 install-libc-headers:
182 $(MAKE) headers_check ARCH=$(ARCH) && \
183 $(MAKE) headers_install ARCH=$(ARCH) INSTALL_HDR_PATH=$(CURDIR)/debian/$(LIBC_PACKAGE)/usr
186 install-modules-extra:
190 mkdir -p $(CURDIR)/debian/kernel-modules-extra/lib/modules/$(KVER)/extra
191 for f in $(MODULES_EXTRA); do \
192 install -c -m 644 $(BUILDTMP)/$$f \
193 $(CURDIR)/debian/kernel-modules-extra/lib/modules/$(KVER)/extra/$$(basename $$f); \
196 install-extra: install-modules-extra
199 install-arch: build-arch install-kernel install-bootimg install-modules install-headers install-libc-headers
202 build-arch: kernel-stamp modules-stamp headers
209 binary-indep: #install-indep
212 dh_installchangelogs -i
220 binary-arch: build-arch install-arch
222 binary-arch: install-libc-headers
225 -e 's,@VERSION@,$(RELEASE),g' \
226 -e 's,@KVER@,$(KVER),g' \
227 < $(CURDIR)/debian/$(FLASHER_PACKAGE).postinst.in \
228 > $(CURDIR)/debian/$(FLASHER_PACKAGE).postinst
230 -e 's,@KVER@,$(KVER),g' \
231 < $(CURDIR)/debian/$(MODULES_PACKAGE).postinst.in \
232 > $(CURDIR)/debian/$(MODULES_PACKAGE).postinst
234 -e 's,@KVER@,$(KVER),g' \
235 < $(CURDIR)/debian/$(MODULES_PACKAGE).postrm.in \
236 > $(CURDIR)/debian/$(MODULES_PACKAGE).postrm
239 dh_installchangelogs -s
243 dh_strip -p$(HEADERS_PACKAGE)
246 dh_fixperms -s --exclude /usr/src/kernel-headers
252 binary: binary-arch #binary-indep
253 .PHONY: build clean binary-indep binary-arch binary install