From aaf1c30d285da21ca0e3657b9e9e4fc68f579c79 Mon Sep 17 00:00:00 2001 From: xxlight Date: Thu, 23 Nov 2023 19:39:08 +0800 Subject: [PATCH] Description: ko test Issue: https://gitee.com/openharmony/build/issues/I8EPL3 Test: build Signed-off-by: xxlight Change-Id: I21adf84d596c7332036db7b06e06881b9df51a41 --- module_sample/BUILD.gn | 6 ++++++ module_sample/ko_sample1/BUILD.gn | 8 ++++++++ module_sample/ko_sample1/sample.c | 32 ++++++++++++++++++++++++++++++ module_sample/ko_sample2/BUILD.gn | 9 +++++++++ module_sample/ko_sample2/sample1.c | 32 ++++++++++++++++++++++++++++++ module_sample/ko_sample2/sample2.c | 26 ++++++++++++++++++++++++ 6 files changed, 113 insertions(+) create mode 100644 module_sample/BUILD.gn create mode 100644 module_sample/ko_sample1/BUILD.gn create mode 100644 module_sample/ko_sample1/sample.c create mode 100644 module_sample/ko_sample2/BUILD.gn create mode 100644 module_sample/ko_sample2/sample1.c create mode 100644 module_sample/ko_sample2/sample2.c diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn new file mode 100644 index 0000000..a4dd55f --- /dev/null +++ b/module_sample/BUILD.gn @@ -0,0 +1,6 @@ +group("ko_test") { + deps = [ + "./ko_sample1:ko_sample", + "./ko_sample2:ko_sample2", + ] +} diff --git a/module_sample/ko_sample1/BUILD.gn b/module_sample/ko_sample1/BUILD.gn new file mode 100644 index 0000000..05a2033 --- /dev/null +++ b/module_sample/ko_sample1/BUILD.gn @@ -0,0 +1,8 @@ +import("//build/templates/kernel/ohos_kernel_build.gni") + +ohos_build_ko("ko_sample") { + sources = [ "sample.c" ] + target_ko_name = "ko_sample" + device_name = device_name + device_arch = "arm64" +} diff --git a/module_sample/ko_sample1/sample.c b/module_sample/ko_sample1/sample.c new file mode 100644 index 0000000..d01b207 --- /dev/null +++ b/module_sample/ko_sample1/sample.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static int test_init(void) +{ + printk(KERN_INFO "Process name is ---->s\n"); + return 0; +} +static void test_exit(void) +{ + printk(KERN_INFO "---Removed---\n"); +} + +module_init(test_init); +module_exit(test_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("ZJX"); diff --git a/module_sample/ko_sample2/BUILD.gn b/module_sample/ko_sample2/BUILD.gn new file mode 100644 index 0000000..8dd78cf --- /dev/null +++ b/module_sample/ko_sample2/BUILD.gn @@ -0,0 +1,9 @@ +import("//build/templates/kernel/ohos_kernel_build.gni") + +ohos_build_ko("ko_sample2") { + sources = [ "sample1.c" ] + sources += [ "sample2.c" ] + target_ko_name = "ko_sample2" + device_name = device_name + device_arch = "arm64" +} diff --git a/module_sample/ko_sample2/sample1.c b/module_sample/ko_sample2/sample1.c new file mode 100644 index 0000000..d01b207 --- /dev/null +++ b/module_sample/ko_sample2/sample1.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static int test_init(void) +{ + printk(KERN_INFO "Process name is ---->s\n"); + return 0; +} +static void test_exit(void) +{ + printk(KERN_INFO "---Removed---\n"); +} + +module_init(test_init); +module_exit(test_exit); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("ZJX"); diff --git a/module_sample/ko_sample2/sample2.c b/module_sample/ko_sample2/sample2.c new file mode 100644 index 0000000..17c7e61 --- /dev/null +++ b/module_sample/ko_sample2/sample2.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static int test1(void) +{ + printk(KERN_INFO "Process name is ---->s\n"); + return 0; +} + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("XXL"); \ No newline at end of file -- Gitee