diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 0000000..ebfb1bf --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,5 @@ +group("ko_build") { + deps = [ + "//kernel/linux/common_modules/module_sample:ko_sample", + ] +} diff --git a/LICENSE b/LICENSE index 4c36850..c1d4537 100644 --- a/LICENSE +++ b/LICENSE @@ -6,5 +6,6 @@ ./memory_security/ ./code_sign ./container_escape_detection + ./module_sample As for the specific use of the licenses, please refer to the relevant description in the documents. diff --git a/OAT.xml b/OAT.xml index ba945ca..607b5e6 100644 --- a/OAT.xml +++ b/OAT.xml @@ -56,7 +56,7 @@ Note:If the text contains special characters, please escape them according to th - + @@ -64,6 +64,7 @@ Note:If the text contains special characters, please escape them according to th + @@ -71,6 +72,7 @@ Note:If the text contains special characters, please escape them according to th + diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn new file mode 100644 index 0000000..f9c8532 --- /dev/null +++ b/module_sample/BUILD.gn @@ -0,0 +1,9 @@ +import("//build/templates/kernel/ohos_kernel_build.gni") + +ohos_build_ko("ko_sample") { + sources = [ "//kernel/linux/common_modules/module_sample/ko_sample.c", + "//kernel/linux/common_modules/module_sample/sample_fun.c" ] + target_ko_name = "kosample" + device_name = device_name + device_arch = "arm64" +} diff --git a/module_sample/ko_sample.c b/module_sample/ko_sample.c new file mode 100644 index 0000000..7279360 --- /dev/null +++ b/module_sample/ko_sample.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ko sample + * + */ + +#include +#include + +static int kosample_init(void) +{ + pr_info("ko sample: %s\n", __func__); + return 0; +} +static void kosample_exit(void) +{ + pr_info("ko sample: %s\n", __func__); +} + +module_init(kosample_init); +module_exit(kosample_exit); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("zhujiaxin "); diff --git a/module_sample/sample_fun.c b/module_sample/sample_fun.c new file mode 100644 index 0000000..17d7298 --- /dev/null +++ b/module_sample/sample_fun.c @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ko sample + * + */ + +#include +#include + +int kosample_fun(void) +{ + pr_info("ko sample call: %s\n", __func__); + return 0; +} +