packaging: Add the intial linux-rpi4 spec file
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 21 Feb 2024 04:31:11 +0000 (13:31 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 12 Nov 2024 04:03:07 +0000 (13:03 +0900)
Add the intial linux-rpi4 spec file to build with gbs.

Change-Id: I59a337621443639a84ecc97960dfb1df1cc6e399
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
.gbs.conf [new file with mode: 0644]
packaging/linux-rpi4.spec [new file with mode: 0644]

diff --git a/.gbs.conf b/.gbs.conf
new file mode 100644 (file)
index 0000000..f744dba
--- /dev/null
+++ b/.gbs.conf
@@ -0,0 +1,4 @@
+[general]
+upstream_branch = upstream
+upstream_tag = v${upstreamversion}
+squash_patches_until = HEAD~10
diff --git a/packaging/linux-rpi4.spec b/packaging/linux-rpi4.spec
new file mode 100644 (file)
index 0000000..d6b0ee1
--- /dev/null
@@ -0,0 +1,323 @@
+# Ignore double dash in version for rpmbuild
+%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
+%define buildarch arm
+%endif
+%define target_board rpi4
+%define variant %{buildarch}-%{target_board}
+
+Name: rpi4-linux-kernel
+Summary: The Linux Kernel for Raspberry Pi4
+Version: 6.6.60
+Release: 0
+License: GPL-2.0
+ExclusiveArch: %{arm} aarch64
+Group: System/Kernel
+Vendor: The Linux Community
+URL: https://www.kernel.org
+Source0:   linux-kernel-%{version}.tar.xz
+BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root
+
+%define fullVersion %{version}-%{variant}
+
+BuildRequires: bc
+BuildRequires: module-init-tools
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: pkgconfig(openssl3)
+BuildRequires: libunwind-devel
+BuildRequires: libdw-devel
+BuildRequires: libelf-devel
+BuildRequires: elfutils
+BuildRequires: xz-devel
+BuildRequires: binutils-devel
+BuildRequires: python3
+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}
+Group: System/Kernel
+Provides: %{variant}-kernel-uname-r = %{fullVersion}
+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
+Provides: %{variant}-kernel-modules = %{fullVersion}
+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
+Group: System/Kernel
+Provides: %{variant}-kernel-devel = %{fullVersion}
+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
+Group: System/Kernel
+Provides: kernel-headers-tizen-dev
+
+%description -n %{variant}-linux-kernel-headers
+This package provides userspaces headers from the Linux kernel. These
+headers are used by the installed headers for GNU glibc and other system
+ libraries.
+
+%package -n linux-kernel-perf
+Summary: The perf performance counter tool
+Group: System/Kernel
+Provides: perf = %{version}
+
+%description -n linux-kernel-perf
+This package provides the "perf" tool that can be used to monitor performance
+counter events as well as various kernel internal events.
+
+%prep
+%setup -q
+
+%build
+%{?asan:/usr/bin/gcc-unforce-options}
+%{?ubsan:/usr/bin/gcc-unforce-options}
+
+for target in %{variant} %{variant}-rt; do
+    echo "-${target}" > localversion-tizen
+
+    # extract uapi headers
+    make O=build/${target} headers_install %{?_smp_mflags}
+
+    # Set config file
+    case $target in
+       %{variant})
+           make O=build/${target} %{config_name} %{?_smp_mflags}
+
+            # Build perf
+           # WERROR=0 make O=build/${target} -s -C tools/lib/traceevent %{?_smp_mflags}
+            WERROR=0 make O=build/${target} -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" %{?_smp_mflags} NO_LIBTRACEEVENT=1
+       ;;
+       %{variant}-rt)
+           cat _localversion-rt > localversion-rt
+           make O=build/${target} %{config_name_rt} %{?_smp_mflags}
+       ;;
+    esac
+
+    # Build Image/Image.gz
+    make O=build/${target} %{?_smp_mflags}
+
+    # Build dtbs
+    make O=build/${target} dtbs %{?_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
+
+# Destination directories
+mkdir -p %{buildroot}/boot
+mkdir -p %{buildroot}/lib/modules
+
+# Install boot binary files
+%ifarch aarch64
+install -m 644 rpi4/boot/config_64bit.txt %{buildroot}/boot/config.txt
+%else
+install -m 644 rpi4/boot/config.txt %{buildroot}/boot/
+%endif
+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/
+
+# Install kernel DTB
+install -m 644 build/%{variant}/arch/%{buildarch}/boot/dts/broadcom/bcm*.dtb %{buildroot}/boot/
+mkdir -p %{buildroot}/boot/overlays
+install -m 644 build/%{variant}/arch/%{buildarch}/boot/dts/overlays/*.dtbo %{buildroot}/boot/overlays/
+
+# 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
+    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
+
+            # Install perf
+            WERROR=0 make O=build/${target} -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" DESTDIR=%{buildroot}/usr install NO_LIBTRACEEVENT=1
+            rm -rf %{buildroot}/usr/etc
+            rm -rf %{buildroot}/usr/lib/debug
+            rm -rf %{buildroot}/usr/lib/perf
+            rm -rf %{buildroot}/usr/share
+
+       ;;
+       %{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
+%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/*%{variant}/
+
+%files -n %{variant}-rt-linux-kernel-devel
+/boot/kernel/devel/*%{variant}-rt/
+
+%files -n %{variant}-linux-kernel
+%license COPYING
+%ifarch aarch64
+/boot/Image
+%else
+/boot/zImage
+%endif
+/boot/bcm*.dtb
+/boot/overlays/*.dtbo
+/boot/config.txt
+/boot/LICENCE.broadcom
+/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/overlays/*.dtbo
+/boot/config.txt
+/boot/LICENCE.broadcom
+/boot/start*.elf
+/boot/fixup*.dat
+
+%files -n %{variant}-linux-kernel-headers
+/usr/include/*
+
+%files -n linux-kernel-perf
+%license COPYING
+/usr/bin/*
+/usr/libexec/*