diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a4dd55f167a71434e0e7d639e0527aa433079c7a --- /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 0000000000000000000000000000000000000000..05a20337f1c13c6340701d46935d762fee0d725f --- /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 0000000000000000000000000000000000000000..d01b2076805e66dd0b0d9972e9b5d5605fae9da5 --- /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 0000000000000000000000000000000000000000..8dd78cf6a10630bdbb51db3e6783c418c255307a --- /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 0000000000000000000000000000000000000000..d01b2076805e66dd0b0d9972e9b5d5605fae9da5 --- /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 0000000000000000000000000000000000000000..17c7e619edf6eb2fec6a88d1f75dc0864b06028f --- /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