前言介绍本人新购入香橙派5 Max想运行大模型但是需要先升级NPU驱动到0.9.8所以开始了我的折腾之路这里是根据博客香橙派 RK3588 使用 RKLLM 更新 NPU 驱动教程 - 逸俊晨晖 - 博客园来自我重新搭建这个内核重新研究这个内核相关的东西所作的记录欢迎大家讨论板子信息和NPU驱动版本号orangepiorangepi5max:~$ screenfetch _,met$$$$$gg. orangepiorangepi5max ,g$$$$$$$$$$$$$$$P. OS: Debian 12 bookworm ,g$$P Y$$.. Kernel: aarch64 Linux 5.10.160-rockchip-rk3588 ,$$P $$$. Uptime: 2h 44m ,$$P ,ggs. $$b: Packages: 1612 d$$ ,$P . $$$ Shell: bash 5.2.15 $$P d$ , $$P Resolution: 1024x768 $$: $$. - ,d$$ DE: Xfce $$\; Y$b._ _,d$P WM: Xfwm4 Y$$. .Y$$$$P WM Theme: Numix $$b -.__ GTK Theme: Materia [GTK2] Y$$ Icon Theme: LoginIcons Y$$. Font: Sans 10 $$b. Disk: 16G / 241G (7%) Y$$b. CPU: ARM Cortex-A55 Cortex-A76 8x 1.8GHz Y$b._ GPU: llvmpipe (LLVM 15.0.6, 128 bits) RAM: 714MiB / 15970MiB orangepiorangepi5max:~$ sudo cat /sys/kernel/debug/rknpu/version [sudo] password for orangepi: RKNPU driver: v0.9.6一、NPU 驱动版本要求在文档《Rockchip_RKLLM_SDK_CN_1.2.1》中明确提到RKLLM 需要 NPU 内核版本为 v0.9.8若当前版本低于该要求则需进行更新。二、查询当前 NPU 版本通过以下命令查询设备当前的 NPU 内核版本cat /sys/kernel/debug/rknpu/version ---------------------------------------------------------- orangepiorangepi5max:~$ sudo cat /sys/kernel/debug/rknpu/version [sudo] password for orangepi: RKNPU driver: v0.9.6若版本为 v0.9.8则无需更新若版本低于 v0.9.8需按以下步骤更新。三、NPU 驱动更新步骤一准备工作下载驱动压缩包下载驱动包rknpu_driver_0.9.8_20241009.tar.bz2下载地址rknn-llm/rknpu-driver at main · airockchip/rknn-llm · GitHub#这里通过git或者github等方法下载驱动的文件 orangepiorangepi5max:git clone https://github.com/airockchip/rknn-llm.git orangepiorangepi5max:~/AIRockChip/rknn-llm$ tree rknpu-driver/ rknpu-driver/ └── rknpu_driver_0.9.8_20241009.tar.bz2 1 directory, 1 file二编译内核前的环境配置参考香橙派文档香橙派文档《OrangePi_5_Ultra_RK3588_用户手册_v1.0》建议通过以下方式配置编译环境在 PC 上安装 Ubuntu 22.04 虚拟机#如果是Windows系统使用WSL会报环境错误最好是Linux物理机或者安装一个虚拟机完成更换 APT 源加速软件下载安装必要工具并下载 Linux SDK 源码sudo apt-get update sudo apt-get install -y git \# 克隆源码仓库若下载慢可通过主机共享局域网代理加速 git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next三首次编译内核关闭自动同步进入源码目录并启动编译配置cd orangepi-build sudo ./build.sh---------------------- #最后几行编译完的log信息 #能看到编译的结果文件存放位置 patching file tools/include/tools/be_byteshift.h patching file tools/include/tools/le_byteshift.h dpkg-deb: building package linux-headers-current-rockchip-rk3588 in ../linux-headers-current-rockchip-rk3588_1.0.2_arm64.deb. dpkg-deb: building package linux-dtb-current-rockchip-rk3588 in ../linux-dtb-current-rockchip-rk3588_1.0.2_arm64.deb. dpkg-deb: building package linux-image-current-rockchip-rk3588 in ../linux-image-current-rockchip-rk3588_1.0.2_arm64.deb. dpkg-deb: building package linux-image-current-rockchip-rk3588-dbg in ../linux-image-current-rockchip-rk3588-dbg_1.0.2_arm64.deb. dpkg-genchanges: info: binary-only upload (no source code included) dpkg-buildpackage: info: binary-only upload (no source included) [ o.k. ] Kernel build done [ host ] [ o.k. ] Target directory [ /home/banana/orangepi-build/output/debs/ ] [ o.k. ] File name [ linux-image-current-rockchip-rk3588_1.0.2_arm64.deb ] [ o.k. ] Runtime [ 22 min ] [ o.k. ] Repeat Build Options [ sudo ./build.sh BOARDorangepi5max BRANCHcurrent BUILD_OPTkernel KERNEL_CONFIGUREno ] bananaubuntuserver:~/orangepi-build$按以下选项配置选择Kernel package内核包选择板卡orangepi5ultra选择do not change不修改内核配置开始首次编译目的是关闭源码自动同步关闭内核源码自动同步\# 编辑配置文件 vim userpatches/config-default.conf \# 将以下变量设置为yes IGNORE_UPDATESyes------------------------- #userpatches/config-default.conf内容如下 KERNEL_CONFIGURE # leave empty to select each time, set to yes or no to skip dialog prompt CLEAN_LEVELdebs,oldcache # comma-separated list of clean targets: make make clean for selected kernel and u-boot, # debs delete packages in ./output/debs for current branch and family, # alldebs delete all packages in ./output/debs, images delete ./output/images, # cache delete ./output/cache, sources delete ./sources # oldcache remove old cached rootfs except for the newest 8 files DEST_LANGen_US.UTF-8 # sl_SI.UTF-8, en_US.UTF-8 # advanced EXTERNAL_NEWprebuilt # compile and install or install prebuilt additional packages INSTALL_HEADERS # install kernel headers package LIB_TAGmaster # change to branchname to use any branch currently available. USE_TORRENTyes # use torrent network for faster toolchain and cache download DOWNLOAD_MIRRORchina # set to china to use mirrors.tuna.tsinghua.edu.cn BOARD BRANCH RELEASE WIREGUARDno BUILD_KSRCno INSTALL_KSRCno IGNORE_UPDATESyes COMPRESS_OUTPUTIMAGEno NO_APT_CACHERyes GITEE_SERVERno #install_balena_etcheryes #install_zfsyes #install_dockeryes #install_chromiumyes #install_firefoxyes四替换 NPU 驱动并重新编译解压下载的驱动包将其中的rknpu驱动代码覆盖到内核源码目录重新编译内核这里注意rknpu驱动的位置在:bananaubuntuserver:~/orangepi-build$ ls kernel/orange-pi-6.1-rk35xx/drivers/rknpu/ Kconfig include rknpu_debugger.o rknpu_drv.c rknpu_gem.c rknpu_iommu.o rknpu_mem.c rknpu_reset.o Makefile modules.order rknpu_devfreq.c rknpu_drv.o rknpu_gem.o rknpu_job.c rknpu_mm.c built-in.a rknpu_debugger.c rknpu_devfreq.o rknpu_fence.c rknpu_iommu.c rknpu_job.o rknpu_reset.csudo ./build.sh编译完成后deb 包位于output/debs目录下五安装新内核到开发板将编译好的内核 deb 包上传到开发板以实际文件名和 IP 为例cd output/debs scp linux-image-legacy-rockchip-rk3588\_1.0.2\_arm64.deb root192.168.1.xxx:/root登录开发板卸载旧内核并安装新内核\# 卸载旧版本 apt purge -y linux-image-legacy-rockchip-rk3588 \# 安装新版本 dpkg -i linux-image-legacy-rockchip-rk3588\_1.0.2\_arm64.deb ---------------------------------------------------------- orangepiorangepi5max:~$ sudo apt purge -y linux-image-legacy-rockchip-rk3588 [sudo] password for orangepi: Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: linux-image-legacy-rockchip-rk3588* 0 upgraded, 0 newly installed, 1 to remove and 399 not upgraded. After this operation, 171 MB disk space will be freed. (Reading database ... 218642 files and directories currently installed.) Removing linux-image-legacy-rockchip-rk3588 (1.0.0) ... update-initramfs: Deleting /boot/initrd.img-5.10.160-rockchip-rk3588 Free space after deleting the package linux-image-legacy-rockchip-rk3588 in /boot: 962.4M (Reading database ... 216597 files and directories currently installed.) Purging configuration files for linux-image-legacy-rockchip-rk3588 (1.0.0) ... dpkg: warning: while removing linux-image-legacy-rockchip-rk3588, directory /lib/modules not empty so not removed ---------------------------------------------------------- orangepiorangepi5max:~$ sudo dpkg -i linux-image-current-rockchip-rk3588_1.0.2_arm64.deb Selecting previously unselected package linux-image-current-rockchip-rk3588. (Reading database ... 216598 files and directories currently installed.) Preparing to unpack linux-image-current-rockchip-rk3588_1.0.2_arm64.deb ... Unpacking linux-image-current-rockchip-rk3588 (1.0.2) ... Setting up linux-image-current-rockchip-rk3588 (1.0.2) ... update-initramfs: Generating /boot/initrd.img-6.1.99-rockchip-rk3588 update-initramfs: Converting to u-boot format Free space after deleting the package linux-image-current-rockchip-rk3588 in /boot: 941.5M重启开发板reboot ------------------------------------------------------ orangepiorangepi5max:~$ sudo reboot Broadcast message from rootorangepi5max on pts/1 (Sat 2026-07-11 20:04:35 CST): The system will reboot now!四、验证更新结果重启后再次查询 NPU 版本cat /sys/kernel/debug/rknpu/version若显示版本为v0.9.8则更新成功。orangepiorangepi5max:~$ sudo dpkg -i linux-image-current-rockchip-rk3588_1.0.2_arm64.deb (Reading database ... 135867 files and directories currently installed.) Preparing to unpack linux-image-current-rockchip-rk3588_1.0.2_arm64.deb ... Unpacking linux-image-current-rockchip-rk3588 (1.0.2) over (1.0.0) ... Setting up linux-image-current-rockchip-rk3588 (1.0.2) ... dkms: running auto installation service for kernel 6.1.99-rockchip-rk3588:. update-initramfs: Generating /boot/initrd.img-6.1.99-rockchip-rk3588 update-initramfs: Converting to u-boot format Remove unused generated file: /boot/initrd.img-6.1.43-rockchip-rk3588 Free space after deleting the package linux-image-current-rockchip-rk3588 in /boot: 945.1M orangepiorangepi5max:~$ sudo reboot now Connection to 192.168.31.227 closed by remote host. Connection to 192.168.31.227 closed. PS C:\Users\T1998 ssh orangepi192.168.31.227 orangepi192.168.31.227s password: ___ ____ _ ____ __ __ / _ \| _ \(_) | ___| | \/ | __ ___ __ | | | | |_) | | |___ \ | |\/| |/ _ \ \/ / | |_| | __/| | ___) | | | | | (_| | \___/|_| |_| |____/ |_| |_|\__,_/_/\_\ Welcome to Orange Pi 1.0.0 Bullseye with Linux 6.1.99-rockchip-rk3588 System load: 14% Up time: 0 min Memory usage: 2% of 15.59G IP: 192.168.31.227 CPU temp: 41°C Usage of /: 2% of 232G [ 0 security updates available, 299 updates total: apt upgrade ] Last check: 2026-07-11 21:47 [ General system configuration (beta): orangepi-config ] Last login: Sat Jul 11 21:47:21 2026 orangepiorangepi5max:~$ sudo cat /sys/kernel/debug/rknpu/version [sudo] password for orangepi: RKNPU driver: v0.9.8 orangepiorangepi5max:~$