Skip to content
Discussion options

You must be logged in to vote

之前引入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

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@waruqi
Comment options

Answer selected by wangzhankun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants