3 # Note that the emulator of Tizen Studio only supports X86 architecutre
4 # (both 32bit {i386,i586,i686} and 64bit). We additionally need to generate
5 # kernel-headers rpm only to handle the kernel module build of ARM architecutre
6 # as well as X86 architecture.
8 %define buildarch x86_64
9 %define config_name tizen_emul_defconfig
13 %define buildarch i386
14 %define config_name tizen_emul_defconfig
18 %define buildarch arm64
19 %define config_name defconfig
24 %define config_name exynos_defconfig
27 %define target_board emulator
29 # Want to enable initramfs facility to hand modulable kernel (e.g., file systems)?
30 %define with_initramfs 1
33 Summary: The Linux Kernel for Tizen Studio Emulator
38 URL: https://www.kernel.org
40 Vendor: Samsung Electronics/TAOS team
41 Packager: Geunsik Lim <geunsik.lim@samsung.com>
42 Source0: %{name}-%{version}.tar.gz
43 Source1001: %{name}.manifest
44 %define fullVersion %{version}-%{buildarch}-%{target_board}
47 BuildRequires: coreutils
48 BuildRequires: pkgconfig(openssl3)
49 BuildRequires: glibc-devel
51 BuildRequires: kmod kmod-compat module-init-tools
53 # Want to enable perf facility for profiling?
57 # Note that Linux 4.4 requires elfutils-devel/libdw-devel >= 0.158
58 BuildRequires: elfutils libelf libelf-devel libdw libdw-devel
59 BuildRequires: libunwind-devel
60 BuildRequires: zlib-devel binutils-devel python-devel bison flex xz-devel
61 BuildRequires: audit-libs-devel
64 Provides: %{name} = %{fullVersion}
65 Provides: %{name}-uname-r = %{fullVersion}
68 This package provides the Linux kernel (vmlinuz,bzImage), the core of any
69 Linux-based operating system. The kernel handles the basic functions
70 of the OS: memory allocation, process allocation, device I/O, etc.
71 This package contains the Linux kernel for Tizen (arch %{buildarch},
72 target board %{target_board})
75 Summary: Kernel modules for %{target_board}
77 Provides: %{name}-modules = %{fullVersion}
78 Provides: %{name}-modules-uname-r = %{fullVersion}
81 Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board}
85 Summary: Linux support kernel map and etc for other packages
87 Provides: %{name}-devel = %{fullVersion}
88 Provides: %{name}-devel-uname-r = %{fullVersion}
89 Provides: linux-kernel-modulebuild = %{fullVersion}
92 This package provides the kernel header files and makefiles
93 sufficient to build modules against the kernel package.
96 Summary: Header files for the Linux kernel for use by glibc
97 Group: Development/System
98 Provides: %{name}-user-headers = %{fullVersion}
99 Provides: %{name}-user-headers-uname-r = %{fullVersion}
100 Provides: linux-kernel-modulebuild-header = %{fullVersion}
102 %description user-headers
103 Kernel-headers includes the C header files that specify the interface
104 between the Linux kernel and userspace libraries and programs. The
105 header files define structures and constants that are needed for
106 building most standard programs and are also needed for rebuilding the
111 Summary: Performance monitoring for the Linux kernel
112 Group: Development/System
116 This package contains the perf tool, which enables performance monitoring
121 %setup -q -n emulator-kernel-%{version}
126 %{?asan:/usr/bin/gcc-unforce-options}
127 %{?ubsan:/usr/bin/gcc-unforce-options}
129 # Make sure EXTRAVERSION says what we want it to say
130 sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildarch}/" Makefile
132 # 1.1 build: set config file
133 %ifarch x86_64 %{ix86}
134 make %{?_smp_mflags} ARCH=%{buildarch} %{config_name}
136 make %{?_smp_mflags} %{config_name}
140 ./scripts/config --set-str CONFIG_INITRAMFS_SOURCE ramfs/initramfs.%{buildarch} -e CONFIG_CRYPTO_AES_X86_64
144 ./scripts/config --set-str CONFIG_INITRAMFS_SOURCE ramfs/initramfs.%{buildarch} -e CONFIG_CRYPTO_AES_586
147 # To prevent the script scripts/setlocalversion to append the "+" to the end of
148 # the kernel local version, we create an empty .scmversion file in the root of the kernel source.
151 # 1.2 build: generate bzImage for x86 and x86_64
152 %ifarch x86_64 %{ix86}
153 make %{?_smp_mflags} ARCH=%{buildarch} bzImage
156 # 1.3 build: generate modules
157 %ifarch x86_64 %{ix86}
158 make %{?_smp_mflags} modules
161 # in case of arm/aarch64, just generate header files without real kernel modules (*.ko)
162 %ifarch aarch64 %{arm}
163 make %{?_smp_mflags} modules_prepare
167 # Note that util/dwarf-aux.c generates build error due to -Werror=implicit-function-declaration
168 # and -Werror=nested-externs option of GCC 6.2. Let's skip with -Wno-error option.
169 # https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Warning-Options.html#Warning-Options
171 make -s EXTRA_CFLAGS="-Wno-error -Wno-error=implicit-function-declaration -Wno-error=nested-externs" -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 HAVE_CPLUS_DEMANGLE=1 NO_NEWT=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 NO_LIBNUMA=1 NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1 NO_DWARF=1 NO_AUXTRACE=1 NO_LIBPERL=1 NO_SLANG=1 NO_LIBPYTHON=1 prefix=%{_prefix}
174 %{perf_make} DESTDIR=%{buildroot} all
178 QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT
180 # 2.1 install: installing kernel modules
181 %ifarch x86_64 %{ix86}
182 make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install
185 # 2.2 Install user-headers
186 make INSTALL_PATH=%{buildroot} INSTALL_MOD_PATH=%{buildroot} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
188 # 2.3 install: installing bzImage(vmlinuz), config, System.map, and initramfs
189 mkdir -p %{buildroot}/boot
191 %ifarch x86_64 %{ix86}
192 install -m 644 arch/%{buildarch}/boot/bzImage %{buildroot}/boot/bzImage.%{buildarch}
193 install -m 644 .config %{buildroot}/boot/config-%{version}-%{buildarch}
195 install -m 644 config %{buildroot}/lib/modules/%{version}-%{buildarch}/
196 install -m 644 System.map %{buildroot}/boot/System.map-%{version}-%{buildarch}
197 install -m 644 System.map %{buildroot}/lib/modules/%{version}-%{buildarch}/
200 %ifarch x86_64 %{ix86}
201 %if %{with_initramfs}
202 install -m 644 ramfs/initramfs.%{buildarch} %{buildroot}/boot/
206 # 2.4 install: remove unnecessary files before generating a devel package
207 find %{_builddir}/emulator-kernel-%{version} -name ".tmp_vmlinux*" -delete
208 find %{_builddir}/emulator-kernel-%{version} -name ".gitignore" -delete
209 find %{_builddir}/emulator-kernel-%{version} -name "\.*dtb*tmp" -delete
210 find %{_builddir}/emulator-kernel-%{version} -name "\.*dtb" -delete
211 find %{_builddir}/emulator-kernel-%{version} -name "*\.*tmp" -delete
212 find %{_builddir}/emulator-kernel-%{version} -name "vmlinux" -delete
213 find %{_builddir}/emulator-kernel-%{version} -name "Image" -delete
214 find %{_builddir}/emulator-kernel-%{version} -name "Image.gz" -delete
215 find %{_builddir}/emulator-kernel-%{version} -name "*.cmd" -delete
216 find %{_builddir}/emulator-kernel-%{version} -name "*\.ko" -delete
217 find %{_builddir}/emulator-kernel-%{version} -name "*\.o" -delete
218 find %{_builddir}/emulator-kernel-%{version} -name "*\.S" -delete
219 find %{_builddir}/emulator-kernel-%{version} -name "*\.HEX" -type f -delete
220 find %{_builddir}/emulator-kernel-%{version} -name "*\.c" -not -path "%{_builddir}/emulator-kernel-%{version}/scripts/*" -delete
222 # 2.5 install: move filted files into /boot/kernel/devel/ for devel package
223 mkdir -p %{buildroot}/boot/kernel/devel
224 cp -arf %{_builddir}/emulator-kernel-%{version} %{buildroot}/boot/kernel/devel/
226 # redefine symbolic link with Tizen style (e.g., /boot/kernel/devel/emulator-kernel-%{version}/)
227 %ifarch x86_64 %{ix86}
228 rm -f %{buildroot}/lib/modules/%{version}-%{buildarch}/{build,source}
229 ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/lib/modules/%{version}-%{buildarch}/build
230 ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/lib/modules/%{version}-%{buildarch}/source
233 # let's make /usr/src/linux-headers as a symbolc linke for compatibility
234 mkdir -p %{buildroot}/usr/src
235 ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/usr/src/linux-headers-%{version}
236 ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/usr/src/linux-headers
240 # perf tool binary and supporting scripts/binaries
241 # Note that install-*** dependent on libc6-dev[el] or glibc-devel.i686 package
242 # %%{perf_make} DESTDIR=%%{buildroot} lib=%%{_lib} install-bin install-traceevent-plugins
243 # remove the 'trace' symlink.
244 # rm -f %%{buildroot}%%{_bindir}/trace
245 mkdir -p %{buildroot}%{_bindir}/
246 install -m 755 ./tools/perf/perf %{buildroot}%{_bindir}
247 mkdir -p %{buildroot}%{_libdir}/traceevent/plugins/
248 install -m 755 ./tools/lib/traceevent/* %{buildroot}%{_libdir}/traceevent/plugins/
255 %defattr(-,root,root,-)
256 %ifarch x86_64 %{ix86}
257 %manifest %{name}.manifest
260 %ifarch x86_64 %{ix86}
264 %if %{with_initramfs}
265 /boot/initramfs.%{buildarch}
270 %defattr(-,root,root,-)
271 %ifarch x86_64 %{ix86}
276 %defattr(-,root,root,-)
281 %defattr(-,root,root,-)
286 %defattr(-,root,root,-)
288 %dir %{_libdir}/traceevent/plugins
289 %{_libdir}/traceevent/plugins/*
293 * Mon Apr 09 2018 Geunsik Lim <geunsik.lim@samsung.com>
294 - Support gbs build as well as manual build script (e.g., build-x86.sh)
296 * Mon Nov 13 2017 MyungJoo Ham <myungjoo.ham@samsung.com>
297 - Appended spec to support a build of kernel modules on arm as well as x86
299 * Mon Dec 19 2016 Sooyoung Ha <yoosah.ha@samsung.com>
300 - Updated kernel spec version (4.4.35)
302 * Sun Mar 15 2015 Sooyoung Ha <yoosah.ha@samsung.com>
303 - Applied spec file to build emulator-kernel