diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 0000000..88660ce --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,16 @@ +# 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. + +group("ko_build") { + deps = [ "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..c024cf3 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 + @@ -78,6 +80,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..aaa9331 --- /dev/null +++ b/module_sample/BUILD.gn @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2023 Huawei Device Co., Ltd. +# +# ko build sample +# +# Author: z-jax +# +# Data: 2023-11-25 +# + +import("//build/templates/kernel/ohos_kernel_build.gni") + +ohos_build_ko("ko_sample") { + sources = [ + "ko_sample.c", + "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..feea4a5 --- /dev/null +++ b/module_sample/ko_sample.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * + * ko sample + * + * Author: z-jax + * + * Data: 2023-11-25 + */ + + +#include +#include + +static int kosample_init(void) +{ + pr_err("ko sample: %s\n", __func__); + return 0; +} +static void kosample_exit(void) +{ + pr_err("ko sample: %s\n", __func__); +} + +module_init(kosample_init); +module_exit(kosample_exit); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("z-jax "); diff --git a/module_sample/sample_fun.c b/module_sample/sample_fun.c new file mode 100644 index 0000000..6dc234d --- /dev/null +++ b/module_sample/sample_fun.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * + * ko sample + * + * Author: z-jax + * + * Data: 2023-11-25 + */ + +#include +#include + +int kosample_fun(void) +{ + pr_info("ko sample call: %s\n", __func__); + return 0; +} +