Skip to content

10. Updating Armbian Kernel | 更新 Armbian 内核

ophub edited this page Dec 7, 2023 · 1 revision

Log in to the Armbian system → Enter the command:

# Run as root user (sudo -i)
# If no parameter is specified, it will be updated to the latest version.
armbian-update
Optional Parameters Default Value Options Description
-r ophub/kernel <owner>/<repo> Set the repository to download the kernel from github.com
-u Automatic stable/flippy/dev/rk3588/rk35xx/h6 Set the suffix of the used kernel's tags
-k Latest Version Kernel Version Set the Kernel Version
-b yes yes/no Automatically backup the kernel currently in use when updating the kernel
-m no yes/no Use the mainline u-boot
-s None None [SOS] Use the system kernel in USB to restore eMMC
-h None None View the usage help

Example: armbian-update -k 5.15.50 -u dev

When specifying the kernel version number through the -k parameter, you can accurately specify the specific version number, such as: armbian-update -k 5.15.50, or you can specify the kernel series vaguely, such as: armbian-update -k 5.15, when vaguely specifying, it will automatically use the latest version of the specified series.

When updating the kernel, the currently used system kernel will be automatically backed up, stored in the /ddbr/backup directory, retaining the three most recently used kernel versions. If the newly installed kernel is unstable, you can restore to the backed-up kernel at any time:

# Enter the backup kernel directory, such as 5.10.125
cd /ddbr/backup/5.10.125
# Execute the kernel update command, which will automatically install the kernel in the current directory
armbian-update

In case of issues caused by special reasons such as incomplete updates, which result in the system being unable to boot from eMMC, you can boot any version of the Armbian system from a USB. By running the armbian-update -s command, you can update the system kernel in the USB to eMMC, accomplishing a rescue.

If your network access to github.com is poor and you can't update online, you can manually download the kernel, upload it to any directory of the Armbian system, and enter the kernel directory to execute armbian-update for local installation. If there's a complete set of kernel files in the current directory, it will use the kernel from the current directory for the update (the four kernel files needed for the update are header-xxx.tar.gz, boot-xxx.tar.gz, dtb-xxx.tar.gz, modules-xxx.tar.gz. Other kernel files are not necessary and their presence does not affect the update. The system can accurately identify needed kernel files). You can freely update among the optional kernels supported by the device, such as updating from kernel 5.10.125 to kernel 5.15.50.

Custom options set by -r/-u/-b parameters can be permanently written into the relevant parameters in the individual configuration file /etc/ophub-release, to avoid entering it each time. The corresponding settings are:

# Assign values to custom parameters
-r  :  KERNEL_REPO='ophub/kernel'
-u  :  KERNEL_TAGS='stable'
-b  :  KERNEL_BACKUP='yes'

登录 Armbian 系统 → 输入命令:

# 使用 root 用户运行 (sudo -i)
# 如果不指定参数,将更新为最新版本。
armbian-update
可选参数 默认值 选项 说明
-r ophub/kernel <owner>/<repo> 设置从 github.com 下载内核的仓库
-u 自动化 stable/flippy/dev/rk3588/rk35xx/h6 设置使用的内核的 tags 后缀
-k 最新版 内核版本 设置内核版本
-b yes yes/no 更新内核时自动备份当前系统使用的内核
-m no yes/no 使用主线 u-boot
-s [SOS] 使用 USB 中的系统内核恢复 eMMC
-h 查看使用帮助

举例: armbian-update -k 5.15.50 -u dev

通过 -k 参数指定内核版本号时,可以准确指定具体版本号,例如:armbian-update -k 5.15.50,也可以模糊指定到内核系列,例如:armbian-update -k 5.15,当模糊指定时将自动使用指定系列的最新版本。

更新内核时会自动备份当前系统使用的内核,存储路径在 /ddbr/backup 目录里,保留最近使用过的 3 个版本的内核,如果新安装的内核不稳定,可以随时恢复回备份的内核:

# 进入备份的内核目录,如 5.10.125
cd /ddbr/backup/5.10.125
# 执行更新内核命令,会自动安装当前目录下的内核
armbian-update

因特殊原因导致的更新不完整等问题,造成系统无法从 eMMC 启动时,可以从 USB 中启动任意内核版本的 Armbian 系统,运行 armbian-update -s 命令可以把 USB 中的系统内核更新至 eMMC 中,实现救援的目的。

如果你访问 github.com 的网络不通畅,无法在线下载更新时,可以手动下载内核,上传至 Armbian 系统的任意目录,并进入内核目录,执行 armbian-update 进行本地安装。如果当前目录下有成套的内核文件,将使用当前目录的内核进行更新(更新需要的 4 个内核文件是 header-xxx.tar.gz, boot-xxx.tar.gz, dtb-xxx.tar.gz, modules-xxx.tar.gz。其他内核文件不需要,如果同时存在也不影响更新,系统可以准确识别需要的内核文件)。在设备支持的可选内核里可以自由更新,如从 5.10.125 内核更新为 5.15.50 内核。

通过 -r/-u/-b 等参数设置的自定义选项,可以固定填写到个性化配置文件 /etc/ophub-release 的相关参数里,避免每次输入。对应设置为:

# 自定义修改参数的赋值
-r  :  KERNEL_REPO='ophub/kernel'
-u  :  KERNEL_TAGS='stable'
-b  :  KERNEL_BACKUP='yes'