请问如何在Linux驱动项目中添加on_install和on_uninstall #3287
Answered
by
wangzhankun
wangzhankun
asked this question in
Q&A
-
如题。 |
Beta Was this translation helpful? Give feedback.
Answered by
wangzhankun
Jan 13, 2023
Replies: 2 comments 1 reply
-
不知道你要问什么,on_install 使用 文档里自己看下 |
Beta Was this translation helpful? Give feedback.
0 replies
-
之前引入os模块一直找不到无法引入,后来才在xmake.io中偶然发现。粘贴记录一下: target("testdriver")
add_rules("platform.linux.driver")
set_values("linux.driver.linux-headers", "/lib/modules/5.15.85-1-MANJARO/build")
add_files("src/*.c")
on_install("linux|x86_64", function (package)
import("core.project.depend")
local targetfile = package:targetfile() -- build/linux/x86_64/release/testdriver.ko
os.vrunv("sudo insmod " .. targetfile)
end)
on_uninstall("linux|x86_64", function(package)
import("core.project.depend")
local targetfile = package:targetfile() -- build/linux/x86_64/release/testdriver.ko
os.vrunv("sudo rmmod " .. targetfile)
end)
target_end() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
wangzhankun
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
之前引入os模块一直找不到无法引入,后来才在xmake.io中偶然发现。粘贴记录一下: