Merge pull request #1 from fedya/kernel-5.4:rosa2019.1

add aarch64, lint spec
This commit is contained in:
mikhailnov 2020-11-26 22:06:39 +00:00
commit c75db816bb
2 changed files with 10607 additions and 57 deletions

10510
kernel-arm64.config Normal file

File diff suppressed because it is too large Load diff

View file

@ -40,13 +40,19 @@
%define kverrel %{kversion}-%{fullrpmrel}
%define tar_ver %{kernelversion}.%{patchlevel}
# i586
%ifarch %{ix86}
# Use a standard suffix for 32-bit x86
%define arch_suffix i586
%else
%define arch_suffix i686
%endif
%ifarch %{x86_64}
%define arch_suffix %{_arch}
%endif
%ifarch aarch64
%define arch_suffix arm64
%endif
%define buildrpmrel %{fullrpmrel}%{rpmtag}-%{arch_suffix}
%define buildrel %{kversion}-%{buildrpmrel}
@ -64,7 +70,11 @@
%bcond_without additional_keys
%endif
# User Mode Linux, https://habr.com/ru/company/itsumma/blog/459558/
%ifarch %{ix86} %{x86_64}
%bcond_without uml
%else
%bcond_with uml
%endif
# "Nickel" is a special brand for certified distros
# gost_sign will probably be enabled outside of Nickel later,
@ -133,8 +143,8 @@
# Build defines
%define build_doc 0
%define build_devel 1
%define build_debug 1
%define build_devel 1
%define build_debug 0
# Build kernel-headers package
# Make headers of this kernel not default for rosa2016.1
@ -145,8 +155,14 @@
%endif
# build perf and cpupower tools
%ifarch %{ix86} %{x86_64}
%define build_perf 1
%define build_cpupower 1
%else
%define build_perf 0
%define build_cpupower 0
%endif
# compress modules with xz
%define build_modxz 1
@ -181,13 +197,20 @@
# http://nickdesaulniers.github.io/blog/2018/06/02/speeding-up-linux-kernel-builds-with-ccache/
%if %{with ccache}
%define kmake KBUILD_BUILD_TIMESTAMP='' %make CC='ccache gcc'
%define kmake KBUILD_BUILD_TIMESTAMP='' %make CC='ccache gcc' ARCH="%{arch_suffix}"
%else
%define kmake %make CC='gcc'
%define kmake %make CC='gcc' ARCH="%{arch_suffix}"
%endif
# there are places where parallel make don't work
%define smake make
%ifarch %{ix86} %{x86_64}
%define arch_type x86
%endif
%ifarch aarch64
%define arch_type arm64
%endif
# Parallelize xargs invocations on smp machines
%define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
@ -203,7 +226,6 @@ Version: %{kversion}
Release: %{fullrpmrel}
License: GPLv2
Group: System/Kernel and hardware
ExclusiveArch: %{ix86} x86_64
URL: http://www.kernel.org
####################################################################
@ -304,7 +326,7 @@ BuildRequires: flex
BuildRequires: bzip2
BuildRequires: rsync
%ifarch x86_64
%ifarch x86_64 aarch64
BuildRequires: numa-devel
%endif
@ -339,13 +361,15 @@ BuildRequires: findutils util-linux
%if %{with binary_extra_modules}
BuildRequires: kernel-source-rtl8821ce
BuildRequires: kernel-source-shredder-kernel
BuildRequires: kernel-source-tripso
%ifarch %{ix86} %{x86_64}
BuildRequires: kernel-source-shredder-kernel
BuildRequires: kernel-source-virtualbox
# TODO: drop it for kernels >= 5.6
# because all guest modules have been upstreamized
# https://www.phoronix.com/scan.php?page=news_item&px=VirtualBox-Shared-Folder-5.6
BuildRequires: kernel-source-virtualbox-vboxadditions
%endif
# rosa-test-suite is maintained in certified branches only
# nlkm, memfreetest, pcietest
%if %{with nickel}
@ -546,17 +570,20 @@ find /lib/modules/%{kver_full} -maxdepth 0 -empty -exec rm -rf {} \; || true
%files -n kernel-%{flavour}-devel-%{buildrel}
%{devel_root}/Documentation
%dir %{devel_root}
%dir %{devel_root}/arch
%dir %{devel_root}/include
%{devel_root}/Documentation
%{devel_root}/arch/um
%{devel_root}/arch/x86
%{devel_root}/arch/arm
%{devel_root}/arch/arm64
%{devel_root}/block
%{devel_root}/certs
%{devel_root}/crypto
%{devel_root}/drivers
%{devel_root}/fs
%{devel_root}/include/soc
%{devel_root}/include/acpi
%{devel_root}/include/asm-generic
%{devel_root}/include/clocksource
@ -906,14 +933,16 @@ latest kernel-uml-modules-%{flavour} %{kernelversion}.%{patchlevel}.x
%if %{with binary_extra_modules}
%ksob_mk_module_pkg -n 8821ce -s net/wireless
%ksob_mk_module_pkg -n shredder-kernel -s extra -r rosa-shredder-user
%ksob_mk_module_pkg -n xt_TRIPSO -s net -r tripso
# virtualbox host
%ifarch %{ix86} %{x86_64}
%ksob_mk_module_pkg -n vboxnetflt -s misc
%ksob_mk_module_pkg -n vboxnetadp -s misc
%ksob_mk_module_pkg -n vboxdrv -s misc
%ksob_mk_module_pkg -n vboxpci -s misc
# shredder
%ksob_mk_module_pkg -n shredder-kernel -s extra -r rosa-shredder-user
#------------------------------------------------
# a package which will pull all those modules
@ -954,6 +983,8 @@ Requires: kernel-module-vboxsf-%{flavour}-%{buildrel}
Meta package to pull VirtualBox guest kernel modules for kernel-%{flavour}-%{kernelversion}.%{patchlevel}
%files -n kernel-modules-virtualbox-guest-%{flavour}-%{kernelversion}.%{patchlevel}-latest
# end ifarch
%endif
# empty
#------------------------------------------------
@ -998,7 +1029,7 @@ cp -r %{src_dir} %{src_dir}.uml
%endif
cd %src_dir
%apply_patches
%autopatch -p1
#
# Setup Begin
@ -1026,6 +1057,11 @@ sed -i 's/CONFIG_DEBUG_WX=y/# CONFIG_DEBUG_WX is not set/' .config
touch %{build_dir}/.config.append
# get rid of unwanted files
find . -name '*~' -o -name '*.orig' -o -name '*.append' -delete
# wipe all .gitignore/.get_maintainer.ignore files
find . -name "*.g*ignore" -delete
# Enable debug info if requested.
sed -i '/CONFIG_DEBUG_INFO/d' .config
%if %build_debug
@ -1114,11 +1150,11 @@ echo 'CONFIG_DISK_BASED_SWAP_DEFAULT_ON=y' >> %{build_dir}/.config.append
cat %{build_dir}/.config.append >> .config
# Store the config file in the appropriate directory.
CONFIG_DIR=arch/x86/configs
CONFIG_DIR=arch/%{arch_type}/configs
mkdir -p "${CONFIG_DIR}"
cfg_file=arch/x86/configs/%{arch_suffix}_defconfig-%{flavour}
make ARCH=%{_arch} oldconfig && \
cfg_file=arch/%{arch_type}/configs/%{arch_suffix}_defconfig-%{flavour}
make ARCH=%{arch_suffix} oldconfig && \
mv .config ${cfg_file}
# Looks like 'make oldconfig' removes '# CONFIG_64BIT is not set' for some
@ -1289,7 +1325,7 @@ cat %{certs_public_keys}
# .config
%smake -s mrproper
cp arch/x86/configs/%{arch_suffix}_defconfig-%{flavour} .config
cp arch/%{arch_type}/configs/%{arch_suffix}_defconfig-%{flavour} .config
# make sure EXTRAVERSION says what we want it to say
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{flavour}-%{buildrpmrel}/" Makefile
@ -1308,7 +1344,13 @@ LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{flavour}-%{buildrpmrel}/"
# build the kernel
echo "Building kernel %{kver_full}"
%kmake V=1 -s all
TARGETS="all"
# need to install dtbs to proper boot arm64 devices
%ifarch aarch64
TARGETS="$TARGETS dtbs"
%endif
%kmake V=1 -s all $TARGETS
# Install modules
mkdir -p %{temp_modules}/%{kver_full}
@ -1328,14 +1370,6 @@ cp 8821ce.ko %{temp_modules}/%{kver_full}/kernel/net/wireless/8821ce.ko
popd
rm -fr kernel-source-rtl8821ce
cp -r "$(rpm -q --qf '/usr/src/shredder-kernel-%%{VERSION}-%%{RELEASE}' kernel-source-shredder-kernel)" kernel-source-shredder-kernel
pushd kernel-source-shredder-kernel
%kmake KERNEL_PATH=%{src_dir}
mkdir -p %{temp_modules}/%{kver_full}/kernel/extra/
cp shredder-kernel.ko %{temp_modules}/%{kver_full}/kernel/extra/
popd
rm -fr kernel-source-shredder-kernel
cp -r "$(rpm -q --qf '/usr/src/tripso-%%{VERSION}-%%{RELEASE}' kernel-source-tripso)" kernel-source-tripso
pushd kernel-source-tripso
%kmake KDIR=%{src_dir}
@ -1344,6 +1378,15 @@ cp xt_TRIPSO.ko %{temp_modules}/%{kver_full}/kernel/net/
popd
rm -fr kernel-source-tripso
%ifarch %{ix86} %{x86_64}
cp -r "$(rpm -q --qf '/usr/src/shredder-kernel-%%{VERSION}-%%{RELEASE}' kernel-source-shredder-kernel)" kernel-source-shredder-kernel
pushd kernel-source-shredder-kernel
%kmake KERNEL_PATH=%{src_dir}
mkdir -p %{temp_modules}/%{kver_full}/kernel/extra/
cp shredder-kernel.ko %{temp_modules}/%{kver_full}/kernel/extra/
popd
rm -fr kernel-source-shredder-kernel
# build commands for virtualbox are based on the ones from the virtualbox package
cp -r "$(rpm -q --qf '/usr/src/vboxadditions-%%{VERSION}-%%{RELEASE}' kernel-source-virtualbox-vboxadditions)" kernel-source-virtualbox-vboxadditions
mkdir -p %{temp_modules}/%{kver_full}/kernel/misc/
@ -1377,6 +1420,8 @@ do
cp -v "${i}/${i}.ko" %{temp_modules}/%{kver_full}/kernel/misc/
done
popd
# end ifarch ix86
%endif
%if %{with nickel}
# rosa-test-suite uses /sr/src/xxx-version, not /usr/src/xxx-version-release
@ -1426,7 +1471,11 @@ install -m 644 System.map %{temp_boot}/System.map-%{kver_full}
install -m 644 .config %{temp_boot}/config-%{kver_full}
xz -c Module.symvers > %{temp_boot}/symvers-%{kver_full}.xz
cp -f arch/x86/boot/bzImage %{temp_boot}/vmlinuz-%{kver_full}
%ifarch aarch64
cp -f arch/arm64/boot/Image.gz %{temp_boot}/vmlinuz-%{kver_full}
%else
cp -f arch/%{arch_type}/boot/bzImage %{temp_boot}/vmlinuz-%{kver_full}
%endif
# headers
%if %{build_headers}
@ -1450,12 +1499,19 @@ cp -fR scripts %{temp_devel_root}
cp -fR kernel/bounds.c %{temp_devel_root}/kernel
cp -fR kernel/time/timeconst.bc %{temp_devel_root}/kernel/time
cp -fR tools %{temp_devel_root}/
cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel_root}/arch/x86/kernel/
cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel_root}/arch/x86/kernel/
cp -fR arch/x86/purgatory/* %{temp_devel_root}/arch/x86/purgatory/
cp -fR arch/x86/entry/syscalls/syscall* %{temp_devel_root}/arch/x86/entry/syscalls/
cp -fR arch/x86/include %{temp_devel_root}/arch/x86/
cp -fR arch/x86/tools %{temp_devel_root}/arch/x86/
cp -fR arch/%{arch_type}/kernel/asm-offsets.{c,s} %{temp_devel_root}/arch/%{arch_type}/kernel/
%ifarch %{ix86} %{x86_64}
cp -fR arch/%{arch_type}/kernel/asm-offsets_{32,64}.c %{temp_devel_root}/arch/%{arch_type}/kernel/
cp -fR arch/%{arch_type}/purgatory/* %{temp_devel_root}/arch/%{arch_type}/purgatory/
# needed for arch/x86/purgatory
cp -fR lib/*.h lib/*.c %{temp_devel_root}/lib/
cp -fR arch/%{arch_type}/entry/syscalls/syscall* %{temp_devel_root}/arch/%{arch_type}/entry/syscalls/
cp -fR arch/%{arch_type}/tools %{temp_devel_root}/arch/%{arch_type}/
# needed for kexec
cp -fR arch/%{arch_type}/boot/*.h %{temp_devel_root}/arch/%{arch_type}/boot/
cp -fR arch/%{arch_type}/boot/*.c %{temp_devel_root}/arch/%{arch_type}/boot/
%endif
cp -fR arch/%{arch_type}/include %{temp_devel_root}/arch/%{arch_type}/
cp -fR .config Module.symvers %{temp_devel_root}
# Needed for truecrypt build (Danny)
@ -1475,29 +1531,17 @@ cp -fR fs/aufs/magic.mk %{temp_devel_root}/fs/aufs
# SELinux needs security/selinux/include
cp -fR security/selinux/include %{temp_devel_root}/security/selinux
# needed for kexec
cp -fR arch/x86/boot/*.h %{temp_devel_root}/arch/x86/boot/
cp -fR arch/x86/boot/*.c %{temp_devel_root}/arch/x86/boot/
# needed for arch/x86/purgatory
cp -fR lib/*.h lib/*.c %{temp_devel_root}/lib/
for i in alpha arc avr32 blackfin c6x cris csky frv h8300 hexagon ia64 m32r m68k m68knommu metag microblaze \
mips mn10300 nds32 nios2 openrisc parisc powerpc riscv s390 score sh sparc tile unicore32 xtensa; do
rm -rf %{temp_devel_root}/arch/$i
done
rm -rf %{temp_devel_root}/arch/arm*
rm -rf %{temp_devel_root}/include/kvm/arm*
rm -rf %{temp_devel_root}/include/soc
# Clean the scripts tree, and make sure everything is ok (sanity check)
# running prepare+scripts (tree was already "prepared" in build)
pushd %{temp_devel_root}
%smake V=1 -s prepare
%smake V=1 -s scripts
%smake V=1 -s clean
%smake V=1 -s clean ARCH=%{arch_type}
popd
rm -f %{temp_devel_root}/.config.old
# fix permissions
@ -1577,11 +1621,13 @@ cat > $kernel_files <<EOF
%if %{with binary_extra_modules}
# 8821ce.ko.debug will not be excluded and will be in the main debug subpackage
%exclude %{_modulesdir}/%{kver_full}/kernel/net/wireless/8821ce.ko%{kmod_suffix}
%ifarch %{ix86} %{x86_64}
%exclude %{_modulesdir}/%{kver_full}/kernel/extra/shredder-kernel.ko%{kmod_suffix}
%exclude %{_modulesdir}/%{kver_full}/kernel/net/xt_TRIPSO.ko%{kmod_suffix}
# vbox host: vboxnetflt vboxnetadp vboxdrv vboxpci
# vbox guest: vboxvideo vboxguest vboxsf
%exclude %{_modulesdir}/%{kver_full}/kernel/misc/vbox*.ko%{kmod_suffix}
%endif
%exclude %{_modulesdir}/%{kver_full}/kernel/net/xt_TRIPSO.ko%{kmod_suffix}
%if %{with nickel}
%exclude %{_modulesdir}/%{kver_full}/kernel/misc/nlkm.ko%{kmod_suffix}
%exclude %{_modulesdir}/%{kver_full}/kernel/misc/memfreetest.ko%{kmod_suffix}
@ -1599,13 +1645,7 @@ cat ../kernel_exclude_debug_files.%{flavour} >> $kernel_files
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{fullrpmrel}/" Makefile
%if %{build_perf}
%ifarch x86_64
%define perf_is_x64 1
%else
%define perf_is_x64 0
%endif
%smake -C tools/perf -s IS_X86_64=%{perf_is_x64} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} NO_GTK2=1 all
%smake -C tools/perf -s HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} NO_GTK2=1 all
%smake -C tools/perf -s prefix=%{_prefix} NO_GTK2=1 man
%endif
@ -1692,13 +1732,13 @@ LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{fullrpmrel}/" Makefile
%if %{build_perf}
# perf tool binary and supporting scripts/binaries
make -C tools/perf -s V=1 DESTDIR=%{buildroot} IS_X86_64=%{perf_is_x64} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install
make -C tools/perf -s V=1 DESTDIR=%{buildroot} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install
# Versionize shebang (#!/usr/bin/env python -> #!/usr/bin/python3)
sed -i -e '1 s,^.*$,#!%{__python3},' %{buildroot}%{_prefix}/libexec/perf-core/scripts/python/exported-sql-viewer.py
# perf man pages (note: implicit rpm magic compresses them later)
make -C tools/perf -s V=1 DESTDIR=%{buildroot} IS_X86_64=%{perf_is_x64} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install-man
make -C tools/perf -s V=1 DESTDIR=%{buildroot} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install-man
%endif
%if %{build_cpupower}