From b8ee92ae5d62f72bb92bb2c4a334a762d19c6604 Mon Sep 17 00:00:00 2001 From: Geunsik Lim Date: Mon, 9 Apr 2018 17:41:49 +0900 Subject: [PATCH] Integrate spec files and activate emulator-kernel.spec MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This PR is to remove unnecessary and duplicated spec files. And, it is to activate the kernel image (bzImage) and System map file (System.map) with gbs build as well as build scripts such as build_x86.sh and build_x86_64.sh. **Changes proposed in this PR:** * Changelog v3: 1. Appended symbolic link with /usr/src/linux-headers for compatibility * Changelog v2: 1. Applied the comments of @Mikhail Labiuk and @MyungJoo Ham * Changelog v1: 1. bzImage is used to run emulator rootfs based on QEMU/KVM 2. System.map is used to do debugging kernel functions 3. Removed unnecessary spec files 4. Integrated the spec files into one spec file for consistency 5. Added kernel-headers rpm to support kernel module build of arm/aarch64 **Self assessment:** 1. GBS build: Passed 1. OBS build: Passed (manually) **How to evaluate:** 1. x86/32bit: time gbs build -A i586 --clean --include-all --define "with emulator" 2. x86/64bit: time gbs build -A x86_64 --clean --include-all --define "with emulator" 3. arm/32bit: time gbs build -A armv7l --clean --include-all --define "with emulator" 4. arm/64bit: time gbs build -A aarch64 --clean --include-all --define "with emulator" **After this PR:** $ ls -al /home/leemgs/GBS-ROOT-4.0/local/repos/tizen/i586/RPMS drwxrwxr-x 2 invain invain 4096 4월 10 17:16 . drwxrwxr-x 6 invain invain 4096 4월 10 17:16 .. -rw-rw-r-- 2 invain invain 7175827 4월 10 17:15 emulator-kernel-4.4.35-0.i686.rpm -rw-rw-r-- 2 invain invain 338716 4월 10 17:15 emulator-kernel-debugsource-4.4.35-0.i686.rpm -rw-rw-r-- 2 invain invain 59980920 4월 10 17:15 emulator-kernel-devel-4.4.35-0.i686.rpm -rw-rw-r-- 2 invain invain 1936999 4월 10 17:16 emulator-kernel-devel-debuginfo-4.4.35-0.i686.rpm -rw-rw-r-- 2 invain invain 580448 4월 10 17:15 emulator-kernel-modules-4.4.35-0.i686.rpm -rw-rw-r-- 2 invain invain 1026336 4월 10 17:15 emulator-kernel-perf-4.4.35-0.i686.rpm -rw-rw-r-- 2 invain invain 1721079 4월 10 17:16 emulator-kernel-perf-debuginfo-4.4.35-0.i686.rpm -rw-rw-r-- 2 invain invain 883864 4월 10 17:15 emulator-kernel-user-headers-4.4.35-0.i686.rpm Change-Id: I80607659c6fb66ee45ccd2d683d23c9f2c642cfc Signed-off-by: Geunsik Lim --- packaging/emulator-kernel.manifest | 5 + packaging/emulator-kernel.spec | 369 ++++++++++++++++++++--------- packaging/kernel-emulator.spec.backup | 408 -------------------------------- packaging/linux-kernel-modulebuild.spec | 70 ------ 4 files changed, 263 insertions(+), 589 deletions(-) create mode 100644 packaging/emulator-kernel.manifest delete mode 100644 packaging/kernel-emulator.spec.backup delete mode 100644 packaging/linux-kernel-modulebuild.spec diff --git a/packaging/emulator-kernel.manifest b/packaging/emulator-kernel.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/emulator-kernel.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/emulator-kernel.spec b/packaging/emulator-kernel.spec index c12031d..9579c36 100644 --- a/packaging/emulator-kernel.spec +++ b/packaging/emulator-kernel.spec @@ -1,52 +1,106 @@ -%bcond_with emulator +#%%bcond_with emulator + +# Note that the emulator of Tizen Studio only supports X86 architecutre +# (both 32bit {i386,i586,i686} and 64bit). We additionally need to generate +# kernel-headers rpm only to handle the kernel module build of ARM architecutre +# as well as X86 architecture. +%ifarch x86_64 +%define buildarch x86_64 +%define config_name tizen_emul_defconfig +%endif + +%ifarch %{ix86} +%define buildarch i386 +%define config_name tizen_emul_defconfig +%endif + +%ifarch aarch64 +%define buildarch arm64 +%define config_name defconfig +%endif %ifarch %{arm} -%define config_name arm_tizen_emul_defconfig -%define buildarch arm -%define imageName zImage -%else -%define config_name tizen_emul_defconfig -%define buildarch x86 -%define imageName bzImage +%define buildarch arm +%define config_name exynos_defconfig %endif -%define abiver 1 -%define build_id %{config_name}.%{abiver} +%define target_board emulator -#%undefine _missing_build_ids_terminate_build -Name: emulator-kernel -Summary: The Linux Emulator Kernel -Version: 4.4.35 -Release: 1 -License: GPL-2.0 -Group: System Environment/Kernel -Vendor: The Linux Community -URL: http://www.kernel.org -Source0: %{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root -%if %{with emulator} -ExclusiveArch: %{ix86} x86_64 -%else -ExclusiveArch: +# Want to enable initramfs facility to hand modulable kernel (e.g., file systems)? +%define with_initramfs 1 + +Name: emulator-kernel +Summary: The Linux Kernel for Tizen Studio Emulator +Version: 4.4.35 +Release: 0 +License: GPL-2.0 +Group: System/Kernel +URL: https://www.kernel.org +Distribution: Tizen +Vendor: Samsung Electronics/TAOS team +Packager: Geunsik Lim +Source0: %{name}-%{version}.tar.gz +Source1001: %{name}.manifest +%define fullVersion %{version}-%{buildarch}-%{target_board} + +BuildRequires: bc +BuildRequires: coreutils +BuildRequires: libopenssl-devel +BuildRequires: glibc-devel + +BuildRequires: kmod kmod-compat module-init-tools +%if %{with_initramfs} +BuildRequires: initrd %endif -Provides: linux-kernel = %{version}-%{release} -%define fullVersion %{version} +# Want to enable perf facility for profiling? +%define with_perf 0 -#BuildRequires: linux-glibc-devel -#BuildRequires: bc +%if %{with_perf} +# Note that Linux 4.4 requires elfutils-devel/libdw-devel >= 0.158 +BuildRequires: elfutils libelf libelf-devel libdw libdw-devel +BuildRequires: libunwind-devel +BuildRequires: zlib-devel binutils-devel python-devel bison flex xz-devel +BuildRequires: audit-libs-devel +%endif -Provides: kernel = %{version}-%{release} -Provides: kernel-uname-r = %{fullVersion} +Provides: %{name} = %{fullVersion} +Provides: %{name}-uname-r = %{fullVersion} %description -The Linux Kernel, the operating system core itself +This package provides the Linux kernel (vmlinuz,bzImage), the core of any +Linux-based operating system. The kernel handles the basic functions +of the OS: memory allocation, process allocation, device I/O, etc. +This package contains the Linux kernel for Tizen (arch %{buildarch}, +target board %{target_board}) + +%package modules +Summary: Kernel modules for %{target_board} +Group: System/Kernel +Provides: %{name}-modules = %{fullVersion} +Provides: %{name}-modules-uname-r = %{fullVersion} + +%description modules +Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board} + +%package devel +License: GPL-2.0 +Summary: Linux support kernel map and etc for other packages +Group: System/Kernel +Provides: %{name}-devel = %{fullVersion} +Provides: %{name}-devel-uname-r = %{fullVersion} +Provides: linux-kernel-modulebuild = %{fullVersion} + +%description devel +This package provides the kernel header files and makefiles +sufficient to build modules against the kernel package. %package user-headers Summary: Header files for the Linux kernel for use by glibc Group: Development/System -Obsoletes: kernel-headers -Provides: kernel-headers = %{version}-%{release} +Provides: %{name}-user-headers = %{fullVersion} +Provides: %{name}-user-headers-uname-r = %{fullVersion} +Provides: linux-kernel-modulebuild-header = %{fullVersion} %description user-headers Kernel-headers includes the C header files that specify the interface @@ -55,105 +109,198 @@ header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package. -%package devel -Summary: Prebuilt linux kernel for out-of-tree modules +%if %{with_perf} +%package perf +Summary: Performance monitoring for the Linux kernel Group: Development/System -Provides: kernel-devel = %{fullVersion} -Provides: kernel-devel-uname-r = %{fullVersion} -Requires: %{name} = %{version}-%{release} +License: GPLv2 -%description devel -Prebuilt linux kernel for out-of-tree modules. +%description perf +This package contains the perf tool, which enables performance monitoring +of the Linux kernel. +%endif %prep -%setup -q +%setup -q -n emulator-kernel-%{version} +cp %{SOURCE1001} . + %build -# 1. Compile sources -make %{config_name} -#make EXTRAVERSION="-%{build_id}" %{?_smp_mflags} +%{?asan:/usr/bin/gcc-unforce-options} +%{?ubsan:/usr/bin/gcc-unforce-options} -# 2. Build uImage -#make EXTRAVERSION="-%{build_id}" %{imageName} %{?_smp_mflags} +# Make sure EXTRAVERSION says what we want it to say +sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildarch}/" Makefile -# 3. Build modules -make modules %{?_smp_mflags} +# 1.1 build: set config file +%ifarch x86_64 %{ix86} +make %{?_smp_mflags} ARCH=%{buildarch} %{config_name} +%else +make %{?_smp_mflags} %{config_name} +%endif -# 4. Create tar repo for build directory -tar cpSf kernel-devel-tizen_emulator.tar . +%ifarch x86_64 +./scripts/config --set-str CONFIG_INITRAMFS_SOURCE ramfs/initramfs.%{buildarch} -e CONFIG_CRYPTO_AES_X86_64 +%endif -%install -QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT +%ifarch %{ix86} +./scripts/config --set-str CONFIG_INITRAMFS_SOURCE ramfs/initramfs.%{buildarch} -e CONFIG_CRYPTO_AES_586 +%endif + +# To prevent the script scripts/setlocalversion to append the "+" to the end of +# the kernel local version, we create an empty .scmversion file in the root of the kernel source. +touch .scmversion -# 1. Destynation directories -mkdir -p %{buildroot}/usr/src/kernel-devel-tizen_emulator -mkdir -p %{buildroot}/lib/modules/%{fullVersion} -mkdir -p %{buildroot}/boot/ +# 1.2 build: generate bzImage for x86 and x86_64 +%ifarch x86_64 %{ix86} +make %{?_smp_mflags} ARCH=%{buildarch} bzImage +%endif + +# 1.3 build: generate modules +%ifarch x86_64 %{ix86} +make %{?_smp_mflags} modules +%endif -# 2. Install uImage, System.map, ... -#install -m 755 arch/%{buildarch}/boot/%{imageName} %{buildroot}/boot/ -#install -m 644 System.map %{buildroot}/boot/System.map-%{fullVersion} -install -m 644 .config %{buildroot}/boot/config-%{fullVersion} +# in case of arm/aarch64, just generate header files without real kernel modules (*.ko) +%ifarch aarch64 %{arm} +make %{?_smp_mflags} modules_prepare +%endif -# 3. Install modules +# 1.4 build: perf +# Note that util/dwarf-aux.c generates build error due to -Werror=implicit-function-declaration +# and -Werror=nested-externs option of GCC 6.2. Let's skip with -Wno-error option. +# https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Warning-Options.html#Warning-Options +%global perf_make \ + 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} + +%if %{with_perf} +%{perf_make} DESTDIR=%{buildroot} all +%endif + +%install +QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT + +# 2.1 install: installing kernel modules +%ifarch x86_64 %{ix86} make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install +%endif -# 4. Install kernel headers +# 2.2 Install user-headers make INSTALL_PATH=%{buildroot} INSTALL_MOD_PATH=%{buildroot} INSTALL_HDR_PATH=%{buildroot}/usr headers_install -# 5. Restore source and build irectory -tar -xf kernel-devel-tizen_emulator.tar -C %{buildroot}/usr/src/kernel-devel-tizen_emulator -mv %{buildroot}/usr/src/kernel-devel-tizen_emulator/arch/%{buildarch} . -mv %{buildroot}/usr/src/kernel-devel-tizen_emulator/arch/Kconfig . -rm -rf %{buildroot}/usr/src/kernel-devel-tizen_emulator/arch/* -mv %{buildarch} %{buildroot}/usr/src/kernel-devel-tizen_emulator/arch/ -mv Kconfig %{buildroot}/usr/src/kernel-devel-tizen_emulator/arch/ - -# 6. Remove files -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name ".tmp_vmlinux*" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "\.*dtb*tmp" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "*\.*tmp" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "vmlinux" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "bzImage" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "zImage" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "*.cmd" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "*\.ko" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "*\.o" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "*\.S" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "*\.c" -not -path "%{buildroot}/usr/src/kernel-devel-tizen_emulator/scripts/*" -exec rm -f {} \; -find %{buildroot}/usr/src/kernel-devel-tizen_emulator -name "*.HEX" -type f -delete -find %{buildroot}/usr/include -name "\.\.install.cmd" -exec rm -f {} \; -find %{buildroot}/usr/include -name "\.install" -exec rm -f {} \; -find %{buildroot}/usr -name "..install.cmd" -exec rm -f {} \; - -rm -rf %{buildroot}/boot/vmlinux* -rm -rf %{buildroot}/System.map* -rm -rf %{buildroot}/vmlinux* - -# 7. Create symbolic links -rm -f %{buildroot}/lib/modules/%{fullVersion}/build -rm -f %{buildroot}/lib/modules/%{fullVersion}/source -ln -sf /usr/src/kernel-devel-tizen_emulator %{buildroot}/lib/modules/%{fullVersion}/build - -find %{buildroot}/lib/modules/ -name "*.ko" -type f -exec chmod 755 {} \; +# 2.3 install: installing bzImage(vmlinuz), config, System.map, and initramfs +mkdir -p %{buildroot}/boot + +%ifarch x86_64 %{ix86} +install -m 644 arch/%{buildarch}/boot/bzImage %{buildroot}/boot/bzImage.%{buildarch} +install -m 644 .config %{buildroot}/boot/config-%{version}-%{buildarch} +cp .config config +install -m 644 config %{buildroot}/lib/modules/%{version}-%{buildarch}/ +install -m 644 System.map %{buildroot}/boot/System.map-%{version}-%{buildarch} +install -m 644 System.map %{buildroot}/lib/modules/%{version}-%{buildarch}/ +%endif + +%ifarch x86_64 %{ix86} +%if %{with_initramfs} +install -m 644 ramfs/initramfs.%{buildarch} %{buildroot}/boot/ +%endif +%endif + +# 2.4 install: remove unnecessary files before generating a devel package +find %{_builddir}/emulator-kernel-%{version} -name ".tmp_vmlinux*" -delete +find %{_builddir}/emulator-kernel-%{version} -name ".gitignore" -delete +find %{_builddir}/emulator-kernel-%{version} -name "\.*dtb*tmp" -delete +find %{_builddir}/emulator-kernel-%{version} -name "\.*dtb" -delete +find %{_builddir}/emulator-kernel-%{version} -name "*\.*tmp" -delete +find %{_builddir}/emulator-kernel-%{version} -name "vmlinux" -delete +find %{_builddir}/emulator-kernel-%{version} -name "Image" -delete +find %{_builddir}/emulator-kernel-%{version} -name "Image.gz" -delete +find %{_builddir}/emulator-kernel-%{version} -name "*.cmd" -delete +find %{_builddir}/emulator-kernel-%{version} -name "*\.ko" -delete +find %{_builddir}/emulator-kernel-%{version} -name "*\.o" -delete +find %{_builddir}/emulator-kernel-%{version} -name "*\.S" -delete +find %{_builddir}/emulator-kernel-%{version} -name "*\.HEX" -type f -delete +find %{_builddir}/emulator-kernel-%{version} -name "*\.c" -not -path "%{_builddir}/emulator-kernel-%{version}/scripts/*" -delete + +# 2.5 install: move filted files into /boot/kernel/devel/ for devel package +mkdir -p %{buildroot}/boot/kernel/devel +cp -arf %{_builddir}/emulator-kernel-%{version} %{buildroot}/boot/kernel/devel/ + +# redefine symbolic link with Tizen style (e.g., /boot/kernel/devel/emulator-kernel-%{version}/) +%ifarch x86_64 %{ix86} +rm -f %{buildroot}/lib/modules/%{version}-%{buildarch}/{build,source} +ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/lib/modules/%{version}-%{buildarch}/build +ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/lib/modules/%{version}-%{buildarch}/source +%endif + +# let's make /usr/src/linux-headers as a symbolc linke for compatibility +mkdir -p %{buildroot}/usr/src +ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/usr/src/linux-headers-%{version} +ln -s /boot/kernel/devel/emulator-kernel-%{version} %{buildroot}/usr/src/linux-headers + +# 2.6 install: perf +%if %{with_perf} +# perf tool binary and supporting scripts/binaries +# Note that install-*** dependent on libc6-dev[el] or glibc-devel.i686 package +# %%{perf_make} DESTDIR=%%{buildroot} lib=%%{_lib} install-bin install-traceevent-plugins +# remove the 'trace' symlink. +# rm -f %%{buildroot}%%{_bindir}/trace +mkdir -p %{buildroot}%{_bindir}/ +install -m 755 ./tools/perf/perf %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_libdir}/traceevent/plugins/ +install -m 755 ./tools/lib/traceevent/* %{buildroot}%{_libdir}/traceevent/plugins/ +%endif %clean rm -rf %{buildroot} +%files +%defattr(-,root,root,-) +%ifarch x86_64 %{ix86} +%manifest %{name}.manifest +%endif +%license COPYING +%ifarch x86_64 %{ix86} +/boot/bzImage* +/boot/config-* +/boot/System.map-* +%if %{with_initramfs} +/boot/initramfs.%{buildarch} +%endif +%endif + +%files modules +%defattr(-,root,root,-) +%ifarch x86_64 %{ix86} +/lib/modules/* +%endif + +%files devel +%defattr(-,root,root,-) +/boot/kernel/devel/* +/usr/src/* + %files user-headers -%defattr (-, root, root) +%defattr(-,root,root,-) /usr/include -%files devel -%defattr (-, root, root) -/usr/src/kernel-devel-tizen_emulator -/lib/modules/%{fullVersion}/modules.* -/lib/modules/%{fullVersion}/build +%if %{with_perf} +%files perf +%defattr(-,root,root,-) +%{_bindir}/perf +%dir %{_libdir}/traceevent/plugins +%{_libdir}/traceevent/plugins/* +%endif -%files -#%license COPYING -#/boot/%{imageName} -#/boot/System.map* -/boot/config* -/lib/modules/%{fullVersion}/kernel -/lib/modules/%{fullVersion}/modules.* +%changelog +* Mon Apr 09 2018 Geunsik Lim +- Support gbs build as well as manual build script (e.g., build-x86.sh) + +* Mon Nov 13 2017 MyungJoo Ham +- Appended spec to support a build of kernel modules on arm as well as x86 + +* Mon Dec 19 2016 Sooyoung Ha +- Updated kernel spec version (4.4.35) + +* Sun Mar 15 2015 Sooyoung Ha +- Applied spec file to build emulator-kernel diff --git a/packaging/kernel-emulator.spec.backup b/packaging/kernel-emulator.spec.backup deleted file mode 100644 index 30d71a1..0000000 --- a/packaging/kernel-emulator.spec.backup +++ /dev/null @@ -1,408 +0,0 @@ -# -# Spec written for Tizen Mobile, some bits and pieces originate -# from MeeGo/Moblin/Fedora -# -%bcond_with emulator - -%define upstream_version 3.12.18 - -%if %{with emulator} -%define platform emulator -%endif - -%if !%{defined platform} -%define platform default -%endif - -%define variant %{profile}-%{_arch}-%{platform} -%define kernel_version %{version}-%{release} -%define kernel_full_version %{version}-%{release}-%{variant} -%define arch_32bits i386 i586 i686 %{ix86} - -# Default arch config for tizen per arch (unless overiden after) -%define kernel_image bzImage -%define defconfig tizen_defconfig - -%define dtbs_supported 0 -%define modules_supported 1 -%define trace_supported 1 -%define uboot_supported 0 -%define vdso_supported 1 - - -# Overide per configuration - -%ifarch %{arch_32bits} -%define kernel_arch i386 -%define kernel_arch_subdir arch/x86 -%define defconfig %{profile}_x86_defconfig -%if "%{platform}" == "emulator" -%define defconfig %{kernel_arch}_tizen_emul_defconfig -%define trace_supported 0 -%endif -%endif - -%ifarch x86_64 -%define kernel_arch x86_64 -%define kernel_arch_subdir arch/x86 -%define defconfig %{profile}_%{kernel_arch}_defconfig -%endif - -%ifarch %arm -%define kernel_arch arm -%define kernel_arch_subdir arch/%{kernel_arch} -%define kernel_image zImage -%define vdso_supported 0 -%define modules_supported 0 -%endif - - -Name: kernel-emulator -Summary: Tizen kernel -Group: System/Kernel -License: GPL-2.0 -URL: http://www.kernel.org/ -Version: %{upstream_version} - -# The below is used when we are on an -rc version -#%#define rc_num 6 -#%#define release_ver 0 -#%#define rc_str %{?rc_num:0.rc%{rc_num}}%{!?rc_num:1} -#%if ! 0%{?opensuse_bs} -#Release: 0 -#%else -#Release: 0 -#%endif -Release: 0 - -BuildRequires: module-init-tools -BuildRequires: findutils -BuildRequires: libelf-devel -BuildRequires: binutils-devel -BuildRequires: which -BuildRequires: bc -# net-tools provides the 'hostname' utility which kernel build wants -BuildRequires: net-tools -# The below is required for building perf -BuildRequires: flex -BuildRequires: bison -BuildRequires: libdw-devel -BuildRequires: python-devel -%if %{uboot_supported} -BuildRequires: u-boot-tools -%endif - -%if %{with emulator} -ExclusiveArch: %{arch_32bits} x86_64 armv7l -%else -ExclusiveArch: -%endif - -Source0: emulator-kernel-%{version}.tar.bz2 - -%description -This package contains the Linux kernel for Tizen. - - -%package -n kernel-%{variant} -Summary: Tizen kernel -Group: System/Kernel -Provides: kernel-profile-%{profile} = %{version}-%{release} -Provides: kernel-uname-r = %{kernel_full_version} -Requires(post): /usr/bin/ln -Requires(post): /usr/bin/sort -Requires(post): rpm - -# We use 'setup-scripts-bootloader-conf' in post and postun, so ideally we need to -# have the below here, but this causes gbs/obs build failures like this: -# "have choice for virtual-setup-scripts-bootloader needed by kernel-x86-scripts: setup-extlinux setup-gummiboot" -# The reason is that it will try to install the kernel to the build root, and -# fail with the above error. To fix it one would need to add 'setup-extlinux' -# or 'setup-gummiboot' to 'review.tizen.org/gerrit/scm/meta/build-config'. But -# it is probably not worth the trouble, so I commented out the below two lines. -# -- Artem -#Requires(post): virtual-setup-scripts-bootloader -#Requires(postun): virtual-setup-scripts-bootloader - -#Requires(post): setup-gummiboot -#Requires(postun): setup-gummiboot - -Requires(post): /usr/sbin/depmod -Requires(post): /usr/bin/dracut -Requires(post): /usr/bin/kmod - -Requires(postun): /usr/bin/ln -Requires(postun): /usr/bin/sed -Requires(postun): rpm - -# We can't let RPM do the dependencies automatic because it'll then pick up -# a correct but undesirable perl dependency from the module headers which -# isn't required for the kernel proper to function -AutoReq: no -AutoProv: yes - -%description -n kernel-%{variant} -This package contains the Linux kernel for Tizen (%{profile} profile, architecure %{_arch}) - -%package -n kernel-%{variant}-devel -Summary: Development package for building kernel modules -Group: Development/System -Provides: kernel-devel = %{kernel_full_version} -Provides: kernel-devel-uname-r = %{kernel_full_version} -Requires(post): /usr/bin/find -Requires: %{name} = %{version}-%{release} -AutoReqProv: no - -%description -n kernel-%{variant}-devel -This package provides kernel headers and makefiles sufficient to build modules -against the %{variant} kernel package. - - -%package -n perf -Summary: The 'perf' performance counter tool -Group: System/Kernel -Provides: perf = %{kernel_full_version} -Requires: %{name} = %{version}-%{release} - -%description -n perf -This package provides the "perf" tool that can be used to monitor performance -counter events as well as various kernel internal events. - - - -### -### PREP -### -%prep -# Unpack the kernel tarball -%setup -q -n %{name}-%{version} - - - -### -### BUILD -### -%build -# Make sure EXTRAVERSION says what we want it to say -sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}-%{variant}/" Makefile - -# Build perf -%if %trace_supported -make -s -C tools/lib/traceevent ARCH=%{kernel_arch} %{?_smp_mflags} -make -s -C tools/perf WERROR=0 ARCH=%{kernel_arch} -%endif - - -%if %{defined loadaddr} -export LOADADDR=%{loadaddr} -%endif - -# Build kernel and modules -make -s ARCH=%{kernel_arch} %{defconfig} -make %{?_smp_mflags} %{kernel_image} ARCH=%{kernel_arch} - -%if %modules_supported -make -s ARCH=%{kernel_arch} %{?_smp_mflags} modules -%endif - -%if %dtbs_supported -make -s ARCH=%{kernel_arch} %{?_smp_mflags} dtbs -%endif - - - -### -### INSTALL -### -%install -install -d %{buildroot}/boot - -install -m 644 .config %{buildroot}/boot/config-%{kernel_full_version} -install -m 644 System.map %{buildroot}/boot/System.map-%{kernel_full_version} -install -m 755 %{kernel_arch_subdir}/boot/%{kernel_image} %{buildroot}/boot/vmlinuz-%{kernel_full_version} -# Dummy initrd, will not be included in the actual package but needed for files -touch %{buildroot}/boot/initrd-%{kernel_full_version}.img - -%if %modules_supported -make -s ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{buildroot} modules_install KERNELRELEASE=%{kernel_full_version} -%endif - -%if %vdso_supported -make -s ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{buildroot} vdso_install KERNELRELEASE=%{kernel_full_version} -%endif - -%if %dtbs_supported -install -d "%{buildroot}/boot/" -find "arch/%{kernel_arch}/" -iname "*.dtb" -exec install "{}" "%{buildroot}/boot/" \; -%endif - -rm -rf %{buildroot}/lib/firmware - -# And save the headers/makefiles etc for building modules against -# -# This all looks scary, but the end result is supposed to be: -# * all arch relevant include/ files -# * all Makefile/Kconfig files -# * all script/ files - -# Remove existing build/source links and create pristine dirs -rm -f %{buildroot}/lib/modules/%{kernel_full_version}/build -rm -f %{buildroot}/lib/modules/%{kernel_full_version}/source -install -d %{buildroot}/lib/modules/%{kernel_full_version}/build -ln -fs build %{buildroot}/lib/modules/%{kernel_full_version}/source - - -# First, copy all dirs containing Makefile of Kconfig files -cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %{buildroot}/lib/modules/%{kernel_full_version}/build -install Module.symvers %{buildroot}/lib/modules/%{kernel_full_version}/build/ -install System.map %{buildroot}/lib/modules/%{kernel_full_version}/build/ - -# Then, drop all but the needed Makefiles/Kconfig files -rm -rf %{buildroot}/lib/modules/%{kernel_full_version}/build/Documentation -rm -rf %{buildroot}/lib/modules/%{kernel_full_version}/build/scripts -rm -rf %{buildroot}/lib/modules/%{kernel_full_version}/build/include - -# Copy config and scripts -install .config %{buildroot}/lib/modules/%{kernel_full_version}/build/ -cp -a scripts %{buildroot}/lib/modules/%{kernel_full_version}/build -if [ -d %{kernel_arch_subdir}/scripts ]; then - cp -a %{kernel_arch_subdir}/scripts %{buildroot}/lib/modules/%{kernel_full_version}/build/%{kernel_arch_subdir}/ || : -fi -if [ -f %{kernel_arch_subdir}/*lds ]; then - cp -a %{kernel_arch_subdir}/*lds %{buildroot}/lib/modules/%{kernel_full_version}/build/%{kernel_arch_subdir}/ || : -fi -rm -f %{buildroot}/lib/modules/%{kernel_full_version}/build/scripts/*.o -rm -f %{buildroot}/lib/modules/%{kernel_full_version}/build/scripts/*/*.o -cp -a --parents %{kernel_arch_subdir}/include %{buildroot}/lib/modules/%{kernel_full_version}/build - -# Copy include files -mkdir -p %{buildroot}/lib/modules/%{kernel_full_version}/build/include -find include/ -mindepth 1 -maxdepth 1 -type d | xargs -I{} cp -a {} %{buildroot}/lib/modules/%{kernel_full_version}/build/include - -# Save the vmlinux file for kernel debugging into the devel package -cp vmlinux %{buildroot}/lib/modules/%{kernel_full_version} - -# Mark modules executable so that strip-to-file can strip them -find %{buildroot}/lib/modules/%{kernel_full_version} -name "*.ko" -type f | xargs --no-run-if-empty chmod 755 - -# Move the devel headers out of the root file system -install -d %{buildroot}/usr/src/kernels -mv %{buildroot}/lib/modules/%{kernel_full_version}/build %{buildroot}/usr/src/kernels/%{kernel_full_version} - -ln -sf /usr/src/kernels/%{kernel_full_version} %{buildroot}/lib/modules/%{kernel_full_version}/build - -# Install perf -install -d %{buildroot} -make -s -C tools/perf DESTDIR=%{buildroot} install -install -d %{buildroot}%{_bindir} -install -d %{buildroot}%{_libexecdir} -mv %{buildroot}/bin/* %{buildroot}%{_bindir} -mv %{buildroot}/libexec/* %{buildroot}%{_libexecdir} -rm %{buildroot}/etc/bash_completion.d/perf - -# Dont package debug files -rm -rf %{buildroot}/usr/lib/debug/.build-id -rm -rf %{buildroot}/usr/lib/debug/lib/traceevent/plugins/*.debug - - - -### -### SCRIPTS -### - -%post -n kernel-%{variant} -if [ -f "/boot/loader/loader.conf" ]; then - # EFI boot with gummiboot - INSTALLERFW_MOUNT_PREFIX="/" /usr/sbin/setup-scripts-gummiboot-conf - # "/etc/installerfw-environment" does not exist in MIC environment, when it - # builds the image. MIC will add boot-loader entries later using the - # 'setup-scripts-boot' script. - if [ -f "/etc/installerfw-environment" ] && \ - [ -x "/usr/sbin/setup-scripts-bootloader-conf" ]; then - /usr/sbin/setup-scripts-bootloader-conf add -f vmlinuz-%{kernel_full_version} - /usr/sbin/setup-scripts-bootloader-conf default -f vmlinuz-%{kernel_full_version} - fi -else - # Legacy boot - last_installed_ver="$(rpm -q --qf '%{INSTALLTIME}: %{VERSION}-%{RELEASE}\n' kernel-%{variant} | sort -r | sed -e 's/[^:]*: \(.*\)/\1/g' | sed -n -e "1p")" - ln -sf vmlinuz-$last_installed_ver-%{variant} /boot/vmlinuz - - if [ -z "$last_installed_ver" ]; then - # Something went wrong, print some diagnostics - printf "%s\n" "Error: cannot find kernel version" 1>&2 - printf "%s\n" "The command was: rpm -q --qf '%{INSTALLTIME}: %{VERSION}-%{RELEASE}\n' kernel-%{variant} | sort -r | sed -e 's/[^:]*: \(.*\)/\1/g' | sed -n -e \"1p\"" 1>&2 - printf "%s\n" "Output of the \"rpm -q --qf '%{INSTALLTIME}: %{VERSION}-%{RELEASE}\n' kernel-%{variant}\" is:" 1>&2 - result="$(rpm -q --qf '%{INSTALLTIME}: %{VERSION}-%{RELEASE}\n' kernel-%{variant})" - printf "%s\n" "$result" 1>&2 - fi -fi - -%{_bindir}/dracut /boot/initrd-%{kernel_full_version}.img %{kernel_full_version} - -%post -n kernel-%{variant}-devel -if [ -x /usr/sbin/hardlink ]; then - cd /usr/src/kernels/%{kernel_full_version} - /usr/bin/find . -type f | while read f; do - hardlink -c /usr/src/kernels/*/$f $f - done -fi - -%postun -n kernel-%{variant} -if [ -f "/boot/loader/loader.conf" ]; then - # EFI boot with gummiboot - INSTALLERFW_MOUNT_PREFIX="/" /usr/sbin/setup-scripts-gummiboot-conf - if [ -f "/etc/installerfw-environment" ] && \ - [ -x "/usr/sbin/setup-scripts-bootloader-conf" ]; then - /usr/sbin/setup-scripts-bootloader-conf remove -f vmlinuz-%{kernel_full_version} - fi - -else - last_installed_ver="$(rpm -q --qf '%{INSTALLTIME}: %{VERSION}-%{RELEASE}\n' kernel-%{variant} | sort -r | sed -e 's/[^:]*: \(.*\)/\1/g' | sed -n -e "1p")" - if [ -n "$last_installed_ver" ]; then - ln -sf vmlinuz-$last_installed_ver-%{variant} /boot/vmlinuz - else - rm -rf /boot/vmlinuz - fi -fi - - - -### -### FILES -### -%files -n kernel-%{variant} -%license COPYING -/boot/vmlinuz-%{kernel_full_version} -/boot/System.map-%{kernel_full_version} -/boot/config-%{kernel_full_version} -%if %modules_supported -%dir /lib/modules/%{kernel_full_version} -/lib/modules/%{kernel_full_version}/kernel -/lib/modules/%{kernel_full_version}/modules.* -%endif -/lib/modules/%{kernel_full_version}/build -/lib/modules/%{kernel_full_version}/source - -%if %vdso_supported -/lib/modules/%{kernel_full_version}/vdso -%endif -%if %dtbs_supported -/boot/*.dtb -%endif -%ghost /boot/initrd-%{kernel_full_version}.img - - -%files -n kernel-%{variant}-devel -%license COPYING -%verify(not mtime) /usr/src/kernels/%{kernel_full_version} -/lib/modules/%{kernel_full_version}/vmlinux - - -%files -n perf -%license COPYING -%{_bindir}/perf -%{_libexecdir}/perf-core -%if %trace_supported -%{_bindir}/trace -/%{_lib}/traceevent/plugins/*.so -%endif diff --git a/packaging/linux-kernel-modulebuild.spec b/packaging/linux-kernel-modulebuild.spec deleted file mode 100644 index b464be9..0000000 --- a/packaging/linux-kernel-modulebuild.spec +++ /dev/null @@ -1,70 +0,0 @@ -Name: linux-kernel-modulebuild -Summary: Linux Kernel Module Build Files -Version: 4.4.35 -Release: 1 -License: GPL-2.0 -Group: System Environment/Kernel -Vendor: The Linux Community -URL: http://www.kernel.org -Source0: %{name}-%{version}.tar.gz -BuildRequires: linux-glibc-devel -BuildRequires: tar - -%description -Module build support for The Linux Kernel, the operating system core itself - -%package header -Summary: Header files for /usr/include -%description header -Header of The Linux Kernel, the operating system core itself - -%prep -%setup -q - -%build -%ifarch %{arm} -make exynos_defconfig -%endif -%ifarch %{ix86} -make tizen_emul_defconfig -%endif -%ifarch aarch64 -make defconfig -%endif -%ifarch x86_64 -make x86_64_defconfig -%endif - -make modules_prepare - -find -wholename "*/include/*" > headers -find -name "Kconfig" >> headers -find -name "Kbuild" >> headers -find -name "Makefile" >> headers -find -name "Makefile.*" >> headers -find -name "Makefile_32.cpu" >> headers - -%install -QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT - -mkdir -p %{buildroot}/usr/src/linux-headers-%{version}-%{release} -tar -cf - -T headers |(pushd %{buildroot}/usr/src/linux-headers-%{version}-%{release} && tar -xvf - && popd) - -mkdir -p %{buildroot}/usr/src/linux-headers-%{version}-%{release}/scripts -cp -pR scripts/* %{buildroot}/usr/src/linux-headers-%{version}-%{release}/scripts/ - -cp include/config/kernel.release %{buildroot}/usr/src/linux-headers-%{version}-%{release}/include/config/ - -pushd %{buildroot}/usr/src -ln -s linux-headers-%{version}-%{release} linux-headers-%{version} -ln -s linux-headers-%{version}-%{release} linux-headers-4.4 -ln -s linux-headers-%{version}-%{release} linux-headers -popd - -make INSTALL_PATH=%{buildroot} INSTALL_MOD_PATH=%{buildroot} INSTALL_HDR_PATH=%{buildroot}/usr headers_install - -%files -/usr/src/* - -%files header -/usr/include/* -- 2.7.4