Skip to content

Commit

Permalink
Improve -r parameter description
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed Jan 21, 2022
1 parent d559ea9 commit bc378cc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 36 deletions.
6 changes: 3 additions & 3 deletions compile-kernel/README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
| -k | Kernel | 指定 [kernel](https://cdn.kernel.org/pub/linux/kernel/v5.x/) 名称,如 `-k 5.4.170` . 多个内核使用 `_` 进行连接,如 `-k 5.10.90_5.4.170` |
| -a | AutoKernel | 设置是否自动采用同系列最新版本内核。当为 `true` 时,将自动查找在 `-k` 中指定的内核如 `5.4.170``5.4` 同系列是否有更新的版本,如有 `5.4.170` 之后的最新版本时,将自动更换为最新版。设置为 `false` 时将编译指定版本内核。默认值:`true` |
| -n | CustomName | 设置内核自定义签名。默认值为 `-meson64-dev` ,生成的内核名称为 `5.4.170-meson64-dev` 。设置自定义签名时请勿包含空格。 |
| -r | Repo | 指定编译内核的源码。可选项为 [kernel.org](https://www.kernel.org/)github.com 上的内核源码仓库(linux-5.x.y)的拥有者名称如 [unifreq](https://github.com/unifreq) 。默认为 `unifreq` |
| -r | Repo | 指定编译内核的源代码仓库。默认为 `unifreq` 。可选择 [kernel.org](https://cdn.kernel.org/pub/linux/kernel/v5.x/) 的源码和 [github.com](https://github.com/) 的内核源代码仓库。例如 `-r kernel.org``-r unifreq` 。当使用 github.com 的内核源代码仓库时,可设置参数格式为 `owner/repo@branch` 三项组合,参数中的所有者名称 `owner` 为必选参数,内核源代码仓库名称 `/repo` 和 仓库的分支名称 `@branch` 为可选参数。当仅指定所有者名称 `owner` 参数时,将自动匹配所有者的名称为 `linux-5.x.y` 格式且分支为 `main` 的内核源代码仓库。如果仓库名称或分支名称不同,请使用组合方式指定,如 `owner@branch``owner/repo``owner/repo@branch` |

- `sudo ./recompile -d -k 5.4.170` : 使用默认配置,并通过 -k 进行指定需要编译的内核版本,多个版本同时编译时使用 `_` 进行连接。
- `sudo ./recompile -d -k 5.4.170 -a true` : 使用默认配置,并通过 -a 参数设置编译内核时,是否自动升级到同系列最新内核。
- `sudo ./recompile -d -k 5.4.170 -n -leifeng` : 使用默认配置,并通过 -n 参数设置内核自定义签名。
- `sudo ./recompile -d -k 5.4.170 -r kernel.org` : 使用默认配置,并通过 -r 参数设置编译源码的下载站
- `sudo ./recompile -d -k 5.4.170 -r kernel.org` : 使用默认配置,并通过 -r 参数设置内核源代码仓库
- `sudo ./recompile -d -k 5.10.90_5.4.170 -a true -n -leifeng -r kernel.org` : 使用默认配置,并通过多个参数进行设置。

💡提示:可以使用 `unifreq`[.config](https://github.com/unifreq/arm64-kernel-configs) 模板和源码编译 [5.4](https://github.com/unifreq/linux-5.4.y) / [5.10](https://github.com/unifreq/linux-5.10.y) / [5.12](https://github.com/unifreq/linux-5.12.y) / [5.13](https://github.com/unifreq/linux-5.13.y) / [5.14](https://github.com/unifreq/linux-5.14.y) / [5.15](https://github.com/unifreq/linux-5.15.y) `最新版本``其他系列或历史版本` 可以使用 [kernel.org](https://cdn.kernel.org/pub/linux/kernel/v5.x/) 编译。
💡提示:推荐使用 `unifreq`[.config](https://github.com/unifreq/arm64-kernel-configs) 模板和源码编译 [5.4](https://github.com/unifreq/linux-5.4.y) / [5.10](https://github.com/unifreq/linux-5.10.y) / [5.12](https://github.com/unifreq/linux-5.12.y) / [5.13](https://github.com/unifreq/linux-5.13.y) / [5.14](https://github.com/unifreq/linux-5.14.y) / [5.15](https://github.com/unifreq/linux-5.15.y) 等内核的 `最新版本``其他系列或历史版本` 可以使用 [kernel.org](https://cdn.kernel.org/pub/linux/kernel/v5.x/) 编译。

- ### 本地编译

Expand Down
6 changes: 3 additions & 3 deletions compile-kernel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Compile a custom kernel as needed. This kernel can be used in [Armbian](https://
| -k | Kernel | Specify [kernel](https://cdn.kernel.org/pub/linux/kernel/v5.x/) name, such as `-k 5.4.170`. Multiple kernels use `_` to connect, such as `- k 5.10.90_5.4.170` |
| -a | AutoKernel | Set whether to automatically adopt the latest version of the kernel of the same series. When it is `true`, it will automatically find whether there is a newer version of the kernel specified in `-k` such as `5.4.170` of the `5.4` series. If there is the latest version after `5.4.170`, it will be automatically replaced with the latest version . When set to `false`, the specified version of the kernel will be compiled. Default value: `true` |
| -n | CustomName | Set the kernel custom signature. The default value is `-meson64-dev` and the generated kernel is `5.4.170-meson64-dev`. Do not include spaces when setting a custom signature. |
| -r | Repo | Specify the source code to compile the kernel. The options are [kernel.org](https://www.kernel.org/) and the name of the owner of the kernel source repository (linux-5.x.y) on github.com such as [unifreq](https://github.com/unifreq). the default is `unifreq` |
| -r | Repo | Specifies the source code repository for the compiled kernel. Defaults to `unifreq` . You can choose the source code of [kernel.org](https://cdn.kernel.org/pub/linux/kernel/v5.x/) and the kernel source of [github.com](https://github.com/) code repository. For example `-r kernel.org` or `-r unifreq` . When using the kernel source code repository of github.com, the parameter format can be set to the three-item combination of `owner/repo@branch` , The owner name `owner` in the parameters is a required parameter, the kernel source code repository name `/repo` and the repository branch name `@branch` are optional parameters. When only the owner name `owner` parameter is specified, it will automatically match kernel source code repositories whose owner's name is in `linux-5.x.y` format and branch is `main`. If the repository name or branch name is different, use a combination, such as `owner@branch` or `owner/repo` or `owner/repo@branch` |

- `sudo ./recompile -d -k 5.4.170`: Use the default configuration, and use the `-k` parameter to specify the kernel version to be compiled, and use `_` to link when multiple versions are compiled at the same time.
- `sudo ./recompile -d -k 5.4.170 -a true`: Use the default configuration, and use the `-a` parameter to set whether to automatically upgrade to the latest kernel of the same series when compiling the kernel.
- `sudo ./recompile -d -k 5.4.170 -n -leifeng`: Use the default configuration, and use the `-n` parameter to set the kernel custom signature.
- `sudo ./recompile -d -k 5.4.170 -r kernel.org`: Use the default configuration, and use the `-r` parameter to set the download station of the compiled source code.
- `sudo ./recompile -d -k 5.4.170 -r kernel.org`: Use the default configuration, and set the kernel source code repository through the `-r` parameter.
- `sudo ./recompile -d -k 5.10.90_5.4.170 -a true -n -leifeng -r kernel.org`: Use the default configuration, and set through multiple parameters.

💡Tip: You can use the [.config](https://github.com/unifreq/arm64-kernel-configs) template and source code of `unifreq` to compile the `latest version` of [5.4](https://github.com/unifreq/linux-5.4.y) / [5.10](https://github.com/unifreq/linux-5.10.y) / [5.12](https://github.com/unifreq/linux-5.12.y) / [5.13](https://github.com/unifreq/linux-5.13.y) / [5.14](https://github.com/unifreq/linux-5.14.y) / [5.15](https://github.com/unifreq/linux-5.15.y). `Other series or historical versions` can be compiled with [kernel.org](https://cdn.kernel.org/pub/linux/kernel/v5.x/).
💡Tip: Recommended Use the [.config](https://github.com/unifreq/arm64-kernel-configs) template and source code of `unifreq` to compile the `latest version` of [5.4](https://github.com/unifreq/linux-5.4.y) / [5.10](https://github.com/unifreq/linux-5.10.y) / [5.12](https://github.com/unifreq/linux-5.12.y) / [5.13](https://github.com/unifreq/linux-5.13.y) / [5.14](https://github.com/unifreq/linux-5.14.y) / [5.15](https://github.com/unifreq/linux-5.15.y), etc. `Other series or historical versions` can be compiled with [kernel.org](https://cdn.kernel.org/pub/linux/kernel/v5.x/).

- ### Local compilation

Expand Down
62 changes: 32 additions & 30 deletions recompile
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
#!/bin/bash
#===========================================================================
#============================================================================================
#
# Description: compile linux kernel for armbian
# Copyright (C) 2020-2021 https://github.com/unifreq
# Copyright (C) 2020-2021 https://github.com/ophub/amlogic-s9xxx-armbian
#===========================================================================
#
#============================================================================================
#
# Command to compile the kernel: [ sudo ./recompile -r unifreq -k 5.4.170_5.10.90 ]
#
# ---------- Specify the code repository of github.com through the [ -r ] parameter ---------
#
# 01. [ sudo ./recompile -r owner ]
# 01. From the [ owner ], Search the [ linux-5.x.y ] named repository, branch is default
#
# 02. [ sudo ./recompile -r owner@branch ]
# 02. From the [ owner ], Search the [ linux-5.x.y ] named repository, branch is [ branch ]
#
# 03. [ sudo ./recompile -r owner/repo ]
# 03. From the [ owner ], Search the [ repo ] named repository, branch is default
#
# 04. [ sudo ./recompile -r owner/repo@branch ]
# 04. From the [ owner ], Search the [ repo ] named repository, branch is [ branch ]
#
# ---------- Specify the code repository of kernel.org through the [ -r ] parameter ---------
#
# 01. [ sudo ./recompile -r kernel.org ]
# 01. From the [ kernel.org ], download [ linux-5.x.y.tar.xz ] kernel zip file
#
#============================================================================================

#===== Do not modify the following parameter settings, Start =====
# Set environment variables
Expand All @@ -22,13 +47,12 @@ build_kernel=("5.4.170" "5.10.90")
# Kernel custom name
custom_name="-meson64-dev"

# Kernel download from github.com, Support repository named in [ linux-5.x.y ] format.
# Set the default value of the [ -r ] parameter
# When set to [ -r kernel.org ], Kernel download from kernel.org
kernel_org_repo="https://cdn.kernel.org/pub/linux/kernel/v5.x/"
# Set the default for downloading kernel sources from github.com
repo_owner="unifreq"
repo_branch="main"
#
# Kernel download from kernel.org
#repo_owner="kernel.org"
kernel_org_repo="https://cdn.kernel.org/pub/linux/kernel/v5.x/"

# Cross compile
use_linuxgun_url="https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel"
Expand Down Expand Up @@ -492,27 +516,7 @@ while [ "${1}" ]; do
shift
done

#========== Specify the code repository of github.com through the -r parameter ==========
#
# 01. [ sudo ./recompile -r owner ]
# 01. From the [ owner ], Search the [ linux-5.x.y ] named repository, branch is default
#
# 02. [ sudo ./recompile -r owner@branch ]
# 02. From the [ owner ], Search the [ linux-5.x.y ] named repository, branch is [ branch ]
#
# 03. [ sudo ./recompile -r owner/repo ]
# 03. From the [ owner ], Search the [ repo ] named repository, branch is default
#
# 04. [ sudo ./recompile -r owner/repo@branch ]
# 04. From the [ owner ], Search the [ repo ] named repository, branch is [ branch ]
#
#========== Specify the code repository of kernel.org through the -r parameter ==========
#
# 01. [ sudo ./recompile -r kernel.org ]
# 01. From the [ kernel.org ], download [ linux-5.x.y.tar.xz ] kernel zip file
#
#===========================================================================================
#
# Receive the value entered by the [ -r ] parameter
input_r_value="${repo_owner//https\:\/\/github\.com\//}"
#
code_owner="$(echo "${input_r_value}" | awk -F '@' '{print $1}' | awk -F '/' '{print $1}')"
Expand All @@ -522,8 +526,6 @@ code_branch="$(echo "${input_r_value}" | awk -F '@' '{print $2}')"
[ -n "${code_owner}" ] || error_msg "The [ -r ] parameter is invalid."
[ -n "${code_branch}" ] || code_branch="${repo_branch}"
echo -e "Input owner: [ ${code_owner} ], repo: [ ${code_repo} ], branch: [ ${code_branch} ]"
#
#===========================================================================================

gcc_check
# Set whether to replace the kernel
Expand Down

0 comments on commit bc378cc

Please sign in to comment.