!2 增加 spec 文件用于构建生成树莓派内核 RPM

Merge pull request !2 from woqidaideshi/dev
This commit is contained in:
openeuler-ci-bot 2020-07-13 09:45:55 +08:00 committed by Gitee
commit 7cf0e08002
5 changed files with 149 additions and 36 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
kernel.tar.gz filter=lfs diff=lfs merge=lfs -text

View File

@ -1,22 +1,38 @@
# raspberrypi-kernel
#### Description
Kernel of Raspberry Pi
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
Software architecture description
AArch64
#### Installation
1. xxxx
2. xxxx
3. xxxx
`dnf install raspberrypi-kernel`
#### Instructions
1. xxxx
2. xxxx
3. xxxx
1. The version of raspberrypi kernel ends with `.raspi`, e.g., `4.19.90-2005.2.0.0036.raspi.aarch64 `.
2. The module files will be installed into `/lib/modules`. The directory name of these module files is the same as the version of raspberrypi kernel, such as `4.19.90-2005.2.0.0036.raspi.aarch64`.
3. The image file will be installed into `/boot`, whose filename is like `vmlinuz-4.19.90-2005.2.0.0036.raspi.aarch64`. Note that the image file is in GZ compression format by default. You can decompress this file, and then rename it to `kernel8.img` as follows.
```
cd /boot
cp vmlinuz-4.19.90-2005.2.0.0036.raspi.aarch64 Image.gz
gunzip Image.gz
mv Image kernel8.img
```
4. The device tree files will be installed into `/boot`. The directory name of these files looks like `dtb-4.19.90-2005.2.0.0036.raspi.aarch64`. You need to copy the device tree files to `/boot` as follows.
```
cd /boot
cp dtb-4.19.90-2005.2.0.0036.raspi.aarch64/*.dtb ./
```
#### Contribution
@ -24,13 +40,3 @@ Software architecture description
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,23 +1,42 @@
# raspberrypi-kernel
#### 介绍
Kernel of Raspberry Pi
Raspberry Pi 内核映像文件。
`kernel.tar.gz` 来自 <https://gitee.com/openeuler/raspberrypi-kernel> 仓库,将 SSH 公钥添加到 gitee.com 的账户中后,可通过执行 `. SOURCE` 来获取 `kernel.tar.gz`。也可以采用本仓库通过 Git LFS 上传的 `kernel.tar.gz`
#### 软件架构
软件架构说明
AArch64
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
`dnf install raspberrypi-kernel`
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
安装 raspberrypi-kernel 后,
1. 内核版本号后缀增加 `.raspi` 标识,形如 `4.19.90-2005.2.0.0036.raspi.aarch64`
2. 内核模块安装在 `/lib/modules` 目录下,对应文件夹名称同内核版本号,如 `4.19.90-2005.2.0.0036.raspi.aarch64`
3. 内核映像文件在 `/boot` 目录下,映像文件名形如 `vmlinuz-4.19.90-2005.2.0.0036.raspi.aarch64`。注意,该文件默认是采用 GZ 压缩格式的压缩文件,需要解压缩后重命名为 `kernel8.img`
具体过程:
```
cd /boot
cp vmlinuz-4.19.90-2005.2.0.0036.raspi.aarch64 Image.gz
gunzip Image.gz
mv Image kernel8.img
```
4. 设备树文件在 `/boot` 目录下的文件夹下,该文件夹名称形如 `dtb-4.19.90-2005.2.0.0036.raspi.aarch64`,需要将其中的设备树文件拷贝到 `/boot` 目录下。
具体过程:
```
cd /boot
cp dtb-4.19.90-2005.2.0.0036.raspi.aarch64/*.dtb ./
```
#### 参与贡献
@ -25,13 +44,3 @@ Kernel of Raspberry Pi
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

1
SOURCE Normal file
View File

@ -0,0 +1 @@
git archive --format=tar.gz --prefix=kernel/ -o kernel.tar.gz --remote=git@gitee.com:openeuler/raspberrypi-kernel.git openEuler-20.03-LTS-raspi

96
raspberrypi-kernel.spec Normal file
View File

@ -0,0 +1,96 @@
%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 2005.2.0
%global debug_package %{nil}
Name: raspberrypi-kernel
Version: 4.19.90
Release: %{hulkrelease}.0036
Summary: Linux Kernel
License: GPLv2
URL: http://www.kernel.org/
Source0: kernel.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 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) 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} openeuler-raspi_defconfig
make ARCH=%{Arch} dtbs
TargetImage=$(basename $(make -s image_name))
make ARCH=%{Arch} $TargetImage %{?_smp_mflags}
make ARCH=%{Arch} modules %{?_smp_mflags}
%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
install -m 755 $(make -s image_name) $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/
install -m 644 arch/%{Arch}/boot/dts/overlays/README $RPM_BUILD_ROOT/boot/dtb-%{KernelVer}/overlays/
%files
%defattr (-, root, root)
%doc
/boot/config-*
/boot/System.map-*
/boot/vmlinuz-*
/boot/dtb-*
/lib/modules/%{KernelVer}/
%changelog
* Thu Jun 11 2020 EulixOS Buildteam <isrc-support@iscas.ac.cn> - 4.19.90-2003.4.0.0036-raspi
- Add spec file to generate RaspberryPi kernel image rpm.