From: Jaehoon Chung Date: Wed, 13 Mar 2024 07:46:10 +0000 (+0900) Subject: packaging: linux-lpi4a: Add the initial spec file X-Git-Tag: accepted/tizen/unified/x/20240314.073055^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24c1b945b87733e2aef8eed3ac714d3048843df7;p=platform%2Fkernel%2Flinux-thead.git packaging: linux-lpi4a: Add the initial spec file ADd the initial spec file. Change-Id: I0ae20783340b8182e7f1517c4bb3275bf609ed87 Signed-off-by: Jaehoon Chung --- diff --git a/.gbs.conf b/.gbs.conf new file mode 100644 index 000000000000..f744dbaac48e --- /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-lpi4a.spec b/packaging/linux-lpi4a.spec new file mode 100644 index 000000000000..9a195bd0445f --- /dev/null +++ b/packaging/linux-lpi4a.spec @@ -0,0 +1,189 @@ +%define target_board lpi4a + +# Ignore double dash in version for rpmbuild +%define _wrong_version_format_terminate_build 0 + +%define config_name tizen-%{target_board}_defconfig +%define buildarch riscv +%define variant %{buildarch}-%{target_board} + +Name: %{variant}-linux-kernel +Summary: The Linux Kernel for RISC-V %{target_board} +Version: 6.6.20 +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}-%{target_board} + +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 +BuildRequires: python3-devel + +# 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 %{variant}-linux-kernel-perf +Summary: The perf performance counter tool +Group: System/Kernel +Provides: perf = %{version} + +%description -n %{variant}-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 -n linux-kernel-%{version} + +%build +%{?asan:/usr/bin/gcc-unforce-options} +%{?ubsan:/usr/bin/gcc-unforce-options} + +# distinguish binaries for different variants +echo "-%{variant}" > localversion-tizen + +# extract uapi headers +make headers_install %{?_smp_mflags} + +# Set config file +make %{config_name} %{?_smp_mflags} + +# Build perf +make -s -C tools/perf EXTRA_CFLAGS="-fPIE -rdynamic" %{?_smp_mflags} NO_LIBTRACEEVENT=1 + +# 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/thead/th1520*.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 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 + +# 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/%{version}-%{variant} + +%files -n %{variant}-linux-kernel-devel +/boot/kernel/devel/ + +%files -n %{variant}-linux-kernel +%license COPYING +/boot/Image +/boot/th1520*.dtb + +%files -n %{variant}-linux-kernel-headers +/usr/include/* + +%files -n %{variant}-linux-kernel-perf +%license COPYING +/usr/bin/* +/usr/libexec/*