libraries.
%prep
-%setup -q -n linux-kernel-%{version}
+%setup -q
%build
%{?asan:/usr/bin/gcc-unforce-options}
sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{variant}/" Makefile
# 0. extract uapi headers
-mkdir -p uapi-headers/usr
-make mrproper
-make headers_check
-make headers_install INSTALL_HDR_PATH=uapi-headers/usr
+make headers_check %{?_smp_mflags}
+make headers_install %{?_smp_mflags}
# 1-1. Set config file
-make %{config_name}
+make %{config_name} %{?_smp_mflags}
# 1-2. Build Image/Image.gz
make %{?_smp_mflags}
install -m 644 rpi4/boot/start*.elf %{buildroot}/boot/
install -m 644 rpi4/boot/fixup*.dat %{buildroot}/boot/
-# 2-5. Install uapi headers
-find uapi-headers/usr/include -name ".install" -delete
-find uapi-headers/usr/include -name "..install.cmd" -delete
-mv uapi-headers/usr %{buildroot}
-
-# 3-1. remove unnecessary files to prepare for devel package
-rm -rf uapi-headers
-find %{_builddir}/linux-kernel-%{version} -name ".tmp_vmlinux*" -delete
-find %{_builddir}/linux-kernel-%{version} -name ".gitignore" -delete
-find %{_builddir}/linux-kernel-%{version} -name "\.*dtb*tmp" -delete
-find %{_builddir}/linux-kernel-%{version} -name "\.*dtb" -delete
-find %{_builddir}/linux-kernel-%{version} -name "*\.*tmp" -delete
-find %{_builddir}/linux-kernel-%{version} -name "vmlinux" -delete
-find %{_builddir}/linux-kernel-%{version} -name "Image" -delete
-find %{_builddir}/linux-kernel-%{version} -name "zImage" -delete
-find %{_builddir}/linux-kernel-%{version} -name "Image.gz" -delete
-find %{_builddir}/linux-kernel-%{version} -name "*.cmd" -delete
-find %{_builddir}/linux-kernel-%{version} -name "*\.ko" -delete
-find %{_builddir}/linux-kernel-%{version} -name "*\.o" -delete
-find %{_builddir}/linux-kernel-%{version} -name "*\.S" -delete
-find %{_builddir}/linux-kernel-%{version} -name "*\.HEX" -type f -delete
-find %{_builddir}/linux-kernel-%{version} -name "*\.c" -not -path "%{_builddir}/linux-kernel-%{version}/scripts/*" -delete
-
-# 3-2. move files for devel package
-cp -r %{_builddir}/linux-kernel-%{version}/ %{_builddir}/kernel-devel-%{variant}/
-
-# 4. Move files for each package
-mkdir -p %{buildroot}/boot/kernel/devel
-mv %{_builddir}/kernel-devel-%{variant} %{buildroot}/boot/kernel/devel/
-
+# 2-5. Install kernel headers
+make headers_install %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr
+
+# 3. Copy files for devel package
+mkdir -p %{buildroot}/boot/kernel/devel/kernel-devel-%{variant}
+rsync -r \
+ --include "/scripts/**.c" \
+ --exclude "/debug*.list" \
+ --exclude "/documentation.list" \
+ --exclude "/*.manifest" \
+ --exclude "/packaging/" \
+ --exclude "/.gbs.conf" \
+ --exclude "/.git**" \
+ --exclude ".gitignore" \
+ --exclude "*\.c" \
+ --exclude ".tmp_vmlinux*" \
+ --exclude ".*dtb*tmp" \
+ --exclude ".*dtb" \
+ --exclude "*.*tmp" \
+ --exclude "vmlinux" \
+ --exclude "Image" \
+ --exclude "zImage" \
+ --exclude "Image.gz" \
+ --exclude "*.cmd" \
+ --exclude "*.ko" \
+ --exclude "*.o" \
+ --exclude "*.S" \
+ --exclude "*.HEX" \
+%{_builddir}/%{name}-%{version}/ %{buildroot}/boot/kernel/devel/kernel-devel-%{variant}
%clean
rm -rf %{buildroot}
-rm -rf %{_builddir}/usr
%files -n %{variant}-linux-kernel-modules
/lib/modules/*