现象
拉取 OpenWrt
源码编译出来的内核扩展 ipk
拿到装有官方版本 OpenWrt
的路由器上无法安装,出现以下提示:
1 | * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-xxx: |
解决方案
修改 kernel vermagic
从计算配置文件的 md5 hash
改为固定值。
OpenWrt
源码根目录添加文件vermagic
1
echo 68143adfcb7fc62a239c4be112fe40de ./vermagic
修改
kernel-defaults.mk
1
2
3
4
5
6
7
8
9
10
11diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index cc1e2361be..35ffc1fbba 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -105,7 +105,7 @@ define Kernel/Configure/Default
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
}
$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
- grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | mkhash md5 > $(LINUX_DIR)/.vermagic
+ cp $(TOPDIR)/vermagic $(LINUX_DIR)/.vermagic
endef修改
package/kernel/linux/Makefile
1
2
3
4
5
6
7
8
9
10
11
12diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile
index 39b9e82c27..6ff64b2939 100644
--- a/package/kernel/linux/Makefile
+++ b/package/kernel/linux/Makefile
@@ -24,7 +24,7 @@ export SHELL:=/bin/sh
include $(INCLUDE_DIR)/package.mk
ifeq ($(DUMP),)
- STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | mkhash md5)
+ STAMP_BUILT:=$(STAMP_BUILT)_$(shell cat $(LINUX_DIR)/.vermagic)
-include $(LINUX_DIR)/.config
endif
重新编译
1 | make clean # 注意清除缓存 |