├── .gitignore ├── .github ├── ISSUE_TEMPLATE │ └── bug-report.md └── workflows │ ├── delete-older-releases-workflows.yml │ ├── compile-mainline-beta-kernel.yml │ ├── compile-allwinner-h6-kernel.yml │ ├── compile-mainline-stable-kernel.yml │ ├── compile-rockchip-rk3588-kernel.yml │ └── compile-rockchip-rk35xx-kernel.yml ├── kernel-patch ├── beta │ ├── linux-6.6.y │ │ └── 201-fix-i2ca-and-i2cb-miossing-pins.patch │ ├── linux-6.1.y │ │ └── 201-fix-i2ca-and-i2cb-miossing-pins.patch │ ├── linux-5.15.y │ │ ├── 201-drm-meson-venc-add-support-for-ws7.9.patch │ │ └── 301-dts-add-rockchip-rk3399-cdhx-rb30-dtb.patch │ ├── linux-5.10.y │ │ └── 101-arm64-add-text_offset.patch │ ├── deprecated-patches │ │ ├── 6.1.y-101-arm64-add-text_offset.patch │ │ ├── 6.6.y-101-arm64-add-text_offset.patch │ │ └── 6.12.y-301-dts-add-rockchip-rk3568-alark35-3500-dtb.patch │ └── common-kernel-patches │ │ └── 301-dts-add-rockchip-rk3399-mpc1903-dtb.patch └── README.md ├── kernel-config └── README.md ├── README.cn.md ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | .DS_Store 3 | npm-debug.log* 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Device Information | 设备信息** 10 | - SOC: [e.g. S095x3] 11 | - Model [e.g. HK1] 12 | 13 | **System Version | 系统版本** 14 | - System: [e.g. Armbian/OpenWrt] 15 | 16 | **Kernel Version | 内核版本** 17 | - Kernel Version: [e.g. 5.15.100] 18 | 19 | **Describe the bug | 问题描述** 20 | All issues will only remain open for one week to prioritize resolving them. 21 | After that period, they will be closed but can still continue to be discussed in the thread. 22 | 所有的问题都只保留一周的开启状态供重点关注解决,超时将关闭,但仍然可以长期继续跟帖讨论。 23 | 24 | Please provide a detailed description of the issue and, if necessary, attach a screenshot. 25 | 详细描述问题,并在必要时附上屏幕截图。 26 | 27 | 28 | -------------------------------------------------------------------------------- /kernel-patch/beta/linux-6.6.y/201-fix-i2ca-and-i2cb-miossing-pins.patch: -------------------------------------------------------------------------------- 1 | From 9b2af930c2377459c3e67aa45c928acefb89d227 Mon Sep 17 00:00:00 2001 2 | From: xxx <68696949+xxx@users.noreply.github.com> 3 | Date: Wed, 21 May 2025 12:19:23 +0800 4 | Subject: [PATCH] fix i2cA and i2cB miossing pins 5 | 6 | --- 7 | arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 4 ++++ 8 | 1 file changed, 4 insertions(+) 9 | 10 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 11 | index ed00e67e6..460a21a4f 100644 12 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 13 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 14 | @@ -339,6 +339,8 @@ 15 | 16 | &i2c_A { 17 | clocks = <&clkc CLKID_I2C>; 18 | + pinctrl-names = "default"; 19 | + pinctrl-0 = <&i2c_a_pins>; 20 | }; 21 | 22 | &i2c_AO { 23 | @@ -347,6 +349,8 @@ 24 | 25 | &i2c_B { 26 | clocks = <&clkc CLKID_I2C>; 27 | + pinctrl-names = "default"; 28 | + pinctrl-0 = <&i2c_b_pins>; 29 | }; 30 | 31 | &i2c_C { 32 | -------------------------------------------------------------------------------- /kernel-patch/beta/linux-6.1.y/201-fix-i2ca-and-i2cb-miossing-pins.patch: -------------------------------------------------------------------------------- 1 | From 59d66d6c9465f4fee9c8fc6acc4235be9342baff Mon Sep 17 00:00:00 2001 2 | From: xxx <68696949+xxx@users.noreply.github.com> 3 | Date: Wed, 21 May 2025 12:15:46 +0800 4 | Subject: [PATCH] fix i2cA and i2cB miossing pins 5 | 6 | --- 7 | arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 4 ++++ 8 | 1 file changed, 4 insertions(+) 9 | 10 | diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 11 | index 256c46771d..2a8d05373e 100644 12 | --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 13 | +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi 14 | @@ -333,6 +333,8 @@ 15 | 16 | &i2c_A { 17 | clocks = <&clkc CLKID_I2C>; 18 | + pinctrl-names = "default"; 19 | + pinctrl-0 = <&i2c_a_pins>; 20 | }; 21 | 22 | &i2c_AO { 23 | @@ -341,6 +343,8 @@ 24 | 25 | &i2c_B { 26 | clocks = <&clkc CLKID_I2C>; 27 | + pinctrl-names = "default"; 28 | + pinctrl-0 = <&i2c_b_pins>; 29 | }; 30 | 31 | &i2c_C { 32 | -------------------------------------------------------------------------------- /kernel-patch/beta/linux-5.15.y/201-drm-meson-venc-add-support-for-ws7.9.patch: -------------------------------------------------------------------------------- 1 | From 50f2d2574a541855ed5bf14dc9835de424fa3b60 Mon Sep 17 00:00:00 2001 2 | From: xxx <68696949+xxx@users.noreply.github.com> 3 | Date: Wed, 21 May 2025 12:08:39 +0800 4 | Subject: [PATCH] hack: drm/meson: venc: add support for WS7.9 5 | 6 | --- 7 | drivers/gpu/drm/meson/meson_venc.c | 8 +++++--- 8 | 1 file changed, 5 insertions(+), 3 deletions(-) 9 | 10 | diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c 11 | index 559ab3b5e2..40d6a908b3 100644 12 | --- a/drivers/gpu/drm/meson/meson_venc.c 13 | +++ b/drivers/gpu/drm/meson/meson_venc.c 14 | @@ -866,11 +866,13 @@ meson_venc_hdmi_supported_mode(const struct drm_display_mode *mode) 15 | DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC)) 16 | return MODE_BAD; 17 | 18 | - /* support higher resolution than 1920x1080 */ 19 | - if (mode->hdisplay < 640 || mode->hdisplay > 2560) 20 | + /* support 384x1280 and 1280x384 for the waveshare 7.9" 21 | + * as well, support 2560x1600 for 2K resolution 22 | + */ 23 | + if (mode->hdisplay < 384 || mode->hdisplay > 2560) 24 | return MODE_BAD_HVALUE; 25 | 26 | - if (mode->vdisplay < 480 || mode->vdisplay > 1600) 27 | + if (mode->vdisplay < 384 || mode->vdisplay > 1600) 28 | return MODE_BAD_VVALUE; 29 | 30 | return MODE_OK; 31 | -------------------------------------------------------------------------------- /kernel-config/README.md: -------------------------------------------------------------------------------- 1 | # Kernel Personalized Configuration Guide 2 | 3 | During cloud compilation using GitHub Actions, you can use the `kernel_config` parameter to specify personalized kernel configuration. The naming of the configuration files (config-k.x) of each kernel version uses the major version number (for example: config-6.1). You can refer to the settings in [compile-mainline-stable-kernel.yml](../.github/workflows/compile-mainline-stable-kernel.yml): 4 | 5 | ```yaml 6 | - name: Compile the kernel 7 | uses: ophub/amlogic-s9xxx-armbian@main 8 | with: 9 | build_target: kernel 10 | kernel_version: 5.15.y_6.1.y 11 | kernel_auto: true 12 | kernel_config: kernel-config/release/stable 13 | ``` 14 | 15 | If there is no special requirement, you can proceed without specifying personalized configuration. The kernel default configuration file [compile-kernel/tools/config](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel/tools/config) will be used for kernel compilation. For more settings, please refer to the [Kernel Compilation Guide](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel) document. 16 | 17 | # 内核个性化配置说明 18 | 19 | 在 GitHub Actions 云编译时,可以使用 `kernel_config` 参数指定个性化内核配置,各内核版本的配置文件(config-k.x)的命名使用主版本号(例如:config-6.1),使用方法可以参考 [compile-mainline-stable-kernel.yml](../.github/workflows/compile-mainline-stable-kernel.yml) 的设置: 20 | 21 | ```yaml 22 | - name: Compile the kernel 23 | uses: ophub/amlogic-s9xxx-armbian@main 24 | with: 25 | build_target: kernel 26 | kernel_version: 5.15.y_6.1.y 27 | kernel_auto: true 28 | kernel_config: kernel-config/release/stable 29 | ``` 30 | 31 | 如果没有特殊需求,可以不指定个性化配置,编译时将采用内核默认配置文件 [compile-kernel/tools/config](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel/tools/config) 进行内核编译。更多设置请查看[内核编译说明](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel)文档。 32 | -------------------------------------------------------------------------------- /.github/workflows/delete-older-releases-workflows.yml: -------------------------------------------------------------------------------- 1 | #========================================================================== 2 | # https://github.com/ophub/kernel 3 | # Description: Delete older releases and workflows runs 4 | #========================================================================== 5 | 6 | name: Delete older releases and workflows 7 | 8 | on: 9 | repository_dispatch: 10 | workflow_dispatch: 11 | inputs: 12 | del_workflows: 13 | description: "Delete workflows records?" 14 | required: true 15 | default: true 16 | type: boolean 17 | workflows_keep_day: 18 | description: "Days to keep workflows." 19 | required: false 20 | default: "1" 21 | type: choice 22 | options: 23 | - 30 24 | - 20 25 | - 10 26 | - 9 27 | - 8 28 | - 7 29 | - 6 30 | - 5 31 | - 4 32 | - 3 33 | - 2 34 | - 1 35 | - 0 36 | workflows_keep_keyword: 37 | description: "keywords for keep workflows." 38 | required: false 39 | default: "" 40 | out_log: 41 | description: "Output detailed JSON logs." 42 | required: false 43 | default: true 44 | type: boolean 45 | 46 | env: 47 | TZ: Etc/UTC 48 | 49 | jobs: 50 | build: 51 | runs-on: ubuntu-24.04-arm 52 | if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }} 53 | 54 | steps: 55 | - name: Checkout 56 | uses: actions/checkout@v6 57 | 58 | - name: Initialization environment 59 | id: init 60 | env: 61 | DEBIAN_FRONTEND: noninteractive 62 | run: | 63 | sudo timedatectl set-timezone "${TZ}" 64 | echo "status=success" >> ${GITHUB_OUTPUT} 65 | 66 | - name: Delete releases and workflows runs 67 | uses: ophub/delete-releases-workflows@main 68 | with: 69 | delete_releases: false 70 | delete_tags: false 71 | delete_workflows: ${{ inputs.del_workflows }} 72 | workflows_keep_day: ${{ inputs.workflows_keep_day }} 73 | workflows_keep_keyword: ${{ inputs.workflows_keep_keyword }} 74 | out_log: ${{ inputs.out_log }} 75 | gh_token: ${{ secrets.GITHUB_TOKEN }} 76 | -------------------------------------------------------------------------------- /kernel-patch/README.md: -------------------------------------------------------------------------------- 1 | # Kernel Patch Usage Guide 2 | 3 | During cloud compilation using GitHub Actions, you can use the `kernel_patch` parameter to specify the directory of the kernel patches in your repository. The common kernel patches that can be used for each series of kernels adopt a fixed directory name (`common-kernel-patches`). Only the patches specific to a particular series, for example, [linux-5.15.y](https://github.com/unifreq/linux-5.15.y), use the directory name `identical to the kernel source library`. Other custom named directories (such as the `deprecated-patches` directory for storing obsolete patches) will be skipped during kernel compilation and will not be used. 4 | 5 | ```shell 6 | ~/kernel 7 | └── 8 | ├── common-kernel-patches # Fixed directory name: Stores kernel patches common to all versions 9 | ├── linux-5.15.y # Same as the kernel source library: stores dedicated patches 10 | ├── linux-6.1.y 11 | ├── linux-5.10.y-rk35xx 12 | └── more kernel directory... 13 | ``` 14 | 15 | The usage in the kernel compilation script can refer to the settings in [compile-mainline-beta-kernel.yml](../.github/workflows/compile-mainline-beta-kernel.yml): 16 | 17 | ```yaml 18 | - name: Compile the kernel 19 | uses: ophub/amlogic-s9xxx-armbian@main 20 | with: 21 | build_target: kernel 22 | kernel_version: 5.15.1_6.1.1 23 | kernel_auto: true 24 | kernel_config: kernel-config/release/stable 25 | kernel_patch: kernel-patch/beta 26 | auto_patch: true 27 | ``` 28 | 29 | When compiling the kernel, it will first enumerate all the patches with `.patch` suffix under `common-kernel-patches` and apply them, then enumerate and apply the dedicated patches for the current compiled kernel (such as: linux-6.1.y). For more instructions, please refer to the detailed introduction in [Kernel Compilation Method](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel) and [Kernel Patch Addition Method](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/documents/README.md#9-compiling-armbian-kernel). 30 | 31 | # 内核补丁使用说明 32 | 33 | 在 GitHub Actions 云编译时,可以使用 `kernel_patch` 参数指定内核补丁在你仓库中的目录。其中每个系列的内核都能使用的通用内核补丁,采用固定目录名称(`common-kernel-patches`),仅适用于指定系列,例如 [linux-5.15.y](https://github.com/unifreq/linux-5.15.y) 的内核补丁,使用 `与内核源码库同名` 的目录名称。使用其他自定义命名的目录(例如存放已弃用补丁的目录`deprecated-patches`)在内核编译时将跳过,不会被使用。 34 | 35 | ```shell 36 | ~/kernel 37 | └── 38 | ├── common-kernel-patches # 固定目录名:存放各版本都通用的内核补丁 39 | ├── linux-5.15.y # 与内核源码库同名:存放专用补丁 40 | ├── linux-6.1.y 41 | ├── linux-5.10.y-rk35xx 42 | └── more kernel directory... 43 | ``` 44 | 45 | 在内核编译脚本中使用方法可以参考 [compile-mainline-beta-kernel.yml](../.github/workflows/compile-mainline-beta-kernel.yml) 的设置: 46 | 47 | ```yaml 48 | - name: Compile the kernel 49 | uses: ophub/amlogic-s9xxx-armbian@main 50 | with: 51 | build_target: kernel 52 | kernel_version: 5.15.1_6.1.1 53 | kernel_auto: true 54 | kernel_config: kernel-config/release/stable 55 | kernel_patch: kernel-patch/beta 56 | auto_patch: true 57 | ``` 58 | 59 | 在编译内核时,会先遍列 `common-kernel-patches` 下后缀是 `.patch` 的全部补丁并应用,然后再遍列当前编译内核(如:linux-6.1.y)的专用补丁并应用。更多说明请参考 [内核编译方法](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel) 和 [内核补丁添加方法](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/documents/README.cn.md#9-编译-armbian-内核) 中的详细介绍。 60 | -------------------------------------------------------------------------------- /README.cn.md: -------------------------------------------------------------------------------- 1 | # 内核说明 2 | 3 | 查看英文说明 | [View English description](README.md) 4 | 5 | 这些内核可用于 `Armbian` 和 `OpenWrt` 系统。例如 [amlogic-s9xxx-armbian](https://github.com/ophub/amlogic-s9xxx-armbian), [amlogic-s9xxx-openwrt](https://github.com/ophub/amlogic-s9xxx-openwrt), [flippy-openwrt-actions](https://github.com/ophub/flippy-openwrt-actions) 和 [unifreq/openwrt_packit](https://github.com/unifreq/openwrt_packit) 等项目。可以在编译固件时集成,也可以安装到已有的系统中使用。其中的 [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable),[kernel_flippy](https://github.com/ophub/kernel/releases/tag/kernel_flippy) 和 [kernel_beta](https://github.com/ophub/kernel/releases/tag/kernel_beta) 是可以互换使用的主线内核。具体使用方法详见[内核使用说明](https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/compile-kernel/README.cn.md#内核使用说明)。 6 | 7 | 8 | - 在 Releases 的 [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable) 里的内核文件是`稳定版`,根据用户需求启用了更多支持选项。 9 | - 在 Releases 的 [kernel_flippy](https://github.com/ophub/kernel/releases/tag/kernel_flippy) 里的内核文件是`稳定版`,是`flippy`制作分享的系列内核。 10 | - 在 Releases 的 [kernel_beta](https://github.com/ophub/kernel/releases/tag/kernel_beta) 里的内核文件是 `测试版`,支持自定义添加第三方驱动等补丁,支持自定义配置编译。 11 | - 在 Releases 的 [kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588) 里的内核文件是 `rk3588` 系列的`专用版本`,和其他系列不通用。 12 | - 在 Releases 的 [kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) 里的内核文件是 `rk3528/rk3566/rk3568` 系列的`专用版本`,和其他系列不通用。 13 | - 在 Releases 的 [kernel_h6](https://github.com/ophub/kernel/releases/tag/kernel_h6) 里的内核文件是 `全志 H6(TQC-A01)` 设备的`专用版本`,和其他系列不通用。 14 | - 在 Releases 的 [dev](https://github.com/ophub/kernel/releases/tag/dev) 里有编译内核时需要的`交叉编译工具链`下载镜像。 15 | - 在 Releases 的 [tools](https://github.com/ophub/kernel/releases/tag/tools) 里有一些常见的电视盒子的`安卓系统`下载镜像,在使用 Armbian 和 OpenWrt 系统时,可以用于恢复安卓系统使用。 16 | 17 | ## 编译内核 18 | 19 | - 编译内核的方法详见 [compile-kernel](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel),使用 github.com 的 Actions 编译内核的方法可参考 [.github/workflows](.github/workflows),可以通过修改 [kernel-config](kernel-config) 里的内核配置文件进行自定义内核,可以在 [kernel-patch](kernel-patch) 目录里添加自定义内核补丁。 20 | 21 | - 你可以根据需要对内核的配置进行调整,如添加驱动和补丁。也可以根据心情编译具有特殊意义的个性化签名内核,如 `5.10.95-happy-new-year`, `5.10.96-beijing-winter-olympics`, `5.10.99-valentines-day` 等等。 22 | 23 | 24 | ```yaml 25 | - name: Compile the kernel 26 | uses: ophub/amlogic-s9xxx-armbian@main 27 | with: 28 | build_target: kernel 29 | kernel_version: 6.1.y_6.12.y 30 | kernel_auto: true 31 | kernel_sign: -yourname 32 | ``` 33 | 34 | ## 内核源码 35 | 36 | 非常感谢 unifreq 等大佬们维护的内核源码,目前仓库中的内核文件使用的源码如下: 37 | 38 | | 内核标签 | 源码仓库 | 适用设备 | 39 | | ------------- | --------------------- | --------------------- | 40 | | [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable)
[kernel_flippy](https://github.com/ophub/kernel/releases/tag/kernel_flippy)
[kernel_beta](https://github.com/ophub/kernel/releases/tag/kernel_beta) | [unifreq/linux-5.10.y](https://github.com/unifreq/linux-5.10.y)
[unifreq/linux-5.15.y](https://github.com/unifreq/linux-5.15.y)
[unifreq/linux-6.1.y](https://github.com/unifreq/linux-6.1.y)
[unifreq/linux-6.6.y](https://github.com/unifreq/linux-6.6.y)
[unifreq/linux-6.12.y](https://github.com/unifreq/linux-6.12.y) | Amlogic
Allwinner
Rockchip | 41 | | [kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588) | [unifreq/linux-5.10.y-rk35xx](https://github.com/unifreq/linux-5.10.y-rk35xx)
[unifreq/linux-6.1.y-rockchip](https://github.com/unifreq/linux-6.1.y-rockchip) | Rockchip-RK3588 | 42 | | [kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) | [unifreq/linux-5.10.y-rk35xx](https://github.com/unifreq/linux-5.10.y-rk35xx)
[unifreq/linux-6.1.y-rockchip](https://github.com/unifreq/linux-6.1.y-rockchip) | Rockchip-RK3528/RK3566/RK3568 | 43 | | [kernel_h6](https://github.com/ophub/kernel/releases/tag/kernel_h6) | [13584452567/linux-6.4.y](https://github.com/13584452567/linux-6.4.y)
[13584452567/linux-6.5.y](https://github.com/13584452567/linux-6.5.y)
[13584452567/linux-6.6.y](https://github.com/13584452567/linux-6.6.y) | Allwinner-H6(TQC-A01) | 44 | | [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable)
[kernel_h6](https://github.com/ophub/kernel/releases/tag/kernel_h6)
[kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588)
[kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) | [ophub/linux-5.10.y](https://github.com/ophub/linux-5.10.y)
[ophub/linux-5.15.y](https://github.com/ophub/linux-5.15.y)
[ophub/linux-6.1.y](https://github.com/ophub/linux-6.1.y)
[ophub/linux-6.6.y](https://github.com/ophub/linux-6.6.y)
[ophub/linux-6.12.y](https://github.com/ophub/linux-6.12.y)
[ophub/linux-h6-6.6.y](https://github.com/ophub/linux-h6-6.6.y)
[ophub/linux-6.1.y-rockchip](https://github.com/ophub/linux-6.1.y-rockchip) | 内核源码复制自 [unifreq](https://github.com/unifreq), [13584452567](https://github.com/13584452567) 和 [chewitt](https://github.com/chewitt/linux) 的仓库,
便于跟随大佬们学习如何给内核打补丁。 | 45 | | [kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588) | [armbian/linux-rockchip](https://github.com/armbian/linux-rockchip) | Rockchip-Beta(6.1.y) | 46 | | [kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) | [armbian/linux-rockchip](https://github.com/armbian/linux-rockchip) | Rockchip-Beta(6.1.y) | 47 | 48 | 49 | ## 链接 50 | 51 | - [unifreq/kernel](https://github.com/unifreq) 52 | - [13584452567/kernel](https://github.com/13584452567/linux-6.4.y) 53 | - [chewitt/linux](https://github.com/chewitt/linux) 54 | - [torvalds/linux](https://github.com/torvalds/linux) 55 | - [kernel.org](https://kernel.org) 56 | 57 | ## License 58 | 59 | The kernel © OPHUB is licensed under [GPL-2.0](https://github.com/ophub/kernel/blob/main/LICENSE) 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kernel Description 2 | 3 | View Chinese description | [查看中文说明](README.cn.md) 4 | 5 | These kernels can be used for `Armbian` and `OpenWrt` systems, such as the [amlogic-s9xxx-armbian](https://github.com/ophub/amlogic-s9xxx-armbian), [amlogic-s9xxx-openwrt](https://github.com/ophub/amlogic-s9xxx-openwrt), [flippy-openwrt-actions](https://github.com/ophub/flippy-openwrt-actions), and [unifreq/openwrt_packit](https://github.com/unifreq/openwrt_packit) projects. They can be integrated when compiling firmware or installed in an existing system. Among them, [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable), [kernel_flippy](https://github.com/ophub/kernel/releases/tag/kernel_flippy) and [kernel_beta](https://github.com/ophub/kernel/releases/tag/kernel_beta) is an interchangeable mainline kernel. For specific usage methods, see the [Kernel Use Instructions](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel). 6 | 7 | - The kernel files in the [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable) section of the Releases are `stable version`, which have enabled more support options according to user needs. 8 | - The kernel files in the [kernel_flippy](https://github.com/ophub/kernel/releases/tag/kernel_flippy) section of the Releases are `stable version`, which are series kernels shared by `flippy`. 9 | - The kernel files in the [kernel_beta](https://github.com/ophub/kernel/releases/tag/kernel_beta) section of the Releases are `beta version`, which support custom addition of third-party driver patches, and allow custom configuration compilation. 10 | - The kernel files in the [kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588) section of the Releases are `special version` for the `rk3588` series, and they are not compatible with other series. 11 | - The kernel files in the [kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) section of the Releases are `special version` for the `rk3528/rk3566/rk3568` series, and they are not compatible with other series. 12 | - The kernel files in the [kernel_h6](https://github.com/ophub/kernel/releases/tag/kernel_h6) section of the Releases are `special version` for the `Allwinner H6 (TQC-A01)` device, and they are not compatible with other series. 13 | - The [dev](https://github.com/ophub/kernel/releases/tag/dev) section in the Releases has the download image of the `cross-compilation toolchain` required when compiling the kernel. 14 | - The [tools](https://github.com/ophub/kernel/releases/tag/tools) section in the Releases has download images of `Android systems` for some common TV boxes, which can be used to restore the Android system when using Armbian and OpenWrt systems. 15 | 16 | 17 | ## Kernel Compilation 18 | 19 | - For the method of kernel compilation, please refer to [compile-kernel](https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/compile-kernel). For the method of kernel compilation using Actions on github.com, refer to [.github/workflows](.github/workflows). You can customize the kernel by modifying the kernel configuration files in [kernel-config](kernel-config), and add custom kernel patches in the [kernel-patch](kernel-patch) directory. 20 | 21 | - You can adjust the configuration of the kernel according to your needs, such as adding drivers and patches. You can also compile a personalized signature kernel with special meaning according to your mood, such as `5.10.95-happy-new-year`, `5.10.96-beijing-winter-olympics`, `5.10.99-valentines-day`, etc. 22 | 23 | ```yaml 24 | - name: Compile the kernel 25 | uses: ophub/amlogic-s9xxx-armbian@main 26 | with: 27 | build_target: kernel 28 | kernel_version: 6.1.y_6.12.y 29 | kernel_auto: true 30 | kernel_sign: -yourname 31 | ``` 32 | 33 | ## Kernel Source Code 34 | 35 | A big thank you to unifreq and others for maintaining the kernel source code. The source code used in the kernel files in the repository is as follows: 36 | 37 | | Kernel Tags | Source Code Repository | Applicable devices | 38 | | ------------- | ----------------------- | ----------------------- | 39 | | [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable)
[kernel_flippy](https://github.com/ophub/kernel/releases/tag/kernel_flippy)
[kernel_beta](https://github.com/ophub/kernel/releases/tag/kernel_beta) | [unifreq/linux-5.10.y](https://github.com/unifreq/linux-5.10.y)
[unifreq/linux-5.15.y](https://github.com/unifreq/linux-5.15.y)
[unifreq/linux-6.1.y](https://github.com/unifreq/linux-6.1.y)
[unifreq/linux-6.6.y](https://github.com/unifreq/linux-6.6.y)
[unifreq/linux-6.12.y](https://github.com/unifreq/linux-6.12.y) | Amlogic
Allwinner
Rockchip | 40 | | [kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588) | [unifreq/linux-5.10.y-rk35xx](https://github.com/unifreq/linux-5.10.y-rk35xx)
[unifreq/linux-6.1.y-rockchip](https://github.com/unifreq/linux-6.1.y-rockchip) | Rockchip-RK3588 | 41 | | [kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) | [unifreq/linux-5.10.y-rk35xx](https://github.com/unifreq/linux-5.10.y-rk35xx)
[unifreq/linux-6.1.y-rockchip](https://github.com/unifreq/linux-6.1.y-rockchip) | Rockchip-RK3528/RK3566/RK3568 | 42 | | [kernel_h6](https://github.com/ophub/kernel/releases/tag/kernel_h6) | [13584452567/linux-6.4.y](https://github.com/13584452567/linux-6.4.y)
[13584452567/linux-6.5.y](https://github.com/13584452567/linux-6.5.y)
[13584452567/linux-6.6.y](https://github.com/13584452567/linux-6.6.y) | Allwinner-H6(TQC-A01) | 43 | | [kernel_stable](https://github.com/ophub/kernel/releases/tag/kernel_stable)
[kernel_h6](https://github.com/ophub/kernel/releases/tag/kernel_h6)
[kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588)
[kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) | [ophub/linux-5.10.y](https://github.com/ophub/linux-5.10.y)
[ophub/linux-5.15.y](https://github.com/ophub/linux-5.15.y)
[ophub/linux-6.1.y](https://github.com/ophub/linux-6.1.y)
[ophub/linux-6.6.y](https://github.com/ophub/linux-6.6.y)
[ophub/linux-6.12.y](https://github.com/ophub/linux-6.12.y)
[ophub/linux-h6-6.6.y](https://github.com/ophub/linux-h6-6.6.y)
[ophub/linux-6.1.y-rockchip](https://github.com/ophub/linux-6.1.y-rockchip) | The kernel source code was cloned from the repositories
of [unifreq](https://github.com/unifreq), [13584452567](https://github.com/13584452567) and [chewitt](https://github.com/chewitt/linux), facilitating learning
how to patch the kernel by following these experts. | 44 | | [kernel_rk3588](https://github.com/ophub/kernel/releases/tag/kernel_rk3588) | [armbian/linux-rockchip](https://github.com/armbian/linux-rockchip) | Rockchip-Beta(6.1.y) | 45 | | [kernel_rk35xx](https://github.com/ophub/kernel/releases/tag/kernel_rk35xx) | [armbian/linux-rockchip](https://github.com/armbian/linux-rockchip) | Rockchip-Beta(6.1.y) | 46 | 47 | ## Links 48 | 49 | - [unifreq/kernel](https://github.com/unifreq) 50 | - [13584452567/kernel](https://github.com/13584452567/linux-6.4.y) 51 | - [chewitt/linux](https://github.com/chewitt/linux) 52 | - [torvalds/linux](https://github.com/torvalds/linux) 53 | - [kernel.org](https://kernel.org) 54 | 55 | ## License 56 | 57 | The kernel © OPHUB is licensed under [GPL-2.0](https://github.com/ophub/kernel/blob/main/LICENSE) 58 | -------------------------------------------------------------------------------- /.github/workflows/compile-mainline-beta-kernel.yml: -------------------------------------------------------------------------------- 1 | #========================================================================== 2 | # Description: Compile mainline beta kernel 3 | # Copyright (C) 2021 https://github.com/unifreq/openwrt_packit 4 | # Copyright (C) 2021 https://github.com/ophub/kernel 5 | #========================================================================== 6 | 7 | name: Compile mainline beta kernel 8 | 9 | on: 10 | repository_dispatch: 11 | workflow_dispatch: 12 | inputs: 13 | kernel_source: 14 | description: "Select the kernel source" 15 | required: false 16 | default: "unifreq" 17 | type: choice 18 | options: 19 | - unifreq 20 | - ophub 21 | kernel_version: 22 | description: "Select kernel version" 23 | required: false 24 | default: "6.12.y" 25 | type: choice 26 | options: 27 | - 5.10.y 28 | - 5.15.y 29 | - 6.1.y 30 | - 6.6.y 31 | - 6.12.y 32 | kernel_auto: 33 | description: "Auto use the latest kernel" 34 | required: false 35 | default: true 36 | type: boolean 37 | kernel_package: 38 | description: "Select compile package list" 39 | required: false 40 | default: "all" 41 | type: choice 42 | options: 43 | - all 44 | - dtbs 45 | kernel_config: 46 | description: "Set the path of kernel .config" 47 | required: false 48 | default: "kernel-config/release/stable" 49 | type: choice 50 | options: 51 | - kernel-config/release/stable 52 | - false 53 | kernel_patch: 54 | description: "Set the directory for kernel patches" 55 | required: false 56 | default: "kernel-patch/beta" 57 | type: choice 58 | options: 59 | - kernel-patch/beta 60 | - false 61 | auto_patch: 62 | description: "Set whether to use kernel patches" 63 | required: false 64 | default: "true" 65 | type: choice 66 | options: 67 | - true 68 | - false 69 | kernel_toolchain: 70 | description: "Select the compilation toolchain" 71 | required: false 72 | default: "gcc" 73 | type: choice 74 | options: 75 | - clang 76 | - gcc 77 | - gcc-14.2 78 | - gcc-14.3 79 | ccache_clear: 80 | description: "Set whether to clear the cache" 81 | required: false 82 | default: false 83 | type: boolean 84 | docker_image: 85 | description: "Select Armbian docker image" 86 | required: false 87 | default: "trixie" 88 | type: choice 89 | options: 90 | - trixie 91 | - bookworm 92 | - noble 93 | - jammy 94 | 95 | env: 96 | TZ: Etc/UTC 97 | 98 | jobs: 99 | build: 100 | runs-on: ubuntu-24.04-arm 101 | if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }} 102 | 103 | steps: 104 | - name: Checkout 105 | uses: actions/checkout@v6 106 | 107 | - name: Initialization environment 108 | id: init 109 | env: 110 | DEBIAN_FRONTEND: noninteractive 111 | run: | 112 | docker rmi -f $(docker images -q) 2>/dev/null || true 113 | [[ -n "${AGENT_TOOLSDIRECTORY}" ]] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}" 114 | sudo rm -rf /usr/share/dotnet /usr/local/lib/android 2>/dev/null 115 | sudo swapoff -a 116 | sudo rm -f /swapfile /mnt/swapfile 117 | sudo -E apt-get -y update 118 | sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true 119 | sudo -E apt-get -y install $(curl -fsSL https://ophub.org/ubuntu2404-build-armbian-depends) 120 | sudo -E systemctl daemon-reload 121 | #sudo -E apt-get -y full-upgrade 122 | sudo -E apt-get -y autoremove --purge 123 | sudo -E apt-get clean 124 | sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile} 125 | sudo rm -rf ~/{.cargo,.dotnet,.rustup} 126 | sudo -E timedatectl set-timezone "${TZ:-Etc/UTC}" 127 | sudo -E ntpdate ntp.ubuntu.com 0.pool.ntp.org || true 128 | sudo -E timedatectl set-ntp true 129 | date -u 130 | timedatectl status || true 131 | echo "status=success" >> ${GITHUB_OUTPUT} 132 | 133 | - name: Create simulated physical disk 134 | id: disk 135 | run: | 136 | mnt_size=$(expr $(df -h /mnt | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 1) 137 | root_size=$(expr $(df -h / | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 4) 138 | sudo truncate -s "${mnt_size}"G /mnt/mnt.img 139 | sudo truncate -s "${root_size}"G /root.img 140 | sudo losetup /dev/loop6 /mnt/mnt.img 141 | sudo losetup /dev/loop7 /root.img 142 | sudo pvcreate /dev/loop6 143 | sudo pvcreate /dev/loop7 144 | sudo vgcreate github /dev/loop6 /dev/loop7 145 | sudo lvcreate -n runner -l 100%FREE github 146 | sudo mkfs.xfs -f -i sparse=0 -b size=4096 /dev/github/runner 147 | sudo mkdir -p /builder 148 | sudo mount /dev/github/runner /builder 149 | sudo chown -R runner:runner /builder 150 | df -Th 151 | echo "status=success" >> ${GITHUB_OUTPUT} 152 | 153 | - name: Install Docker 154 | id: install 155 | working-directory: /builder 156 | if: ${{ steps.disk.outputs.status }} == 'success' && !cancelled() 157 | run: | 158 | df -hT ${PWD} 159 | curl -fsSL https://get.docker.com | sh 160 | sudo usermod -aG docker $USER 161 | sudo newgrp docker 162 | echo "status=success" >> ${GITHUB_OUTPUT} 163 | 164 | - name: Pull Docker Image [ ${{ inputs.docker_image }} ] 165 | id: pull 166 | working-directory: /builder 167 | if: ${{ steps.install.outputs.status }} == 'success' && !cancelled() 168 | run: | 169 | # Create a docker mapping directory 170 | mkdir -p /builder/{compile-kernel/{kernel,output},ccache} 171 | ln -sf /builder/compile-kernel/kernel /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/kernel 172 | ln -sf /builder/compile-kernel/output /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/output 173 | 174 | # Pull the Armbian Docker image 175 | docker run -d --privileged \ 176 | --name armbian-ophub \ 177 | -v /builder/compile-kernel:/opt/kernel/compile-kernel \ 178 | -v /builder/ccache:/root/.ccache \ 179 | -v /etc/localtime:/etc/localtime:ro \ 180 | -v /etc/timezone:/etc/timezone:ro \ 181 | -e CCACHE_DIR=/root/.ccache \ 182 | --restart=always \ 183 | ophub/armbian-${{ inputs.docker_image }}:arm64 184 | 185 | echo "status=success" >> ${GITHUB_OUTPUT} 186 | 187 | - name: Get kernel source hash 188 | id: kernelhash 189 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 190 | run: | 191 | # Get the latest source hash from the kernel repository 192 | api_url="https://api.github.com/repos/${{ inputs.kernel_source }}/linux-${{ inputs.kernel_version }}/git/ref/heads/main" 193 | source_hash=$(curl -fsSL -m 20 \ 194 | -H "Accept: application/vnd.github+json" \ 195 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ 196 | ${api_url} | 197 | jq -r '.object.sha' 198 | ) 199 | [[ -z "${source_hash}" || "${source_hash}" == "null" ]] && source_hash="${{ github.sha }}" 200 | echo "source_hash=${source_hash}" >> ${GITHUB_ENV} 201 | echo "status=success" >> ${GITHUB_OUTPUT} 202 | 203 | - name: Cache ccache 204 | uses: actions/cache@v4 205 | with: 206 | path: /builder/ccache 207 | key: kernel-mainline-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}-${{ env.source_hash }} 208 | restore-keys: | 209 | kernel-mainline-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}- 210 | 211 | - name: Compile the kernel [ ${{ inputs.kernel_version }} ] 212 | uses: ophub/amlogic-s9xxx-armbian@main 213 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 214 | with: 215 | build_target: kernel 216 | kernel_source: ${{ inputs.kernel_source }} 217 | kernel_version: ${{ inputs.kernel_version }} 218 | kernel_auto: ${{ inputs.kernel_auto }} 219 | kernel_package: ${{ inputs.kernel_package }} 220 | kernel_toolchain: ${{ inputs.kernel_toolchain }} 221 | kernel_config: ${{ inputs.kernel_config }} 222 | kernel_patch: ${{ inputs.kernel_patch }} 223 | auto_patch: ${{ inputs.auto_patch }} 224 | ccache_clear: ${{ inputs.ccache_clear }} 225 | kernel_sign: -beta 226 | delete_source: true 227 | 228 | - name: Upload Kernel to Release 229 | uses: ncipollo/release-action@main 230 | if: ${{ env.PACKAGED_STATUS }} == 'success' && !cancelled() 231 | with: 232 | tag: kernel_beta 233 | artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/* 234 | allowUpdates: true 235 | removeArtifacts: false 236 | replacesArtifacts: true 237 | makeLatest: true 238 | token: ${{ secrets.GITHUB_TOKEN }} 239 | body: | 240 | - This is a beta kernel intended only for specific testing purposes. Do not use it unless you know what you are doing. 241 | - 这是`测试版`内核,仅用于特定需求的测试,不知情勿用。 242 | -------------------------------------------------------------------------------- /kernel-patch/beta/linux-5.10.y/101-arm64-add-text_offset.patch: -------------------------------------------------------------------------------- 1 | From d1aeee50b5d43042c7c71ec101953349e350f3cf Mon Sep 17 00:00:00 2001 2 | From: xxxxx <67037522+xxxxx@users.noreply.github.com> 3 | Date: Sun, 23 Apr 2023 02:02:44 +0000 4 | Subject: [PATCH] Add text_offset 5 | 6 | --- 7 | arch/arm64/Makefile | 5 +++++ 8 | arch/arm64/include/asm/boot.h | 3 ++- 9 | arch/arm64/include/asm/kernel-pgtable.h | 2 +- 10 | arch/arm64/include/asm/memory.h | 2 +- 11 | arch/arm64/kernel/Makefile | 3 +++ 12 | arch/arm64/kernel/head.S | 10 +++++----- 13 | arch/arm64/kernel/image.h | 1 + 14 | arch/arm64/kernel/setup.c | 3 --- 15 | arch/arm64/kernel/vmlinux.lds.S | 4 ++-- 16 | drivers/firmware/efi/libstub/Makefile | 1 + 17 | drivers/firmware/efi/libstub/arm64-stub.c | 6 +++--- 18 | 11 files changed, 24 insertions(+), 16 deletions(-) 19 | 20 | diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile 21 | index 96dcddc358..4abbcdc974 100644 22 | --- a/arch/arm64/Makefile 23 | +++ b/arch/arm64/Makefile 24 | @@ -11,6 +11,7 @@ 25 | # Copyright (C) 1995-2001 by Russell King 26 | 27 | LDFLAGS_vmlinux :=--no-undefined -X --pic-veneer 28 | +CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 29 | 30 | ifeq ($(CONFIG_RELOCATABLE), y) 31 | # Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour 32 | @@ -134,6 +135,10 @@ endif 33 | # Default value 34 | head-y := arch/arm64/kernel/head.o 35 | 36 | +# The byte offset of the kernel image in RAM from the start of RAM. 37 | +TEXT_OFFSET := 0x01080000 38 | +export TEXT_OFFSET 39 | + 40 | ifeq ($(CONFIG_KASAN_SW_TAGS), y) 41 | KASAN_SHADOW_SCALE_SHIFT := 4 42 | else 43 | diff --git a/arch/arm64/include/asm/boot.h b/arch/arm64/include/asm/boot.h 44 | index 3e7943fd17..c7f67da13c 100644 45 | --- a/arch/arm64/include/asm/boot.h 46 | +++ b/arch/arm64/include/asm/boot.h 47 | @@ -13,7 +13,8 @@ 48 | #define MAX_FDT_SIZE SZ_2M 49 | 50 | /* 51 | - * arm64 requires the kernel image to placed at a 2 MB aligned base address 52 | + * arm64 requires the kernel image to placed 53 | + * TEXT_OFFSET bytes beyond a 2 MB aligned base 54 | */ 55 | #define MIN_KIMG_ALIGN SZ_2M 56 | 57 | diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h 58 | index 4b06cf9a8c..8aa453127a 100644 59 | --- a/arch/arm64/include/asm/kernel-pgtable.h 60 | +++ b/arch/arm64/include/asm/kernel-pgtable.h 61 | @@ -86,7 +86,7 @@ 62 | + EARLY_PGDS((vstart), (vend)) /* each PGDIR needs a next level page table */ \ 63 | + EARLY_PUDS((vstart), (vend)) /* each PUD needs a next level page table */ \ 64 | + EARLY_PMDS((vstart), (vend))) /* each PMD needs a next level page table */ 65 | -#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end)) 66 | +#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR + TEXT_OFFSET, _end)) 67 | #define IDMAP_DIR_SIZE (IDMAP_PGTABLE_LEVELS * PAGE_SIZE) 68 | 69 | /* Initial memory map size */ 70 | diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h 71 | index 505bdd75b5..ebc750ca8e 100644 72 | --- a/arch/arm64/include/asm/memory.h 73 | +++ b/arch/arm64/include/asm/memory.h 74 | @@ -173,7 +173,7 @@ extern s64 memstart_addr; 75 | /* PHYS_OFFSET - the physical address of the start of memory. */ 76 | #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; }) 77 | 78 | -/* the virtual base of the kernel image */ 79 | +/* the virtual base of the kernel image (minus TEXT_OFFSET) */ 80 | extern u64 kimage_vaddr; 81 | 82 | /* the offset between the kernel virtual and physical mappings */ 83 | diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile 84 | index bbaf0bc4ad..8ac70422a0 100644 85 | --- a/arch/arm64/kernel/Makefile 86 | +++ b/arch/arm64/kernel/Makefile 87 | @@ -3,6 +3,9 @@ 88 | # Makefile for the linux kernel. 89 | # 90 | 91 | + 92 | +CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) 93 | +AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 94 | CFLAGS_armv8_deprecated.o := -I$(src) 95 | 96 | CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) 97 | diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S 98 | index 351ee64c7d..834030aa6c 100644 99 | --- a/arch/arm64/kernel/head.S 100 | +++ b/arch/arm64/kernel/head.S 101 | @@ -36,7 +36,7 @@ 102 | 103 | #include "efi-header.S" 104 | 105 | -#define __PHYS_OFFSET KERNEL_START 106 | +#define __PHYS_OFFSET (KERNEL_START - TEXT_OFFSET) 107 | 108 | #if (PAGE_OFFSET & 0x1fffff) != 0 109 | #error PAGE_OFFSET must be at least 2MB aligned 110 | @@ -51,7 +51,7 @@ 111 | * x0 = physical address to the FDT blob. 112 | * 113 | * This code is mostly position independent so you call this at 114 | - * __pa(PAGE_OFFSET). 115 | + * __pa(PAGE_OFFSET + TEXT_OFFSET). 116 | * 117 | * Note that the callee-saved registers are used for storing variables 118 | * that are useful before the MMU is enabled. The allocations are described 119 | @@ -73,7 +73,7 @@ _head: 120 | b primary_entry // branch to kernel start, magic 121 | .long 0 // reserved 122 | #endif 123 | - .quad 0 // Image load offset from start of RAM, little-endian 124 | + le64sym _kernel_offset_le // Image load offset from start of RAM, little-endian 125 | le64sym _kernel_size_le // Effective size of kernel image, little-endian 126 | le64sym _kernel_flags_le // Informative flags, little-endian 127 | .quad 0 // reserved 128 | @@ -379,7 +379,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables) 129 | * Map the kernel image (starting with PHYS_OFFSET). 130 | */ 131 | adrp x0, init_pg_dir 132 | - mov_q x5, KIMAGE_VADDR // compile time __va(_text) 133 | + mov_q x5, KIMAGE_VADDR + TEXT_OFFSET // compile time __va(_text) 134 | add x5, x5, x23 // add KASLR displacement 135 | mov x4, PTRS_PER_PGD 136 | adrp x6, _end // runtime __pa(_end) 137 | @@ -471,7 +471,7 @@ SYM_FUNC_END(__primary_switched) 138 | 139 | .pushsection ".rodata", "a" 140 | SYM_DATA_START(kimage_vaddr) 141 | - .quad _text 142 | + .quad _text - TEXT_OFFSET 143 | SYM_DATA_END(kimage_vaddr) 144 | EXPORT_SYMBOL(kimage_vaddr) 145 | .popsection 146 | diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h 147 | index 7bc3ba8979..c7d38c6603 100644 148 | --- a/arch/arm64/kernel/image.h 149 | +++ b/arch/arm64/kernel/image.h 150 | @@ -62,6 +62,7 @@ 151 | */ 152 | #define HEAD_SYMBOLS \ 153 | DEFINE_IMAGE_LE64(_kernel_size_le, _end - _text); \ 154 | + DEFINE_IMAGE_LE64(_kernel_offset_le, TEXT_OFFSET); \ 155 | DEFINE_IMAGE_LE64(_kernel_flags_le, __HEAD_FLAGS); 156 | 157 | #endif /* __ARM64_KERNEL_IMAGE_H */ 158 | diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c 159 | index eb4b24652c..3dbfbac471 100644 160 | --- a/arch/arm64/kernel/setup.c 161 | +++ b/arch/arm64/kernel/setup.c 162 | @@ -325,9 +325,6 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) 163 | xen_early_init(); 164 | efi_init(); 165 | 166 | - if (!efi_enabled(EFI_BOOT) && ((u64)_text % MIN_KIMG_ALIGN) != 0) 167 | - pr_warn(FW_BUG "Kernel image misaligned at boot, please fix your bootloader!"); 168 | - 169 | arm64_memblock_init(); 170 | 171 | paging_init(); 172 | diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S 173 | index 44c6dece97..4b1b1b4ca9 100644 174 | --- a/arch/arm64/kernel/vmlinux.lds.S 175 | +++ b/arch/arm64/kernel/vmlinux.lds.S 176 | @@ -116,7 +116,7 @@ SECTIONS 177 | *(.ARM.attributes) 178 | } 179 | 180 | - . = KIMAGE_VADDR; 181 | + . = KIMAGE_VADDR + TEXT_OFFSET; 182 | 183 | .head.text : { 184 | _text = .; 185 | @@ -306,4 +306,4 @@ ASSERT((__entry_tramp_text_end - __entry_tramp_text_start) <= 3*PAGE_SIZE, 186 | /* 187 | * If padding is applied before .head.text, virt<->phys conversions will fail. 188 | */ 189 | -ASSERT(_text == KIMAGE_VADDR, "HEAD is misaligned") 190 | +ASSERT(_text == (KIMAGE_VADDR + TEXT_OFFSET), "HEAD is misaligned") 191 | diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile 192 | index d7bcfe0d50..fe0978778d 100644 193 | --- a/drivers/firmware/efi/libstub/Makefile 194 | +++ b/drivers/firmware/efi/libstub/Makefile 195 | @@ -76,6 +76,7 @@ lib-$(CONFIG_ARM64) += arm64-stub.o 196 | lib-$(CONFIG_X86) += x86-stub.o 197 | lib-$(CONFIG_RISCV) += riscv-stub.o 198 | CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 199 | +CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 200 | 201 | # Even when -mbranch-protection=none is set, Clang will generate a 202 | # .note.gnu.property for code-less object files (like lib/ctype.c), 203 | diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c 204 | index 7f4bafcd9d..ac51ff5288 100644 205 | --- a/drivers/firmware/efi/libstub/arm64-stub.c 206 | +++ b/drivers/firmware/efi/libstub/arm64-stub.c 207 | @@ -125,7 +125,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 208 | 209 | kernel_size = _edata - _text; 210 | kernel_memsize = kernel_size + (_end - _edata); 211 | - *reserve_size = kernel_memsize; 212 | + *reserve_size = kernel_memsize + TEXT_OFFSET % min_kimg_align; 213 | 214 | if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && phys_seed != 0) { 215 | /* 216 | @@ -141,7 +141,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 217 | if (status != EFI_SUCCESS) { 218 | if (!check_image_region((u64)_text, kernel_memsize)) { 219 | efi_err("FIRMWARE BUG: Image BSS overlaps adjacent EFI memory region\n"); 220 | - } else if (IS_ALIGNED((u64)_text, min_kimg_align)) { 221 | + } else if (IS_ALIGNED((u64)_text - TEXT_OFFSET, min_kimg_align)) { 222 | /* 223 | * Just execute from wherever we were loaded by the 224 | * UEFI PE/COFF loader if the alignment is suitable. 225 | @@ -161,7 +161,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 226 | } 227 | } 228 | 229 | - *image_addr = *reserve_addr; 230 | + *image_addr = *reserve_addr + TEXT_OFFSET % min_kimg_align; 231 | memcpy((void *)*image_addr, _text, kernel_size); 232 | 233 | return EFI_SUCCESS; 234 | -------------------------------------------------------------------------------- /.github/workflows/compile-allwinner-h6-kernel.yml: -------------------------------------------------------------------------------- 1 | #========================================================================== 2 | # Description: Compile allwinner h6 kernel 3 | # Copyright (C) 2023 https://github.com/13584452567 4 | # Copyright (C) 2023 https://github.com/ophub/kernel 5 | #========================================================================== 6 | 7 | name: Compile allwinner h6 kernel 8 | 9 | on: 10 | repository_dispatch: 11 | workflow_dispatch: 12 | inputs: 13 | kernel_source: 14 | description: "Select the kernel source" 15 | required: false 16 | default: "ophub/linux-h6-6.6.y" 17 | type: choice 18 | options: 19 | - 13584452567/linux-6.6.y 20 | - ophub/linux-h6-6.6.y 21 | kernel_version: 22 | description: "Select kernel version" 23 | required: false 24 | default: "6.6.y" 25 | type: choice 26 | options: 27 | - 6.6.y 28 | kernel_auto: 29 | description: "Auto use the latest kernel" 30 | required: false 31 | default: true 32 | type: boolean 33 | delete_source: 34 | description: "Delete source after compilation" 35 | required: false 36 | default: true 37 | type: boolean 38 | kernel_package: 39 | description: "Select compile package list" 40 | required: false 41 | default: "all" 42 | type: choice 43 | options: 44 | - all 45 | - dtbs 46 | kernel_toolchain: 47 | description: "Select the compilation toolchain" 48 | required: false 49 | default: "gcc" 50 | type: choice 51 | options: 52 | - clang 53 | - gcc 54 | - gcc-14.2 55 | - gcc-14.3 56 | ccache_clear: 57 | description: "Set whether to clear the cache" 58 | required: false 59 | default: false 60 | type: boolean 61 | docker_image: 62 | description: "Select Armbian docker image" 63 | required: false 64 | default: "trixie" 65 | type: choice 66 | options: 67 | - trixie 68 | - bookworm 69 | - noble 70 | - jammy 71 | kernel_sign: 72 | description: "Set the kernel custom signature" 73 | required: false 74 | default: "-zicai" 75 | type: choice 76 | options: 77 | - -zicai 78 | - -ophub 79 | - -happy-new-year 80 | - -dragon-boat-festival 81 | - -mid-autumn-festival 82 | - -happy-national-day 83 | - -merry-christmas 84 | - -spring-plowing 85 | - -summer-growing 86 | - -autumn-harvesting 87 | - -winter-storing 88 | - -yourname 89 | kernel_config: 90 | description: "Set the path of kernel .config" 91 | required: false 92 | default: "kernel-config/release/h6" 93 | type: choice 94 | options: 95 | - kernel-config/release/h6 96 | - false 97 | 98 | env: 99 | TZ: Etc/UTC 100 | 101 | jobs: 102 | build: 103 | runs-on: ubuntu-24.04-arm 104 | if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }} 105 | 106 | steps: 107 | - name: Checkout 108 | uses: actions/checkout@v6 109 | 110 | - name: Initialization environment 111 | id: init 112 | env: 113 | DEBIAN_FRONTEND: noninteractive 114 | run: | 115 | docker rmi -f $(docker images -q) 2>/dev/null || true 116 | [[ -n "${AGENT_TOOLSDIRECTORY}" ]] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}" 117 | sudo rm -rf /usr/share/dotnet /usr/local/lib/android 2>/dev/null 118 | sudo swapoff -a 119 | sudo rm -f /swapfile /mnt/swapfile 120 | sudo -E apt-get -y update 121 | sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true 122 | sudo -E apt-get -y install $(curl -fsSL https://ophub.org/ubuntu2404-build-armbian-depends) 123 | sudo -E systemctl daemon-reload 124 | #sudo -E apt-get -y full-upgrade 125 | sudo -E apt-get -y autoremove --purge 126 | sudo -E apt-get clean 127 | sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile} 128 | sudo rm -rf ~/{.cargo,.dotnet,.rustup} 129 | sudo -E timedatectl set-timezone "${TZ:-Etc/UTC}" 130 | sudo -E ntpdate ntp.ubuntu.com 0.pool.ntp.org || true 131 | sudo -E timedatectl set-ntp true 132 | date -u 133 | timedatectl status || true 134 | echo "status=success" >> ${GITHUB_OUTPUT} 135 | 136 | - name: Create simulated physical disk 137 | id: disk 138 | run: | 139 | mnt_size=$(expr $(df -h /mnt | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 1) 140 | root_size=$(expr $(df -h / | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 4) 141 | sudo truncate -s "${mnt_size}"G /mnt/mnt.img 142 | sudo truncate -s "${root_size}"G /root.img 143 | sudo losetup /dev/loop6 /mnt/mnt.img 144 | sudo losetup /dev/loop7 /root.img 145 | sudo pvcreate /dev/loop6 146 | sudo pvcreate /dev/loop7 147 | sudo vgcreate github /dev/loop6 /dev/loop7 148 | sudo lvcreate -n runner -l 100%FREE github 149 | sudo mkfs.xfs -f -i sparse=0 -b size=4096 /dev/github/runner 150 | sudo mkdir -p /builder 151 | sudo mount /dev/github/runner /builder 152 | sudo chown -R runner:runner /builder 153 | df -Th 154 | echo "status=success" >> ${GITHUB_OUTPUT} 155 | 156 | - name: Install Docker 157 | id: install 158 | working-directory: /builder 159 | if: ${{ steps.disk.outputs.status }} == 'success' && !cancelled() 160 | run: | 161 | df -hT ${PWD} 162 | curl -fsSL https://get.docker.com | sh 163 | sudo usermod -aG docker $USER 164 | sudo newgrp docker 165 | echo "status=success" >> ${GITHUB_OUTPUT} 166 | 167 | - name: Pull Docker Image [ ${{ inputs.docker_image }} ] 168 | id: pull 169 | working-directory: /builder 170 | if: ${{ steps.install.outputs.status }} == 'success' && !cancelled() 171 | run: | 172 | # Create a docker mapping directory 173 | mkdir -p /builder/{compile-kernel/{kernel,output},ccache} 174 | ln -sf /builder/compile-kernel/kernel /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/kernel 175 | ln -sf /builder/compile-kernel/output /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/output 176 | 177 | # Pull the Armbian Docker image 178 | docker run -d --privileged \ 179 | --name armbian-ophub \ 180 | -v /builder/compile-kernel:/opt/kernel/compile-kernel \ 181 | -v /builder/ccache:/root/.ccache \ 182 | -v /etc/localtime:/etc/localtime:ro \ 183 | -v /etc/timezone:/etc/timezone:ro \ 184 | -e CCACHE_DIR=/root/.ccache \ 185 | --restart=always \ 186 | ophub/armbian-${{ inputs.docker_image }}:arm64 187 | 188 | echo "status=success" >> ${GITHUB_OUTPUT} 189 | 190 | - name: Get kernel source hash 191 | id: kernelhash 192 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 193 | run: | 194 | # Get the latest source hash from the kernel repository 195 | api_url="https://api.github.com/repos/${{ inputs.kernel_source }}/git/ref/heads/main" 196 | source_hash=$(curl -fsSL -m 20 \ 197 | -H "Accept: application/vnd.github+json" \ 198 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ 199 | ${api_url} | 200 | jq -r '.object.sha' 201 | ) 202 | [[ -z "${source_hash}" || "${source_hash}" == "null" ]] && source_hash="${{ github.sha }}" 203 | echo "source_hash=${source_hash}" >> ${GITHUB_ENV} 204 | echo "status=success" >> ${GITHUB_OUTPUT} 205 | 206 | - name: Cache ccache 207 | uses: actions/cache@v4 208 | with: 209 | path: /builder/ccache 210 | key: kernel-h6-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}-${{ env.source_hash }} 211 | restore-keys: | 212 | kernel-h6-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}- 213 | 214 | - name: Compile the kernel [ ${{ inputs.kernel_version }} ] 215 | uses: ophub/amlogic-s9xxx-armbian@main 216 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 217 | with: 218 | build_target: kernel 219 | kernel_source: ${{ inputs.kernel_source }} 220 | kernel_version: ${{ inputs.kernel_version }} 221 | kernel_auto: ${{ inputs.kernel_auto }} 222 | delete_source: ${{ inputs.delete_source }} 223 | kernel_package: ${{ inputs.kernel_package }} 224 | kernel_toolchain: ${{ inputs.kernel_toolchain }} 225 | kernel_sign: ${{ inputs.kernel_sign }} 226 | kernel_config: ${{ inputs.kernel_config }} 227 | ccache_clear: ${{ inputs.ccache_clear }} 228 | 229 | - name: Upload Kernel to Release 230 | uses: ncipollo/release-action@main 231 | if: ${{ env.PACKAGED_STATUS }} == 'success' && !cancelled() 232 | with: 233 | tag: kernel_h6 234 | artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/* 235 | allowUpdates: true 236 | removeArtifacts: false 237 | replacesArtifacts: true 238 | makeLatest: true 239 | token: ${{ secrets.GITHUB_TOKEN }} 240 | body: | 241 | - These kernels can be used for Armbian and OpenWrt. 242 | - These are dedicated kernels for `Allwinner H6 (TQC-A01)` devices and are not compatible with other series. 243 | - 这些内核可用于 Armbian 和 OpenWrt。 244 | - 这些是 `全志 H6(TQC-A01)` 设备的专用内核,和其他系列不通用。 -------------------------------------------------------------------------------- /.github/workflows/compile-mainline-stable-kernel.yml: -------------------------------------------------------------------------------- 1 | #========================================================================== 2 | # Description: Compile mainline stable kernel 3 | # Copyright (C) 2021 https://github.com/unifreq/openwrt_packit 4 | # Copyright (C) 2021 https://github.com/ophub/kernel 5 | #========================================================================== 6 | 7 | name: Compile mainline stable kernel 8 | 9 | on: 10 | repository_dispatch: 11 | workflow_dispatch: 12 | inputs: 13 | kernel_source: 14 | description: "Select the kernel source" 15 | required: false 16 | default: "unifreq" 17 | type: choice 18 | options: 19 | - unifreq 20 | - ophub 21 | kernel_version: 22 | description: "Select kernel version" 23 | required: false 24 | default: "6.12.y" 25 | type: choice 26 | options: 27 | - 5.10.y 28 | - 5.15.y 29 | - 6.1.y 30 | - 6.6.y 31 | - 6.12.y 32 | kernel_auto: 33 | description: "Auto use the latest kernel" 34 | required: false 35 | default: true 36 | type: boolean 37 | delete_source: 38 | description: "Delete source after compilation" 39 | required: false 40 | default: true 41 | type: boolean 42 | kernel_package: 43 | description: "Select compile package list" 44 | required: false 45 | default: "all" 46 | type: choice 47 | options: 48 | - all 49 | - dtbs 50 | kernel_toolchain: 51 | description: "Select the compilation toolchain" 52 | required: false 53 | default: "gcc" 54 | type: choice 55 | options: 56 | - clang 57 | - gcc 58 | - gcc-14.2 59 | - gcc-14.3 60 | ccache_clear: 61 | description: "Set whether to clear the cache" 62 | required: false 63 | default: false 64 | type: boolean 65 | docker_image: 66 | description: "Select Armbian docker image" 67 | required: false 68 | default: "trixie" 69 | type: choice 70 | options: 71 | - trixie 72 | - bookworm 73 | - noble 74 | - jammy 75 | kernel_sign: 76 | description: "Set the kernel custom signature" 77 | required: false 78 | default: "-ophub" 79 | type: choice 80 | options: 81 | - -ophub 82 | - -happy-new-year 83 | - -dragon-boat-festival 84 | - -mid-autumn-festival 85 | - -happy-national-day 86 | - -merry-christmas 87 | - -spring-plowing 88 | - -summer-growing 89 | - -autumn-harvesting 90 | - -winter-storing 91 | - -yourname 92 | kernel_config: 93 | description: "Set the path of kernel .config" 94 | required: false 95 | default: "kernel-config/release/stable" 96 | type: choice 97 | options: 98 | - kernel-config/release/stable 99 | - false 100 | 101 | env: 102 | TZ: Etc/UTC 103 | 104 | jobs: 105 | build: 106 | runs-on: ubuntu-24.04-arm 107 | if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }} 108 | 109 | steps: 110 | - name: Checkout 111 | uses: actions/checkout@v6 112 | 113 | - name: Initialization environment 114 | id: init 115 | env: 116 | DEBIAN_FRONTEND: noninteractive 117 | run: | 118 | docker rmi -f $(docker images -q) 2>/dev/null || true 119 | [[ -n "${AGENT_TOOLSDIRECTORY}" ]] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}" 120 | sudo rm -rf /usr/share/dotnet /usr/local/lib/android 2>/dev/null 121 | sudo swapoff -a 122 | sudo rm -f /swapfile /mnt/swapfile 123 | sudo -E apt-get -y update 124 | sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true 125 | sudo -E apt-get -y install $(curl -fsSL https://ophub.org/ubuntu2404-build-armbian-depends) 126 | sudo -E systemctl daemon-reload 127 | #sudo -E apt-get -y full-upgrade 128 | sudo -E apt-get -y autoremove --purge 129 | sudo -E apt-get clean 130 | sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile} 131 | sudo rm -rf ~/{.cargo,.dotnet,.rustup} 132 | sudo -E timedatectl set-timezone "${TZ:-Etc/UTC}" 133 | sudo -E ntpdate ntp.ubuntu.com 0.pool.ntp.org || true 134 | sudo -E timedatectl set-ntp true 135 | date -u 136 | timedatectl status || true 137 | echo "status=success" >> ${GITHUB_OUTPUT} 138 | 139 | - name: Create simulated physical disk 140 | id: disk 141 | run: | 142 | mnt_size=$(expr $(df -h /mnt | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 1) 143 | root_size=$(expr $(df -h / | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 4) 144 | sudo truncate -s "${mnt_size}"G /mnt/mnt.img 145 | sudo truncate -s "${root_size}"G /root.img 146 | sudo losetup /dev/loop6 /mnt/mnt.img 147 | sudo losetup /dev/loop7 /root.img 148 | sudo pvcreate /dev/loop6 149 | sudo pvcreate /dev/loop7 150 | sudo vgcreate github /dev/loop6 /dev/loop7 151 | sudo lvcreate -n runner -l 100%FREE github 152 | sudo mkfs.xfs -f -i sparse=0 -b size=4096 /dev/github/runner 153 | sudo mkdir -p /builder 154 | sudo mount /dev/github/runner /builder 155 | sudo chown -R runner:runner /builder 156 | df -Th 157 | echo "status=success" >> ${GITHUB_OUTPUT} 158 | 159 | - name: Install Docker 160 | id: install 161 | working-directory: /builder 162 | if: ${{ steps.disk.outputs.status }} == 'success' && !cancelled() 163 | run: | 164 | df -hT ${PWD} 165 | curl -fsSL https://get.docker.com | sh 166 | sudo usermod -aG docker $USER 167 | sudo newgrp docker 168 | echo "status=success" >> ${GITHUB_OUTPUT} 169 | 170 | - name: Pull Docker Image [ ${{ inputs.docker_image }} ] 171 | id: pull 172 | working-directory: /builder 173 | if: ${{ steps.install.outputs.status }} == 'success' && !cancelled() 174 | run: | 175 | # Create a docker mapping directory 176 | mkdir -p /builder/{compile-kernel/{kernel,output},ccache} 177 | ln -sf /builder/compile-kernel/kernel /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/kernel 178 | ln -sf /builder/compile-kernel/output /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/output 179 | 180 | # Pull the Armbian Docker image 181 | docker run -d --privileged \ 182 | --name armbian-ophub \ 183 | -v /builder/compile-kernel:/opt/kernel/compile-kernel \ 184 | -v /builder/ccache:/root/.ccache \ 185 | -v /etc/localtime:/etc/localtime:ro \ 186 | -v /etc/timezone:/etc/timezone:ro \ 187 | -e CCACHE_DIR=/root/.ccache \ 188 | --restart=always \ 189 | ophub/armbian-${{ inputs.docker_image }}:arm64 190 | 191 | echo "status=success" >> ${GITHUB_OUTPUT} 192 | 193 | - name: Get kernel source hash 194 | id: kernelhash 195 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 196 | run: | 197 | # Get the latest source hash from the kernel repository 198 | api_url="https://api.github.com/repos/${{ inputs.kernel_source }}/linux-${{ inputs.kernel_version }}/git/ref/heads/main" 199 | source_hash=$(curl -fsSL -m 20 \ 200 | -H "Accept: application/vnd.github+json" \ 201 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ 202 | ${api_url} | 203 | jq -r '.object.sha' 204 | ) 205 | [[ -z "${source_hash}" || "${source_hash}" == "null" ]] && source_hash="${{ github.sha }}" 206 | echo "source_hash=${source_hash}" >> ${GITHUB_ENV} 207 | echo "status=success" >> ${GITHUB_OUTPUT} 208 | 209 | - name: Cache ccache 210 | uses: actions/cache@v4 211 | with: 212 | path: /builder/ccache 213 | key: kernel-mainline-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}-${{ env.source_hash }} 214 | restore-keys: | 215 | kernel-mainline-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}- 216 | 217 | - name: Compile the kernel [ ${{ inputs.kernel_version }} ] 218 | uses: ophub/amlogic-s9xxx-armbian@main 219 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 220 | with: 221 | build_target: kernel 222 | kernel_source: ${{ inputs.kernel_source }} 223 | kernel_version: ${{ inputs.kernel_version }} 224 | kernel_auto: ${{ inputs.kernel_auto }} 225 | delete_source: ${{ inputs.delete_source }} 226 | kernel_package: ${{ inputs.kernel_package }} 227 | kernel_toolchain: ${{ inputs.kernel_toolchain }} 228 | kernel_sign: ${{ inputs.kernel_sign }} 229 | kernel_config: ${{ inputs.kernel_config }} 230 | ccache_clear: ${{ inputs.ccache_clear }} 231 | 232 | - name: Upload Kernel to Release 233 | uses: ncipollo/release-action@main 234 | if: ${{ env.PACKAGED_STATUS }} == 'success' && !cancelled() 235 | with: 236 | tag: kernel_stable 237 | artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/* 238 | allowUpdates: true 239 | removeArtifacts: false 240 | replacesArtifacts: true 241 | makeLatest: true 242 | token: ${{ secrets.GITHUB_TOKEN }} 243 | body: | 244 | - These are Mainline `stable` kernels that provide support for Armbian and OpenWrt. 245 | - It works with most `Amlogic`, `Rockchip`, and `Allwinner` devices. For specific details, please refer to the instructions on the homepage of each system's repository. 246 | - 这些是主线稳定内核,为 Armbian 和 OpenWrt 提供支持。 247 | - 适用于 `amlogic`,`rockchip`,`allwinner` 的大部分设备,具体可以参考各系统仓库首页的说明。 248 | -------------------------------------------------------------------------------- /.github/workflows/compile-rockchip-rk3588-kernel.yml: -------------------------------------------------------------------------------- 1 | #========================================================================== 2 | # Description: Compile rockchip rk3588 kernel 3 | # Copyright (C) 2023 https://github.com/unifreq/linux-5.10.y-rk35xx 4 | # Copyright (C) 2023 https://github.com/ophub/kernel 5 | #========================================================================== 6 | 7 | name: Compile rockchip rk3588 kernel 8 | 9 | on: 10 | repository_dispatch: 11 | workflow_dispatch: 12 | inputs: 13 | kernel_source: 14 | description: "Select the kernel source" 15 | required: false 16 | default: "unifreq/linux-6.1.y-rockchip" 17 | type: choice 18 | options: 19 | - unifreq/linux-6.1.y-rockchip 20 | - unifreq/linux-5.10.y-rk35xx 21 | - ophub/linux-6.1.y-rockchip 22 | - armbian/linux-rockchip@rk-6.1-rkr6.1 23 | - armbian/linux-rockchip@rk-6.1-rkr5.1 24 | kernel_version: 25 | description: "Select kernel version" 26 | required: false 27 | default: "6.1.y" 28 | type: choice 29 | options: 30 | - 6.1.y 31 | - 5.10.y 32 | kernel_auto: 33 | description: "Auto use the latest kernel" 34 | required: false 35 | default: true 36 | type: boolean 37 | kernel_package: 38 | description: "Select compile package list" 39 | required: false 40 | default: "all" 41 | type: choice 42 | options: 43 | - all 44 | - dtbs 45 | kernel_toolchain: 46 | description: "Select the compilation toolchain" 47 | required: false 48 | default: "gcc" 49 | type: choice 50 | options: 51 | - gcc 52 | - gcc-14.2 53 | - gcc-14.3 54 | ccache_clear: 55 | description: "Set whether to clear the cache" 56 | required: false 57 | default: false 58 | type: boolean 59 | docker_image: 60 | description: "Select Armbian docker image" 61 | required: false 62 | default: "trixie" 63 | type: choice 64 | options: 65 | - trixie 66 | - bookworm 67 | - noble 68 | - jammy 69 | kernel_sign: 70 | description: "Set the kernel custom signature" 71 | required: false 72 | default: "-rk3588-ophub" 73 | type: choice 74 | options: 75 | - -rk3588-ophub 76 | - -happy-new-year 77 | - -dragon-boat-festival 78 | - -mid-autumn-festival 79 | - -happy-national-day 80 | - -merry-christmas 81 | - -spring-plowing 82 | - -summer-growing 83 | - -autumn-harvesting 84 | - -winter-storing 85 | - -yourname 86 | kernel_config: 87 | description: "Set the path of kernel .config" 88 | required: false 89 | default: "kernel-config/release/rk3588" 90 | type: choice 91 | options: 92 | - kernel-config/release/rk3588 93 | - false 94 | 95 | env: 96 | TZ: Etc/UTC 97 | 98 | jobs: 99 | build: 100 | runs-on: ubuntu-24.04-arm 101 | if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }} 102 | 103 | steps: 104 | - name: Checkout 105 | uses: actions/checkout@v6 106 | 107 | - name: Initialization environment 108 | id: init 109 | env: 110 | DEBIAN_FRONTEND: noninteractive 111 | run: | 112 | docker rmi -f $(docker images -q) 2>/dev/null || true 113 | [[ -n "${AGENT_TOOLSDIRECTORY}" ]] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}" 114 | sudo rm -rf /usr/share/dotnet /usr/local/lib/android 2>/dev/null 115 | sudo swapoff -a 116 | sudo rm -f /swapfile /mnt/swapfile 117 | sudo -E apt-get -y update 118 | sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true 119 | sudo -E apt-get -y install $(curl -fsSL https://ophub.org/ubuntu2404-build-armbian-depends) 120 | sudo -E systemctl daemon-reload 121 | #sudo -E apt-get -y full-upgrade 122 | sudo -E apt-get -y autoremove --purge 123 | sudo -E apt-get clean 124 | sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile} 125 | sudo rm -rf ~/{.cargo,.dotnet,.rustup} 126 | sudo -E timedatectl set-timezone "${TZ:-Etc/UTC}" 127 | sudo -E ntpdate ntp.ubuntu.com 0.pool.ntp.org || true 128 | sudo -E timedatectl set-ntp true 129 | date -u 130 | timedatectl status || true 131 | echo "status=success" >> ${GITHUB_OUTPUT} 132 | 133 | - name: Create simulated physical disk 134 | id: disk 135 | run: | 136 | mnt_size=$(expr $(df -h /mnt | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 1) 137 | root_size=$(expr $(df -h / | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 4) 138 | sudo truncate -s "${mnt_size}"G /mnt/mnt.img 139 | sudo truncate -s "${root_size}"G /root.img 140 | sudo losetup /dev/loop6 /mnt/mnt.img 141 | sudo losetup /dev/loop7 /root.img 142 | sudo pvcreate /dev/loop6 143 | sudo pvcreate /dev/loop7 144 | sudo vgcreate github /dev/loop6 /dev/loop7 145 | sudo lvcreate -n runner -l 100%FREE github 146 | sudo mkfs.xfs -f -i sparse=0 -b size=4096 /dev/github/runner 147 | sudo mkdir -p /builder 148 | sudo mount /dev/github/runner /builder 149 | sudo chown -R runner:runner /builder 150 | df -Th 151 | echo "status=success" >> ${GITHUB_OUTPUT} 152 | 153 | - name: Install Docker 154 | id: install 155 | working-directory: /builder 156 | if: ${{ steps.disk.outputs.status }} == 'success' && !cancelled() 157 | run: | 158 | df -hT ${PWD} 159 | curl -fsSL https://get.docker.com | sh 160 | sudo usermod -aG docker $USER 161 | sudo newgrp docker 162 | echo "status=success" >> ${GITHUB_OUTPUT} 163 | 164 | - name: Pull Docker Image [ ${{ inputs.docker_image }} ] 165 | id: pull 166 | working-directory: /builder 167 | if: ${{ steps.install.outputs.status }} == 'success' && !cancelled() 168 | run: | 169 | # Create a docker mapping directory 170 | mkdir -p /builder/{compile-kernel/{kernel,output},ccache} 171 | ln -sf /builder/compile-kernel/kernel /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/kernel 172 | ln -sf /builder/compile-kernel/output /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/output 173 | 174 | # Pull the Armbian Docker image 175 | docker run -d --privileged \ 176 | --name armbian-ophub \ 177 | -v /builder/compile-kernel:/opt/kernel/compile-kernel \ 178 | -v /builder/ccache:/root/.ccache \ 179 | -v /etc/localtime:/etc/localtime:ro \ 180 | -v /etc/timezone:/etc/timezone:ro \ 181 | -e CCACHE_DIR=/root/.ccache \ 182 | --restart=always \ 183 | ophub/armbian-${{ inputs.docker_image }}:arm64 184 | 185 | echo "status=success" >> ${GITHUB_OUTPUT} 186 | 187 | - name: Get kernel source hash 188 | id: kernelhash 189 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 190 | run: | 191 | # Get the kernel source branch 192 | kernel_source="${{ inputs.kernel_source }}" 193 | [[ "${kernel_source}" =~ @ ]] && kernel_branch="$(echo "${kernel_source}" | awk -F'@' '{print $2}')" || kernel_branch="main" 194 | 195 | # Get the latest source hash from the kernel repository 196 | api_url="https://api.github.com/repos/${{ inputs.kernel_source }}/git/ref/heads/${kernel_branch}" 197 | source_hash=$(curl -fsSL -m 20 \ 198 | -H "Accept: application/vnd.github+json" \ 199 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ 200 | ${api_url} | 201 | jq -r '.object.sha' 202 | ) 203 | [[ -z "${source_hash}" || "${source_hash}" == "null" ]] && source_hash="${{ github.sha }}" 204 | echo "source_hash=${source_hash}" >> ${GITHUB_ENV} 205 | echo "status=success" >> ${GITHUB_OUTPUT} 206 | 207 | - name: Cache ccache 208 | uses: actions/cache@v4 209 | with: 210 | path: /builder/ccache 211 | key: kernel-rk3588-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}-${{ env.source_hash }} 212 | restore-keys: | 213 | kernel-rk3588-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}- 214 | 215 | - name: Compile the kernel [ ${{ inputs.kernel_version }} ] 216 | uses: ophub/amlogic-s9xxx-armbian@main 217 | if: ${{ steps.mapped.outputs.status }} == 'success' && !cancelled() 218 | with: 219 | build_target: kernel 220 | kernel_source: ${{ inputs.kernel_source }} 221 | kernel_version: ${{ inputs.kernel_version }} 222 | kernel_auto: ${{ inputs.kernel_auto }} 223 | kernel_package: ${{ inputs.kernel_package }} 224 | kernel_toolchain: ${{ inputs.kernel_toolchain }} 225 | kernel_sign: ${{ inputs.kernel_sign }} 226 | kernel_config: ${{ inputs.kernel_config }} 227 | ccache_clear: ${{ inputs.ccache_clear }} 228 | 229 | - name: Upload Kernel to Release 230 | uses: ncipollo/release-action@main 231 | if: ${{ env.PACKAGED_STATUS }} == 'success' && !cancelled() 232 | with: 233 | tag: kernel_rk3588 234 | artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/* 235 | allowUpdates: true 236 | removeArtifacts: false 237 | replacesArtifacts: true 238 | makeLatest: true 239 | token: ${{ secrets.GITHUB_TOKEN }} 240 | body: | 241 | - These are dedicated BSP kernels for `Rockchip rk3588` and are not compatible with other series. 242 | - Those with `flippy` in the filename are manually uploaded kernels maintained and shared by [flippy](https://github.com/unifreq), while the others are automatically compiled online. 243 | - 这些是 `Rockchip rk3588` 专用 BSP 内核,和其他系列不通用。 244 | - 其中名字里带有 `flippy` 的是手动上传的由 [flippy](https://github.com/unifreq) 大佬维护制作分享的内核,其他是在线自动编译的。 245 | -------------------------------------------------------------------------------- /.github/workflows/compile-rockchip-rk35xx-kernel.yml: -------------------------------------------------------------------------------- 1 | #========================================================================== 2 | # Description: Compile rockchip rk35xx kernel 3 | # Copyright (C) 2023 https://github.com/unifreq/linux-5.10.y-rk35xx 4 | # Copyright (C) 2023 https://github.com/ophub/kernel 5 | #========================================================================== 6 | 7 | name: Compile rockchip rk35xx kernel 8 | 9 | on: 10 | repository_dispatch: 11 | workflow_dispatch: 12 | inputs: 13 | kernel_source: 14 | description: "Select the kernel source" 15 | required: false 16 | default: "unifreq/linux-6.1.y-rockchip" 17 | type: choice 18 | options: 19 | - unifreq/linux-6.1.y-rockchip 20 | - unifreq/linux-5.10.y-rk35xx 21 | - ophub/linux-6.1.y-rockchip 22 | - armbian/linux-rockchip@rk-6.1-rkr6.1 23 | - armbian/linux-rockchip@rk-6.1-rkr5.1 24 | kernel_version: 25 | description: "Select kernel version" 26 | required: false 27 | default: "6.1.y" 28 | type: choice 29 | options: 30 | - 6.1.y 31 | - 5.10.y 32 | kernel_auto: 33 | description: "Auto use the latest kernel" 34 | required: false 35 | default: true 36 | type: boolean 37 | kernel_package: 38 | description: "Select compile package list" 39 | required: false 40 | default: "all" 41 | type: choice 42 | options: 43 | - all 44 | - dtbs 45 | kernel_toolchain: 46 | description: "Select the compilation toolchain" 47 | required: false 48 | default: "gcc" 49 | type: choice 50 | options: 51 | - gcc 52 | - gcc-14.2 53 | - gcc-14.3 54 | ccache_clear: 55 | description: "Set whether to clear the cache" 56 | required: false 57 | default: false 58 | type: boolean 59 | docker_image: 60 | description: "Select Armbian docker image" 61 | required: false 62 | default: "trixie" 63 | type: choice 64 | options: 65 | - trixie 66 | - bookworm 67 | - noble 68 | - jammy 69 | kernel_sign: 70 | description: "Set the kernel custom signature" 71 | required: false 72 | default: "-rk35xx-ophub" 73 | type: choice 74 | options: 75 | - -rk35xx-ophub 76 | - -happy-new-year 77 | - -dragon-boat-festival 78 | - -mid-autumn-festival 79 | - -happy-national-day 80 | - -merry-christmas 81 | - -spring-plowing 82 | - -summer-growing 83 | - -autumn-harvesting 84 | - -winter-storing 85 | - -yourname 86 | kernel_config: 87 | description: "Set the path of kernel .config" 88 | required: false 89 | default: "kernel-config/release/rk35xx" 90 | type: choice 91 | options: 92 | - kernel-config/release/rk35xx 93 | - false 94 | 95 | env: 96 | TZ: Etc/UTC 97 | 98 | jobs: 99 | build: 100 | runs-on: ubuntu-24.04-arm 101 | if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }} 102 | 103 | steps: 104 | - name: Checkout 105 | uses: actions/checkout@v6 106 | 107 | - name: Initialization environment 108 | id: init 109 | env: 110 | DEBIAN_FRONTEND: noninteractive 111 | run: | 112 | docker rmi -f $(docker images -q) 2>/dev/null || true 113 | [[ -n "${AGENT_TOOLSDIRECTORY}" ]] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}" 114 | sudo rm -rf /usr/share/dotnet /usr/local/lib/android 2>/dev/null 115 | sudo swapoff -a 116 | sudo rm -f /swapfile /mnt/swapfile 117 | sudo -E apt-get -y update 118 | sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true 119 | sudo -E apt-get -y install $(curl -fsSL https://ophub.org/ubuntu2404-build-armbian-depends) 120 | sudo -E systemctl daemon-reload 121 | #sudo -E apt-get -y full-upgrade 122 | sudo -E apt-get -y autoremove --purge 123 | sudo -E apt-get clean 124 | sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile} 125 | sudo rm -rf ~/{.cargo,.dotnet,.rustup} 126 | sudo -E timedatectl set-timezone "${TZ:-Etc/UTC}" 127 | sudo -E ntpdate ntp.ubuntu.com 0.pool.ntp.org || true 128 | sudo -E timedatectl set-ntp true 129 | date -u 130 | timedatectl status || true 131 | echo "status=success" >> ${GITHUB_OUTPUT} 132 | 133 | - name: Create simulated physical disk 134 | id: disk 135 | run: | 136 | mnt_size=$(expr $(df -h /mnt | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 1) 137 | root_size=$(expr $(df -h / | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 4) 138 | sudo truncate -s "${mnt_size}"G /mnt/mnt.img 139 | sudo truncate -s "${root_size}"G /root.img 140 | sudo losetup /dev/loop6 /mnt/mnt.img 141 | sudo losetup /dev/loop7 /root.img 142 | sudo pvcreate /dev/loop6 143 | sudo pvcreate /dev/loop7 144 | sudo vgcreate github /dev/loop6 /dev/loop7 145 | sudo lvcreate -n runner -l 100%FREE github 146 | sudo mkfs.xfs -f -i sparse=0 -b size=4096 /dev/github/runner 147 | sudo mkdir -p /builder 148 | sudo mount /dev/github/runner /builder 149 | sudo chown -R runner:runner /builder 150 | df -Th 151 | echo "status=success" >> ${GITHUB_OUTPUT} 152 | 153 | - name: Install Docker 154 | id: install 155 | working-directory: /builder 156 | if: ${{ steps.disk.outputs.status }} == 'success' && !cancelled() 157 | run: | 158 | df -hT ${PWD} 159 | curl -fsSL https://get.docker.com | sh 160 | sudo usermod -aG docker $USER 161 | sudo newgrp docker 162 | echo "status=success" >> ${GITHUB_OUTPUT} 163 | 164 | - name: Pull Docker Image [ ${{ inputs.docker_image }} ] 165 | id: pull 166 | working-directory: /builder 167 | if: ${{ steps.install.outputs.status }} == 'success' && !cancelled() 168 | run: | 169 | # Create a docker mapping directory 170 | mkdir -p /builder/{compile-kernel/{kernel,output},ccache} 171 | ln -sf /builder/compile-kernel/kernel /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/kernel 172 | ln -sf /builder/compile-kernel/output /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/compile-kernel/output 173 | 174 | # Pull the Armbian Docker image 175 | docker run -d --privileged \ 176 | --name armbian-ophub \ 177 | -v /builder/compile-kernel:/opt/kernel/compile-kernel \ 178 | -v /builder/ccache:/root/.ccache \ 179 | -v /etc/localtime:/etc/localtime:ro \ 180 | -v /etc/timezone:/etc/timezone:ro \ 181 | -e CCACHE_DIR=/root/.ccache \ 182 | --restart=always \ 183 | ophub/armbian-${{ inputs.docker_image }}:arm64 184 | 185 | echo "status=success" >> ${GITHUB_OUTPUT} 186 | 187 | - name: Get kernel source hash 188 | id: kernelhash 189 | if: ${{ steps.pull.outputs.status }} == 'success' && !cancelled() 190 | run: | 191 | # Get the kernel source branch 192 | kernel_source="${{ inputs.kernel_source }}" 193 | [[ "${kernel_source}" =~ @ ]] && kernel_branch="$(echo "${kernel_source}" | awk -F'@' '{print $2}')" || kernel_branch="main" 194 | 195 | # Get the latest source hash from the kernel repository 196 | api_url="https://api.github.com/repos/${{ inputs.kernel_source }}/git/ref/heads/${kernel_branch}" 197 | source_hash=$(curl -fsSL -m 20 \ 198 | -H "Accept: application/vnd.github+json" \ 199 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ 200 | ${api_url} | 201 | jq -r '.object.sha' 202 | ) 203 | [[ -z "${source_hash}" || "${source_hash}" == "null" ]] && source_hash="${{ github.sha }}" 204 | echo "source_hash=${source_hash}" >> ${GITHUB_ENV} 205 | echo "status=success" >> ${GITHUB_OUTPUT} 206 | 207 | - name: Cache ccache 208 | uses: actions/cache@v4 209 | with: 210 | path: /builder/ccache 211 | key: kernel-rk35xx-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}-${{ env.source_hash }} 212 | restore-keys: | 213 | kernel-rk35xx-${{ inputs.kernel_toolchain }}-${{ inputs.kernel_version }}- 214 | 215 | - name: Compile the kernel [ ${{ inputs.kernel_version }} ] 216 | uses: ophub/amlogic-s9xxx-armbian@main 217 | if: ${{ steps.mapped.outputs.status }} == 'success' && !cancelled() 218 | with: 219 | build_target: kernel 220 | kernel_source: ${{ inputs.kernel_source }} 221 | kernel_version: ${{ inputs.kernel_version }} 222 | kernel_auto: ${{ inputs.kernel_auto }} 223 | kernel_package: ${{ inputs.kernel_package }} 224 | kernel_toolchain: ${{ inputs.kernel_toolchain }} 225 | kernel_sign: ${{ inputs.kernel_sign }} 226 | kernel_config: ${{ inputs.kernel_config }} 227 | ccache_clear: ${{ inputs.ccache_clear }} 228 | 229 | - name: Upload Kernel to Release 230 | uses: ncipollo/release-action@main 231 | if: ${{ env.PACKAGED_STATUS }} == 'success' && !cancelled() 232 | with: 233 | tag: kernel_rk35xx 234 | artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/* 235 | allowUpdates: true 236 | removeArtifacts: false 237 | replacesArtifacts: true 238 | makeLatest: true 239 | token: ${{ secrets.GITHUB_TOKEN }} 240 | body: | 241 | - These are dedicated BSP kernels for `Rockchip rk3528/rk3566/rk3568` and are not compatible with other series. 242 | - Those with `flippy` in the filename are manually uploaded kernels maintained and shared by [flippy](https://github.com/unifreq), while the others are automatically compiled online. 243 | - 这些是 `Rockchip rk3528/rk3566/rk3568` 专用 BSP 内核,和其他系列不通用。 244 | - 其中名字里带有 `flippy` 的是手动上传的由 [flippy](https://github.com/unifreq) 大佬维护制作分享的内核,其他是在线自动编译的。 245 | -------------------------------------------------------------------------------- /kernel-patch/beta/deprecated-patches/6.1.y-101-arm64-add-text_offset.patch: -------------------------------------------------------------------------------- 1 | From 5bebdd36f56da96f08bad5ab34e39bffd3ef872b Mon Sep 17 00:00:00 2001 2 | From: xxxxx <67037522+xxxxx@users.noreply.github.com> 3 | Date: Thu, 7 Mar 2024 11:38:19 +0800 4 | Subject: [PATCH] arm64: Apply the text_offset patch 5 | 6 | --- 7 | arch/arm64/Makefile | 5 +++++ 8 | arch/arm64/include/asm/boot.h | 3 ++- 9 | arch/arm64/include/asm/kernel-pgtable.h | 2 +- 10 | arch/arm64/include/asm/memory.h | 2 +- 11 | arch/arm64/kernel/Makefile | 3 ++- 12 | arch/arm64/kernel/head.S | 22 +++++++++++++++++----- 13 | arch/arm64/kernel/image.h | 1 + 14 | arch/arm64/kernel/setup.c | 3 --- 15 | arch/arm64/kernel/vmlinux.lds.S | 4 ++-- 16 | arch/arm64/mm/mmu.c | 3 --- 17 | drivers/firmware/efi/libstub/Makefile | 1 + 18 | drivers/firmware/efi/libstub/arm64-stub.c | 6 +++--- 19 | 12 files changed, 35 insertions(+), 20 deletions(-) 20 | 21 | diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile 22 | index c9496539c..c86cd9445 100644 23 | --- a/arch/arm64/Makefile 24 | +++ b/arch/arm64/Makefile 25 | @@ -11,6 +11,7 @@ 26 | # Copyright (C) 1995-2001 by Russell King 27 | 28 | LDFLAGS_vmlinux :=--no-undefined -X 29 | +CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 30 | 31 | ifeq ($(CONFIG_RELOCATABLE), y) 32 | # Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour 33 | @@ -133,6 +134,10 @@ ifeq ($(CONFIG_DYNAMIC_FTRACE_WITH_REGS),y) 34 | CC_FLAGS_FTRACE := -fpatchable-function-entry=2 35 | endif 36 | 37 | +# The byte offset of the kernel image in RAM from the start of RAM. 38 | +TEXT_OFFSET := 0x01080000 39 | +export TEXT_OFFSET 40 | + 41 | ifeq ($(CONFIG_KASAN_SW_TAGS), y) 42 | KASAN_SHADOW_SCALE_SHIFT := 4 43 | else ifeq ($(CONFIG_KASAN_GENERIC), y) 44 | diff --git a/arch/arm64/include/asm/boot.h b/arch/arm64/include/asm/boot.h 45 | index 3e7943fd1..c7f67da13 100644 46 | --- a/arch/arm64/include/asm/boot.h 47 | +++ b/arch/arm64/include/asm/boot.h 48 | @@ -13,7 +13,8 @@ 49 | #define MAX_FDT_SIZE SZ_2M 50 | 51 | /* 52 | - * arm64 requires the kernel image to placed at a 2 MB aligned base address 53 | + * arm64 requires the kernel image to placed 54 | + * TEXT_OFFSET bytes beyond a 2 MB aligned base 55 | */ 56 | #define MIN_KIMG_ALIGN SZ_2M 57 | 58 | diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h 59 | index 32d14f481..da22c57b4 100644 60 | --- a/arch/arm64/include/asm/kernel-pgtable.h 61 | +++ b/arch/arm64/include/asm/kernel-pgtable.h 62 | @@ -85,7 +85,7 @@ 63 | + EARLY_PGDS((vstart), (vend), add) /* each PGDIR needs a next level page table */ \ 64 | + EARLY_PUDS((vstart), (vend), add) /* each PUD needs a next level page table */ \ 65 | + EARLY_PMDS((vstart), (vend), add)) /* each PMD needs a next level page table */ 66 | -#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end, EARLY_KASLR)) 67 | +#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR + TEXT_OFFSET, _end, EARLY_KASLR)) 68 | 69 | /* the initial ID map may need two extra pages if it needs to be extended */ 70 | #if VA_BITS < 48 71 | diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h 72 | index 9dd08cd33..4dae5cbfc 100644 73 | --- a/arch/arm64/include/asm/memory.h 74 | +++ b/arch/arm64/include/asm/memory.h 75 | @@ -192,7 +192,7 @@ extern s64 memstart_addr; 76 | /* PHYS_OFFSET - the physical address of the start of memory. */ 77 | #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; }) 78 | 79 | -/* the virtual base of the kernel image */ 80 | +/* the virtual base of the kernel image (minus TEXT_OFFSET) */ 81 | extern u64 kimage_vaddr; 82 | 83 | /* the offset between the kernel virtual and physical mappings */ 84 | diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile 85 | index 2f361a883..fd925c914 100644 86 | --- a/arch/arm64/kernel/Makefile 87 | +++ b/arch/arm64/kernel/Makefile 88 | @@ -2,7 +2,8 @@ 89 | # 90 | # Makefile for the linux kernel. 91 | # 92 | - 93 | +CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) 94 | +AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 95 | CFLAGS_armv8_deprecated.o := -I$(src) 96 | 97 | CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) 98 | diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S 99 | index cdbbc95eb..344282cde 100644 100 | --- a/arch/arm64/kernel/head.S 101 | +++ b/arch/arm64/kernel/head.S 102 | @@ -37,6 +37,8 @@ 103 | 104 | #include "efi-header.S" 105 | 106 | +#define __PHYS_OFFSET (KERNEL_START - TEXT_OFFSET) 107 | + 108 | #if (PAGE_OFFSET & 0x1fffff) != 0 109 | #error PAGE_OFFSET must be at least 2MB aligned 110 | #endif 111 | @@ -49,6 +51,9 @@ 112 | * MMU = off, D-cache = off, I-cache = on or off, 113 | * x0 = physical address to the FDT blob. 114 | * 115 | + * This code is mostly position independent so you call this at 116 | + * __pa(PAGE_OFFSET + TEXT_OFFSET). 117 | + * 118 | * Note that the callee-saved registers are used for storing variables 119 | * that are useful before the MMU is enabled. The allocations are described 120 | * in the entry routines. 121 | @@ -59,7 +64,7 @@ 122 | */ 123 | efi_signature_nop // special NOP to identity as PE/COFF executable 124 | b primary_entry // branch to kernel start, magic 125 | - .quad 0 // Image load offset from start of RAM, little-endian 126 | + le64sym _kernel_offset_le // Image load offset from start of RAM, little-endian 127 | le64sym _kernel_size_le // Effective size of kernel image, little-endian 128 | le64sym _kernel_flags_le // Informative flags, little-endian 129 | .quad 0 // reserved 130 | @@ -370,7 +375,7 @@ SYM_FUNC_END(create_idmap) 131 | 132 | SYM_FUNC_START_LOCAL(create_kernel_mapping) 133 | adrp x0, init_pg_dir 134 | - mov_q x5, KIMAGE_VADDR // compile time __va(_text) 135 | + mov_q x5, KIMAGE_VADDR + TEXT_OFFSET // compile time __va(_text) 136 | #ifdef CONFIG_RELOCATABLE 137 | add x5, x5, x23 // add KASLR displacement 138 | #endif 139 | @@ -415,7 +420,7 @@ SYM_FUNC_END(create_kernel_mapping) 140 | /* 141 | * The following fragment of code is executed with the MMU enabled. 142 | * 143 | - * x0 = __pa(KERNEL_START) 144 | + * x0 = __PHYS_OFFSET 145 | */ 146 | SYM_FUNC_START_LOCAL(__primary_switched) 147 | adr_l x4, init_task 148 | @@ -469,6 +474,13 @@ SYM_FUNC_START_LOCAL(__primary_switched) 149 | ASM_BUG() 150 | SYM_FUNC_END(__primary_switched) 151 | 152 | + .pushsection ".rodata", "a" 153 | + SYM_DATA_START(kimage_vaddr) 154 | + .quad _text - TEXT_OFFSET 155 | + SYM_DATA_END(kimage_vaddr) 156 | + EXPORT_SYMBOL(kimage_vaddr) 157 | + .popsection 158 | + 159 | /* 160 | * end early head section, begin head code that is also used for 161 | * hotplug and needs to have the same protections as the text region 162 | @@ -798,7 +810,7 @@ SYM_FUNC_START_LOCAL(__primary_switch) 163 | adrp x2, init_idmap_pg_dir 164 | bl __enable_mmu 165 | #ifdef CONFIG_RELOCATABLE 166 | - adrp x23, KERNEL_START 167 | + adrp x23, __PHYS_OFFSET 168 | and x23, x23, MIN_KIMG_ALIGN - 1 169 | #ifdef CONFIG_RANDOMIZE_BASE 170 | mov x0, x22 171 | @@ -820,6 +832,6 @@ SYM_FUNC_START_LOCAL(__primary_switch) 172 | bl __relocate_kernel 173 | #endif 174 | ldr x8, =__primary_switched 175 | - adrp x0, KERNEL_START // __pa(KERNEL_START) 176 | + adrp x0, __PHYS_OFFSET 177 | br x8 178 | SYM_FUNC_END(__primary_switch) 179 | diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h 180 | index 7bc3ba897..c7d38c660 100644 181 | --- a/arch/arm64/kernel/image.h 182 | +++ b/arch/arm64/kernel/image.h 183 | @@ -62,6 +62,7 @@ 184 | */ 185 | #define HEAD_SYMBOLS \ 186 | DEFINE_IMAGE_LE64(_kernel_size_le, _end - _text); \ 187 | + DEFINE_IMAGE_LE64(_kernel_offset_le, TEXT_OFFSET); \ 188 | DEFINE_IMAGE_LE64(_kernel_flags_le, __HEAD_FLAGS); 189 | 190 | #endif /* __ARM64_KERNEL_IMAGE_H */ 191 | diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c 192 | index fea322370..25032cbf8 100644 193 | --- a/arch/arm64/kernel/setup.c 194 | +++ b/arch/arm64/kernel/setup.c 195 | @@ -328,9 +328,6 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) 196 | xen_early_init(); 197 | efi_init(); 198 | 199 | - if (!efi_enabled(EFI_BOOT) && ((u64)_text % MIN_KIMG_ALIGN) != 0) 200 | - pr_warn(FW_BUG "Kernel image misaligned at boot, please fix your bootloader!"); 201 | - 202 | arm64_memblock_init(); 203 | 204 | paging_init(); 205 | diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S 206 | index 45131e354..329433fda 100644 207 | --- a/arch/arm64/kernel/vmlinux.lds.S 208 | +++ b/arch/arm64/kernel/vmlinux.lds.S 209 | @@ -151,7 +151,7 @@ SECTIONS 210 | *(.dynsym .dynstr .hash .gnu.hash) 211 | } 212 | 213 | - . = KIMAGE_VADDR; 214 | + . = KIMAGE_VADDR + TEXT_OFFSET; 215 | 216 | .head.text : { 217 | _text = .; 218 | @@ -353,7 +353,7 @@ ASSERT(__hyp_bss_start == __bss_start, "HYP and Host BSS are misaligned") 219 | /* 220 | * If padding is applied before .head.text, virt<->phys conversions will fail. 221 | */ 222 | -ASSERT(_text == KIMAGE_VADDR, "HEAD is misaligned") 223 | +ASSERT(_text == (KIMAGE_VADDR + TEXT_OFFSET), "HEAD is misaligned") 224 | 225 | ASSERT(swapper_pg_dir - reserved_pg_dir == RESERVED_SWAPPER_OFFSET, 226 | "RESERVED_SWAPPER_OFFSET is wrong!") 227 | diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c 228 | index 4b302dbf7..8632e111f 100644 229 | --- a/arch/arm64/mm/mmu.c 230 | +++ b/arch/arm64/mm/mmu.c 231 | @@ -52,9 +52,6 @@ u64 vabits_actual __ro_after_init = VA_BITS_MIN; 232 | EXPORT_SYMBOL(vabits_actual); 233 | #endif 234 | 235 | -u64 kimage_vaddr __ro_after_init = (u64)&_text; 236 | -EXPORT_SYMBOL(kimage_vaddr); 237 | - 238 | u64 kimage_voffset __ro_after_init; 239 | EXPORT_SYMBOL(kimage_voffset); 240 | 241 | diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile 242 | index 473ef1842..8693b17f6 100644 243 | --- a/drivers/firmware/efi/libstub/Makefile 244 | +++ b/drivers/firmware/efi/libstub/Makefile 245 | @@ -89,6 +89,7 @@ lib-$(CONFIG_RISCV) += riscv-stub.o 246 | lib-$(CONFIG_LOONGARCH) += loongarch-stub.o 247 | 248 | CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 249 | +CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 250 | 251 | zboot-obj-$(CONFIG_RISCV) := lib-clz_ctz.o lib-ashldi3.o 252 | lib-$(CONFIG_EFI_ZBOOT) += zboot.o $(zboot-obj-y) 253 | diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c 254 | index 16f15e36f..bc68c9fdc 100644 255 | --- a/drivers/firmware/efi/libstub/arm64-stub.c 256 | +++ b/drivers/firmware/efi/libstub/arm64-stub.c 257 | @@ -172,7 +172,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 258 | 259 | kernel_size = _edata - _text; 260 | kernel_memsize = kernel_size + (_end - _edata); 261 | - *reserve_size = kernel_memsize; 262 | + *reserve_size = kernel_memsize + TEXT_OFFSET % min_kimg_align; 263 | 264 | if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && phys_seed != 0) { 265 | /* 266 | @@ -191,7 +191,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 267 | if (status != EFI_SUCCESS) { 268 | if (!check_image_region((u64)_text, kernel_memsize)) { 269 | efi_err("FIRMWARE BUG: Image BSS overlaps adjacent EFI memory region\n"); 270 | - } else if (IS_ALIGNED((u64)_text, min_kimg_align) && 271 | + } else if (IS_ALIGNED((u64)_text - TEXT_OFFSET, min_kimg_align) && 272 | (u64)_end < EFI_ALLOC_LIMIT) { 273 | /* 274 | * Just execute from wherever we were loaded by the 275 | @@ -213,7 +213,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 276 | } 277 | } 278 | 279 | - *image_addr = *reserve_addr; 280 | + *image_addr = *reserve_addr + TEXT_OFFSET % min_kimg_align;; 281 | memcpy((void *)*image_addr, _text, kernel_size); 282 | 283 | return EFI_SUCCESS; 284 | -------------------------------------------------------------------------------- /kernel-patch/beta/deprecated-patches/6.6.y-101-arm64-add-text_offset.patch: -------------------------------------------------------------------------------- 1 | From f020c3333bea5fe6ab69504ed8f613c190ef9de3 Mon Sep 17 00:00:00 2001 2 | From: codesnas <67037511+codesnas@users.noreply.github.com> 3 | Date: Thu, 1 Feb 2024 22:26:10 +0800 4 | Subject: [PATCH] Add text_offset 5 | 6 | --- 7 | arch/arm64/Makefile | 5 +++++ 8 | arch/arm64/include/asm/boot.h | 3 ++- 9 | arch/arm64/include/asm/kernel-pgtable.h | 2 +- 10 | arch/arm64/include/asm/memory.h | 2 +- 11 | arch/arm64/kernel/Makefile | 3 ++- 12 | arch/arm64/kernel/head.S | 22 +++++++++++++++++----- 13 | arch/arm64/kernel/image.h | 1 + 14 | arch/arm64/kernel/setup.c | 7 ------- 15 | arch/arm64/kernel/vmlinux.lds.S | 4 ++-- 16 | arch/arm64/mm/mmu.c | 3 --- 17 | drivers/firmware/efi/libstub/Makefile | 2 ++ 18 | drivers/firmware/efi/libstub/arm64-stub.c | 4 +++- 19 | drivers/firmware/efi/libstub/kaslr.c | 4 ++-- 20 | 13 files changed, 38 insertions(+), 24 deletions(-) 21 | 22 | diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile 23 | index 26b8c7630..9c93bdca9 100644 24 | --- a/arch/arm64/Makefile 25 | +++ b/arch/arm64/Makefile 26 | @@ -11,6 +11,7 @@ 27 | # Copyright (C) 1995-2001 by Russell King 28 | 29 | LDFLAGS_vmlinux :=--no-undefined -X 30 | +CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 31 | 32 | ifeq ($(CONFIG_RELOCATABLE), y) 33 | # Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour 34 | @@ -134,6 +135,10 @@ else ifeq ($(CONFIG_DYNAMIC_FTRACE_WITH_ARGS),y) 35 | CC_FLAGS_FTRACE := -fpatchable-function-entry=2 36 | endif 37 | 38 | +# The byte offset of the kernel image in RAM from the start of RAM. 39 | +TEXT_OFFSET := 0x01080000 40 | +export TEXT_OFFSET 41 | + 42 | ifeq ($(CONFIG_KASAN_SW_TAGS), y) 43 | KASAN_SHADOW_SCALE_SHIFT := 4 44 | else ifeq ($(CONFIG_KASAN_GENERIC), y) 45 | diff --git a/arch/arm64/include/asm/boot.h b/arch/arm64/include/asm/boot.h 46 | index 3e7943fd1..c7f67da13 100644 47 | --- a/arch/arm64/include/asm/boot.h 48 | +++ b/arch/arm64/include/asm/boot.h 49 | @@ -13,7 +13,8 @@ 50 | #define MAX_FDT_SIZE SZ_2M 51 | 52 | /* 53 | - * arm64 requires the kernel image to placed at a 2 MB aligned base address 54 | + * arm64 requires the kernel image to placed 55 | + * TEXT_OFFSET bytes beyond a 2 MB aligned base 56 | */ 57 | #define MIN_KIMG_ALIGN SZ_2M 58 | 59 | diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h 60 | index 85d26143f..d0333cd63 100644 61 | --- a/arch/arm64/include/asm/kernel-pgtable.h 62 | +++ b/arch/arm64/include/asm/kernel-pgtable.h 63 | @@ -83,7 +83,7 @@ 64 | + EARLY_PGDS((vstart), (vend), add) /* each PGDIR needs a next level page table */ \ 65 | + EARLY_PUDS((vstart), (vend), add) /* each PUD needs a next level page table */ \ 66 | + EARLY_PMDS((vstart), (vend), add)) /* each PMD needs a next level page table */ 67 | -#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR, _end, EARLY_KASLR)) 68 | +#define INIT_DIR_SIZE (PAGE_SIZE * EARLY_PAGES(KIMAGE_VADDR + TEXT_OFFSET, _end, EARLY_KASLR)) 69 | 70 | /* the initial ID map may need two extra pages if it needs to be extended */ 71 | #if VA_BITS < 48 72 | diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h 73 | index fde4186cc..479c5c336 100644 74 | --- a/arch/arm64/include/asm/memory.h 75 | +++ b/arch/arm64/include/asm/memory.h 76 | @@ -193,7 +193,7 @@ extern s64 memstart_addr; 77 | /* PHYS_OFFSET - the physical address of the start of memory. */ 78 | #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; }) 79 | 80 | -/* the virtual base of the kernel image */ 81 | +/* the virtual base of the kernel image (minus TEXT_OFFSET) */ 82 | extern u64 kimage_vaddr; 83 | 84 | /* the offset between the kernel virtual and physical mappings */ 85 | diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile 86 | index d95b3d6b4..449e109cf 100644 87 | --- a/arch/arm64/kernel/Makefile 88 | +++ b/arch/arm64/kernel/Makefile 89 | @@ -2,7 +2,8 @@ 90 | # 91 | # Makefile for the linux kernel. 92 | # 93 | - 94 | +CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET) 95 | +AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 96 | CFLAGS_armv8_deprecated.o := -I$(src) 97 | 98 | CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) 99 | diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S 100 | index 7b236994f..28020aee8 100644 101 | --- a/arch/arm64/kernel/head.S 102 | +++ b/arch/arm64/kernel/head.S 103 | @@ -37,6 +37,8 @@ 104 | 105 | #include "efi-header.S" 106 | 107 | +#define __PHYS_OFFSET (KERNEL_START - TEXT_OFFSET) 108 | + 109 | #if (PAGE_OFFSET & 0x1fffff) != 0 110 | #error PAGE_OFFSET must be at least 2MB aligned 111 | #endif 112 | @@ -49,6 +51,9 @@ 113 | * MMU = off, D-cache = off, I-cache = on or off, 114 | * x0 = physical address to the FDT blob. 115 | * 116 | + * This code is mostly position independent so you call this at 117 | + * __pa(PAGE_OFFSET + TEXT_OFFSET). 118 | + * 119 | * Note that the callee-saved registers are used for storing variables 120 | * that are useful before the MMU is enabled. The allocations are described 121 | * in the entry routines. 122 | @@ -59,7 +64,7 @@ 123 | */ 124 | efi_signature_nop // special NOP to identity as PE/COFF executable 125 | b primary_entry // branch to kernel start, magic 126 | - .quad 0 // Image load offset from start of RAM, little-endian 127 | + le64sym _kernel_offset_le // Image load offset from start of RAM, little-endian 128 | le64sym _kernel_size_le // Effective size of kernel image, little-endian 129 | le64sym _kernel_flags_le // Informative flags, little-endian 130 | .quad 0 // reserved 131 | @@ -422,7 +427,7 @@ SYM_FUNC_END(create_idmap) 132 | 133 | SYM_FUNC_START_LOCAL(create_kernel_mapping) 134 | adrp x0, init_pg_dir 135 | - mov_q x5, KIMAGE_VADDR // compile time __va(_text) 136 | + mov_q x5, KIMAGE_VADDR + TEXT_OFFSET // compile time __va(_text) 137 | #ifdef CONFIG_RELOCATABLE 138 | add x5, x5, x23 // add KASLR displacement 139 | #endif 140 | @@ -467,7 +472,7 @@ SYM_FUNC_END(create_kernel_mapping) 141 | /* 142 | * The following fragment of code is executed with the MMU enabled. 143 | * 144 | - * x0 = __pa(KERNEL_START) 145 | + * x0 = __PHYS_OFFSET 146 | */ 147 | SYM_FUNC_START_LOCAL(__primary_switched) 148 | adr_l x4, init_task 149 | @@ -524,6 +529,13 @@ SYM_FUNC_START_LOCAL(__primary_switched) 150 | ASM_BUG() 151 | SYM_FUNC_END(__primary_switched) 152 | 153 | + .pushsection ".rodata", "a" 154 | + SYM_DATA_START(kimage_vaddr) 155 | + .quad _text - TEXT_OFFSET 156 | + SYM_DATA_END(kimage_vaddr) 157 | + EXPORT_SYMBOL(kimage_vaddr) 158 | + .popsection 159 | + 160 | /* 161 | * end early head section, begin head code that is also used for 162 | * hotplug and needs to have the same protections as the text region 163 | @@ -875,7 +887,7 @@ SYM_FUNC_START_LOCAL(__primary_switch) 164 | adrp x2, init_idmap_pg_dir 165 | bl __enable_mmu 166 | #ifdef CONFIG_RELOCATABLE 167 | - adrp x23, KERNEL_START 168 | + adrp x23, __PHYS_OFFSET 169 | and x23, x23, MIN_KIMG_ALIGN - 1 170 | #ifdef CONFIG_RANDOMIZE_BASE 171 | mov x0, x22 172 | @@ -897,6 +909,6 @@ SYM_FUNC_START_LOCAL(__primary_switch) 173 | bl __relocate_kernel 174 | #endif 175 | ldr x8, =__primary_switched 176 | - adrp x0, KERNEL_START // __pa(KERNEL_START) 177 | + adrp x0, __PHYS_OFFSET 178 | br x8 179 | SYM_FUNC_END(__primary_switch) 180 | diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h 181 | index 7bc3ba897..c7d38c660 100644 182 | --- a/arch/arm64/kernel/image.h 183 | +++ b/arch/arm64/kernel/image.h 184 | @@ -62,6 +62,7 @@ 185 | */ 186 | #define HEAD_SYMBOLS \ 187 | DEFINE_IMAGE_LE64(_kernel_size_le, _end - _text); \ 188 | + DEFINE_IMAGE_LE64(_kernel_offset_le, TEXT_OFFSET); \ 189 | DEFINE_IMAGE_LE64(_kernel_flags_le, __HEAD_FLAGS); 190 | 191 | #endif /* __ARM64_KERNEL_IMAGE_H */ 192 | diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c 193 | index 417a8a86b..a0eb10a25 100644 194 | --- a/arch/arm64/kernel/setup.c 195 | +++ b/arch/arm64/kernel/setup.c 196 | @@ -335,13 +335,6 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) 197 | xen_early_init(); 198 | efi_init(); 199 | 200 | - if (!efi_enabled(EFI_BOOT)) { 201 | - if ((u64)_text % MIN_KIMG_ALIGN) 202 | - pr_warn(FW_BUG "Kernel image misaligned at boot, please fix your bootloader!"); 203 | - WARN_TAINT(mmu_enabled_at_boot, TAINT_FIRMWARE_WORKAROUND, 204 | - FW_BUG "Booted with MMU enabled!"); 205 | - } 206 | - 207 | arm64_memblock_init(); 208 | 209 | paging_init(); 210 | diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S 211 | index 3cd7e76cc..b63529ca9 100644 212 | --- a/arch/arm64/kernel/vmlinux.lds.S 213 | +++ b/arch/arm64/kernel/vmlinux.lds.S 214 | @@ -164,7 +164,7 @@ SECTIONS 215 | *(.dynsym .dynstr .hash .gnu.hash) 216 | } 217 | 218 | - . = KIMAGE_VADDR; 219 | + . = KIMAGE_VADDR + TEXT_OFFSET; 220 | 221 | .head.text : { 222 | _text = .; 223 | @@ -368,7 +368,7 @@ ASSERT(__hyp_bss_start == __bss_start, "HYP and Host BSS are misaligned") 224 | /* 225 | * If padding is applied before .head.text, virt<->phys conversions will fail. 226 | */ 227 | -ASSERT(_text == KIMAGE_VADDR, "HEAD is misaligned") 228 | +ASSERT(_text == (KIMAGE_VADDR + TEXT_OFFSET), "HEAD is misaligned") 229 | 230 | ASSERT(swapper_pg_dir - reserved_pg_dir == RESERVED_SWAPPER_OFFSET, 231 | "RESERVED_SWAPPER_OFFSET is wrong!") 232 | diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c 233 | index 47781bec6..49a49b375 100644 234 | --- a/arch/arm64/mm/mmu.c 235 | +++ b/arch/arm64/mm/mmu.c 236 | @@ -52,9 +52,6 @@ u64 vabits_actual __ro_after_init = VA_BITS_MIN; 237 | EXPORT_SYMBOL(vabits_actual); 238 | #endif 239 | 240 | -u64 kimage_vaddr __ro_after_init = (u64)&_text; 241 | -EXPORT_SYMBOL(kimage_vaddr); 242 | - 243 | u64 kimage_voffset __ro_after_init; 244 | EXPORT_SYMBOL(kimage_voffset); 245 | 246 | diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile 247 | index a1157c2a7..170523e19 100644 248 | --- a/drivers/firmware/efi/libstub/Makefile 249 | +++ b/drivers/firmware/efi/libstub/Makefile 250 | @@ -93,6 +93,8 @@ lib-$(CONFIG_RISCV) += kaslr.o riscv.o riscv-stub.o 251 | lib-$(CONFIG_LOONGARCH) += loongarch.o loongarch-stub.o 252 | 253 | CFLAGS_arm32-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 254 | +CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 255 | +CFLAGS_kaslr.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 256 | 257 | zboot-obj-$(CONFIG_RISCV) := lib-clz_ctz.o lib-ashldi3.o 258 | lib-$(CONFIG_EFI_ZBOOT) += zboot.o $(zboot-obj-y) 259 | diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c 260 | index 452b7ccd3..781680a85 100644 261 | --- a/drivers/firmware/efi/libstub/arm64-stub.c 262 | +++ b/drivers/firmware/efi/libstub/arm64-stub.c 263 | @@ -22,6 +22,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 264 | efi_handle_t image_handle) 265 | { 266 | efi_status_t status; 267 | + u64 min_kimg_align = efi_get_kimg_min_align(); 268 | + 269 | unsigned long kernel_size, kernel_codesize, kernel_memsize; 270 | 271 | if (image->image_base != _text) { 272 | @@ -36,7 +38,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, 273 | kernel_size = _edata - _text; 274 | kernel_codesize = __inittext_end - _text; 275 | kernel_memsize = kernel_size + (_end - _edata); 276 | - *reserve_size = kernel_memsize; 277 | + *reserve_size = kernel_memsize + TEXT_OFFSET % min_kimg_align; 278 | *image_addr = (unsigned long)_text; 279 | 280 | status = efi_kaslr_relocate_kernel(image_addr, 281 | diff --git a/drivers/firmware/efi/libstub/kaslr.c b/drivers/firmware/efi/libstub/kaslr.c 282 | index 62d63f7a2..6e359714a 100644 283 | --- a/drivers/firmware/efi/libstub/kaslr.c 284 | +++ b/drivers/firmware/efi/libstub/kaslr.c 285 | @@ -129,7 +129,7 @@ efi_status_t efi_kaslr_relocate_kernel(unsigned long *image_addr, 286 | if (status != EFI_SUCCESS) { 287 | if (!check_image_region(*image_addr, kernel_memsize)) { 288 | efi_err("FIRMWARE BUG: Image BSS overlaps adjacent EFI memory region\n"); 289 | - } else if (IS_ALIGNED(*image_addr, min_kimg_align) && 290 | + } else if (IS_ALIGNED(*image_addr - TEXT_OFFSET, min_kimg_align) && 291 | (unsigned long)_end < EFI_ALLOC_LIMIT) { 292 | /* 293 | * Just execute from wherever we were loaded by the 294 | @@ -151,7 +151,7 @@ efi_status_t efi_kaslr_relocate_kernel(unsigned long *image_addr, 295 | } 296 | 297 | memcpy((void *)*reserve_addr, (void *)*image_addr, kernel_size); 298 | - *image_addr = *reserve_addr; 299 | + *image_addr = *reserve_addr + TEXT_OFFSET % min_kimg_align;; 300 | efi_icache_sync(*image_addr, *image_addr + kernel_codesize); 301 | efi_remap_image(*image_addr, *reserve_size, kernel_codesize); 302 | 303 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /kernel-patch/beta/linux-5.15.y/301-dts-add-rockchip-rk3399-cdhx-rb30-dtb.patch: -------------------------------------------------------------------------------- 1 | From ca1d980bb838887e89180b609ba33bdddf2f6533 Mon Sep 17 00:00:00 2001 2 | From: xxx <68696949+xxx@users.noreply.github.com> 3 | Date: Wed, 21 May 2025 12:09:17 +0800 4 | Subject: [PATCH] arch: arm64: dts: add cdhx-rb30(rk3399) 5 | 6 | --- 7 | arch/arm64/boot/dts/rockchip/Makefile | 1 + 8 | .../boot/dts/rockchip/rk3399-cdhx-rb30.dts | 750 ++++++++++++++++++ 9 | 2 files changed, 751 insertions(+) 10 | create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-cdhx-rb30.dts 11 | 12 | diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile 13 | index 4a5a18fb56..a37d619f7e 100644 14 | --- a/arch/arm64/boot/dts/rockchip/Makefile 15 | +++ b/arch/arm64/boot/dts/rockchip/Makefile 16 | @@ -40,6 +40,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-lion-haikou.dtb 17 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-orion-r68-meta.dtb 18 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-px5-evb.dtb 19 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-r88.dtb 20 | +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-cdhx-rb30.dtb 21 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-evb.dtb 22 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-ficus.dtb 23 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-firefly.dtb 24 | diff --git a/arch/arm64/boot/dts/rockchip/rk3399-cdhx-rb30.dts b/arch/arm64/boot/dts/rockchip/rk3399-cdhx-rb30.dts 25 | new file mode 100644 26 | index 0000000000..8a670d47d9 27 | --- /dev/null 28 | +++ b/arch/arm64/boot/dts/rockchip/rk3399-cdhx-rb30.dts 29 | @@ -0,0 +1,750 @@ 30 | +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 31 | +/dts-v1/; 32 | + 33 | +#include 34 | +#include 35 | +#include "dt-bindings/input/input.h" 36 | +#include 37 | +#include "rk3399.dtsi" 38 | +#include "rk3399-opp.dtsi" 39 | +// #include "rk3399-t-opp.dtsi" 40 | + 41 | +/ { 42 | + model = "CDHX RB30"; 43 | + compatible = "cdhx,rb30", "rockchip,rk3399"; 44 | + 45 | + aliases { 46 | + ethernet0 = &gmac; 47 | + mmc0 = &sdio0; 48 | + mmc1 = &sdmmc; 49 | + mmc2 = &sdhci; 50 | + }; 51 | + 52 | + chosen { 53 | + stdout-path = "serial2:1500000n8"; 54 | + }; 55 | + 56 | + board_info: board-info { 57 | + compatible = "board-info"; 58 | + pmic-reset = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>; 59 | + }; 60 | + 61 | + clkin_gmac: external-gmac-clock { 62 | + compatible = "fixed-clock"; 63 | + clock-frequency = <125000000>; 64 | + clock-output-names = "clkin_gmac"; 65 | + #clock-cells = <0>; 66 | + }; 67 | + 68 | + gpio-keys { 69 | + compatible = "gpio-keys"; 70 | + autorepeat; 71 | + pinctrl-names = "default"; 72 | + pinctrl-0 = <&pwrbtn>; 73 | + 74 | + key-power { 75 | + debounce-interval = <100>; 76 | + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; // bsp 77 | + label = "GPIO Key Power"; 78 | + linux,code = ; 79 | + wakeup-source; 80 | + }; 81 | + }; 82 | + 83 | + sdio_pwrseq: sdio-pwrseq { 84 | + compatible = "mmc-pwrseq-simple"; 85 | + clocks = <&rk808 1>; 86 | + clock-names = "ext_clock"; 87 | + pinctrl-names = "default"; 88 | + pinctrl-0 = <&wifi_enable_h>; 89 | + reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; // bsp 90 | + }; 91 | + 92 | + vcc12v_dcin: vcc12v-dcin { 93 | + compatible = "regulator-fixed"; 94 | + regulator-name = "vcc12v_dcin"; 95 | + regulator-always-on; 96 | + regulator-boot-on; 97 | + regulator-min-microvolt = <12000000>; 98 | + regulator-max-microvolt = <12000000>; 99 | + }; 100 | + 101 | + vcc_lcd: vcc-lcd { 102 | + compatible = "regulator-fixed"; 103 | + enable-active-high; 104 | + gpio = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>; // bsp 105 | + pinctrl-names = "default"; 106 | + pinctrl-0 = <&vcc_lcd_en>; 107 | + regulator-name = "vcc_lcd"; 108 | + regulator-always-on; 109 | + }; 110 | + 111 | + vccadc_ref: vccadc-ref { 112 | + compatible = "regulator-fixed"; 113 | + regulator-name = "vcc1v8_sys"; 114 | + regulator-always-on; 115 | + regulator-boot-on; 116 | + regulator-min-microvolt = <1800000>; 117 | + regulator-max-microvolt = <1800000>; 118 | + }; 119 | + 120 | + vcc_phy: vcc-phy-regulator { 121 | + compatible = "regulator-fixed"; 122 | + regulator-name = "vcc_phy"; 123 | + regulator-always-on; 124 | + regulator-boot-on; 125 | + }; 126 | + 127 | + vcc_sd: vcc-sd { 128 | + compatible = "regulator-fixed"; 129 | + regulator-name = "vcc_sd"; 130 | + regulator-always-on; 131 | + regulator-boot-on; 132 | + regulator-min-microvolt = <3300000>; 133 | + regulator-max-microvolt = <3300000>; 134 | + vin-supply = <&vcc5v0_sys>; 135 | + }; 136 | + 137 | + vcc3v3_sys: vcc3v3-sys { 138 | + compatible = "regulator-fixed"; 139 | + regulator-name = "vcc3v3_sys"; 140 | + regulator-always-on; 141 | + regulator-boot-on; 142 | + regulator-min-microvolt = <3300000>; 143 | + regulator-max-microvolt = <3300000>; 144 | + vin-supply = <&vcc5v0_sys>; 145 | + }; 146 | + 147 | + vcc5v0_host: vcc5v0-host-regulator { 148 | + compatible = "regulator-fixed"; 149 | + enable-active-high; 150 | + gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>; // bsp 151 | + pinctrl-names = "default"; 152 | + pinctrl-0 = <&vcc5v0_host_en>; 153 | + regulator-name = "vcc5v0_host"; 154 | + regulator-always-on; 155 | + vin-supply = <&vcc5v0_sys>; 156 | + }; 157 | + 158 | + usb2_hub: usb2-hub-en { 159 | + compatible = "regulator-fixed"; 160 | + enable-active-high; 161 | + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; 162 | + pinctrl-names = "default"; 163 | + pinctrl-0 = <&usb2_hub_en>; // bsp 164 | + regulator-name = "usb2_hub"; 165 | + regulator-always-on; 166 | + }; 167 | + 168 | + vcc5v0_sys: vcc5v0-sys { 169 | + compatible = "regulator-fixed"; 170 | + regulator-name = "vcc5v0_sys"; 171 | + regulator-always-on; 172 | + regulator-boot-on; 173 | + regulator-min-microvolt = <5000000>; 174 | + regulator-max-microvolt = <5000000>; 175 | + vin-supply = <&vcc12v_dcin>; 176 | + }; 177 | + 178 | + vdd_log: vdd-log { 179 | + compatible = "pwm-regulator"; 180 | + pwms = <&pwm2 0 25000 1>; 181 | + pwm-supply = <&vcc5v0_sys>; 182 | + regulator-name = "vdd_log"; 183 | + regulator-always-on; 184 | + regulator-boot-on; 185 | + regulator-min-microvolt = <800000>; 186 | + regulator-max-microvolt = <1700000>; 187 | + }; 188 | +}; 189 | + 190 | +&cpu_l0 { 191 | + cpu-supply = <&vdd_cpu_l>; 192 | +}; 193 | + 194 | +&cpu_l1 { 195 | + cpu-supply = <&vdd_cpu_l>; 196 | +}; 197 | + 198 | +&cpu_l2 { 199 | + cpu-supply = <&vdd_cpu_l>; 200 | +}; 201 | + 202 | +&cpu_l3 { 203 | + cpu-supply = <&vdd_cpu_l>; 204 | +}; 205 | + 206 | +&cpu_b0 { 207 | + cpu-supply = <&vdd_cpu_b>; 208 | +}; 209 | + 210 | +&cpu_b1 { 211 | + cpu-supply = <&vdd_cpu_b>; 212 | +}; 213 | + 214 | +&emmc_phy { 215 | + status = "okay"; 216 | +}; 217 | + 218 | +&gmac { 219 | + assigned-clocks = <&cru SCLK_RMII_SRC>; 220 | + assigned-clock-parents = <&clkin_gmac>; 221 | + clock_in_out = "input"; 222 | + phy-supply = <&vcc_phy>; 223 | + phy-mode = "rgmii"; 224 | + pinctrl-names = "default"; 225 | + pinctrl-0 = <&rgmii_pins>; 226 | + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; // bsp 227 | + snps,reset-active-low; 228 | + snps,reset-delays-us = <0 10000 50000>; 229 | + tx_delay = <0x28>; 230 | + rx_delay = <0x11>; 231 | + status = "okay"; 232 | +}; 233 | + 234 | +&hdmi { 235 | + status = "okay"; 236 | + ddc-i2c-bus = <&i2c3>; 237 | + pinctrl-names = "default"; 238 | + pinctrl-0 = <&hdmi_cec>; 239 | +}; 240 | + 241 | +&hdmi_sound { 242 | + status = "okay"; 243 | +}; 244 | + 245 | +&gpu { 246 | + mali-supply = <&vdd_gpu>; 247 | + status = "okay"; 248 | +}; 249 | + 250 | +&i2c0 { 251 | + status = "okay"; 252 | + clock-frequency = <400000>; 253 | + i2c-scl-rising-time-ns = <168>; 254 | + i2c-scl-falling-time-ns = <4>; 255 | + 256 | + rk808: pmic@1b { 257 | + compatible = "rockchip,rk808"; 258 | + reg = <0x1b>; 259 | + interrupt-parent = <&gpio1>; 260 | + interrupts = ; 261 | + #clock-cells = <1>; 262 | + clock-output-names = "xin32k", "rk808-clkout2"; 263 | + pinctrl-names = "default"; 264 | + pinctrl-0 = <&pmic_int_l>; 265 | + rockchip,system-power-controller; 266 | + wakeup-source; 267 | + 268 | + vcc1-supply = <&vcc3v3_sys>; 269 | + vcc2-supply = <&vcc3v3_sys>; 270 | + vcc3-supply = <&vcc3v3_sys>; 271 | + vcc4-supply = <&vcc3v3_sys>; 272 | + vcc6-supply = <&vcc3v3_sys>; 273 | + vcc7-supply = <&vcc3v3_sys>; 274 | + vcc8-supply = <&vcc3v3_sys>; 275 | + vcc9-supply = <&vcc3v3_sys>; 276 | + vcc10-supply = <&vcc3v3_sys>; 277 | + vcc11-supply = <&vcc3v3_sys>; 278 | + vcc12-supply = <&vcc3v3_sys>; 279 | + vddio-supply = <&vcc_1v8>; 280 | + 281 | + regulators { 282 | + vdd_center: DCDC_REG1 { 283 | + regulator-name = "vdd_center"; 284 | + regulator-always-on; 285 | + regulator-boot-on; 286 | + regulator-min-microvolt = <750000>; 287 | + regulator-max-microvolt = <1350000>; 288 | + regulator-ramp-delay = <6001>; 289 | + regulator-state-mem { 290 | + regulator-off-in-suspend; 291 | + }; 292 | + }; 293 | + 294 | + vdd_cpu_l: DCDC_REG2 { 295 | + regulator-name = "vdd_cpu_l"; 296 | + regulator-always-on; 297 | + regulator-boot-on; 298 | + regulator-min-microvolt = <750000>; 299 | + regulator-max-microvolt = <1350000>; 300 | + regulator-ramp-delay = <6001>; 301 | + regulator-state-mem { 302 | + regulator-off-in-suspend; 303 | + }; 304 | + }; 305 | + 306 | + vcc_ddr: DCDC_REG3 { 307 | + regulator-name = "vcc_ddr"; 308 | + regulator-always-on; 309 | + regulator-boot-on; 310 | + regulator-state-mem { 311 | + regulator-on-in-suspend; 312 | + }; 313 | + }; 314 | + 315 | + vcc_1v8: DCDC_REG4 { 316 | + regulator-name = "vcc_1v8"; 317 | + regulator-always-on; 318 | + regulator-boot-on; 319 | + regulator-min-microvolt = <1800000>; 320 | + regulator-max-microvolt = <1800000>; 321 | + regulator-state-mem { 322 | + regulator-on-in-suspend; 323 | + regulator-suspend-microvolt = <1800000>; 324 | + }; 325 | + }; 326 | + 327 | + vcc1v8_dvp: LDO_REG1 { 328 | + regulator-name = "vcc1v8_dvp"; 329 | + regulator-always-on; 330 | + regulator-boot-on; 331 | + regulator-min-microvolt = <1800000>; 332 | + regulator-max-microvolt = <1800000>; 333 | + regulator-state-mem { 334 | + regulator-off-in-suspend; 335 | + }; 336 | + }; 337 | + 338 | + vcc3v0_tp: LDO_REG2 { 339 | + regulator-name = "vcc3v0_tp"; 340 | + // regulator-always-on; 341 | + // regulator-boot-on; 342 | + regulator-min-microvolt = <3000000>; 343 | + regulator-max-microvolt = <3000000>; 344 | + regulator-state-mem { 345 | + regulator-off-in-suspend; 346 | + }; 347 | + }; 348 | + 349 | + vcc1v8_pmu: LDO_REG3 { 350 | + regulator-name = "vcc1v8_pmu"; 351 | + regulator-always-on; 352 | + regulator-boot-on; 353 | + regulator-min-microvolt = <1800000>; 354 | + regulator-max-microvolt = <1800000>; 355 | + regulator-state-mem { 356 | + regulator-on-in-suspend; 357 | + regulator-suspend-microvolt = <1800000>; 358 | + }; 359 | + }; 360 | + 361 | + vccio_sd: LDO_REG4 { 362 | + regulator-name = "vccio_sd"; 363 | + regulator-always-on; 364 | + regulator-boot-on; 365 | + regulator-min-microvolt = <1800000>; 366 | + regulator-max-microvolt = <3300000>; 367 | + regulator-state-mem { 368 | + regulator-on-in-suspend; 369 | + regulator-suspend-microvolt = <3300000>; 370 | + }; 371 | + }; 372 | + 373 | + vcca3v0_codec: LDO_REG5 { 374 | + regulator-name = "vcca3v0_codec"; 375 | + regulator-always-on; 376 | + regulator-boot-on; 377 | + regulator-min-microvolt = <3000000>; 378 | + regulator-max-microvolt = <3000000>; 379 | + regulator-state-mem { 380 | + regulator-off-in-suspend; 381 | + }; 382 | + }; 383 | + 384 | + vcc_1v5: LDO_REG6 { 385 | + regulator-name = "vcc_1v5"; 386 | + regulator-always-on; 387 | + regulator-boot-on; 388 | + regulator-min-microvolt = <1500000>; 389 | + regulator-max-microvolt = <1500000>; 390 | + regulator-state-mem { 391 | + regulator-on-in-suspend; 392 | + regulator-suspend-microvolt = <1500000>; 393 | + }; 394 | + }; 395 | + 396 | + vcca1v8_codec: LDO_REG7 { 397 | + regulator-name = "vcca1v8_codec"; 398 | + regulator-always-on; 399 | + regulator-boot-on; 400 | + regulator-min-microvolt = <1800000>; 401 | + regulator-max-microvolt = <1800000>; 402 | + regulator-state-mem { 403 | + regulator-off-in-suspend; 404 | + }; 405 | + }; 406 | + 407 | + vcc_3v0: LDO_REG8 { 408 | + regulator-name = "vcc_3v0"; 409 | + regulator-always-on; 410 | + regulator-boot-on; 411 | + regulator-min-microvolt = <3000000>; 412 | + regulator-max-microvolt = <3000000>; 413 | + regulator-state-mem { 414 | + regulator-on-in-suspend; 415 | + regulator-suspend-microvolt = <3000000>; 416 | + }; 417 | + }; 418 | + 419 | + vcc3v3_s3: SWITCH_REG1 { 420 | + regulator-name = "vcc3v3_s3"; 421 | + regulator-always-on; 422 | + regulator-boot-on; 423 | + regulator-state-mem { 424 | + regulator-off-in-suspend; 425 | + }; 426 | + }; 427 | + 428 | + vcc3v3_s0: SWITCH_REG2 { 429 | + regulator-name = "vcc3v3_s0"; 430 | + regulator-always-on; 431 | + regulator-boot-on; 432 | + regulator-state-mem { 433 | + regulator-off-in-suspend; 434 | + }; 435 | + }; 436 | + }; 437 | + }; 438 | + 439 | + vdd_cpu_b: regulator@40 { 440 | + compatible = "silergy,syr827"; 441 | + reg = <0x40>; 442 | + fcs,suspend-voltage-selector = <1>; 443 | + pinctrl-names = "default"; 444 | + pinctrl-0 = <&vsel1_pin>; // bsp 445 | + regulator-name = "vdd_cpu_b"; 446 | + regulator-min-microvolt = <712500>; 447 | + regulator-max-microvolt = <1500000>; 448 | + regulator-ramp-delay = <1000>; 449 | + regulator-always-on; 450 | + regulator-boot-on; 451 | + vin-supply = <&vcc5v0_sys>; 452 | + 453 | + regulator-state-mem { 454 | + regulator-off-in-suspend; 455 | + }; 456 | + }; 457 | + 458 | + vdd_gpu: regulator@41 { 459 | + compatible = "silergy,syr828"; 460 | + reg = <0x41>; 461 | + fcs,suspend-voltage-selector = <1>; 462 | + pinctrl-names = "default"; 463 | + pinctrl-0 = <&vsel2_pin>; // bsp 464 | + regulator-name = "vdd_gpu"; 465 | + regulator-min-microvolt = <712500>; 466 | + regulator-max-microvolt = <1500000>; 467 | + regulator-ramp-delay = <1000>; 468 | + regulator-always-on; 469 | + regulator-boot-on; 470 | + vin-supply = <&vcc5v0_sys>; 471 | + 472 | + regulator-state-mem { 473 | + regulator-off-in-suspend; 474 | + }; 475 | + }; 476 | +}; 477 | + 478 | +&i2c1 { 479 | + i2c-scl-rising-time-ns = <300>; 480 | + i2c-scl-falling-time-ns = <15>; 481 | + status = "okay"; 482 | +}; 483 | + 484 | +// HDMI 485 | +&i2c3 { 486 | + i2c-scl-rising-time-ns = <450>; 487 | + i2c-scl-falling-time-ns = <15>; 488 | + status = "okay"; 489 | +}; 490 | + 491 | +// ALC5651 492 | +&i2c4 { 493 | + i2c-scl-rising-time-ns = <600>; 494 | + i2c-scl-falling-time-ns = <20>; 495 | + status = "okay"; 496 | +}; 497 | + 498 | +// HDMI sound 499 | +&i2s2 { 500 | + #sound-dai-cells = <0>; 501 | + status = "okay"; 502 | +}; 503 | + 504 | +&io_domains { 505 | + status = "okay"; 506 | + bt656-supply = <&vcc_3v0>; 507 | + audio-supply = <&vcca1v8_codec>; 508 | + sdmmc-supply = <&vccio_sd>; 509 | + gpio1830-supply = <&vcc_3v0>; 510 | +}; 511 | + 512 | +&pmu_io_domains { 513 | + status = "okay"; 514 | + pmu1830-supply = <&vcc_3v0>; 515 | +}; 516 | + 517 | +&pinctrl { 518 | + bt { 519 | + bt_enable_h: bt-enable-h { 520 | + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 521 | + }; 522 | + 523 | + bt_host_wake_l: bt-host-wake-l { 524 | + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 525 | + }; 526 | + 527 | + bt_wake_l: bt-wake-l { 528 | + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 529 | + }; 530 | + }; 531 | + 532 | + wifi { 533 | + wifi_host_wake_l: wifi-host-wake-l { 534 | + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 535 | + }; 536 | + }; 537 | + 538 | + buttons { 539 | + pwrbtn: pwrbtn { 540 | + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; // common 541 | + }; 542 | + }; 543 | + 544 | + pmic { 545 | + pmic_int_l: pmic-int-l { 546 | + rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; // bsp 547 | + }; 548 | + 549 | + vsel1_pin: vsel1-pin { 550 | + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 551 | + }; 552 | + 553 | + vsel2_pin: vsel2-pin { 554 | + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; // bsp 555 | + }; 556 | + }; 557 | + 558 | + sdio-pwrseq { 559 | + wifi_enable_h: wifi-enable-h { 560 | + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; // common 561 | + }; 562 | + }; 563 | + 564 | + usb { 565 | + vcc5v0_host_en: vcc5v0-host-en { 566 | + rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 567 | + }; 568 | + usb2_hub_en: usb2-hub-en { 569 | + rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>; // bsp 570 | + }; 571 | + }; 572 | + 573 | + headphone { 574 | + spk_ctl: spk-ctl { 575 | + rockchip,pins = <4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; // bsp: spk-con-gpio 576 | + }; 577 | + spk_pwr: spk-pwr { 578 | + rockchip,pins = <1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 579 | + }; 580 | + }; 581 | + 582 | + bl_ctrl { 583 | + bl_en: bl-en { 584 | + rockchip,pins = <4 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; // bsp 585 | + }; 586 | + vcc_lcd_en: vcc-lcd-en { 587 | + rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; // bsp 588 | + }; 589 | + }; 590 | + 591 | + gmac { 592 | + rgmii_sleep_pins: rgmii-sleep-pins { 593 | + rockchip,pins =<3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>; // bsp 594 | + }; 595 | + }; 596 | +}; 597 | + 598 | +&pwm1 { 599 | + status = "okay"; 600 | +}; 601 | + 602 | +&pwm2 { 603 | + status = "okay"; 604 | +}; 605 | + 606 | +&saradc { 607 | + status = "okay"; 608 | + vref-supply = <&vccadc_ref>; 609 | +}; 610 | + 611 | +&sdio0 { 612 | + status = "okay"; 613 | + #address-cells = <1>; 614 | + #size-cells = <0>; 615 | + bus-width = <4>; 616 | + clock-frequency = <50000000>; 617 | + cap-sdio-irq; 618 | + cap-sd-highspeed; 619 | + keep-power-in-suspend; 620 | + mmc-pwrseq = <&sdio_pwrseq>; 621 | + non-removable; 622 | + pinctrl-names = "default"; 623 | + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; 624 | + sd-uhs-sdr104; 625 | + 626 | + brcmf: wifi@1 { 627 | + compatible = "brcm,bcm43455-fmac"; 628 | + reg = <1>; 629 | + interrupt-parent = <&gpio0>; 630 | + interrupts = ; 631 | + interrupt-names = "host-wake"; 632 | + pinctrl-names = "default"; 633 | + pinctrl-0 = <&wifi_host_wake_l>; // bsp 634 | + }; 635 | +}; 636 | + 637 | +&sdmmc { 638 | + clock-frequency = <150000000>; 639 | + clock-freq-min-max = <100000 150000000>; 640 | + supports-sd; 641 | + bus-width = <4>; 642 | + cap-mmc-highspeed; 643 | + cap-sd-highspeed; 644 | + disable-wp; 645 | + num-slots = <1>; 646 | + sd-uhs-sdr104; 647 | + vmmc-supply = <&vcc_sd>; 648 | + vqmmc-supply = <&vccio_sd>; 649 | + pinctrl-names = "default"; 650 | + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; 651 | + status = "okay"; 652 | +}; 653 | + 654 | +&sdhci { 655 | + bus-width = <8>; 656 | + mmc-hs400-enhanced-strobe; 657 | + non-removable; 658 | + status = "okay"; 659 | +}; 660 | + 661 | +&tcphy0 { 662 | + status = "okay"; 663 | +}; 664 | + 665 | +&tcphy1 { 666 | + status = "okay"; 667 | +}; 668 | + 669 | +&tsadc { 670 | + /* tshut mode 0:CRU 1:GPIO */ 671 | + rockchip,hw-tshut-mode = <1>; 672 | + /* tshut polarity 0:LOW 1:HIGH */ 673 | + rockchip,hw-tshut-polarity = <1>; 674 | + status = "okay"; 675 | +}; 676 | + 677 | +&u2phy0 { 678 | + status = "okay"; 679 | + 680 | + u2phy0_otg: otg-port { 681 | + status = "okay"; 682 | + }; 683 | + 684 | + u2phy0_host: host-port { 685 | + phy-supply = <&vcc5v0_host>; 686 | + status = "okay"; 687 | + }; 688 | +}; 689 | + 690 | +&u2phy1 { 691 | + status = "okay"; 692 | + 693 | + u2phy1_otg: otg-port { 694 | + status = "okay"; 695 | + }; 696 | + 697 | + u2phy1_host: host-port { 698 | + phy-supply = <&vcc5v0_host>; 699 | + status = "okay"; 700 | + }; 701 | +}; 702 | + 703 | +&uart0 { 704 | + pinctrl-names = "default"; 705 | + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; 706 | + status = "okay"; 707 | + 708 | + bluetooth { 709 | + compatible = "brcm,bcm43438-bt"; 710 | + clocks = <&rk808 1>; 711 | + clock-names = "lpo"; 712 | + device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; // bsp 713 | + host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; // bsp 714 | + shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; // bsp 715 | + pinctrl-names = "default"; 716 | + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; 717 | + vbat-supply = <&vcc3v3_sys>; 718 | + vddio-supply = <&vcc_1v8>; 719 | + }; 720 | +}; 721 | + 722 | +// Debug TTL 723 | +&uart2 { 724 | + status = "okay"; 725 | +}; 726 | + 727 | +&usb_host0_ehci { 728 | + status = "okay"; 729 | +}; 730 | + 731 | +&usb_host0_ohci { 732 | + status = "okay"; 733 | +}; 734 | + 735 | +&usb_host1_ehci { 736 | + status = "okay"; 737 | +}; 738 | + 739 | +&usb_host1_ohci { 740 | + status = "okay"; 741 | +}; 742 | + 743 | +&usbdrd3_0 { 744 | + status = "okay"; 745 | +}; 746 | + 747 | +&usbdrd_dwc3_0 { 748 | + status = "okay"; 749 | + dr_mode = "host"; 750 | +}; 751 | + 752 | +&usbdrd3_1 { 753 | + status = "okay"; 754 | +}; 755 | + 756 | +&usbdrd_dwc3_1 { 757 | + status = "okay"; 758 | + dr_mode = "host"; 759 | +}; 760 | + 761 | +&vopb { 762 | + status = "okay"; 763 | +}; 764 | + 765 | +&vopb_mmu { 766 | + status = "okay"; 767 | +}; 768 | + 769 | +&vopl { 770 | + status = "okay"; 771 | +}; 772 | + 773 | +&vopl_mmu { 774 | + status = "okay"; 775 | +}; 776 | + 777 | +&iep_mmu { 778 | + status = "okay"; 779 | +}; 780 | -------------------------------------------------------------------------------- /kernel-patch/beta/common-kernel-patches/301-dts-add-rockchip-rk3399-mpc1903-dtb.patch: -------------------------------------------------------------------------------- 1 | From d738ec5df78c21fc22fb2860af9a8cc7481d2c9d Mon Sep 17 00:00:00 2001 2 | From: xxxxx <67037522+xxxxx@users.noreply.github.com> 3 | Date: Mon, 18 Sep 2023 03:09:25 +0000 4 | Subject: [PATCH] Add rk3399-mpc1903 5 | 6 | --- 7 | arch/arm64/boot/dts/rockchip/Makefile | 1 + 8 | .../boot/dts/rockchip/rk3399-mpc1903.dts | 814 ++++++++++++++++++ 9 | 2 files changed, 815 insertions(+) 10 | create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-mpc1903.dts 11 | 12 | diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile 13 | index f97cf4c32..ff70c1b4d 100644 14 | --- a/arch/arm64/boot/dts/rockchip/Makefile 15 | +++ b/arch/arm64/boot/dts/rockchip/Makefile 16 | @@ -37,6 +37,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-dlfr100.dtb 17 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-evb.dtb 18 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-ficus.dtb 19 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-firefly.dtb 20 | +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-mpc1903.dtb 21 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-bob.dtb 22 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb 23 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-dumo.dtb 24 | diff --git a/arch/arm64/boot/dts/rockchip/rk3399-mpc1903.dts b/arch/arm64/boot/dts/rockchip/rk3399-mpc1903.dts 25 | new file mode 100644 26 | index 000000000..7cac536bb 27 | --- /dev/null 28 | +++ b/arch/arm64/boot/dts/rockchip/rk3399-mpc1903.dts 29 | @@ -0,0 +1,814 @@ 30 | +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 31 | + 32 | +/dts-v1/; 33 | +#include 34 | +#include "rk3399.dtsi" 35 | +#include "rk3399-opp.dtsi" 36 | + 37 | +/ { 38 | + model = "Rocktech MPC1903"; 39 | + compatible = "rocktech,mpc1903", "rockchip,rk3399"; 40 | + 41 | + aliases { 42 | + mmc0 = &sdmmc; 43 | + mmc1 = &sdhci; 44 | + mmc2 = &sdio0; 45 | + }; 46 | + 47 | + chosen { 48 | + stdout-path = "serial2:1500000n8"; 49 | + }; 50 | + 51 | + clkin_gmac: external-gmac-clock { 52 | + compatible = "fixed-clock"; 53 | + clock-frequency = <125000000>; 54 | + clock-output-names = "clkin_gmac"; 55 | + #clock-cells = <0>; 56 | + }; 57 | + 58 | + sdio_pwrseq: sdio-pwrseq { 59 | + compatible = "mmc-pwrseq-simple"; 60 | + clocks = <&rk808 1>; 61 | + clock-names = "ext_clock"; 62 | + pinctrl-names = "default"; 63 | + pinctrl-0 = <&wifi_enable_h>; 64 | + reset-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_LOW>; 65 | + }; 66 | + 67 | + vcc12v_dcin: dc-12v { 68 | + compatible = "regulator-fixed"; 69 | + regulator-name = "vcc12v_dcin"; 70 | + regulator-always-on; 71 | + regulator-boot-on; 72 | + regulator-min-microvolt = <12000000>; 73 | + regulator-max-microvolt = <12000000>; 74 | + }; 75 | + 76 | + vcc5v0_sys: vcc-sys { 77 | + compatible = "regulator-fixed"; 78 | + regulator-name = "vcc5v0_sys"; 79 | + regulator-always-on; 80 | + regulator-boot-on; 81 | + regulator-min-microvolt = <5000000>; 82 | + regulator-max-microvolt = <5000000>; 83 | + vin-supply = <&vcc12v_dcin>; 84 | + }; 85 | + 86 | + vcc5v0_hub: vcc5v0-hub { 87 | + compatible = "regulator-fixed"; 88 | + enable-active-high; 89 | + gpio = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>; 90 | + pinctrl-names = "default"; 91 | + pinctrl-0 = <&vcc5v0_hub_en>; 92 | + regulator-name = "vcc5v0_hub"; 93 | + regulator-always-on; 94 | + vin-supply = <&vcc5v0_sys>; 95 | + }; 96 | + 97 | + /*vcc3v3_pcie: vcc3v3-pcie-regulator { 98 | + compatible = "regulator-fixed"; 99 | + enable-active-high; 100 | + gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>; 101 | + pinctrl-names = "default"; 102 | + pinctrl-0 = <&pcie_drv>; 103 | + regulator-boot-on; 104 | + regulator-always-on; 105 | + regulator-name = "vcc3v3_pcie"; 106 | + vin-supply = <&vcc5v0_sys>; 107 | + };*/ 108 | + 109 | + vcc3v3_gsm: vcc3v3-gsm { 110 | + compatible = "regulator-fixed"; 111 | + enable-active-high; 112 | + gpio = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>; 113 | + pinctrl-names = "default"; 114 | + pinctrl-0 = <&vcc3v3_gsm_en>; 115 | + regulator-boot-on; 116 | + regulator-always-on; 117 | + regulator-name = "vcc3v3_gsm"; 118 | + vin-supply = <&vcc3v3_sys>; 119 | + }; 120 | + 121 | + vcc3v3_sys: vcc3v3-sys { 122 | + compatible = "regulator-fixed"; 123 | + regulator-name = "vcc3v3_sys"; 124 | + regulator-always-on; 125 | + regulator-boot-on; 126 | + regulator-min-microvolt = <3300000>; 127 | + regulator-max-microvolt = <3300000>; 128 | + vin-supply = <&vcc5v0_sys>; 129 | + }; 130 | + 131 | + vcc5v0_host: vcc5v0-host { 132 | + compatible = "regulator-fixed"; 133 | + enable-active-high; 134 | + gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>; 135 | + pinctrl-names = "default"; 136 | + pinctrl-0 = <&vcc5v0_host_en>; 137 | + regulator-name = "vcc5v0_host"; 138 | + regulator-always-on; 139 | + vin-supply = <&vcc5v0_sys>; 140 | + }; 141 | + 142 | + vcc5v0_typec: vcc5v0-typec-regulator { 143 | + compatible = "regulator-fixed"; 144 | + enable-active-high; 145 | + gpio = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; 146 | + pinctrl-names = "default"; 147 | + pinctrl-0 = <&vcc5v0_typec_en>; 148 | + regulator-name = "vcc5v0_typec"; 149 | + regulator-always-on; 150 | + vin-supply = <&vcc5v0_sys>; 151 | + }; 152 | + 153 | + vcc_lan: vcc-phy { 154 | + compatible = "regulator-fixed"; 155 | + regulator-name = "vcc_lan"; 156 | + regulator-always-on; 157 | + regulator-boot-on; 158 | + regulator-min-microvolt = <3300000>; 159 | + regulator-max-microvolt = <3300000>; 160 | + }; 161 | + 162 | + vdd_log: vdd-log { 163 | + compatible = "pwm-regulator"; 164 | + pwms = <&pwm2 0 25000 1>; 165 | + regulator-name = "vdd_log"; 166 | + regulator-always-on; 167 | + regulator-boot-on; 168 | + regulator-min-microvolt = <800000>; 169 | + regulator-max-microvolt = <1400000>; 170 | + vin-supply = <&vcc5v0_sys>; 171 | + }; 172 | + 173 | + leds { 174 | + compatible = "gpio-leds"; 175 | + pinctrl-names = "default"; 176 | + pinctrl-0 = <&status_led_pin>; 177 | + 178 | + status_led: status-led { 179 | + label = "status_led"; 180 | + linux,default-trigger = "heartbeat"; 181 | + gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_LOW>; 182 | + }; 183 | + }; 184 | + 185 | + wireless_wlan: wireless-wlan { 186 | + compatible = "wlan-platdata"; 187 | + rockchip,grf = <&grf>; 188 | + wifi_chip_type = "rtl8723bu"; 189 | + sdio_vref = <1800>; 190 | + WIFI,host_wake_irq = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; 191 | + status = "okay"; 192 | + }; 193 | + 194 | + wireless_bluetooth: wireless-bluetooth { 195 | + compatible = "bluetooth-platdata"; 196 | + clocks = <&rk808 1>; 197 | + clock-names = "ext_clock"; 198 | + uart_rts_gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_LOW>; 199 | + pinctrl-names = "default", "rts_gpio"; 200 | + pinctrl-0 = <&uart0_rts>; 201 | + pinctrl-1 = <&uart0_gpios>; 202 | + BT,reset_gpio = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; 203 | + BT,wake_gpio = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; 204 | + BT,wake_host_irq = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; 205 | + status = "okay"; 206 | + }; 207 | +}; 208 | + 209 | +&cpu_l0 { 210 | + cpu-supply = <&vdd_cpu_l>; 211 | +}; 212 | + 213 | +&cpu_l1 { 214 | + cpu-supply = <&vdd_cpu_l>; 215 | +}; 216 | + 217 | +&cpu_l2 { 218 | + cpu-supply = <&vdd_cpu_l>; 219 | +}; 220 | + 221 | +&cpu_l3 { 222 | + cpu-supply = <&vdd_cpu_l>; 223 | +}; 224 | + 225 | +&cpu_b0 { 226 | + cpu-supply = <&vdd_cpu_b>; 227 | +}; 228 | + 229 | +&cpu_b1 { 230 | + cpu-supply = <&vdd_cpu_b>; 231 | +}; 232 | + 233 | +&emmc_phy { 234 | + status = "okay"; 235 | +}; 236 | + 237 | +&gmac { 238 | + assigned-clocks = <&cru SCLK_RMII_SRC>; 239 | + assigned-clock-parents = <&clkin_gmac>; 240 | + clock_in_out = "input"; 241 | + phy-supply = <&vcc_lan>; 242 | + phy-mode = "rgmii"; 243 | + pinctrl-names = "default"; 244 | + pinctrl-0 = <&rgmii_pins>; 245 | + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; 246 | + snps,reset-active-low; 247 | + snps,reset-delays-us = <0 10000 50000>; 248 | + tx_delay = <0x28>; 249 | + rx_delay = <0x11>; 250 | + status = "okay"; 251 | +}; 252 | + 253 | +&gpu { 254 | + mali-supply = <&vdd_gpu>; 255 | + status = "okay"; 256 | +}; 257 | + 258 | +&hdmi { 259 | + ddc-i2c-bus = <&i2c3>; 260 | + pinctrl-names = "default"; 261 | + pinctrl-0 = <&hdmi_i2c_xfer>; 262 | + status = "okay"; 263 | +}; 264 | + 265 | +&hdmi_sound { 266 | + status = "okay"; 267 | +}; 268 | + 269 | +&i2c0 { 270 | + clock-frequency = <400000>; 271 | + i2c-scl-rising-time-ns = <168>; 272 | + i2c-scl-falling-time-ns = <4>; 273 | + status = "okay"; 274 | + 275 | + rk808: pmic@1b { 276 | + compatible = "rockchip,rk808"; 277 | + reg = <0x1b>; 278 | + interrupt-parent = <&gpio1>; 279 | + interrupts = <21 IRQ_TYPE_LEVEL_LOW>; 280 | + #clock-cells = <1>; 281 | + clock-output-names = "xin32k", "rk808-clkout2"; 282 | + pinctrl-names = "default"; 283 | + pinctrl-0 = <&pmic_int_l>; 284 | + rockchip,system-power-controller; 285 | + wakeup-source; 286 | + 287 | + vcc1-supply = <&vcc5v0_sys>; 288 | + vcc2-supply = <&vcc5v0_sys>; 289 | + vcc3-supply = <&vcc5v0_sys>; 290 | + vcc4-supply = <&vcc5v0_sys>; 291 | + vcc6-supply = <&vcc5v0_sys>; 292 | + vcc7-supply = <&vcc5v0_sys>; 293 | + vcc8-supply = <&vcc3v3_sys>; 294 | + vcc9-supply = <&vcc5v0_sys>; 295 | + vcc10-supply = <&vcc5v0_sys>; 296 | + vcc11-supply = <&vcc5v0_sys>; 297 | + vcc12-supply = <&vcc3v3_sys>; 298 | + vddio-supply = <&vcc_3v0>; 299 | + 300 | + regulators { 301 | + vdd_center: DCDC_REG1 { 302 | + regulator-name = "vdd_center"; 303 | + regulator-always-on; 304 | + regulator-boot-on; 305 | + regulator-min-microvolt = <750000>; 306 | + regulator-max-microvolt = <1350000>; 307 | + regulator-ramp-delay = <6001>; 308 | + 309 | + regulator-state-mem { 310 | + regulator-off-in-suspend; 311 | + }; 312 | + }; 313 | + 314 | + vdd_cpu_l: DCDC_REG2 { 315 | + regulator-name = "vdd_cpu_l"; 316 | + regulator-always-on; 317 | + regulator-boot-on; 318 | + regulator-min-microvolt = <750000>; 319 | + regulator-max-microvolt = <1350000>; 320 | + regulator-ramp-delay = <6001>; 321 | + 322 | + regulator-state-mem { 323 | + regulator-off-in-suspend; 324 | + }; 325 | + }; 326 | + 327 | + vcc_ddr: DCDC_REG3 { 328 | + regulator-name = "vcc_ddr"; 329 | + regulator-always-on; 330 | + regulator-boot-on; 331 | + 332 | + regulator-state-mem { 333 | + regulator-on-in-suspend; 334 | + }; 335 | + }; 336 | + 337 | + vcc_1v8: DCDC_REG4 { 338 | + regulator-name = "vcc_1v8"; 339 | + regulator-always-on; 340 | + regulator-boot-on; 341 | + regulator-min-microvolt = <1800000>; 342 | + regulator-max-microvolt = <1800000>; 343 | + 344 | + regulator-state-mem { 345 | + regulator-on-in-suspend; 346 | + regulator-suspend-microvolt = <1800000>; 347 | + }; 348 | + }; 349 | + 350 | + gen_1v8: LDO_REG1 { 351 | + regulator-name = "gen_3v0"; 352 | + regulator-always-on; 353 | + regulator-boot-on; 354 | + regulator-min-microvolt = <3000000>; 355 | + regulator-max-microvolt = <3000000>; 356 | + 357 | + regulator-state-mem { 358 | + regulator-off-in-suspend; 359 | + }; 360 | + }; 361 | + 362 | + gen_3v0: LDO_REG2 { 363 | + regulator-name = "gen_gen"; 364 | + regulator-always-on; 365 | + regulator-boot-on; 366 | + regulator-min-microvolt = <3000000>; 367 | + regulator-max-microvolt = <3000000>; 368 | + 369 | + regulator-state-mem { 370 | + regulator-on-in-suspend; 371 | + regulator-suspend-microvolt = <3000000>; 372 | + }; 373 | + }; 374 | + 375 | + vcc1v8_pmu: LDO_REG3 { 376 | + regulator-name = "vcc1v8_pmu"; 377 | + regulator-always-on; 378 | + regulator-boot-on; 379 | + regulator-min-microvolt = <1800000>; 380 | + regulator-max-microvolt = <1800000>; 381 | + 382 | + regulator-state-mem { 383 | + regulator-on-in-suspend; 384 | + regulator-suspend-microvolt = <1800000>; 385 | + }; 386 | + }; 387 | + 388 | + vcc_sdio: LDO_REG4 { 389 | + regulator-name = "vcc_sdio"; 390 | + regulator-always-on; 391 | + regulator-boot-on; 392 | + regulator-min-microvolt = <3000000>; 393 | + regulator-max-microvolt = <3000000>; 394 | + 395 | + regulator-state-mem { 396 | + regulator-on-in-suspend; 397 | + regulator-suspend-microvolt = <3000000>; 398 | + }; 399 | + }; 400 | + 401 | + vcca3v0_codec: LDO_REG5 { 402 | + regulator-name = "vcca3v0_codec"; 403 | + regulator-always-on; 404 | + regulator-boot-on; 405 | + regulator-min-microvolt = <3000000>; 406 | + regulator-max-microvolt = <3000000>; 407 | + 408 | + regulator-state-mem { 409 | + regulator-off-in-suspend; 410 | + }; 411 | + }; 412 | + 413 | + vcc_1v5: LDO_REG6 { 414 | + regulator-name = "vcc_1v5"; 415 | + regulator-always-on; 416 | + regulator-boot-on; 417 | + regulator-min-microvolt = <1500000>; 418 | + regulator-max-microvolt = <1500000>; 419 | + 420 | + regulator-state-mem { 421 | + regulator-off-in-suspend; 422 | + }; 423 | + }; 424 | + 425 | + vcc1v8_codec: LDO_REG7 { 426 | + regulator-name = "vcc1v8_codec"; 427 | + regulator-always-on; 428 | + regulator-boot-on; 429 | + regulator-min-microvolt = <1800000>; 430 | + regulator-max-microvolt = <1800000>; 431 | + 432 | + regulator-state-mem { 433 | + regulator-off-in-suspend; 434 | + regulator-suspend-microvolt = <1800000>; 435 | + }; 436 | + }; 437 | + 438 | + vcc_3v0: LDO_REG8 { 439 | + regulator-name = "vcc_3v0"; 440 | + regulator-always-on; 441 | + regulator-boot-on; 442 | + regulator-min-microvolt = <3000000>; 443 | + regulator-max-microvolt = <3000000>; 444 | + 445 | + regulator-state-mem { 446 | + regulator-on-in-suspend; 447 | + regulator-suspend-microvolt = <3000000>; 448 | + }; 449 | + }; 450 | + 451 | + vcc3v3_s3: SWITCH_REG1 { 452 | + regulator-always-on; 453 | + regulator-boot-on; 454 | + regulator-name = "vcc3v3_s3"; 455 | + 456 | + regulator-state-mem { 457 | + regulator-off-in-suspend; 458 | + }; 459 | + }; 460 | + 461 | + vcc3v3_s0: SWITCH_REG2 { 462 | + regulator-always-on; 463 | + regulator-boot-on; 464 | + regulator-name = "vcc3v3_s0"; 465 | + 466 | + regulator-state-mem { 467 | + regulator-off-in-suspend; 468 | + }; 469 | + }; 470 | + }; 471 | + }; 472 | + 473 | + vdd_cpu_b: regulator@40 { 474 | + compatible = "silergy,syr827"; 475 | + reg = <0x40>; 476 | + fcs,suspend-voltage-selector = <1>; 477 | + pinctrl-names = "default"; 478 | + pinctrl-0 = <&vsel1_pin>; 479 | + regulator-name = "vdd_cpu_b"; 480 | + regulator-min-microvolt = <712500>; 481 | + regulator-max-microvolt = <1500000>; 482 | + regulator-ramp-delay = <1000>; 483 | + regulator-always-on; 484 | + regulator-boot-on; 485 | + vin-supply = <&vcc5v0_sys>; 486 | + 487 | + regulator-state-mem { 488 | + regulator-off-in-suspend; 489 | + }; 490 | + }; 491 | + 492 | + vdd_gpu: regulator@41 { 493 | + compatible = "silergy,syr828"; 494 | + reg = <0x41>; 495 | + fcs,suspend-voltage-selector = <1>; 496 | + pinctrl-names = "default"; 497 | + pinctrl-0 = <&vsel2_pin>; 498 | + regulator-name = "vdd_gpu"; 499 | + regulator-min-microvolt = <712500>; 500 | + regulator-max-microvolt = <1500000>; 501 | + regulator-ramp-delay = <1000>; 502 | + regulator-always-on; 503 | + regulator-boot-on; 504 | + vin-supply = <&vcc5v0_sys>; 505 | + 506 | + regulator-state-mem { 507 | + regulator-off-in-suspend; 508 | + }; 509 | + }; 510 | + 511 | + rtc: pcf85263@51 { 512 | + compatible = "nxp,pcf85263"; 513 | + reg = <0x51>; 514 | + pinctrl-0 = <&rtc_int>; 515 | + rtc_int_gpio = <&gpio2 RK_PB4 GPIO_ACTIVE_HIGH>; 516 | + }; 517 | +}; 518 | + 519 | +&i2c1 { 520 | + status = "okay"; 521 | + i2c-scl-rising-time-ns = <300>; 522 | + i2c-scl-falling-time-ns = <15>; 523 | + clock-frequency = <200000>; 524 | + 525 | + /*rt5651: rt5651@1a { 526 | + #sound-dai-cells = <0>; 527 | + compatible = "realtek,rt5651"; 528 | + reg = <0x1a>; 529 | + clocks = <&cru SCLK_I2S_8CH_OUT>; 530 | + clock-names = "mclk"; 531 | + pinctrl-names = "default"; 532 | + pinctrl-0 = <&i2s_8ch_mclk>; 533 | + spk-con-gpio = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>; 534 | + hp-det-gpio = <&gpio4 RK_PB3 GPIO_ACTIVE_LOW>; 535 | + status = "okay"; 536 | + };*/ 537 | + 538 | + es8323: es8323@10 { 539 | + #sound-dai-cells = <0x0>; 540 | + compatible = "everest,es8323"; 541 | + reg = <0x10>; 542 | + clocks = <&cru SCLK_I2S_8CH_OUT>; 543 | + clock-names = "mclk"; 544 | + pinctrl-names = "default"; 545 | + pinctrl-0 = <&spk_con &spk_pwr &_pwr &i2s_8ch_mclk>; 546 | + spk-con-gpio = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>; 547 | + amp-pwr-en = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>; 548 | + spk-pwr = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; 549 | + }; 550 | +}; 551 | + 552 | +&i2c4 { 553 | + clock-frequency = <400000>; 554 | + i2c-scl-rising-time-ns = <450>; 555 | + i2c-scl-falling-time-ns = <15>; 556 | + status = "okay"; 557 | +}; 558 | + 559 | +&i2c6 { 560 | + status = "okay"; 561 | +}; 562 | + 563 | +&i2s0 { 564 | + rockchip,i2s-broken-burst-len; 565 | + rockchip,playback-channels = <8>; 566 | + rockchip,capture-channels = <8>; 567 | + status = "okay"; 568 | +}; 569 | + 570 | +&i2s2 { 571 | + rockchip,bclk-fs = <128>; 572 | + status = "okay"; 573 | +}; 574 | + 575 | +&io_domains { 576 | + status = "okay"; 577 | + 578 | + bt656-supply = <&vcc_3v0>; 579 | + audio-supply = <&vcc1v8_codec>; 580 | + sdmmc-supply = <&vcc_sdio>; 581 | + gpio1830-supply = <&vcc_3v0>; 582 | +}; 583 | + 584 | +&pmu_io_domains { 585 | + status = "okay"; 586 | + 587 | + pmu1830-supply = <&vcc_3v0>; 588 | +}; 589 | + 590 | +/*&pcie_phy { 591 | + status = "okay"; 592 | +}; 593 | + 594 | +&pcie0 { 595 | + ep-gpios = <&gpio2 RK_PB0 GPIO_ACTIVE_HIGH>; 596 | + num-lanes = <4>; 597 | + pinctrl-0 = <&pcie_clkreqnb_cpm>; 598 | + pinctrl-names = "default"; 599 | + status = "okay"; 600 | +};*/ 601 | + 602 | +&pinctrl { 603 | + pmic { 604 | + pmic_int_l: pmic-int-l { 605 | + rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; 606 | + }; 607 | + 608 | + vsel1_pin: vsel1-pin { 609 | + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; 610 | + }; 611 | + 612 | + vsel2_pin: vsel2-pin { 613 | + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; 614 | + }; 615 | + }; 616 | + 617 | + usb2 { 618 | + vcc5v0_host_en: vcc5v0-host-en { 619 | + rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; 620 | + }; 621 | + 622 | + vcc5v0_hub_en: vcc5v0-hub-en { 623 | + rockchip,pins = <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>; 624 | + }; 625 | + 626 | + vcc3v3_gsm_en: vcc3v3-gsm-en { 627 | + rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; 628 | + }; 629 | + }; 630 | + 631 | + usb-typec { 632 | + vcc5v0_typec_en: vcc5v0-typec-en { 633 | + rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; 634 | + }; 635 | + }; 636 | + 637 | + sdio-pwrseq { 638 | + wifi_enable_h: wifi-enable-h { 639 | + rockchip,pins = <2 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; 640 | + }; 641 | + }; 642 | + 643 | + rtc { 644 | + rtc_int: rtc-int { 645 | + rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>; 646 | + }; 647 | + }; 648 | + 649 | + led { 650 | + status_led_pin: status-led-pin { 651 | + rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; 652 | + }; 653 | + }; 654 | + 655 | + rockchip-key { 656 | + power_key: power-key { 657 | + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; 658 | + }; 659 | + }; 660 | + 661 | + es8323 { 662 | + spk_con: spk-con { 663 | + rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>; 664 | + }; 665 | + 666 | + spk_pwr: spk-pwr { 667 | + rockchip,pins = <4 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; 668 | + }; 669 | + 670 | + amp_pwr: amp-pwr { 671 | + rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>; 672 | + }; 673 | + }; 674 | + 675 | + i2s0 { 676 | + i2s_8ch_mclk: i2s-8ch-mclk { 677 | + ockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>; 678 | + }; 679 | + }; 680 | + 681 | + fusb30x { 682 | + fusb0_int: fusb0-int { 683 | + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; 684 | + }; 685 | + }; 686 | + 687 | + wireless-bluetooth { 688 | + uart0_gpios: uart0-gpios { 689 | + rockchip,pins = <2 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; 690 | + }; 691 | + }; 692 | + 693 | +/* pcie { 694 | + pcie_drv: pcie-drv { 695 | + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; 696 | + }; 697 | + };*/ 698 | +}; 699 | + 700 | +&pwm2 { 701 | + status = "okay"; 702 | +}; 703 | + 704 | +&saradc { 705 | + status = "okay"; 706 | + 707 | + vref-supply = <&vcc_1v8>; 708 | +}; 709 | + 710 | +&sdio0 { 711 | + max-frequency = <200000000>; 712 | + bus-width = <4>; 713 | + clock-frequency = <50000000>; 714 | + cap-sdio-irq; 715 | + cap-sd-highspeed; 716 | + keep-power-in-suspend; 717 | + mmc-pwrseq = <&sdio_pwrseq>; 718 | + non-removable; 719 | + pinctrl-names = "default"; 720 | + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; 721 | + sd-uhs-sdr104; 722 | + status = "okay"; 723 | +}; 724 | + 725 | +&sdmmc { 726 | + bus-width = <4>; 727 | + cap-mmc-highspeed; 728 | + cap-sd-highspeed; 729 | + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; 730 | + max-frequency = <150000000>; 731 | + pinctrl-names = "default"; 732 | + pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>; 733 | + status = "okay"; 734 | +}; 735 | + 736 | +&sdhci { 737 | + max-frequency = <150000000>; 738 | + bus-width = <8>; 739 | + mmc-hs400-1_8v; 740 | + mmc-hs400-enhanced-strobe; 741 | + non-removable; 742 | + status = "okay"; 743 | +}; 744 | + 745 | +&tcphy0 { 746 | + status = "okay"; 747 | +}; 748 | + 749 | +&tcphy1 { 750 | + status = "okay"; 751 | +}; 752 | + 753 | +&tsadc { 754 | + status = "okay"; 755 | + rockchip,hw-tshut-temp = <120000>; 756 | + /* tshut mode 0:CRU 1:GPIO */ 757 | + rockchip,hw-tshut-mode = <1>; 758 | + /* tshut polarity 0:LOW 1:HIGH */ 759 | + rockchip,hw-tshut-polarity = <1>; 760 | +}; 761 | + 762 | +&u2phy0 { 763 | + status = "okay"; 764 | +}; 765 | + 766 | +&u2phy0_otg { 767 | + status = "okay"; 768 | +}; 769 | + 770 | +&u2phy0_host { 771 | + status = "okay"; 772 | +}; 773 | + 774 | +&u2phy1 { 775 | + status = "okay"; 776 | +}; 777 | + 778 | +&u2phy1_otg { 779 | + status = "okay"; 780 | +}; 781 | + 782 | +&u2phy1_host { 783 | + status = "okay"; 784 | +}; 785 | + 786 | +&uart0 { 787 | + pinctrl-names = "default"; 788 | + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; 789 | +}; 790 | + 791 | +&uart2 { 792 | + status = "okay"; 793 | +}; 794 | + 795 | +&usb_host0_ehci { 796 | + status = "okay"; 797 | +}; 798 | + 799 | +&usb_host0_ohci { 800 | + status = "okay"; 801 | +}; 802 | + 803 | +&usb_host1_ehci { 804 | + status = "okay"; 805 | +}; 806 | + 807 | +&usb_host1_ohci { 808 | + status = "okay"; 809 | +}; 810 | + 811 | +&usbdrd3_0 { 812 | + status = "okay"; 813 | +}; 814 | + 815 | +&usbdrd_dwc3_0 { 816 | + status = "okay"; 817 | + dr_mode = "host"; 818 | +}; 819 | + 820 | +&usbdrd3_1 { 821 | + status = "okay"; 822 | +}; 823 | + 824 | +&usbdrd_dwc3_1 { 825 | + status = "okay"; 826 | + dr_mode = "host"; 827 | +}; 828 | + 829 | +&vopb { 830 | + status = "okay"; 831 | +}; 832 | + 833 | +&vopb_mmu { 834 | + status = "okay"; 835 | +}; 836 | + 837 | +&vopl { 838 | + status = "okay"; 839 | +}; 840 | + 841 | +&vopl_mmu { 842 | + status = "okay"; 843 | +}; 844 | -------------------------------------------------------------------------------- /kernel-patch/beta/deprecated-patches/6.12.y-301-dts-add-rockchip-rk3568-alark35-3500-dtb.patch: -------------------------------------------------------------------------------- 1 | From 457ac631dd43a4bf5b807384deacbd85585a414c Mon Sep 17 00:00:00 2001 2 | From: xxx <68696949+xxx@users.noreply.github.com> 3 | Date: Wed, 21 May 2025 14:04:33 +0800 4 | Subject: [PATCH] arch: arm64: rockchip: add rk3568-alark35-3500.dtb 5 | 6 | --- 7 | arch/arm64/boot/dts/rockchip/Makefile | 1 + 8 | .../boot/dts/rockchip/rk3568-alark35-3500.dts | 1162 +++++++++++++++++ 9 | 2 files changed, 1163 insertions(+) 10 | create mode 100644 arch/arm64/boot/dts/rockchip/rk3568-alark35-3500.dts 11 | 12 | diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile 13 | index 5e077b5f1..331b939bc 100644 14 | --- a/arch/arm64/boot/dts/rockchip/Makefile 15 | +++ b/arch/arm64/boot/dts/rockchip/Makefile 16 | @@ -143,6 +143,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-bigtreetech-cb2-manta.dtb 17 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-bigtreetech-pi2.dtb 18 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-jp-tvbox.dtb 19 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-panther-x2.dtb 20 | +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-alark35-3500.dtb 21 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-bpi-r2-pro.dtb 22 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-dg-tn3568.dtb 23 | dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-ec-x.dtb 24 | diff --git a/arch/arm64/boot/dts/rockchip/rk3568-alark35-3500.dts b/arch/arm64/boot/dts/rockchip/rk3568-alark35-3500.dts 25 | new file mode 100644 26 | index 000000000..24347d1d7 27 | --- /dev/null 28 | +++ b/arch/arm64/boot/dts/rockchip/rk3568-alark35-3500.dts 29 | @@ -0,0 +1,1162 @@ 30 | +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 31 | +/* 32 | + * Copyright (c) 2020 Rockchip Electronics Co., Ltd. 33 | + * 34 | + */ 35 | +/dts-v1/; 36 | +#include 37 | +#include 38 | +#include 39 | +#include 40 | +#include "rk3568.dtsi" 41 | + 42 | +/ { 43 | + compatible = "rockchip,RK3568 Alark35-3500 hdmi Board", "rockchip,rk3568"; 44 | + model = "Rockchip RK3568 Alark35-3500 hdmi Board"; 45 | + aliases { 46 | + ethernet0 = &gmac1; 47 | + mmc0 = &sdmmc0; 48 | + mmc1 = &sdhci; 49 | + }; 50 | + //earlycon=uart8250,mmio32,0xfe660000 console=ttyFIQ0 51 | + /delete-node/ chosen; 52 | + 53 | + dc_12v: dc-12v { 54 | + compatible = "regulator-fixed"; 55 | + regulator-name = "dc_12v"; 56 | + regulator-always-on; 57 | + regulator-boot-on; 58 | + regulator-min-microvolt = <12000000>; 59 | + regulator-max-microvolt = <12000000>; 60 | + }; 61 | + vcc3v3_sys: vcc3v3-sys { 62 | + compatible = "regulator-fixed"; 63 | + regulator-name = "vcc3v3_sys"; 64 | + regulator-always-on; 65 | + regulator-boot-on; 66 | + regulator-min-microvolt = <3300000>; 67 | + regulator-max-microvolt = <3300000>; 68 | + vin-supply = <&dc_12v>; 69 | + }; 70 | + vcc5v0_sys: vcc5v0-sys { 71 | + compatible = "regulator-fixed"; 72 | + regulator-name = "vcc5v0_sys"; 73 | + regulator-always-on; 74 | + regulator-boot-on; 75 | + regulator-min-microvolt = <5000000>; 76 | + regulator-max-microvolt = <5000000>; 77 | + vin-supply = <&dc_12v>; 78 | + }; 79 | + vcc5v0_usb: vcc5v0-usb { 80 | + compatible = "regulator-fixed"; 81 | + regulator-name = "vcc5v0_usb"; 82 | + regulator-always-on; 83 | + regulator-boot-on; 84 | + regulator-min-microvolt = <5000000>; 85 | + regulator-max-microvolt = <5000000>; 86 | + vin-supply = <&dc_12v>; 87 | + }; 88 | + 89 | + vcc5v0_host: ostvcc5v0-host-regulator { 90 | + compatible = "regulator-fixed"; 91 | + regulator-name = "vcc5v0_host"; 92 | + regulator-boot-on; 93 | + regulator-always-on; 94 | + regulator-min-microvolt = <5000000>; 95 | + regulator-max-microvolt = <5000000>; 96 | + enable-active-high; 97 | + gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; 98 | + vin-supply = <&vcc5v0_usb>; 99 | + pinctrl-names = "default"; 100 | + pinctrl-0 = <&vcc5v0_host_en>; 101 | + }; 102 | + 103 | + vcc5v0_otg: vcc5v0-otg-regulator { 104 | + compatible = "regulator-fixed"; 105 | + regulator-name = "vcc5v0_otg"; 106 | + regulator-min-microvolt = <5000000>; 107 | + regulator-max-microvolt = <5000000>; 108 | + enable-active-high; 109 | + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; 110 | + vin-supply = <&vcc5v0_usb>; 111 | + pinctrl-names = "default"; 112 | + pinctrl-0 = <&vcc5v0_otg_en>; 113 | + }; 114 | + vcc2v5_sys: vcc2v5-ddr { 115 | + compatible = "regulator-fixed"; 116 | + regulator-name = "vcc2v5-sys"; 117 | + regulator-always-on; 118 | + regulator-boot-on; 119 | + regulator-min-microvolt = <2500000>; 120 | + regulator-max-microvolt = <2500000>; 121 | + vin-supply = <&vcc3v3_sys>; 122 | + }; 123 | + 124 | + qsgmii_3v3: gpio-regulator { 125 | + compatible = "regulator-gpio"; 126 | + regulator-name = "qsgmii_3v3"; 127 | + regulator-min-microvolt = <32768>; 128 | + regulator-max-microvolt = <3300000>; 129 | + gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; 130 | + gpios-states = <0x1>; 131 | + states = <32768 0x0 3300000 0x1>; 132 | + }; 133 | + 134 | + vcc3v3_bu: vcc3v3-bu { 135 | + compatible = "regulator-fixed"; 136 | + regulator-name = "vcc3v3_bu"; 137 | + regulator-always-on; 138 | + regulator-boot-on; 139 | + regulator-min-microvolt = <3300000>; 140 | + regulator-max-microvolt = <3300000>; 141 | + vin-supply = <&vcc5v0_sys>; 142 | + }; 143 | + vcc3v3_lcd0_n: vcc3v3-lcd0-n { 144 | + compatible = "regulator-fixed"; 145 | + regulator-name = "vcc3v3_lcd0_n"; 146 | + regulator-boot-on; 147 | + regulator-min-microvolt = <3300000>; 148 | + regulator-max-microvolt = <3300000>; 149 | + enable-active-high; 150 | + gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>; 151 | + vin-supply = <&vcc3v3_sys>; 152 | + regulator-state-mem { 153 | + regulator-off-in-suspend; 154 | + }; 155 | + }; 156 | + 157 | + //todo 158 | + /* 159 | + sdio-pwrseq { 160 | + compatible = "mmc-pwrseq-simple"; 161 | + clocks = <0x134 0x1>; 162 | + clock-names = "ext_clock"; 163 | + pinctrl-names = "default"; 164 | + pinctrl-0 = <0x135>; 165 | + post-power-on-delay-ms = <0xc8>; 166 | + reset-gpios = <0x136 0x9 0x1>; 167 | + status = "okay"; 168 | + phandle = <0xbe>; 169 | + }; 170 | + 171 | + wireless-wlan { 172 | + compatible = "wlan-platdata"; 173 | + rockchip,grf = <0x33>; 174 | + wifi_chip_type = "ap6212"; 175 | + sdio_vref = <0x708>; 176 | + WIFI,poweren_gpio = <0xe0 0x14 0x0>; 177 | + WIFI,host_wake_irq = <0x136 0xa 0x0>; 178 | + status = "okay"; 179 | + phandle = <0x1e5>; 180 | + }; 181 | + 182 | + wireless-bluetooth { 183 | + compatible = "bluetooth-platdata"; 184 | + clocks = <0x134 0x1>; 185 | + clock-names = "ext_clock"; 186 | + uart_rts_gpios = <0x136 0xd 0x1>; 187 | + pinctrl-names = "default", "rts_gpio"; 188 | + pinctrl-0 = <0x137>; 189 | + pinctrl-1 = <0x138>; 190 | + BT,reset_gpio = <0x136 0xf 0x0>; 191 | + BT,wake_gpio = <0x136 0x11 0x0>; 192 | + BT,wake_host_irq = <0x136 0x10 0x0>; 193 | + status = "okay"; 194 | + phandle = <0x1e6>; 195 | + };*/ 196 | + /* 197 | + phone_option { 198 | + compatible = "phone_option"; 199 | + 4g_reset_gpio = <0x82 0x1a 0x0>; 200 | + 4g_pwr_gpio = <0x37 0x16 0x0>; 201 | + status = "okay"; 202 | + }; 203 | + 204 | + ala-gpio { 205 | + compatible = "ala-gpio"; 206 | + dev_name = "ala-gpio"; 207 | + status = "okay"; 208 | + ala_gpio_1 = <0x40 0x19 0x0>; 209 | + ala_gpio_2 = <0x40 0x1a 0x0>; 210 | + ala_gpio_3 = <0x40 0x1b 0x0>; 211 | + ala_gpio_4 = <0x40 0x1c 0x0>; 212 | + ala_gpio_5 = <0x37 0xf 0x0>; 213 | + ala_gpio_6 = <0x82 0x19 0x0>; 214 | + ala_gpio_7 = <0x82 0x1b 0x0>; 215 | + ala_gpio_8 = <0xe0 0x1a 0x0>; 216 | + ala_gpio_9 = <0xc8>; 217 | + ala_gpio_10 = <0xc9>; 218 | + ala_gpio_11 = <0xca>; 219 | + ala_gpio_12 = <0xcb>; 220 | + ala_gpio_13 = <0xcc>; 221 | + ala_gpio_14 = <0xcd>; 222 | + ala_gpio_15 = <0xd0>; 223 | + ala_gpio_16 = <0xd1>; 224 | + };*/ 225 | + gpio-keys { 226 | + status = "disabled"; 227 | + compatible = "gpio-keys"; 228 | + autorepeat; 229 | + 230 | + vol-up-key { 231 | + gpios = <&gpio0 0x1e 0x1>; 232 | + linux,code = <0x73>; 233 | + label = "volume up"; 234 | + }; 235 | + 236 | + back-key { 237 | + gpios = <&gpio0 0x1c 0x1>; 238 | + linux,code = <0x9e>; 239 | + label = "back"; 240 | + }; 241 | + }; 242 | + 243 | + gmac1_clkin: external-gmac1-clock { 244 | + compatible = "fixed-clock"; 245 | + clock-frequency = <50000000>; 246 | + clock-output-names = "gmac1_clkin"; 247 | + #clock-cells = <0x0>; 248 | + }; 249 | + hdmi-con { 250 | + compatible = "hdmi-connector"; 251 | + type = "a"; 252 | + 253 | + port { 254 | + hdmi_con_in: endpoint { 255 | + remote-endpoint = <&hdmi_out_con>; 256 | + }; 257 | + }; 258 | + }; 259 | + /* 260 | + test-power { 261 | + status = "okay"; 262 | + };*/ 263 | + 264 | +}; 265 | +&xpcs { 266 | + status = "okay"; 267 | +}; 268 | +//50M时钟 269 | +/* 270 | +&gmac1_clkin { 271 | + clock-frequency = <50000000>; 272 | +};*/ 273 | +&gmac1 { 274 | + status = "okay"; 275 | + phy-supply = <&qsgmii_3v3>; 276 | + phy-mode = "rmii"; 277 | + clock_in_out = "input"; 278 | + snps,reset-gpio = <&gpio3 RK_PD7 GPIO_ACTIVE_LOW>; 279 | + snps,reset-active-low; 280 | + snps,reset-delays-us = <0 20000 100000>; 281 | + assigned-clocks = <&cru SCLK_GMAC1_RX_TX &cru SCLK_GMAC1>; 282 | + assigned-clock-parents = <&cru SCLK_GMAC1_RMII_SPEED &gmac1_clkin>; 283 | + pinctrl-names = "default"; 284 | + pinctrl-0 = <&gmac1m1_miim &gmac1m1_clkinout &gmac1m1_rx_bus2 &gmac1m1_tx_bus2>; 285 | + phy-handle = <&rmii_phy0>; 286 | +}; 287 | +&mdio1 { 288 | + rmii_phy0: ethernet-phy@0 { 289 | + compatible = "ethernet-phy-ieee802.3-c22"; 290 | + reg = <0x0>; 291 | + }; 292 | +}; 293 | +/* 294 | +&combphy0_us { 295 | + status = "okay"; 296 | +}; 297 | + 298 | +&combphy1_usq { 299 | + status = "okay"; 300 | +}; 301 | + 302 | +&combphy2_psq { 303 | + status = "okay"; 304 | +}; 305 | +*/ 306 | + 307 | +&combphy0 { 308 | + /* used for USB3 */ 309 | + status = "okay"; 310 | +}; 311 | + 312 | +&combphy1 { 313 | + /* used for USB3 */ 314 | + status = "okay"; 315 | +}; 316 | + 317 | +&combphy2 { 318 | + /* used for SATA */ 319 | + status = "okay"; 320 | +}; 321 | +/* 322 | +&bus_npu { 323 | + bus-supply = <&vdd_logic>; 324 | + pvtm-supply = <&vdd_cpu>; 325 | + status = "okay"; 326 | +};*/ 327 | + 328 | +&cpu0 { 329 | + cpu-supply = <&vdd_cpu>; 330 | +}; 331 | + 332 | +&cpu0_opp_table { 333 | + 334 | +}; 335 | + 336 | +&cpu1 { 337 | +}; 338 | + 339 | +&cpu2 { 340 | +}; 341 | + 342 | +&cpu3 { 343 | +}; 344 | +/* 345 | +&dfi { 346 | + status = "okay"; 347 | +};*/ 348 | + 349 | +/* 350 | +&dmc { 351 | + center-supply = <&vdd_logic>; 352 | + status = "okay"; 353 | +};*/ 354 | + 355 | + 356 | +&gpu { 357 | + clock-names = "gpu", "bus"; 358 | + interrupt-names = "gpu", "mmu", "job"; 359 | + mali-supply = <&vdd_gpu>; 360 | + status = "okay"; 361 | +}; 362 | +/* 363 | +&hdmi { 364 | + status = "okay"; 365 | + rockchip,phy-table = 366 | + <92812500 0x8009 0x0000 0x0270>, 367 | + <165000000 0x800b 0x0000 0x026d>, 368 | + <185625000 0x800b 0x0000 0x01ed>, 369 | + <297000000 0x800b 0x0000 0x01ad>, 370 | + <594000000 0x8029 0x0000 0x0088>, 371 | + <000000000 0x0000 0x0000 0x0000>; 372 | +}; 373 | + 374 | +&hdmi_in { 375 | + status = "okay"; 376 | +}; 377 | + 378 | +&hdmi_out { 379 | + status = "disabled"; 380 | +};*/ 381 | +&hdmi { 382 | + avdd-0v9-supply = <&vdda0v9_image>; 383 | + avdd-1v8-supply = <&vcca1v8_image>; 384 | + status = "okay"; 385 | +}; 386 | + 387 | +&hdmi_in { 388 | + hdmi_in_vp0: endpoint { 389 | + remote-endpoint = <&vp0_out_hdmi>; 390 | + }; 391 | +}; 392 | + 393 | +&hdmi_out { 394 | + hdmi_out_con: endpoint { 395 | + remote-endpoint = <&hdmi_con_in>; 396 | + }; 397 | +}; 398 | + 399 | +&i2c0 { 400 | + status = "okay"; 401 | + 402 | + vdd_cpu: tcs4525@1c { 403 | + compatible = "tcs,tcs4525"; 404 | + reg = <0x1c>; 405 | + vin-supply = <&vcc5v0_sys>; 406 | + regulator-compatible = "fan53555-reg"; 407 | + regulator-name = "vdd_cpu"; 408 | + regulator-min-microvolt = <712500>; 409 | + regulator-max-microvolt = <1390000>; 410 | + regulator-init-microvolt = <900000>; 411 | + regulator-ramp-delay = <2300>; 412 | + fcs,suspend-voltage-selector = <1>; 413 | + regulator-boot-on; 414 | + regulator-always-on; 415 | + regulator-state-mem { 416 | + regulator-off-in-suspend; 417 | + }; 418 | + }; 419 | + 420 | + rk809: pmic@20 { 421 | + compatible = "rockchip,rk809"; 422 | + reg = <0x20>; 423 | + interrupt-parent = <&gpio0>; 424 | + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; 425 | + 426 | + pinctrl-names = "default", "pmic-sleep", 427 | + "pmic-power-off", "pmic-reset"; 428 | + pinctrl-0 = <&pmic_int>; 429 | + pinctrl-1 = <&soc_slppin_slp>, <&rk817_slppin_slp>; 430 | + pinctrl-2 = <&soc_slppin_gpio>, <&rk817_slppin_pwrdn>; 431 | + pinctrl-3 = <&soc_slppin_gpio>, <&rk817_slppin_rst>; 432 | + 433 | + rockchip,system-power-controller; 434 | + wakeup-source; 435 | + #clock-cells = <1>; 436 | + clock-output-names = "rk808-clkout1", "rk808-clkout2"; 437 | + //fb-inner-reg-idxs = <2>; 438 | + /* 1: rst regs (default in codes), 0: rst the pmic */ 439 | + pmic-reset-func = <0>; 440 | + /* not save the PMIC_POWER_EN register in uboot */ 441 | + not-save-power-en = <1>; 442 | + 443 | + vcc1-supply = <&vcc3v3_sys>; 444 | + vcc2-supply = <&vcc3v3_sys>; 445 | + vcc3-supply = <&vcc3v3_sys>; 446 | + vcc4-supply = <&vcc3v3_sys>; 447 | + vcc5-supply = <&vcc3v3_sys>; 448 | + vcc6-supply = <&vcc3v3_sys>; 449 | + vcc7-supply = <&vcc3v3_sys>; 450 | + vcc8-supply = <&vcc3v3_sys>; 451 | + vcc9-supply = <&vcc3v3_sys>; 452 | + 453 | + pwrkey { 454 | + status = "okay"; 455 | + }; 456 | + 457 | + pinctrl_rk8xx: pinctrl_rk8xx { 458 | + gpio-controller; 459 | + #gpio-cells = <2>; 460 | + 461 | + rk817_slppin_null: rk817_slppin_null { 462 | + pins = "gpio_slp"; 463 | + function = "pin_fun0"; 464 | + }; 465 | + 466 | + rk817_slppin_slp: rk817_slppin_slp { 467 | + pins = "gpio_slp"; 468 | + function = "pin_fun1"; 469 | + }; 470 | + 471 | + rk817_slppin_pwrdn: rk817_slppin_pwrdn { 472 | + pins = "gpio_slp"; 473 | + function = "pin_fun2"; 474 | + }; 475 | + 476 | + rk817_slppin_rst: rk817_slppin_rst { 477 | + pins = "gpio_slp"; 478 | + function = "pin_fun3"; 479 | + }; 480 | + }; 481 | + 482 | + regulators { 483 | + vdd_logic: DCDC_REG1 { 484 | + regulator-always-on; 485 | + regulator-boot-on; 486 | + regulator-min-microvolt = <500000>; 487 | + regulator-max-microvolt = <1350000>; 488 | + regulator-init-microvolt = <900000>; 489 | + regulator-ramp-delay = <6001>; 490 | + regulator-initial-mode = <0x2>; 491 | + regulator-name = "vdd_logic"; 492 | + regulator-state-mem { 493 | + //regulator-off-in-suspend; 494 | + // 强制开启电源 495 | + regulator-on-in-suspend; 496 | + }; 497 | + }; 498 | + 499 | + vdd_gpu: DCDC_REG2 { 500 | + regulator-always-on; 501 | + regulator-boot-on; 502 | + regulator-min-microvolt = <500000>; 503 | + regulator-max-microvolt = <1350000>; 504 | + regulator-init-microvolt = <900000>; 505 | + regulator-ramp-delay = <6001>; 506 | + regulator-initial-mode = <0x2>; 507 | + regulator-name = "vdd_gpu"; 508 | + regulator-state-mem { 509 | + //regulator-off-in-suspend; 510 | + // 强制开启电源 511 | + regulator-on-in-suspend; 512 | + }; 513 | + }; 514 | + 515 | + vcc_ddr: DCDC_REG3 { 516 | + regulator-always-on; 517 | + regulator-boot-on; 518 | + regulator-initial-mode = <0x2>; 519 | + regulator-name = "vcc_ddr"; 520 | + regulator-state-mem { 521 | + //regulator-on-in-suspend; 522 | + // 强制开启电源 523 | + regulator-on-in-suspend; 524 | + }; 525 | + }; 526 | + 527 | + vdd_npu: DCDC_REG4 { 528 | + regulator-always-on; 529 | + regulator-boot-on; 530 | + regulator-min-microvolt = <500000>; 531 | + regulator-max-microvolt = <1350000>; 532 | + regulator-init-microvolt = <900000>; 533 | + regulator-ramp-delay = <6001>; 534 | + regulator-initial-mode = <0x2>; 535 | + regulator-name = "vdd_npu"; 536 | + regulator-state-mem { 537 | + //regulator-off-in-suspend; 538 | + // 强制开启电源 539 | + regulator-on-in-suspend; 540 | + }; 541 | + }; 542 | + 543 | + vdda0v9_image: LDO_REG1 { 544 | + regulator-boot-on; 545 | + regulator-always-on; 546 | + regulator-min-microvolt = <900000>; 547 | + regulator-max-microvolt = <900000>; 548 | + regulator-name = "vdda0v9_image"; 549 | + regulator-state-mem { 550 | + //regulator-off-in-suspend; 551 | + // 强制开启电源 552 | + regulator-on-in-suspend; 553 | + }; 554 | + }; 555 | + 556 | + vdda_0v9: LDO_REG2 { 557 | + regulator-always-on; 558 | + regulator-boot-on; 559 | + regulator-min-microvolt = <900000>; 560 | + regulator-max-microvolt = <900000>; 561 | + regulator-name = "vdda_0v9"; 562 | + regulator-state-mem { 563 | + //regulator-off-in-suspend; 564 | + // 强制开启电源 565 | + regulator-on-in-suspend; 566 | + }; 567 | + }; 568 | + 569 | + vdda0v9_pmu: LDO_REG3 { 570 | + regulator-always-on; 571 | + regulator-boot-on; 572 | + regulator-min-microvolt = <900000>; 573 | + regulator-max-microvolt = <900000>; 574 | + regulator-name = "vdda0v9_pmu"; 575 | + regulator-state-mem { 576 | + regulator-on-in-suspend; 577 | + //regulator-suspend-microvolt = <900000>; 578 | + // 强制开启电源 579 | + //regulator-on-in-suspend; 580 | + }; 581 | + }; 582 | + 583 | + vccio_acodec: LDO_REG4 { 584 | + regulator-always-on; 585 | + regulator-boot-on; 586 | + regulator-min-microvolt = <3300000>; 587 | + regulator-max-microvolt = <3300000>; 588 | + regulator-name = "vccio_acodec"; 589 | + regulator-state-mem { 590 | + //regulator-off-in-suspend; 591 | + // 强制开启电源 592 | + regulator-on-in-suspend; 593 | + }; 594 | + }; 595 | + 596 | + vccio_sd: LDO_REG5 { 597 | + regulator-always-on; 598 | + regulator-boot-on; 599 | + regulator-min-microvolt = <1800000>; 600 | + regulator-max-microvolt = <3300000>; 601 | + regulator-name = "vccio_sd"; 602 | + regulator-state-mem { 603 | + //regulator-off-in-suspend; 604 | + // 强制开启电源 605 | + regulator-on-in-suspend; 606 | + }; 607 | + }; 608 | + 609 | + vcc3v3_pmu: LDO_REG6 { 610 | + regulator-always-on; 611 | + regulator-boot-on; 612 | + regulator-min-microvolt = <3300000>; 613 | + regulator-max-microvolt = <3300000>; 614 | + regulator-name = "vcc3v3_pmu"; 615 | + regulator-state-mem { 616 | + regulator-on-in-suspend; 617 | + regulator-suspend-microvolt = <3300000>; 618 | + }; 619 | + }; 620 | + 621 | + vcca_1v8: LDO_REG7 { 622 | + regulator-always-on; 623 | + regulator-boot-on; 624 | + regulator-min-microvolt = <1800000>; 625 | + regulator-max-microvolt = <1800000>; 626 | + regulator-name = "vcca_1v8"; 627 | + regulator-state-mem { 628 | + //regulator-off-in-suspend; 629 | + // 强制开启电源 630 | + regulator-on-in-suspend; 631 | + }; 632 | + }; 633 | + 634 | + vcca1v8_pmu: LDO_REG8 { 635 | + regulator-always-on; 636 | + regulator-boot-on; 637 | + regulator-min-microvolt = <1800000>; 638 | + regulator-max-microvolt = <1800000>; 639 | + regulator-name = "vcca1v8_pmu"; 640 | + regulator-state-mem { 641 | + regulator-on-in-suspend; 642 | + regulator-suspend-microvolt = <1800000>; 643 | + }; 644 | + }; 645 | + 646 | + vcca1v8_image: LDO_REG9 { 647 | + regulator-always-on; 648 | + regulator-boot-on; 649 | + regulator-min-microvolt = <1800000>; 650 | + regulator-max-microvolt = <1800000>; 651 | + regulator-name = "vcca1v8_image"; 652 | + regulator-state-mem { 653 | + //regulator-off-in-suspend; 654 | + // 强制开启电源 655 | + regulator-on-in-suspend; 656 | + }; 657 | + }; 658 | + 659 | + vcc_1v8: DCDC_REG5 { 660 | + regulator-always-on; 661 | + regulator-boot-on; 662 | + regulator-min-microvolt = <1800000>; 663 | + regulator-max-microvolt = <1800000>; 664 | + regulator-name = "vcc_1v8"; 665 | + regulator-state-mem { 666 | + //regulator-off-in-suspend; 667 | + // 强制开启电源 668 | + regulator-on-in-suspend; 669 | + }; 670 | + }; 671 | + 672 | + vcc_3v3: SWITCH_REG1 { 673 | + regulator-always-on; 674 | + regulator-boot-on; 675 | + regulator-name = "vcc_3v3"; 676 | + regulator-state-mem { 677 | + //regulator-off-in-suspend; 678 | + // 强制开启电源 679 | + regulator-on-in-suspend; 680 | + }; 681 | + }; 682 | + 683 | + vcc3v3_sd: SWITCH_REG2 { 684 | + regulator-always-on; 685 | + regulator-boot-on; 686 | + regulator-name = "vcc3v3_sd"; 687 | + regulator-state-mem { 688 | + //regulator-off-in-suspend; 689 | + // 强制开启电源 690 | + regulator-on-in-suspend; 691 | + }; 692 | + }; 693 | + }; 694 | + /* 695 | + rk809_codec: codec { 696 | + #sound-dai-cells = <1>; 697 | + compatible = "rockchip,rk809-codec", "rockchip,rk817-codec"; 698 | + clocks = <&cru I2S1_MCLKOUT>; 699 | + clock-names = "mclk"; 700 | + assigned-clocks = <&cru I2S1_MCLKOUT>, <&cru I2S1_MCLK_TX_IOE>; 701 | + assigned-clock-rates = <12288000>; 702 | + assigned-clock-parents = <&cru I2S1_MCLKOUT_TX>, <&cru I2S1_MCLKOUT_TX>; 703 | + pinctrl-names = "default"; 704 | + pinctrl-0 = <&i2s1m0_mclk>; 705 | + hp-volume = <20>; 706 | + spk-volume = <3>; 707 | + mic-in-differential; 708 | + status = "disabled"; 709 | + };*/ 710 | + }; 711 | +}; 712 | + 713 | +// debug tty,ttys2 714 | +&uart2 { 715 | + /* debug-uart */ 716 | + status = "okay"; 717 | +}; 718 | +&uart0 { 719 | + status = "okay"; 720 | +}; 721 | +&pwm3 { 722 | + compatible = "rockchip,remotectl-pwm"; 723 | + 724 | + status = "okay"; 725 | + remote_pwm_id = <0x3>; 726 | + handle_cpu_id = <0x1>; 727 | + remote_support_psci = <0x0>; 728 | + ir_key1 { 729 | + rockchip,usercode = <0x4040>; 730 | + rockchip,key_table = <0xf2 0xe8 0xba 0x9e 0xf4 0x67 0xf1 0x6c 0xef 0x69 0xee 0x6a 0xbd 0x66 0xea 0x73 0xe3 0x72 0xe2 0xd9 0xb2 0x74 0xbc 0x71 0xec 0x8b 0xbf 0x190 0xe0 0x191 0xe1 0x192 0xe9 0xb7 0xe6 0xf8 0xe8 0xb9 0xe7 0xba 0xf0 0x184 0xbe 0x175>; 731 | + }; 732 | + 733 | + ir_key2 { 734 | + rockchip,usercode = <0xff00>; 735 | + rockchip,key_table = <0xf9 0x66 0xbf 0x9e 0xfb 0x8b 0xaa 0xe8 0xb9 0x67 0xe9 0x6c 0xb8 0x69 0xea 0x6a 0xeb 0x72 0xef 0x73 0xf7 0x71 0xe7 0x74 0xfc 0x74 0xa9 0x72 0xa8 0x72 0xe0 0x72 0xa5 0x72 0xab 0xb7 0xb7 0x184 0xe8 0x184 0xf8 0xb8 0xaf 0xb9 0xed 0x72 0xee 0xba 0xb3 0x72 0xf1 0x72 0xf2 0x72 0xf3 0xd9 0xb4 0x72 0xbe 0xd9>; 736 | + }; 737 | + ir_key3 { 738 | + rockchip,usercode = <0x1dcc>; 739 | + rockchip,key_table = <0xee 0xe8 0xf0 0x9e 0xf8 0x67 0xbb 0x6c 0xef 0x69 0xed 0x6a 0xfc 0x66 0xf1 0x73 0xfd 0x72 0xb7 0xd9 0xff 0x74 0xf3 0x71 0xbf 0x8b 0xf9 0x191 0xf5 0x192 0xb3 0x184 0xbe 0x2 0xba 0x3 0xb2 0x4 0xbd 0x5 0xf9 0x6 0xb1 0x7 0xfc 0x8 0xf8 0x9 0xb0 0xa 0xb6 0xb 0xb5 0xe>; 740 | + }; 741 | +}; 742 | + 743 | +//power,ok 744 | +&power { 745 | + status = "okay"; 746 | + // 必须删除,不删除会 paninc, 747 | + ///delete-node/ power-domain@RK3568_PD_NPU; 748 | +}; 749 | +/* 750 | +&rockchip_suspend { 751 | + status = "okay"; 752 | +};*/ 753 | +/* 754 | +&iep { 755 | + status = "okay"; 756 | +}; 757 | + 758 | +&iep_mmu { 759 | + status = "okay"; 760 | +}; 761 | + 762 | +&jpegd { 763 | + status = "okay"; 764 | +}; 765 | + 766 | +&jpegd_mmu { 767 | + status = "okay"; 768 | +}; 769 | + 770 | +&mpp_srv { 771 | + status = "okay"; 772 | +};*/ 773 | + 774 | +&pinctrl { 775 | + pmic { 776 | + pmic_int: pmic_int { 777 | + rockchip,pins = 778 | + <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; 779 | + }; 780 | + 781 | + soc_slppin_gpio: soc_slppin_gpio { 782 | + rockchip,pins = 783 | + <0 RK_PA2 RK_FUNC_GPIO &pcfg_output_low>; 784 | + }; 785 | + 786 | + soc_slppin_slp: soc_slppin_slp { 787 | + rockchip,pins = 788 | + <0 RK_PA2 1 &pcfg_pull_none>; 789 | + }; 790 | + 791 | + soc_slppin_rst: soc_slppin_rst { 792 | + rockchip,pins = 793 | + <0 RK_PA2 2 &pcfg_pull_none>; 794 | + }; 795 | + }; 796 | + 797 | + 798 | + usb { 799 | + vcc5v0_host_en: vcc5v0-host-en { 800 | + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; 801 | + }; 802 | + 803 | + vcc5v0_otg_en: vcc5v0-otg-en { 804 | + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; 805 | + }; 806 | + }; 807 | + 808 | + wireless-bluetooth { 809 | + uart8_gpios: uart8-gpios { 810 | + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; 811 | + }; 812 | + }; 813 | +}; 814 | + 815 | + /* 816 | + * There are 10 independent IO domains in RK3566/RK3568, including PMUIO[0:2] and VCCIO[1:7]. 817 | + * 1/ PMUIO0 and PMUIO1 are fixed-level power domains which cannot be configured; 818 | + * 2/ PMUIO2 and VCCIO1,VCCIO[3:7] domains require that their hardware power supply voltages 819 | + * must be consistent with the software configuration correspondingly 820 | + * a/ When the hardware IO level is connected to 1.8V, the software voltage configuration 821 | + * should also be configured to 1.8V accordingly; 822 | + * b/ When the hardware IO level is connected to 3.3V, the software voltage configuration 823 | + * should also be configured to 3.3V accordingly; 824 | + * 3/ VCCIO2 voltage control selection (0xFDC20140) 825 | + * BIT[0]: 0x0: from GPIO_0A7 (default) 826 | + * BIT[0]: 0x1: from GRF 827 | + * Default is determined by Pin FLASH_VOL_SEL/GPIO0_A7: 828 | + * L:VCCIO2 must supply 3.3V 829 | + * H:VCCIO2 must supply 1.8V 830 | + */ 831 | +/* 832 | +pmuio2-supply = <0x2a>; 833 | +vccio1-supply = <0x2b>; 834 | +vccio3-supply = <0x2c>; 835 | +vccio4-supply = <0x2d>; 836 | +vccio5-supply = <0x2e>; 837 | +vccio6-supply = <0x2e>; 838 | +vccio7-supply = <0x2e>;*/ 839 | + 840 | +&pmu_io_domains { 841 | + status = "okay"; 842 | + pmuio2-supply = <&vcc3v3_pmu>; 843 | + vccio1-supply = <&vccio_acodec>; 844 | + vccio3-supply = <&vccio_sd>; 845 | + vccio4-supply = <&vcc_1v8>; 846 | + vccio5-supply = <&vcc_3v3>; 847 | + vccio6-supply = <&vcc_3v3>; 848 | + vccio7-supply = <&vcc_3v3>; 849 | +}; 850 | +/* 851 | +&rk_rga { 852 | + status = "okay"; 853 | +}; 854 | + 855 | +&rkvdec { 856 | + status = "okay"; 857 | +}; 858 | + 859 | +&rkvdec_mmu { 860 | + status = "okay"; 861 | +}; 862 | + 863 | +&rkvenc { 864 | + venc-supply = <&vdd_logic>; 865 | + status = "okay"; 866 | +}; 867 | + 868 | +&rkvenc_mmu { 869 | + status = "okay"; 870 | +};*/ 871 | + 872 | +//&rknpu { 873 | +// rknpu-supply = <&vdd_npu>; 874 | +// status = "okay"; 875 | + ///delete-node/ power-domains; 876 | + ///delete-node/ operating-points-v2; 877 | +//}; 878 | + 879 | +//&rknpu_mmu { 880 | +// status = "okay"; 881 | + ///delete-node/ power-domains; 882 | +//}; 883 | +/* 884 | +&route_hdmi { 885 | + status = "okay"; 886 | + connect = <&vp0_out_hdmi>; 887 | +};*/ 888 | + 889 | +&saradc { 890 | + status = "okay"; 891 | + vref-supply = <&vcca_1v8>; 892 | +}; 893 | + 894 | +&sdhci { 895 | + bus-width = <8>; 896 | + no-sdio; 897 | + no-sd; 898 | + non-removable; 899 | + max-frequency = <200000000>; 900 | + full-pwr-cycle-in-suspend; 901 | + status = "okay"; 902 | +}; 903 | + 904 | +&sdmmc0 { 905 | + max-frequency = <150000000>; 906 | + no-sdio; 907 | + no-mmc; 908 | + bus-width = <4>; 909 | + cap-mmc-highspeed; 910 | + cap-sd-highspeed; 911 | + disable-wp; 912 | + sd-uhs-sdr104; 913 | + vmmc-supply = <&vcc3v3_sd>; 914 | + vqmmc-supply = <&vccio_sd>; 915 | + pinctrl-names = "default"; 916 | + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; 917 | + status = "okay"; 918 | +}; 919 | + 920 | +&sfc { 921 | + status = "okay"; 922 | +}; 923 | +/* 924 | +&spdif_8ch { 925 | + status = "okay"; 926 | +};*/ 927 | +&spdif{ 928 | + status = "okay"; 929 | +}; 930 | +&tsadc { 931 | + status = "okay"; 932 | +}; 933 | +/* 934 | +&u2phy0_host { 935 | + phy-supply = <&vcc5v0_host>; 936 | + status = "okay"; 937 | +}; 938 | + 939 | +&u2phy0_otg { 940 | + vbus-supply = <&vcc5v0_otg>; 941 | + status = "okay"; 942 | +}; 943 | + 944 | +&u2phy1_host { 945 | + phy-supply = <&vcc5v0_host>; 946 | + status = "okay"; 947 | +}; 948 | + 949 | +&u2phy1_otg { 950 | + phy-supply = <&vcc5v0_host>; 951 | + status = "okay"; 952 | +}; 953 | + 954 | +&usb2phy0 { 955 | + status = "okay"; 956 | +}; 957 | + 958 | +&usb2phy1 { 959 | + status = "okay"; 960 | +}; 961 | + 962 | +&usb_host0_ehci { 963 | + status = "okay"; 964 | +}; 965 | + 966 | +&usb_host0_ohci { 967 | + status = "okay"; 968 | +}; 969 | + 970 | +&usb_host1_ehci { 971 | + status = "okay"; 972 | +}; 973 | + 974 | +&usb_host1_ohci { 975 | + status = "okay"; 976 | +}; 977 | + 978 | +&usbdrd_dwc3 { 979 | + dr_mode = "otg"; 980 | + extcon = <&usb2phy0>; 981 | + status = "okay"; 982 | +}; 983 | + 984 | +&usbdrd30 { 985 | + status = "okay"; 986 | +}; 987 | + 988 | +&usbhost_dwc3 { 989 | + status = "okay"; 990 | +}; 991 | + 992 | +&usbhost30 { 993 | + status = "okay"; 994 | +}; 995 | +*/ 996 | + 997 | +&usb_host0_ehci { 998 | + status = "okay"; 999 | +}; 1000 | + 1001 | +&usb_host0_ohci { 1002 | + status = "okay"; 1003 | +}; 1004 | + 1005 | +&usb_host0_xhci { 1006 | + extcon = <&usb2phy0>; 1007 | + dr_mode = "host"; 1008 | + snps,dis_enblslpm_quirk; 1009 | + snps,dis-u1u2-quirk; 1010 | + snps,dis-u2-freeclk-exists-quirk; 1011 | + snps,dis-del-phy-power-chg-quirk; 1012 | + snps,dis-tx-ipgap-linecheck-quirk; 1013 | + snps,dis_rxdet_inp3_quirk; 1014 | + snps,xhci-trb-ent-quirk; 1015 | + status = "okay"; 1016 | +}; 1017 | + 1018 | +&usb_host1_ehci { 1019 | + status = "okay"; 1020 | +}; 1021 | + 1022 | +&usb_host1_ohci { 1023 | + status = "okay"; 1024 | +}; 1025 | + 1026 | +&usb_host1_xhci { 1027 | + status = "okay"; 1028 | +}; 1029 | + 1030 | +&usb2phy0 { 1031 | + status = "okay"; 1032 | +}; 1033 | + 1034 | +&usb2phy0_host { 1035 | + phy-supply = <&vcc5v0_host>; 1036 | + status = "okay"; 1037 | +}; 1038 | + 1039 | +&usb2phy0_otg { 1040 | + phy-supply = <&vcc5v0_otg>; 1041 | + status = "okay"; 1042 | +}; 1043 | +&usb2phy1 { 1044 | + /* USB for PCIe/M2 */ 1045 | + status = "okay"; 1046 | +}; 1047 | + 1048 | +&usb2phy1_host { 1049 | + phy-supply = <&vcc5v0_host>; 1050 | + status = "okay"; 1051 | +}; 1052 | + 1053 | +&usb2phy1_otg { 1054 | + phy-supply = <&vcc5v0_host>; 1055 | + status = "okay"; 1056 | +}; 1057 | +/* 1058 | +&u2phy0_host { 1059 | + phy-supply = <&vcc5v0_host>; 1060 | + status = "okay"; 1061 | +}; 1062 | + 1063 | +&u2phy0_otg { 1064 | + vbus-supply = <&vcc5v0_otg>; 1065 | + status = "okay"; 1066 | +}; 1067 | + 1068 | +&u2phy1_host { 1069 | + phy-supply = <&vcc5v0_host>; 1070 | + status = "okay"; 1071 | +}; 1072 | + 1073 | +&u2phy1_otg { 1074 | + phy-supply = <&vcc5v0_host>; 1075 | + status = "okay"; 1076 | +};*/ 1077 | +/* 1078 | +&vdpu { 1079 | + status = "okay"; 1080 | +};*/ 1081 | + 1082 | +&vpu { 1083 | + status = "okay"; 1084 | +}; 1085 | + 1086 | +&vdpu_mmu { 1087 | + status = "okay"; 1088 | +}; 1089 | + 1090 | +&vepu { 1091 | + status = "okay"; 1092 | +}; 1093 | + 1094 | +&vepu_mmu { 1095 | + status = "okay"; 1096 | +}; 1097 | +/* 1098 | +&vop { 1099 | + status = "okay"; 1100 | + vop-supply = <&vdd_logic>; 1101 | + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>, <&cru DCLK_VOP2>; 1102 | + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>, <&cru PLL_GPLL>; 1103 | +};*/ 1104 | +&vop { 1105 | + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; 1106 | + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; 1107 | + status = "okay"; 1108 | +}; 1109 | + 1110 | +&vop_mmu { 1111 | + status = "okay"; 1112 | +}; 1113 | + 1114 | +&vp0 { 1115 | + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { 1116 | + reg = ; 1117 | + remote-endpoint = <&hdmi_in_vp0>; 1118 | + }; 1119 | +}; 1120 | + 1121 | + 1122 | + 1123 | +&pcie2x1 { 1124 | + status = "okay"; 1125 | + //todo 1126 | + reset-gpios = <&gpio1 0xa 0x0>; 1127 | +}; 1128 | + 1129 | +&i2s0_8ch { 1130 | + status = "okay"; 1131 | +}; 1132 | + 1133 | +&i2s1_8ch { 1134 | + status = "okay"; 1135 | + rockchip,clk-trcm = <1>; 1136 | + pinctrl-names = "default"; 1137 | + pinctrl-0 = <&i2s1m0_sclktx 1138 | + &i2s1m0_lrcktx 1139 | + &i2s1m0_sdi0 1140 | + &i2s1m0_sdo0>; 1141 | +}; 1142 | + 1143 | +&i2c1 { 1144 | + status = "okay"; 1145 | + pcf8563: pcf8563@51 { 1146 | + compatible = "nxp,pcf8563"; 1147 | + status = "okay"; 1148 | + reg = <0x51>; 1149 | + #clock-cells = <0x0>; 1150 | + clock-output-names = "pcf8563_xin32k"; 1151 | + }; 1152 | +}; 1153 | + 1154 | +&i2c2 { 1155 | + alastm8s103: alastm8s103@76 { 1156 | + compatible = "stm,alastm8s103"; 1157 | + reg = <0x76>; 1158 | + gpio-base = <0xc8>; 1159 | + status = "okay"; 1160 | + }; 1161 | +}; 1162 | + 1163 | +&wdt { 1164 | + status = "okay"; 1165 | +}; 1166 | + 1167 | +&uart1 { 1168 | + status = "okay"; 1169 | +}; 1170 | + 1171 | +&uart3 { 1172 | + status = "okay"; 1173 | +}; 1174 | +&uart7 { 1175 | + status = "okay"; 1176 | +}; 1177 | + 1178 | +&uart9 { 1179 | + status = "okay"; 1180 | +}; 1181 | + 1182 | +&pwm5 { 1183 | + status = "okay"; 1184 | +}; 1185 | + 1186 | +&hdmi_sound { 1187 | + status = "okay"; 1188 | + simple-audio-card,mclk-fs = <128>; 1189 | +}; 1190 | + 1191 | + 1192 | --------------------------------------------------------------------------------