This commit is contained in:
2025-09-12 14:55:41 +08:00
commit 9c1dd60be5
5 changed files with 2103 additions and 0 deletions

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "src"]
path = src
url = https://git.oerv.ac.cn/OERV-BSP/kernel-starfive-jh7110.git
branch = vendor-6.6

23
_service Normal file
View File

@@ -0,0 +1,23 @@
<services>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://git.oerv.ac.cn/OERV-BSP-RPM/kernel-starfive-jh7110-vendor-6.6.git</param>
<param name="revision">master</param>
<param name="submodules">disable</param>
<param name="version">_none_</param>
<param name="exclude">*</param>
<!-- <param name="extract">*</param> -->
<param name="extract">*.spec</param>
<param name="extract">*_defconfig</param>
</service>
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://git.oerv.ac.cn/OERV-BSP-RPM/kernel-starfive-jh7110-vendor-6.6.git</param>
<param name="revision">master</param>
<param name="submodules">enable</param>
<param name="exclude">.git</param>
<param name="exclude">.gitsubmodules</param>
<param name="version">_none_</param>
<param name="subdir">src</param>
</service>
</services>

1858
jh7110_defconfig Normal file

File diff suppressed because it is too large Load Diff

217
kernel-jh7110.spec Normal file
View File

@@ -0,0 +1,217 @@
## Informations filled by packager
%define vendor_version 5.14.1
%define pkg_release 0
## Default build options
%bcond devel 1
%bcond debuginfo 1
# _arch is undefined if /usr/lib/rpm/platform/*/macros was not included.
%{!?_arch: %define _arch dummy}
%{!?make: %define make make}
%define ARCH $(echo %{_arch} | sed -e 's/riscv.*/riscv/')
%define makeflags %{?_smp_mflags} ARCH=%{ARCH}
%define KERNELRELEASE %{version}-%{release}
Name: kernel-starfive-jh7110-vendor-6.6
Version: 6.6.20
Release: %{?vendor_version: %{vendor_version}.}pkg%{pkg_release}%{?dist}
Summary: Vendor Provided Linux Kernel for StarFive JH7110
URL: https://github.com/starfive-tech/linux/tree/JH7110_VisionFive2_6.6.y_devel
License: GPLv2
Group: System Environment/Kernel
Source0: kernel-starfive-jh7110-vendor-6.6.tar
Source1: jh7110_defconfig
Provides: kernel-%{KERNELRELEASE}
BuildRequires: bc binutils bison dwarves
BuildRequires: (elfutils-devel or libdw-devel)
BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
BuildRequires: make openssl openssl-devel perl python3 rsync
BuildRequires: gcc libgcc uboot-tools
BuildRequires: uboot-tools
Provides: kernel
Obsoletes: kernel
%description
This is the Linux kernel Image with support for StarFive JH7110 SoC.
%package headers
Summary: Header files for the Linux kernel for use by glibc
Group: Development/System
Provides: kernel-headers = %{version}
Obsoletes: kernel-headers < %{version}
Provides: %{name}-headers = %{version}
Obsoletes: %{name}-headers < %{version}
%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.
%if %{with_devel}
%package devel
Summary: Development package for building kernel modules to match the %{version} kernel
Group: System Environment/Kernel
AutoReqProv: no
Provides: kernel-devel
Obsoletes: kernel-devel
%description devel
This package provides kernel headers and makefiles sufficient to build modules
against the %{version} kernel package.
%endif
%if %{with_debuginfo}
# list of debuginfo-related options taken from distribution kernel.spec
# files
%undefine _include_minidebuginfo
%undefine _find_debuginfo_dwz_opts
%undefine _unique_build_ids
%undefine _unique_debug_names
%undefine _unique_debug_srcs
%undefine _debugsource_packages
%undefine _debuginfo_subpackages
%global _find_debuginfo_opts -r
%global _missing_build_ids_terminate_build 1
%global _no_recompute_build_ids 1
%{debug_package}
%endif
# some (but not all) versions of rpmbuild emit %%debug_package with
# %%install. since we've already emitted it manually, that would cause
# a package redefinition error. ensure that doesn't happen
%define debug_package %{nil}
# later, we make all modules executable so that find-debuginfo.sh strips
# them up. but they don't actually need to be executable, so remove the
# executable bit, taking care to do it _after_ find-debuginfo.sh has run
%define __spec_install_post \
%{?__debug_package:%{__debug_install_post}} \
%{__arch_install_post} \
%{__os_install_post} \
find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \\\
| xargs --no-run-if-empty chmod u-x
%prep
%setup -q -n %{name}
cp %{SOURCE1} .config
%build
%{make} %{makeflags} olddefconfig
%{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
%install
mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
# DEPMOD=true makes depmod no-op. We do not package depmod-generated files.
%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} DEPMOD=true modules_install
%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
if %{make} %{makeflags} run-command KBUILD_RUN_COMMAND="test -d $(pwd)/arch/%{ARCH}/boot/dts" 2>/dev/null; then
%{make} %{makeflags} INSTALL_DTBS_PATH=%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb dtbs_install
fi
ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
%if %{with_devel}
%{make} %{makeflags} run-command KBUILD_RUN_COMMAND="$(pwd)/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}"
%endif
{
echo "/lib/modules/%{KERNELRELEASE}"
for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \
devname softdep symbols symbols.bin weakdep; do
echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}"
done
for x in System.map config vmlinuz; do
echo "%ghost /boot/${x}-%{KERNELRELEASE}"
done
if [ -d "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" ];then
find "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" -printf "%%%ghost /boot/dtb-%{KERNELRELEASE}/%%P\n"
fi
echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
} > %{buildroot}/kernel.list
# make modules executable so that find-debuginfo.sh strips them. this
# will be undone later in %%__spec_install_post
find %{buildroot}/lib/modules/%{KERNELRELEASE} -name "*.ko" -type f \
| xargs --no-run-if-empty chmod u+x
%if %{with_debuginfo}
# copying vmlinux directly to the debug directory means it will not get
# stripped (but its source paths will still be collected + fixed up)
mkdir -p %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
cp vmlinux %{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}
%endif
%clean
rm -rf %{buildroot}
rm -f debugfiles.list debuglinks.list debugsourcefiles.list debugsources.list \
elfbins.list
%pre
if [ -e "/lib/modules/%{KERNELRELEASE}/vmlinuz" ]; then
mkdir -p "%{_localstatedir}/lib/rpm-state"
touch "%{_localstatedir}/lib/rpm-state/%{name}-%{KERNELRELEASE}.reinstall"
fi
%post
for file in vmlinuz System.map config; do
if ! cmp --silent "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"; then
cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
fi
done
if [ -d "/lib/modules/%{KERNELRELEASE}/dtb" ] && \
! diff -rq "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}" >/dev/null 2>&1; then
rm -rf "/boot/dtb-%{KERNELRELEASE}"
cp -r "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}"
fi
%{_sbindir}/new-kernel-pkg --package kernel --depmod --mkinitrd --dracut --install %{KERNELRELEASE} || exit $?
%preun
if [ -e "%{_localstatedir}/lib/rpm-state/%{name}-%{KERNELRELEASE}.reinstall" ]; then
exit
fi
%{_sbindir}/new-kernel-pkg --rmmoddep --rminitrd --dracut --remove %{KERNELRELEASE} || exit $?
for file in vmlinuz System.map config; do
if [ -e "/boot/${file}-%{KERNELRELEASE}" ]; then
rm "/boot/${file}-%{KERNELRELEASE}"
fi
done
if [ -d "/boot/dtb-%{KERNELRELEASE}" ]; then
rm -rf "/boot/dtb-%{KERNELRELEASE}"
fi
%postun
if [ -e "%{_localstatedir}/lib/rpm-state/%{name}-%{KERNELRELEASE}.reinstall" ]; then
exit
fi
%{_sbindir}/new-kernel-pkg --package kernel --rpmposttrans %{KERNELRELEASE} || exit $?
%posttrans
rm -f "%{_localstatedir}/lib/rpm-state/%{name}-%{KERNELRELEASE}.reinstall"
%{_sbindir}/new-kernel-pkg --package kernel --rpmposttrans %{KERNELRELEASE} || exit $?
%files -f %{buildroot}/kernel.list
%defattr (-, root, root)
%exclude /kernel.list
%files headers
%defattr (-, root, root)
/usr/include
%if %{with_devel}
%files devel
%defattr (-, root, root)
/usr/src/kernels/%{KERNELRELEASE}
/lib/modules/%{KERNELRELEASE}/build
%endif
%changelog
* Fri Sep 12 2025 Hangfan Li <lihangfan@iscas.ac.cn> - 6.6.20-5.14.1.pkg0-riscv64
- Init package for StarFive JH7110

1
src Submodule

Submodule src added at 37e783d70e