From 7ad4d6d9c101dd7955a52cae5be92e1ff29fa123 Mon Sep 17 00:00:00 2001 From: Alexander Stefanov Date: Thu, 26 Nov 2020 18:48:55 +0000 Subject: [PATCH] add arch_type --- kernel.spec | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/kernel.spec b/kernel.spec index efa1989..74e65c5 100644 --- a/kernel.spec +++ b/kernel.spec @@ -188,6 +188,13 @@ # 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" ] \\\ @@ -551,7 +558,7 @@ find /lib/modules/%{kver_full} -maxdepth 0 -empty -exec rm -rf {} \; || true %dir %{devel_root}/include %{devel_root}/Documentation %{devel_root}/arch/um -%{devel_root}/arch/x86 +%{devel_root}/arch/%{arch_type} %{devel_root}/block %{devel_root}/certs %{devel_root}/crypto @@ -998,7 +1005,7 @@ cp -r %{src_dir} %{src_dir}.uml %endif cd %src_dir -%apply_patches +%autopatch -p1 # # Setup Begin @@ -1114,10 +1121,10 @@ 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} +cfg_file=arch/%{arch_type}/configs/%{arch_suffix}_defconfig-%{flavour} make ARCH=%{_arch} oldconfig && \ mv .config ${cfg_file} @@ -1289,7 +1296,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 @@ -1426,7 +1433,7 @@ 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} +cp -f arch/%{arch_type}/boot/bzImage %{temp_boot}/vmlinuz-%{kver_full} # headers %if %{build_headers} @@ -1450,12 +1457,12 @@ 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/ +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/ +cp -fR arch/%{arch_type}/entry/syscalls/syscall* %{temp_devel_root}/arch/%{arch_type}/entry/syscalls/ +cp -fR arch/%{arch_type}/include %{temp_devel_root}/arch/%{arch_type}/ +cp -fR arch/%{arch_type}/tools %{temp_devel_root}/arch/%{arch_type}/ cp -fR .config Module.symvers %{temp_devel_root} # Needed for truecrypt build (Danny) @@ -1476,8 +1483,8 @@ cp -fR fs/aufs/magic.mk %{temp_devel_root}/fs/aufs 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/ +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/ # needed for arch/x86/purgatory cp -fR lib/*.h lib/*.c %{temp_devel_root}/lib/