Projects
openEuler:23.03
kernel
_service:tar_scm:kernel.spec
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:kernel.spec of Package kernel
%global KernelVer %{version}-%{release}.%{_target_cpu} %global Arch $(echo %{_host_cpu} | sed -e s/riscv.*/riscv/) # The obs worker of RISC-V runs in cross-arch qemu virt, which support # multi-thread maxmium of 8. %global with_perf 1 %global _smp_mflags -j8 %define with_source 1 %define with_release 1 %global debug_package %{nil} Name: kernel Version: 6.1.19 Release: 3 Summary: Linux Kernel for RISC-V URL: http://www.kernel.org/ License: GPLv2 %global commit 937381741d02cc6594477c593b2f3a087b3a0bc1 # The source tarball is compressed by OBS automactically, if you wanted to do a local rpmbuilding, the tarball can be obtained via : https://gitee.com/openeuler/kernel/repository/archive/OLK-%{version}.zip # The Source0: risc-v-kernel-%{version}.tar.bz2 Source1: openEuler_riscv64_defconfig Source2: extend_defconfig Source3: cpupower.service Source4: cpupower.config BuildRequires: module-init-tools, patch >= 2.5.4, bash >= 2.03, tar BuildRequires: bzip2, xz, findutils, gzip, m4, perl, make >= 3.78, diffutils, gawk BuildRequires: gcc >= 3.4.2, binutils >= 2.12 BuildRequires: hostname, net-tools, bc BuildRequires: xmlto, asciidoc BuildRequires: openssl-devel BuildRequires: ncurses-devel BuildRequires: elfutils-libelf-devel BuildRequires: rpm >= 4.14.2 BuildRequires: elfutils-devel zlib-devel binutils-devel newt-devel python-devel perl(ExtUtils::Embed) bison BuildRequires: audit-libs-devel BuildRequires: pciutils-devel gettext BuildRequires: rpm-build, elfutils BuildRequires: numactl-devel python3-devel glibc-static python3-docutils BuildRequires: perl-generators perl(Carp) gtk2-devel libbabeltrace-devel BuildRequires: rsync AutoReq: no AutoProv: yes Provides:kernel-%{_target_cpu} = %{version}-%{release} ExclusiveArch: riscv64 ExclusiveOS: Linux %define arch_config %{SOURCE1} %define hd_arch riscv %description This is the Linux kernel Image for RISC-V openSBI(Supervisor Binary Interface) booting with QEMU RISC-V virt machine. %package devel Summary: Development package for building kernel modules to match the %{KernelVer} kernel AutoReqProv: no Provides: kernel-devel-uname-r = %{KernelVer} %description devel This package provides kernel headers and makefiles sufficient to build modules. %package tools Summary: Assortment of tools for the Linux kernel Provides: %{name}-tools-libs Obsoletes: %{name}-tools-libs Provides: cpufreq-utils = 1:009-0.6.p1 Provides: cpufrequtils = 1:009-0.6.p1 Obsoletes: cpufreq-utils < 1:009-0.6.p1 Obsoletes: cpufrequtils < 1:009-0.6.p1 Obsoletes: cpuspeed < 1:1.5-16 %description tools This package contains the tools/ directory from the kernel source and the supporting documentation. %package tools-devel Summary: Assortment of tools for the Linux kernel Requires: kernel-tools = %{version}-%{release} Requires: kernel-tools-libs = %{version}-%{release} Provides: kernel-tools-libs-devel = %{version}-%{release} Obsoletes: kernel-tools-libs-devel %description tools-devel This package contains the development files for the tools/ directory from the kernel source. %if 0%{?with_perf} %package -n perf Summary: Performance monitoring for the Linux kernel %description -n perf This package contains the perf tool, which enables performance monitoring of the Linux kernel. %package -n python3-perf Summary: Python bindings for apps which will manipulate perf events %description -n python3-perf A Python module that permits applications written in the Python programming language to use the interface to manipulate perf events. # with_perf %endif %package -n bpftool Summary: Inspection and simple manipulation of eBPF programs and maps %description -n bpftool This package contains the bpftool, which allows inspection and simple manipulation of eBPF programs and maps. %if 0%{?with_source} %package source Summary: the kernel source %description source This package contains various source files from the kernel. %endif %package headers Summary: Header files for the Linux kernel for use by glibc Obsoletes: glibc-kernheaders < 3.0-46 Provides: glibc-kernheaders = 3.0-46 %description headers Kernel-headers includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package. %prep %setup -n risc-v-kernel-%{version} -c mv ./risc-v-kernel-%{version} linux-%{KernelVer} cd linux-%{KernelVer} touch .scmversion find . \( -name "*.orig" -o -name "*~" -o -name "\.*" \) -exec rm -f {} \; >/dev/null find . -name .gitignore -exec rm -f {} \; >/dev/null %if 0%{?with_source} # Copy directory backup for kernel-source cp -a ../linux-%{KernelVer} ../linux-%{KernelVer}-source %endif %if 0%{?with_perf} cp -a tools/perf tools/python3-perf %endif %build cd linux-%{KernelVer} perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.%{_target_cpu}/" Makefile # merge additional configure to defconfig ARCH=$(head -1 %{arch_config} | gawk -F' ' '{print $2}') cat %{arch_config} >> arch/${ARCH}/configs/defconfig cat %{SOURCE2} >> arch/${ARCH}/configs/defconfig make -s mrproper make ARCH=${ARCH} defconfig make ARCH=${ARCH} %{?_smp_mflags} make ARCH=${ARCH} %{?_smp_mflags} modules ## make tools %if 0%{?with_perf} # perf %global perf_make make EXTRA_CFLAGS="-Wl,-z,now -g -Wall -fstack-protector-strong -fPIC" EXTRA_PERFLIBS="-fpie -pie" %{?_smp_mflags} -s V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 prefix=%{_prefix} %global perf_python3 -C tools/perf PYTHON=%{__python3} chmod +x tools/perf/check-headers.sh # perf # make sure check-headers.sh is executable chmod +x tools/python3-perf/check-headers.sh %{perf_make} %{perf_python3} all pushd tools/perf/Documentation/ make %{?_smp_mflags} man popd %endif # bpftool pushd tools/bpf/bpftool make %{?_smp_mflags} popd # cpupower chmod +x tools/power/cpupower/utils/version-gen.sh make %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false # thermal pushd tools/thermal/tmon/ make popd # iio pushd tools/iio/ make popd # gpio pushd tools/gpio/ make popd # kvm pushd tools/kvm/kvm_stat/ make %{?_smp_mflags} man popd %install %if 0%{?with_source} %define _python_bytecompile_errors_terminate_build 0 mkdir -p $RPM_BUILD_ROOT/usr/src/ mv linux-%{KernelVer}-source $RPM_BUILD_ROOT/usr/src/linux-%{KernelVer} cp linux-%{KernelVer}/.config $RPM_BUILD_ROOT/usr/src/linux-%{KernelVer}/ %endif cd linux-%{KernelVer} mkdir -p $RPM_BUILD_ROOT/boot install -m 644 .config $RPM_BUILD_ROOT/boot/config-%{KernelVer} # Currently need the flatten kernel image as opensbi payload %if 0%{!?with_release} TargetImage=$(find . -name Image) TargetgzImage=$(find . -name Image.gz) install -m 755 ${TargetImage} $RPM_BUILD_ROOT/boot install -m 755 ${TargetgzImage} $RPM_BUILD_ROOT/boot %else mkdir -p $RPM_BUILD_ROOT/boot/dtbs make ARCH=%{hd_arch} INSTALL_PATH=$RPM_BUILD_ROOT/boot zinstall KERNELRELEASE=%{KernelVer} dd if=/dev/zero of=$RPM_BUILD_ROOT/boot/initramfs-%{KernelVer}.img bs=1M count=20 %endif make ARCH=%{hd_arch} INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/boot/dtbs dtbs_install # kernel_headers make ARCH=%{hd_arch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install find $RPM_BUILD_ROOT/usr/include -name "\.*" -exec rm -f {} \; >/dev/null # modules make ARCH=%{hd_arch} INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=%{KernelVer} %if 0%{?with_release} install -m 644 .config $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/config install -m 644 System.map $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/System.map %endif # bpftool pushd tools/bpf/bpftool make DESTDIR=%{buildroot} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install popd ############ to do collect devel file ######### # deal with /lib/module/ path- sub path: build source kernel rm -f $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build rm -f $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/source mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/extra mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/updates mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/weak-updates # 1. Makefile And Kconfig, .config sysmbol # 2. scrpits dir # 3. .h file find -type f \( -name "Makefile*" -o -name "Kconfig*" \) -exec cp --parents {} $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build \; for f in Module.symvers System.map Module.markers .config;do test -f $f || continue cp $f $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build done cp -a scripts $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build if [ -d arch/%{Arch}/scripts ]; then cp -a arch/%{Arch}/scripts $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/arch/%{_arch} || : fi if [ -f arch/%{Arch}/*lds ]; then cp -a arch/%{Arch}/*lds $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/arch/%{_arch}/ || : fi find $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/scripts/ -name "*.o" -exec rm -rf {} \; if [ -d arch/%{Arch}/include ]; then cp -a --parents arch/%{Arch}/include $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/ fi cp -a include $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/include # copy objtool for kernel-devel (needed for building external modules) if grep -q CONFIG_STACK_VALIDATION=y .config; then mkdir -p $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/tools/objtool cp -a tools/objtool/objtool $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/tools/objtool fi # Make sure the Makefile and version.h have a matching timestamp so that # external modules can be built touch -r $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/Makefile $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/include/generated/uapi/linux/version.h touch -r $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/.config $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/include/generated/autoconf.h # for make prepare if [ ! -f $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/include/config/auto.conf ];then cp .config $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build/include/config/auto.conf fi # mv modules to src/kernels/ver mkdir -p %{buildroot}/usr/src/kernels mv $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build $RPM_BUILD_ROOT/usr/src/kernels/%{KernelVer} find $RPM_BUILD_ROOT/usr/src/linux-%{KernelVer} -name ".*.cmd" -exec rm -f {} \; pushd $RPM_BUILD_ROOT/lib/modules/%{KernelVer} ln -sf /usr/src/kernels/%{KernelVer} build ln -sf build source popd ## install tools # perf # perf tool binary and supporting scripts/binaries %{perf_make} %{perf_python3} DESTDIR=%{buildroot} lib=%{_lib} install-bin install-traceevent-plugins # remove the 'trace' symlink. rm -f %{buildroot}%{_bindir}/trace # remove examples rm -rf %{buildroot}/usr/lib/perf/examples # remove the stray header file that somehow got packaged in examples rm -rf %{buildroot}/usr/lib/perf/include/bpf/ # python-perf extension %{perf_make} %{perf_python3} DESTDIR=%{buildroot} install-python_ext # perf man pages (note: implicit rpm magic compresses them later) install -d %{buildroot}/%{_mandir}/man1 install -pm0644 tools/kvm/kvm_stat/kvm_stat.1 %{buildroot}/%{_mandir}/man1/ install -pm0644 tools/perf/Documentation/*.1 %{buildroot}/%{_mandir}/man1/ # bpftool pushd tools/bpf/bpftool make DESTDIR=%{buildroot} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install popd # cpupower make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install rm -f %{buildroot}%{_libdir}/*.{a,la} %find_lang cpupower mv cpupower.lang ../ chmod 0755 %{buildroot}%{_libdir}/libcpupower.so* mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig install -m644 %{SOURCE3} %{buildroot}%{_unitdir}/cpupower.service install -m644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/cpupower # thermal pushd tools/thermal/tmon make INSTALL_ROOT=%{buildroot} install popd # iio pushd tools/iio make DESTDIR=%{buildroot} install popd # gpio pushd tools/gpio make DESTDIR=%{buildroot} install popd # kvm pushd tools/kvm/kvm_stat make INSTALL_ROOT=%{buildroot} install-tools popd %post -n kernel-tools /sbin/ldconfig %systemd_post cpupower.service %preun -n kernel-tools %systemd_preun cpupower.service %postun -n kernel-tools /sbin/ldconfig %systemd_postun cpupower.service %files %defattr (-, root, root) %doc /boot/config-* %if 0%{!?with_release} /boot/Image* /boot/*.dtb %else /boot/System.map-* /boot/vmlinuz-* /boot/initramfs-* %dir /boot/dtbs/ /boot/dtbs/* %endif /lib/modules/%{KernelVer}/ %exclude /lib/modules/%{KernelVer}/source %files devel %defattr (-, root, root) %doc /lib/modules/%{KernelVer}/source /lib/modules/%{KernelVer}/build /usr/src/kernels/%{KernelVer} %files headers %defattr (-, root, root) /usr/include/* %if 0%{?with_perf} %files -n perf %{_bindir}/perf %dir %{_libdir}/traceevent %{_libdir}/traceevent/plugins/ %{_libexecdir}/perf-core %{_datadir}/perf-core/ %{_mandir}/man[1-8]/perf* %{_sysconfdir}/bash_completion.d/perf %doc linux-%{KernelVer}/tools/perf/Documentation/examples.txt %dir %{_datadir}/doc/perf-tip %{_datadir}/doc/perf-tip/* %license linux-%{KernelVer}/COPYING %files -n python3-perf %license linux-%{KernelVer}/COPYING %{python3_sitearch}/* %endif %files -n kernel-tools -f cpupower.lang %{_bindir}/cpupower %{_unitdir}/cpupower.service %{_datadir}/bash-completion/completions/cpupower %{_mandir}/man[1-8]/cpupower* %config(noreplace) %{_sysconfdir}/sysconfig/cpupower %{_bindir}/tmon %{_bindir}/iio_event_monitor %{_bindir}/iio_generic_buffer %{_bindir}/lsiio %{_bindir}/lsgpio %{_bindir}/gpio-hammer %{_bindir}/gpio-event-mon %{_bindir}/gpio-watch %{_mandir}/man1/kvm_stat* %{_bindir}/kvm_stat %{_libdir}/libcpupower.so.0 %{_libdir}/libcpupower.so.0.0.1 %license linux-%{KernelVer}/COPYING %files -n kernel-tools-devel %{_libdir}/libcpupower.so %{_includedir}/cpufreq.h %{_includedir}/cpuidle.h %files -n bpftool %{_sbindir}/bpftool %{_sysconfdir}/bash_completion.d/bpftool %{_mandir}/man8/bpftool-cgroup.8.gz %{_mandir}/man8/bpftool-map.8.gz %{_mandir}/man8/bpftool-prog.8.gz %{_mandir}/man8/bpftool-perf.8.gz %{_mandir}/man8/bpftool.8.gz %{_mandir}/man8/bpftool-btf.8.gz %{_mandir}/man8/bpftool-feature.8.gz %{_mandir}/man8/bpftool-gen.8.gz %{_mandir}/man8/bpftool-iter.8.gz %{_mandir}/man8/bpftool-link.8.gz %{_mandir}/man8/bpftool-net.8.gz %{_mandir}/man8/bpftool-struct_ops.8.gz %license linux-%{KernelVer}/COPYING %if 0%{?with_source} %files source %defattr(-,root,root) /usr/src/linux-%{KernelVer}/* /usr/src/linux-%{KernelVer}/.config %endif %changelog * Tue Apr 18 2023 jchzhou <zhoujiacheng@iscas.ac.cn> -6.1.19-3-riscv64 - enable sm3_generic in defconfig * Tue Apr 04 2023 jchzhou <zhoujiacheng@iscas.ac.cn> -6.1.19-1-riscv64 - Upgrade to 6.1.19 - enable fuse filesystem in defconfig * Wed Mar 29 2023 jchzhou <zhoujiacheng@iscas.ac.cn> -6.1.8-3-riscv64 - add multiple defconfigs back from 5.10 - enable MGLRU for better low-memory performance * Mon Mar 27 2023 laokz <zhangkai@iscas.ac.cn> -6.1.8-2-riscv64 - add %{Arch} definition * Sun Feb 05 2023 wangjunqiang <wangjunqiang@iscas.ac.cn> -6.1.8-1-riscv64 - update kernel * Tue Nov 22 2022 wangjunqiang <wangjunqiang@iscas.ac.cn> -6.1.0-1-rc3-riscv64 - update to hareware kernel * Mon Apr 25 2022 wangjunqiang <wangjunqiang@iscas.ac.cn> -5.13-19-riscv64 - update to unmatched kernel * Wed Aug 11 2021 whoisxxx <zhangxuzhou4@huawei.com> -5.10-3-riscv64 - Make kernel source as a submodule of risc-v-kernel * Tue Jul 27 2021 whoisxxx <zhangxuzhou4@huawei.com> -5.10-2-riscv64 - Add subpackages: kernel-headers bpftool source; - Disable bytecompile error terminate build * Fri Apr 23 2021 whoisxxx <zhangxuzhou4@huawei.com> -5.10-1-riscv64 - Update to openEuler OLK-5.10 * Sat Oct 31 2020 whoisxxx <zhangxuzhou4@huawei.com> -5.5.19-3-riscv64 - kernel.spec: Delete redundant definition in KernelVer * Mon Oct 12 2020 liyuanr <liyuanrong1@huawei.com> -5.5.19-2-riscv64 - kernel.spec: Add collection of devel file * Tue Jul 28 2020 whoisxxx <zhangxuzhou4@huawei.com> - 5.5.19-1-riscv64 - Build the flatten Linux Kernel 5.5.19 Image for openEuler RISC-V
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2