packaging: add rpm packaging spec 14/248914/5
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 7 Dec 2020 01:54:27 +0000 (10:54 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 10 Dec 2020 07:36:43 +0000 (16:36 +0900)
For Tizen packaging, add rpm packaging spec to build both odroid
and kvim boards.

Change-Id: I14815c8df90b6455bb1bd37b8111e9f206163040
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
.gbs.conf [new file with mode: 0644]
packaging/linux-amlogic.spec [new file with mode: 0644]

diff --git a/.gbs.conf b/.gbs.conf
new file mode 100644 (file)
index 0000000..5dc0892
--- /dev/null
+++ b/.gbs.conf
@@ -0,0 +1,4 @@
+[general]
+upstream_branch = upstream
+upstream_tag = v${upstreamversion}
+squash_patches_until = HEAD~5
diff --git a/packaging/linux-amlogic.spec b/packaging/linux-amlogic.spec
new file mode 100644 (file)
index 0000000..c06dd24
--- /dev/null
@@ -0,0 +1,256 @@
+# Ignore double dash in version for rpmbuild
+%define _wrong_version_format_terminate_build 0
+%define debug_package %{nil}
+
+%ifarch aarch64
+%define buildarch arm64
+%define KERNEL_IMAGE Image.gz
+%else
+%define buildarch arm
+%define KERNEL_IMAGE zImage
+%endif
+
+%define CHIPSET amlogic
+%define TARGET_ODROIDS odroid
+%define ODROIDS_DT_PREFIX meson64_odroid
+%define TARGET_VIMS kvim
+%define VIMS_DT_PREFIX kvim
+%define TARGETS %{TARGET_ODROIDS} %{TARGET_VIMS}
+
+Name: linux-amlogic
+Summary: The Linux Kernel for amlogic boards
+Version: 4.9.241
+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
+
+BuildRequires: bc
+BuildRequires: module-init-tools
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: libopenssl1.1-devel
+
+%description
+The Linux Kernel, the operating system core itself
+
+## 0. Start of Packages lists
+#  0-1. kernel-headers package for all amlogic targets both for arm and arm64
+%package -n kernel-headers-amlogic
+License: GPL-2.0
+Summary: Linux support headers for amlogic userspace development
+Group: System/Kernel
+Provides: kernel-headers-tizen-dev
+Provides: kernel-headers-amlogic-odroid = %{version}-%{CHIPSET}-odroid
+Provides: kernel-headers-amlogic-kvim = %{version}-%{CHIPSET}-kvim
+
+%description -n kernel-headers-amlogic
+This package provides userspaces headers from the Linux kernel for Amlogic.
+These headers are used by the installed headers for GNU glibc and other
+system libraries.
+
+#  0-2. ARM64 Build result pagckages for each target
+%ifarch aarch64
+%package -n linux-kernel-amlogic-odroid
+License: GPL-2.0
+Summary: Tizen kernel for amlogic odroid boards
+Group: System/Kernel
+Provides: linux-amlogic-odroid = %{version}-%{CHIPSET}-odroid
+
+%description -n linux-kernel-amlogic-odroid
+This package contains the Tizen Linux kernel for amlogic odroid boards
+
+%package -n linux-kernel-modules-amlogic-odroid
+Summary: Kernel modules for amlogic odroid boards
+Group: System/Kernel
+Provides: linux-kernel-modules-amlogic-odroid = %{version}-%{CHIPSET}-odroid
+
+%description -n linux-kernel-modules-amlogic-odroid
+Kernel-modules includes the loadable kernel modules(.ko files) for amlogic odroid
+
+%package -n linux-kernel-devel-amlogic-odroid
+License: GPL-2.0
+Summary: Linux support kernel map and etc for other packages
+Group: System/Kernel
+Provides: linux-kernel-devel-amlogic-odroid = %{version}-%{CHIPSET}-odroid
+
+%description -n linux-kernel-devel-amlogic-odroid
+This package provides kernel map and etc information.
+
+%package -n linux-kernel-firmware-amlogic-odroid
+License: GPL-2.0
+Summary: firmware files for the amlogic Odroid Linux kernel
+Group: System/Kernel
+
+%description -n linux-kernel-firmware-amlogic-odroid
+This package provides firmware files for the amlogic Odroid Linux kernel.
+
+%package -n linux-kernel-amlogic-kvim
+License: GPL-2.0
+Summary: Tizen kernel for amlogic kadas vim3/vim3l boards
+Group: System/Kernel
+Provides: linux-amlogic-kvim = %{version}-%{CHIPSET}-kvim
+
+%description -n linux-kernel-amlogic-kvim
+This package contains the Tizen Linux kernel for amlogic khadas vim3/vim3l boards
+
+%package -n linux-kernel-modules-amlogic-kvim
+Summary: Kernel modules for amlogic khadas vim3/vim3l boards
+Group: System/Kernel
+Provides: linux-kernel-modules-amlogic-kvim = %{version}-%{CHIPSET}-kvim
+
+%description -n linux-kernel-modules-amlogic-kvim
+Kernel-modules includes the loadable kernel modules(.ko files) for amlogic khadas vim3/vim3l
+
+%package -n linux-kernel-devel-amlogic-kvim
+License: GPL-2.0
+Summary: Linux support kernel map and etc for other packages
+Group: System/Kernel
+Provides: linux-kernel-devel-amlogic-kvim = %{version}-%{CHIPSET}-kvim
+
+%description -n linux-kernel-devel-amlogic-kvim
+This package provides kernel map and etc information.
+%endif
+## 0. End   of Packages lists
+
+%prep
+%setup -q -n linux-kernel-%{version}
+
+%build
+export ARCH=%{buildarch}
+%{?asan:/usr/bin/gcc-unforce-options}
+%{?ubsan:/usr/bin/gcc-unforce-options}
+
+## 1. Start of Build steps
+#  1-1. extract uapi headers
+mkdir -p %{_builddir}/uapi-headers/usr
+make mrproper
+make headers_check
+make headers_install INSTALL_HDR_PATH=%{_builddir}/uapi-headers/usr
+
+#  1-2. remove headers install cmd
+find %{_builddir}/uapi-headers/usr/include -name ".install" -delete
+find %{_builddir}/uapi-headers/usr/include -name "..install.cmd" -delete
+
+#  1-3. Build for each target for arm64
+%ifarch aarch64
+for target_board in %{TARGETS}; do
+       # 1-3-0. extract target board
+       case $target_board in
+       %{TARGET_ODROIDS})
+               CONFIG_NAME=odroidg12
+               DT_PREFIX=%{ODROIDS_DT_PREFIX}
+       ;;
+       %{TARGET_VIMS})
+               CONFIG_NAME=kvims
+               DT_PREFIX=%{VIMS_DT_PREFIX}
+       ;;
+       esac
+
+       %define variant TIZEN-%{CHIPSET}-${target_board}
+
+       # 1-3-1. Clean
+       make mrproper
+
+       # 1-3-2. Make sure EXTRAVERSION says what we want it to say
+       sed -i "s/^EXTRAVERSION.*/EXTRAVERSION = -%{variant}/" Makefile
+
+       # 1-3-3. Set defconfig file
+       make tizen_${CONFIG_NAME}_defconfig
+
+       # 1-3-4. Build kernel image, dtb and modules
+       make %{KERNEL_IMAGE} %{?_smp_mflags}
+       make dtbs %{?_smp_mflags}
+       make modules %{?_smp_mflags}
+
+       # 1-3-5. build result directories
+       mkdir -p %{_builddir}/boot/${target_board}/kernel
+
+       # 1-3-6. move build files
+       install -m 644 arch/%{buildarch}/boot/%{KERNEL_IMAGE} %{_builddir}/boot/${target_board}/
+       install -m 644 arch/%{buildarch}/boot/dts/amlogic/${DT_PREFIX}*.dtb %{_builddir}/boot/
+       make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=%{_builddir} modules_install
+
+       # 1-3-7. copy files for devel package
+       cp -r  %{_builddir}/linux-kernel-%{version} %{_builddir}/boot/${target_board}/kernel/devel
+
+       # 1-3-8. remove unnecessary files to prepare for devel package
+       find %{_builddir}/boot/${target_board}/kernel/devel -name ".tmp_vmlinux*" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name ".gitignore" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "\.*dtb*tmp" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "\.*dtb" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "*\.*tmp" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "vmlinux" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "Image" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "zImage" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "Image.gz" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "*.cmd" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "*\.ko" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "*\.o" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "*\.S" -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "*\.HEX" -type f -delete
+       find %{_builddir}/boot/${target_board}/kernel/devel -name "*\.c" -not -path "%{_builddir}/boot/${target_board}/kernel/devel/scripts/*" -delete
+done
+%endif
+## 1. End   of Build steps
+
+%install
+QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT
+
+## 2. Start of install steps
+mkdir -p %{buildroot}/boot/
+
+#  2-1. Install uapi headers
+mv %{_builddir}/uapi-headers/usr %{buildroot}
+
+#  2-2. Install files for arm64
+%ifarch aarch64
+mv %{_builddir}/boot/* %{buildroot}/boot
+mv %{_builddir}/lib %{buildroot}
+%endif
+## 2. End   of install steps
+
+%clean
+rm -rf %{buildroot}
+rm -rf %{_builddir}/usr
+rm -rf %{_builddir}/boot
+rm -rf %{_builddir}/lib
+
+## 3. Start of rpm pack
+#  3-1. uapi header
+%files -n kernel-headers-amlogic
+/usr/include/*
+
+#  3-2. ARM64 Build result pagckages for each target
+%ifarch aarch64
+%files -n linux-kernel-amlogic-odroid
+%license COPYING
+/boot/%{ODROIDS_DT_PREFIX}*.dtb
+/boot/%{TARGET_ODROIDS}/%{KERNEL_IMAGE}
+
+%files -n linux-kernel-modules-amlogic-odroid
+/lib/modules/*%{TARGET_ODROIDS}*/*
+
+%files -n linux-kernel-devel-amlogic-odroid
+/boot/%{TARGET_ODROIDS}/kernel/*
+
+%files -n linux-kernel-firmware-amlogic-odroid
+/lib/firmware/*
+
+%files -n linux-kernel-amlogic-kvim
+%license COPYING
+/boot/%{VIMS_DT_PREFIX}*.dtb
+/boot/%{TARGET_VIMS}/%{KERNEL_IMAGE}
+
+%files -n linux-kernel-modules-amlogic-kvim
+/lib/modules/*%{TARGET_VIMS}*/*
+
+%files -n linux-kernel-devel-amlogic-kvim
+/boot/%{TARGET_VIMS}/kernel/*
+%endif
+## 3. End   of rpm pack