From 637edcde4c997d5c6cc81a4fc0f52974711b797c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Mon, 4 Jan 2021 14:41:58 +0100 Subject: [PATCH] spec: support gbs(1) incremental builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gbs(1) enable incremental builds that are significantly faster, hoewever, spec files need some adjustments. + You can't use -n with %setup + There is no point in making mrproper + use rsync(1) instead of cp(1)+find(1) to copy devel files Other changes are: + use make headers_install to install headers in the buildroot + add _smp_mflags to make(1) things faster Change-Id: Ia14fbe7acab8b83683f9e07757b4f62a7657b2a5 Signed-off-by: Łukasz Stelmach --- packaging/linux-rpi4.spec | 70 ++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/packaging/linux-rpi4.spec b/packaging/linux-rpi4.spec index 52b1d17f7..1d5d670 100644 --- a/packaging/linux-rpi4.spec +++ b/packaging/linux-rpi4.spec @@ -75,7 +75,7 @@ headers are used by the installed headers for GNU glibc and other system libraries. %prep -%setup -q -n linux-kernel-%{version} +%setup -q %build %{?asan:/usr/bin/gcc-unforce-options} @@ -85,13 +85,11 @@ headers are used by the installed headers for GNU glibc and other system 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} @@ -131,40 +129,38 @@ install -m 644 rpi4/boot/LICENCE.broadcom %{buildroot}/boot/ 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/* -- 2.7.4