packaging: Add linux-visionfive2 spec file
authorJaehoon Chung <jh80.chung@samsung.com>
Fri, 10 Mar 2023 06:31:40 +0000 (15:31 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 24 Jul 2023 23:24:47 +0000 (08:24 +0900)
Add linux-visionfive2 spec vile to build with gbs.
This is for only visionfive2 board.

Change-Id: Icc8feec48b9d77c27b4ce8f2d9468ca882d1fca1
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
.gbs.conf [new file with mode: 0644]
packaging/linux-visionfive2.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-visionfive2.spec b/packaging/linux-visionfive2.spec
new file mode 100644 (file)
index 0000000..330c3f1
--- /dev/null
@@ -0,0 +1,193 @@
+# Ignore double dash in version for rpmbuild
+%define _wrong_version_format_terminate_build 0
+
+%define config_name tizen_vf2_defconfig
+%define buildarch riscv
+%define target_board visionfive2
+%define variant %{buildarch}-%{target_board}
+
+Name: visionfive2-linux-kernel
+Summary: The Linux Kernel for VisionFive2 Board
+Version: 6.1.29
+Release: 0
+License: GPL-2.0
+ExclusiveArch: riscv64
+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: libopenssl1.1-devel
+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})
+
+# 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}
+
+# 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.
+
+#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}
+
+# extract uapi headers
+make headers_install %{?_smp_mflags}
+
+# Set config file
+make %{config_name} %{?_smp_mflags}
+
+# Build perf
+make -s -C tools/lib/traceevent %{?_smp_mflags}
+make -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" %{?_smp_mflags}
+
+# Build Image/Image.gz
+make %{?_smp_mflags}
+
+# Build modules
+make  modules %{?_smp_mflags}
+
+%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 kernel DTB
+install -m 644 arch/%{buildarch}/boot/dts/starfive/jh7110*.dtb %{buildroot}/boot/
+mkdir -p %{buildroot}/boot/overlays
+
+# Install kernel headers
+make headers_install %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr
+
+install -m 644 arch/%{buildarch}/boot/Image %{buildroot}/boot/Image
+
+# Install perf
+make -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" DESTDIR=%{buildroot}/usr install
+rm -rf %{buildroot}/usr/etc
+rm -rf %{buildroot}/usr/lib/debug
+rm -rf %{buildroot}/usr/lib/perf
+rm -rf %{buildroot}/usr/share
+
+# Install modules
+make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{buildroot} modules_install
+
+# 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" \
+  --exclude "/build/" \
+  ./  %{buildroot}/boot/kernel/devel/kernel-devel-%{variant}
+
+%clean
+rm -rf %{buildroot}
+
+%files -n %{variant}-linux-kernel-modules
+/lib/modules/
+
+%files -n %{variant}-linux-kernel-devel
+/boot/kernel/devel/
+
+%files -n %{variant}-linux-kernel
+%license COPYING
+/boot/Image
+/boot/jh7110*.dtb
+
+%files -n %{variant}-linux-kernel-headers
+/usr/include/*
+
+%files -n linux-kernel-perf
+%license COPYING
+/usr/bin/*
+/usr/libexec/*
+/usr/lib/traceevent/*