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