From 0f8c67a5d0eb59d57a7c9fd9c158e2f1758545c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Stelmach?= Date: Thu, 3 Mar 2022 13:51:19 +0100 Subject: [PATCH] spec: Build rt packages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Build a second set of packages with PREEMPT_RT enabled Change-Id: I1c0ec964f68eda41d6c628b0476a5246045171ad Signed-off-by: Łukasz Stelmach --- packaging/linux-rpi4.spec | 226 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 167 insertions(+), 59 deletions(-) diff --git a/packaging/linux-rpi4.spec b/packaging/linux-rpi4.spec index f6f3849..c74417b 100644 --- a/packaging/linux-rpi4.spec +++ b/packaging/linux-rpi4.spec @@ -2,6 +2,7 @@ %define _wrong_version_format_terminate_build 0 %define config_name tizen_bcm2711_defconfig +%define config_name_rt tizen_bcm2711_rt_defconfig %ifarch aarch64 %define buildarch arm64 %else @@ -34,6 +35,7 @@ BuildRequires: rsync %description The Linux Kernel, the operating system core itself +# kernel %package -n %{variant}-linux-kernel License: GPL-2.0 Summary: Tizen kernel for %{target_board} @@ -44,6 +46,18 @@ Provides: linux-kernel = %{version}-%{release} %description -n %{variant}-linux-kernel This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board}) +%package -n %{variant}-rt-linux-kernel +License: GPL-2.0 +Summary: Tizen kernel for %{target_board} +Group: System/Kernel +Provides: %{variant}-kernel-uname-r = %{fullVersion}-rt +Provides: linux-kernel = %{version}-%{release}-rt + +%description -n %{variant}-rt-linux-kernel +This package contains the Linux kernel for Tizen (arch %{buildarch}, target board %{target_board}) + +# modules + %package -n %{variant}-linux-kernel-modules Summary: Kernel modules for %{target_board} Group: System/Kernel @@ -53,6 +67,18 @@ Provides: %{variant}-kernel-modules-uname-r = %{fullVersion} %description -n %{variant}-linux-kernel-modules Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board} +%package -n %{variant}-rt-linux-kernel-modules +Summary: Kernel modules for %{target_board} +Group: System/Kernel +Provides: %{variant}-kernel-modules = %{fullVersion}-rt +Provides: %{variant}-kernel-modules-uname-r = %{fullVersion}-rt + +%description -n %{variant}-rt-linux-kernel-modules +Kernel-modules includes the loadable kernel modules(.ko files) for %{target_board} +with the PREEMPT_RT patch + +# devel + %package -n %{variant}-linux-kernel-devel License: GPL-2.0 Summary: Linux support kernel map and etc for other packages @@ -63,6 +89,17 @@ Provides: %{variant}-kernel-devel-uname-r = %{fullVersion} %description -n %{variant}-linux-kernel-devel This package provides kernel map and etc information. +%package -n %{variant}-rt-linux-kernel-devel +License: GPL-2.0 +Summary: Linux support kernel map and etc for other packages +Group: System/Kernel +Provides: %{variant}-kernel-devel = %{fullVersion}-rt +Provides: %{variant}-kernel-devel-uname-r = %{fullVersion}-rt + +%description -n %{variant}-rt-linux-kernel-devel +This package provides kernel map and etc information. + +#headers %package -n %{variant}-linux-kernel-headers License: GPL-2.0 Summary: Linux support headers for userspace development @@ -81,45 +118,44 @@ headers are used by the installed headers for GNU glibc and other system %{?asan:/usr/bin/gcc-unforce-options} %{?ubsan:/usr/bin/gcc-unforce-options} -# 0. extract uapi headers -make headers_check %{?_smp_mflags} -make headers_install %{?_smp_mflags} +mv localversion-rt _localversion-rt +for target in %{variant} %{variant}-rt; do + rm -f localversion-rt + echo "-${target}" > localversion-tizen + + # extract uapi headers + make O=build/${target} headers_check %{?_smp_mflags} + make O=build/${target} headers_install %{?_smp_mflags} -# 1-1. Set config file -make %{config_name} %{?_smp_mflags} -if ! grep -q "^CONFIG_LOCALVERSION=\"-%{variant}" .config; then - ./scripts/config --set-str CONFIG_LOCALVERSION "-%{variant}$(eval $(grep ^CONFIG_LOCALVERSION= .config); echo $CONFIG_LOCALVERSION)" -fi + # Set config file + case $target in + %{variant}) + make O=build/${target} %{config_name} %{?_smp_mflags} + ;; + %{variant}-rt) + cat _localversion-rt > localversion-rt + make O=build/${target} %{config_name_rt} %{?_smp_mflags} + ;; + esac -# 1-2. Build Image/Image.gz -make %{?_smp_mflags} + # Build Image/Image.gz + make O=build/${target} %{?_smp_mflags} -# 1-3. Build dtbs -make dtbs %{?_smp_mflags} + # Build dtbs + make O=build/${target} dtbs %{?_smp_mflags} -# 1-4. Build modules -make modules %{?_smp_mflags} + # Build modules + make O=build/${target} modules %{?_smp_mflags} +done %install QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT -# 2-1. Destination directories +# Destination directories mkdir -p %{buildroot}/boot mkdir -p %{buildroot}/lib/modules -# 2-2. Install kernel binary and DTB -%ifarch aarch64 -install -m 644 arch/%{buildarch}/boot/Image %{buildroot}/boot/ -install -m 644 arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/ -%else -install -m 644 arch/%{buildarch}/boot/zImage %{buildroot}/boot/ -install -m 644 arch/%{buildarch}/boot/dts/bcm*.dtb %{buildroot}/boot/ -%endif - -# 2-3. Install modules -make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install - -# 2-4. Install boot binary files +# Install boot binary files %ifarch aarch64 install -m 644 rpi4/boot/config_64bit.txt %{buildroot}/boot/config.txt %else @@ -129,44 +165,103 @@ 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 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} +# Install kernel binary and DTB +%ifarch aarch64 +install -m 644 build/%{variant}/arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/ +%else +install -m 644 build/%{variant}/arch/%{buildarch}/boot/dts/bcm*.dtb %{buildroot}/boot/ +%endif + +# Install kernel headers +make O=build/%{variant} headers_install %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr + +for target in %{variant} %{variant}-rt; do + # Install kernel binary and DTB + case $target in + %{variant}) +%ifarch aarch64 + install -m 644 build/${target}/arch/%{buildarch}/boot/Image %{buildroot}/boot/Image +%else + install -m 644 build/${target}/arch/%{buildarch}/boot/zImage %{buildroot}/boot/zImage +%endif + ;; + %{variant}-rt) +%ifarch aarch64 + install -m 644 build/${target}/arch/%{buildarch}/boot/Image %{buildroot}/boot/Image_rt +%else + install -m 644 build/${target}/arch/%{buildarch}/boot/zImage %{buildroot}/boot/zImage_rt +%endif + ;; + esac + + # Install modules + make O=build/${target} INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install + + # Copy files for devel package + mkdir -p %{buildroot}/boot/kernel/devel/kernel-devel-${target} + 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" \ + --exclude "/build/" \ + ./ build/${target}/ %{buildroot}/boot/kernel/devel/kernel-devel-${target} +done %clean rm -rf %{buildroot} +%post -n %{variant}-rt-linux-kernel +%ifarch aarch64 +mv /boot/Image_rt /boot/Image +%else +mv /boot/zImage_rt /boot/zImage +%endif + +%preun -n %{variant}-rt-linux-kernel +%ifarch aarch64 +mv /boot/Image /boot/Image_rt +%else +mv /boot/zImage /boot/zImage_rt +%endif + %files -n %{variant}-linux-kernel-modules -/lib/modules/* +%ifarch aarch64 +/lib/modules/*%{variant}-v8/ +%else +/lib/modules/*%{variant}-v7l/ +%endif + +%files -n %{variant}-rt-linux-kernel-modules +%ifarch aarch64 +/lib/modules/*%{variant}-rt-v8/ +%else +/lib/modules/*%{variant}-rt-v7l/ +%endif %files -n %{variant}-linux-kernel-devel -/boot/kernel/devel/* +/boot/kernel/devel/*%{variant}/ + +%files -n %{variant}-rt-linux-kernel-devel +/boot/kernel/devel/*%{variant}-rt/ %files -n %{variant}-linux-kernel %license COPYING @@ -181,5 +276,18 @@ rm -rf %{buildroot} /boot/start*.elf /boot/fixup*.dat +%files -n %{variant}-rt-linux-kernel +%license COPYING +%ifarch aarch64 +/boot/Image_rt +%else +/boot/zImage_rt +%endif +/boot/bcm*.dtb +/boot/config.txt +/boot/LICENCE.broadcom +/boot/start*.elf +/boot/fixup*.dat + %files -n %{variant}-linux-kernel-headers /usr/include/* -- 2.7.4