packaging: do not export kdbus.h and logger.h
[platform/kernel/linux-rpi3.git] / packaging / linux-rpi3.spec
1 # Ignore double dash in version for rpmbuild
2 %define _wrong_version_format_terminate_build 0
3
4 %ifarch aarch64
5 %define config_name tizen_bcmrpi3_defconfig
6 %define buildarch arm64
7 %else
8 %define config_name tizen_bcm2709_defconfig
9 %define buildarch arm
10 %endif
11 %define target_board rpi3
12 %define variant %{buildarch}-%{target_board}
13
14 Name: rpi3-linux-kernel
15 Summary: The Linux Kernel for Raspberry Pi3
16 Version: 4.19.49
17 Release: 0
18 License: GPL-2.0
19 ExclusiveArch: %{arm} aarch64
20 Group: System/Kernel
21 Vendor: The Linux Community
22 URL: https://www.kernel.org
23 Source0:   linux-kernel-%{version}.tar.xz
24 BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
25
26 %define fullVersion %{version}-%{variant}
27
28 BuildRequires: bc
29 BuildRequires: module-init-tools
30 BuildRequires: u-boot-tools >= 2016.03
31 BuildRequires: bison
32 BuildRequires: flex
33 BuildRequires: libopenssl1.1-devel
34 BuildRequires: libunwind-devel
35 BuildRequires: libdw-devel
36 BuildRequires: libelf-devel
37 BuildRequires: elfutils
38 BuildRequires: xz-devel
39 BuildRequires: binutils-devel
40 BuildRequires: rsync
41
42 %description
43 The Linux Kernel, the operating system core itself
44
45 %package -n %{variant}-linux-kernel
46 License: GPL-2.0
47 Summary: Tizen kernel for %{target_board}
48 Group: System/Kernel
49 Provides: %{variant}-kernel-uname-r = %{fullVersion}
50 Provides: linux-kernel = %{version}-%{release}
51
52 %description -n %{variant}-linux-kernel
53 This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board})
54
55 %package -n %{variant}-linux-kernel-modules
56 Summary: Kernel modules for %{target_board}
57 Group: System/Kernel
58 Provides: %{variant}-kernel-modules = %{fullVersion}
59 Provides: %{variant}-kernel-modules-uname-r = %{fullVersion}
60
61 %description -n %{variant}-linux-kernel-modules
62 Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board}
63
64 %package -n %{variant}-linux-kernel-devel
65 License: GPL-2.0
66 Summary: Linux support kernel map and etc for other packages
67 Group: System/Kernel
68 Provides: %{variant}-kernel-devel = %{fullVersion}
69 Provides: %{variant}-kernel-devel-uname-r = %{fullVersion}
70
71 %description -n %{variant}-linux-kernel-devel
72 This package provides kernel map and etc information.
73
74 %package -n linux-kernel-perf
75 Summary: The perf performance counter tool
76 Group: System/Kernel
77 Provides: perf = %{fullVersion}
78
79 %description -n linux-kernel-perf
80 This package provides the "perf" tool that can be used to monitor performance
81 counter events as well as various kernel internal events.
82
83 %package -n linux-kernel-kdbus-tests
84 License:       Apache-2.0
85 Summary:       Kdbus tests
86 Group:         Base/IPC
87 BuildRequires: libcap-devel
88
89 %description -n linux-kernel-kdbus-tests
90 A single binary that tests kdbus operation.
91
92 %prep
93 %setup -q
94
95 %build
96 %{?asan:/usr/bin/gcc-unforce-options}
97 %{?ubsan:/usr/bin/gcc-unforce-options}
98
99 # 0. extract uapi headers
100 make headers_check %{?_smp_mflags}
101 make headers_install %{?_smp_mflags}
102
103 # 1-1. Set config file
104 make %{config_name} %{?_smp_mflags}
105 if ! grep -q "^CONFIG_LOCALVERSION=\"-%{variant}" .config; then
106     ./scripts/config --set-str CONFIG_LOCALVERSION "-%{variant}$(eval $(grep ^CONFIG_LOCALVERSION= .config); echo $CONFIG_LOCALVERSION)"
107 fi
108
109 # 1-2. Build Image/Image.gz
110 make %{?_smp_mflags}
111
112 # 1-3. Build dtbs
113 make dtbs %{?_smp_mflags}
114
115 # 1-4. Build modules
116 make modules %{?_smp_mflags}
117
118 # 1-5. Build perf
119 make -s -C tools/lib/traceevent %{?_smp_mflags} NO_LIBPERL=1
120 make -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" %{?_smp_mflags} NO_LIBPERL=1
121
122 # 1-6. Additionally, build kdbus tests
123 make -C tools/testing/selftests/kdbus
124
125 %install
126 QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT
127
128 # 2-1. Destination directories
129 mkdir -p %{buildroot}/boot
130 mkdir -p %{buildroot}/lib/modules
131
132 # 2-2. Install kernel binary and DTB
133 %ifarch aarch64
134 install -m 644 arch/%{buildarch}/boot/Image %{buildroot}/boot/
135 install -m 644 arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/
136 %else
137 install -m 644 arch/%{buildarch}/boot/zImage %{buildroot}/boot/
138 install -m 644 arch/%{buildarch}/boot/dts/bcm*.dtb %{buildroot}/boot/
139 %endif
140
141 # 2-3. Install modules
142 make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install
143
144 # 2-4. Install boot binary files
145 %ifarch aarch64
146 install -m 644 rpi3/boot/config_64bit.txt %{buildroot}/boot/config.txt
147 %else
148 install -m 644 rpi3/boot/config_32bit.txt %{buildroot}/boot/config.txt
149 %endif
150 install -m 644 rpi3/boot/LICENCE.broadcom %{buildroot}/boot/
151 install -m 644 rpi3/boot/bootcode.bin %{buildroot}/boot/
152 install -m 644 rpi3/boot/start*.elf %{buildroot}/boot/
153 install -m 644 rpi3/boot/fixup*.dat %{buildroot}/boot/
154
155 # 2-5. Install perf
156 install -d %{buildroot}/usr
157 make -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" DESTDIR=%{buildroot}/usr install NO_LIBPERL=1
158 rm -rf %{buildroot}/usr/etc
159 rm -rf %{buildroot}/usr/lib/debug
160 rm -rf %{buildroot}/usr/lib/perf
161 rm -rf %{buildroot}/usr/share
162
163 # 2-6. install kdbus tests
164 %define _test_runner_dir /usr/lib/dbus-tests/runner
165 make -C tools/testing/selftests/kdbus INSTALL_PATH=%{buildroot}%{_test_runner_dir} install
166
167
168 # 3. Copy files for devel package
169 mkdir -p %{buildroot}/boot/kernel/devel/kernel-devel-%{variant}
170 rsync -lr \
171     --include "/scripts/**.c" \
172     --exclude "/debug*.list" \
173     --exclude "/documentation.list" \
174     --exclude "/*.manifest" \
175     --exclude "/packaging/" \
176     --exclude "/.gbs.conf" \
177     --exclude "/usr/include/" \
178     --exclude ".gitignore" \
179     --exclude "*\.c" \
180     --exclude ".tmp_vmlinux*" \
181     --exclude ".*dtb*tmp" \
182     --exclude ".*dtb" \
183     --exclude "*.*tmp" \
184     --exclude "Image" \
185     --exclude "zImage" \
186     --exclude "Image.gz" \
187     --exclude "*.cmd" \
188     --exclude "*.ko" \
189     --exclude "*.o" \
190     --exclude "*.S" \
191     --exclude "*.HEX" \
192     --exclude "/include/uapi/linux/logger.h" \
193     --exclude "/usr/include/linux/logger.h" \
194     --exclude "/include/uapi/linux/kdbus.h" \
195     --exclude "/usr/include/linux/kdbus.h" \
196     --exclude "/tools/testing/selftests/kdbus/kdbus-test" \
197 %{_builddir}/%{name}-%{version}/ %{buildroot}/boot/kernel/devel/kernel-devel-%{variant}
198
199
200 %clean
201 rm -rf %{buildroot}
202
203 %files -n %{variant}-linux-kernel-modules
204 /lib/modules/*
205
206 %files -n %{variant}-linux-kernel-devel
207 /boot/kernel/devel/*
208
209 %files -n %{variant}-linux-kernel
210 %license COPYING
211 %ifarch aarch64
212 /boot/Image
213 %else
214 /boot/zImage
215 %endif
216 /boot/bcm*.dtb
217 /boot/config.txt
218 /boot/LICENCE.broadcom
219 /boot/bootcode.bin
220 /boot/start*.elf
221 /boot/fixup*.dat
222
223 %files -n linux-kernel-perf
224 %license COPYING
225 /usr/bin/*
226 /usr/libexec/*
227 /usr/lib/traceevent/*
228
229 %files -n linux-kernel-kdbus-tests
230 %defattr(-,root,root)
231 %{_test_runner_dir}/kdbus-test