1 |
3 |
xianfeng |
# Makefile for the different targets used to generate full packages of a kernel
|
2 |
|
|
# It uses the generic clean infrastructure of kbuild
|
3 |
|
|
|
4 |
|
|
# Ignore the following files/directories during tar operation
|
5 |
|
|
TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
# RPM target
|
9 |
|
|
# ---------------------------------------------------------------------------
|
10 |
|
|
# The rpm target generates two rpm files:
|
11 |
|
|
# /usr/src/packages/SRPMS/kernel-2.6.7rc2-1.src.rpm
|
12 |
|
|
# /usr/src/packages/RPMS/i386/kernel-2.6.7rc2-1..rpm
|
13 |
|
|
# The src.rpm files includes all source for the kernel being built
|
14 |
|
|
# The .rpm includes kernel configuration, modules etc.
|
15 |
|
|
#
|
16 |
|
|
# Process to create the rpm files
|
17 |
|
|
# a) clean the kernel
|
18 |
|
|
# b) Generate .spec file
|
19 |
|
|
# c) Build a tar ball, using symlink to make kernel version
|
20 |
|
|
# first entry in the path
|
21 |
|
|
# d) and pack the result to a tar.gz file
|
22 |
|
|
# e) generate the rpm files, based on kernel.spec
|
23 |
|
|
# - Use /. to avoid tar packing just the symlink
|
24 |
|
|
|
25 |
|
|
# Do we have rpmbuild, otherwise fall back to the older rpm
|
26 |
|
|
RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
|
27 |
|
|
else echo rpm; fi)
|
28 |
|
|
|
29 |
|
|
# Remove hyphens since they have special meaning in RPM filenames
|
30 |
|
|
KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE))
|
31 |
|
|
MKSPEC := $(srctree)/scripts/package/mkspec
|
32 |
|
|
PREV := set -e; cd ..;
|
33 |
|
|
|
34 |
|
|
# rpm-pkg
|
35 |
|
|
# ---------------------------------------------------------------------------
|
36 |
|
|
$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
|
37 |
|
|
$(CONFIG_SHELL) $(MKSPEC) > $@
|
38 |
|
|
|
39 |
|
|
rpm-pkg rpm: $(objtree)/kernel.spec FORCE
|
40 |
|
|
$(MAKE) clean
|
41 |
|
|
$(PREV) ln -sf $(srctree) $(KERNELPATH)
|
42 |
|
|
$(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
|
43 |
|
|
$(PREV) rm $(KERNELPATH)
|
44 |
|
|
|
45 |
|
|
set -e; \
|
46 |
|
|
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
|
47 |
|
|
set -e; \
|
48 |
|
|
mv -f $(objtree)/.tmp_version $(objtree)/.version
|
49 |
|
|
|
50 |
|
|
$(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
|
51 |
|
|
rm ../$(KERNELPATH).tar.gz
|
52 |
|
|
|
53 |
|
|
clean-files := $(objtree)/kernel.spec
|
54 |
|
|
|
55 |
|
|
# binrpm-pkg
|
56 |
|
|
# ---------------------------------------------------------------------------
|
57 |
|
|
$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
|
58 |
|
|
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
|
59 |
|
|
|
60 |
|
|
binrpm-pkg: $(objtree)/binkernel.spec FORCE
|
61 |
|
|
$(MAKE) KBUILD_SRC=
|
62 |
|
|
set -e; \
|
63 |
|
|
$(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
|
64 |
|
|
set -e; \
|
65 |
|
|
mv -f $(objtree)/.tmp_version $(objtree)/.version
|
66 |
|
|
|
67 |
|
|
$(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
|
68 |
|
|
|
69 |
|
|
clean-files += $(objtree)/binkernel.spec
|
70 |
|
|
|
71 |
|
|
# Deb target
|
72 |
|
|
# ---------------------------------------------------------------------------
|
73 |
|
|
deb-pkg: FORCE
|
74 |
|
|
$(MAKE) KBUILD_SRC=
|
75 |
|
|
$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
|
76 |
|
|
|
77 |
|
|
clean-dirs += $(objtree)/debian/
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
# tarball targets
|
81 |
|
|
# ---------------------------------------------------------------------------
|
82 |
|
|
tar%pkg: FORCE
|
83 |
|
|
$(MAKE) KBUILD_SRC=
|
84 |
|
|
$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
|
85 |
|
|
|
86 |
|
|
clean-dirs += $(objtree)/tar-install/
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
# Help text displayed when executing 'make help'
|
90 |
|
|
# ---------------------------------------------------------------------------
|
91 |
|
|
help: FORCE
|
92 |
|
|
@echo ' rpm-pkg - Build the kernel as an RPM package'
|
93 |
|
|
@echo ' binrpm-pkg - Build an rpm package containing the compiled kernel'
|
94 |
|
|
@echo ' and modules'
|
95 |
|
|
@echo ' deb-pkg - Build the kernel as an deb package'
|
96 |
|
|
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
|
97 |
|
|
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
|
98 |
|
|
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
|
99 |
|
|
|