转换LFS仓库为普通仓库

This commit is contained in:
Jiayi Yin 2025-05-18 18:53:04 +00:00
commit 5f911581cf
5 changed files with 254 additions and 0 deletions

BIN
5.10.0-4.9.0.tar.gz Normal file

Binary file not shown.

31
README.en.md Normal file
View File

@ -0,0 +1,31 @@
# raspberrypi-kernel
#### Description
Kernel Image of Raspberry Pi.
The `kernel.tar.gz` is from <https://gitee.com/openeuler/raspberrypi-kernel>. After you put your public ssh key into your account in gitee, you can obtain `kernel.tar.gz` by executing command `. SOURCE`. You can directly use the `kernel.tar.gz` in this repository instead.
#### Software Architecture
AArch64
#### Installation
`dnf install raspberrypi-kernel`
#### Instructions
1. The version of raspberrypi kernel is in the front of `.raspi.aarch64` such as `5.10.0-4.0.0.1.raspi.aarch64`.
2. The module files will be installed into `/lib/modules/` such as `/lib/modules/5.10.0-4.0.0.1.raspi.aarch64`, where `5.10.0-4.0.0.1.raspi` is the version of raspberrypi kernel.
3. The image file will be installed into `/boot/` such as `/boot/vmlinuz-5.10.0-4.0.0.1.raspi.aarch64`. Meanwhile, the `/boot/kernel8.img` will be overrided by the image file.
4. The device tree files will be installed into `/boot/` such as `/boot/dtb-5.10.0-4.0.0.1.raspi.aarch64`. Meanwhile, the `.dtb` files and `overlays` folder in this `dtb-5.10.0-4.0.0.1.raspi.aarch64` directory will replace the corresponding files in `/boot/`.
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request

31
README.md Normal file
View File

@ -0,0 +1,31 @@
# raspberrypi-kernel
#### 介绍
Raspberry Pi 内核映像文件。
`kernel.tar.gz` 来自 <https://gitee.com/openeuler/raspberrypi-kernel> 仓库,将 SSH 公钥添加到 gitee.com 的账户中后,可通过执行 `. SOURCE` 来获取 `kernel.tar.gz`。也可以采用本仓库通过 Git LFS 上传的 `kernel.tar.gz`
#### 软件架构
AArch64
#### 安装教程
`dnf install raspberrypi-kernel`
#### 使用说明
安装 raspberrypi-kernel 后,
1. 内核版本号后缀增加 `.raspi` 标识,形如 `5.10.0-4.0.0.1.raspi.aarch64`
2. 内核模块安装在 `/lib/modules/` 目录下,对应文件夹名称同内核版本号,如 `5.10.0-4.0.0.1.raspi.aarch64`
3. 内核映像文件在 `/boot/` 目录下,映像文件名形如 `vmlinuz-5.10.0-4.0.0.1.raspi.aarch64`。同时,该文件会替换原来的 `/boot/kernel8.img` 文件。
4. 设备树文件在 `/boot/` 目录下的文件夹下,该文件夹名称形如 `dtb-5.10.0-4.0.0.1.raspi.aarch64`。同时,该文件夹下的 `.dtb` 文件和 `overlays` 文件夹会替换 `/boot/` 下对应的文件。
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request

187
raspberrypi-kernel.spec Normal file
View File

@ -0,0 +1,187 @@
%global Arch $(echo %{_host_cpu} | sed -e s/i.86/x86/ -e s/x86_64/x86/ -e s/aarch64.*/arm64/)
%global KernelVer %{version}-%{release}.raspi.%{_target_cpu}
%global hulkrelease 4.9.0
%global debug_package %{nil}
Name: raspberrypi-kernel
Version: 5.10.0
Release: %{hulkrelease}.4
Summary: Linux Kernel
License: GPLv2 and Apache-2.0 and MIT
URL: http://www.kernel.org/
Source0: https://gitee.com/openeuler/kernel/repository/archive/%{version}-%{hulkrelease}.tar.gz
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: hmaccalc
BuildRequires: ncurses-devel
BuildRequires: elfutils-libelf-devel
BuildRequires: rpm >= 4.14.2
BuildRequires: elfutils-devel zlib-devel binutils-devel newt-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) libunwind-devel gtk2-devel libbabeltrace-devel java-1.8.0-openjdk
AutoReq: no
AutoProv: yes
Provides: raspberrypi-kernel-aarch64 = %{version}-%{release}
ExclusiveArch: aarch64
ExclusiveOS: Linux
%description
The Linux Kernel image for RaspberryPi.
%prep
%setup -q -n kernel-%{version} -c
mv kernel linux-%{version}
cp -rl linux-%{version} linux-%{KernelVer}
cd linux-%{KernelVer}
find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null
find . -name .gitignore -exec rm -f {} \; >/dev/null
%build
cd linux-%{KernelVer}
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}.raspi.%{_target_cpu}/" Makefile
make ARCH=%{Arch} %{?_smp_mflags} bcm2711_defconfig
make ARCH=%{Arch} %{?_smp_mflags} KERNELRELEASE=%{KernelVer}
%install
cd linux-%{KernelVer}
## install linux
make ARCH=%{Arch} INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install KERNELRELEASE=%{KernelVer}
rm -rf $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/source $RPM_BUILD_ROOT/lib/modules/%{KernelVer}/build
mkdir -p $RPM_BUILD_ROOT/boot
TargetImage=$(make -s image_name)
TargetImage=${TargetImage%.*}
install -m 755 $TargetImage $RPM_BUILD_ROOT/boot/vmlinuz-%{KernelVer}
install -m 644 .config $RPM_BUILD_ROOT/boot/config-%{KernelVer}
install -m 644 System.map $RPM_BUILD_ROOT/boot/System.map-%{KernelVer}
mkdir -p $RPM_BUILD_ROOT/boot/dtb-%{KernelVer}/overlays
install -m 644 $(find arch/%{Arch}/boot/dts/broadcom/ -name "*.dtb") $RPM_BUILD_ROOT/boot/dtb-%{KernelVer}/
install -m 644 $(find arch/%{Arch}/boot/dts/overlays/ -name "*.dtbo") $RPM_BUILD_ROOT/boot/dtb-%{KernelVer}/overlays/
if ls arch/%{Arch}/boot/dts/overlays/*.dtb > /dev/null 2>&1; then
install -m 644 $(find arch/%{Arch}/boot/dts/overlays/ -name "*.dtb") $RPM_BUILD_ROOT/boot/dtb-%{KernelVer}/overlays/
fi
install -m 644 arch/%{Arch}/boot/dts/overlays/README $RPM_BUILD_ROOT/boot/dtb-%{KernelVer}/overlays/
%postun
version_old=0
if [ "$1" == "0" ]; then
version_old=old
else
version_tmp=0
name_len=`echo -n %{name}-|wc -c`
for item in `rpm -qa %{name} 2>/dev/null`
do
cur_version=${item:name_len}
cpu_version=${cur_version##*.}
if [ "$cpu_version" == "%{_target_cpu}" ]; then
cur_version=${cur_version%.*}
cur_version=$cur_version.raspi.$cpu_version
if [[ "$cur_version" != "%{KernelVer}" && "$cur_version" > "$version_tmp" ]]; then
version_tmp=$cur_version
fi
fi
done
if [[ "$version_tmp" < "%{KernelVer}" ]]; then
version_old=$version_tmp
fi
fi
if [ "$version_old" != "0" ]; then
if [ -f /boot/vmlinuz-$version_old ] && [ -d /boot/dtb-$version_old ] && ( [ "$version_old" == "old" ] || [ -d /lib/modules/$version_old ] ); then
ls /boot/dtb-$version_old/overlays/*.dtbo > /dev/null 2>&1
if [ "$?" == "0" ]; then
ls /boot/dtb-$version_old/*.dtb > /dev/null 2>&1
if [ "$?" == "0" ]; then
rm -rf /boot/*.dtb /boot/overlays /boot/kernel8.img
mkdir /boot/overlays
install -m 755 /boot/vmlinuz-$version_old /boot/kernel8.img
for file in `ls /boot/dtb-$version_old/*.dtb 2>/dev/null`
do
if [ -f $file ]; then
install -m 644 $file /boot/`basename $file`
fi
done
install -m 644 $(find /boot/dtb-$version_old/overlays/ -name "*.dtbo") /boot/overlays/
if ls /boot/dtb-$version_old/overlays/*.dtb > /dev/null 2>&1; then
install -m 644 $(find /boot/dtb-$version_old/overlays/ -name "*.dtb") /boot/overlays/
fi
install -m 644 /boot/dtb-$version_old/overlays/README /boot/overlays/
else
echo "warning: files in /boot/dtb-$version_old/*.dtb missing when resetting kernel as $version_old, something may go wrong when starting this device next time."
fi
else
echo "warning: files in /boot/dtb-$version_old/overlays missing when resetting kernel as $version_old, something may go wrong when starting this device next time."
fi
else
echo "warning: files missing when resetting kernel as $version_old, something may go wrong when starting this device next time."
fi
fi
%posttrans
if [ "$1" == "1" ]; then
if [ ! -f /boot/vmlinuz-old ] && [ -f /boot/kernel8.img ]; then
mkdir /boot/dtb-old
mv /boot/*.dtb /boot/dtb-old
mv /boot/overlays /boot/dtb-old/
mv /boot/kernel8.img /boot/vmlinuz-old
fi
fi
rm -rf /boot/*.dtb /boot/overlays /boot/kernel8.img
mkdir -p /boot/overlays
install -m 755 /boot/vmlinuz-%{KernelVer} /boot/kernel8.img
for file in `ls /boot/dtb-%{KernelVer}/*.dtb 2>/dev/null`
do
if [ -f $file ]; then
install -m 644 $file /boot/`basename $file`
fi
done
install -m 644 $(find /boot/dtb-%{KernelVer}/overlays/ -name "*.dtbo") /boot/overlays/
if ls /boot/dtb-%{KernelVer}/overlays/*.dtb > /dev/null 2>&1; then
install -m 644 $(find /boot/dtb-%{KernelVer}/overlays/ -name "*.dtb") /boot/overlays/
fi
install -m 644 /boot/dtb-%{KernelVer}/overlays/README /boot/overlays/
%files
%defattr (-, root, root)
%doc
/boot/config-*
/boot/System.map-*
/boot/vmlinuz-*
/boot/dtb-*
/lib/modules/%{KernelVer}
%changelog
* Tue Mar 9 2021 Yafen Fang<yafen@iscas.ac.cn> - 5.10.0-4.9.0.4
- update kernel version to openEuler 5.10.0-4.9.0
* Thu Mar 4 2021 Yafen Fang<yafen@iscas.ac.cn> - 5.10.0-4.7.0.3
- update kernel version to openEuler 5.10.0-4.7.0 (change source0 to openeuler/kernel)
- apply patches of Raspberry Pi (commits from f45e8420c8d3a12837817a5de5985af2e95757d6 to ec967eb45f8d4ed59bebafb5748da38118383be7)
* Fri Feb 26 2021 Yafen Fang<yafen@iscas.ac.cn> - 5.10.0-4.3.1.2
- update kernel version to openEuler 5.10.0-4.3.0
- apply patches of Raspberry Pi (commits from 5cd836735908ba0e2ad6f65d9b3f40eaa8253842 to 12fdeddcde1ce67177ae0e13931ff24944015625)
* Mon Feb 22 2021 Yafen Fang<yafen@iscas.ac.cn> - 5.10.0-4.0.0.1
- update kernel version to openEuler 5.10.0-4.0.0

5
raspberrypi-kernel.yaml Normal file
View File

@ -0,0 +1,5 @@
git_url: https://gitee.com/openeuler/raspberrypi-kernel
version_control: gitee
src_repo: openeuler/raspberrypi-kernel
tag_prefix: ^
seperator: .