From 464cb72f4b6d1802fffbdb90baecfc101d921575 Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 10:14:11 +0800 Subject: [PATCH 1/9] ko sample Signed-off-by: zhujiaxin --- BUILD.gn | 5 +++++ LICENSE | 1 + OAT.xml | 4 +++- module_sample/BUILD.gn | 9 +++++++++ module_sample/ko_sample.c | 23 +++++++++++++++++++++++ module_sample/sample_fun.c | 15 +++++++++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 BUILD.gn create mode 100644 module_sample/BUILD.gn create mode 100644 module_sample/ko_sample.c create mode 100644 module_sample/sample_fun.c 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; +} + -- Gitee From 2a8c268edfe2c88d5dfd75d08640abde5ac962ec Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 10:35:39 +0800 Subject: [PATCH 2/9] --amend Signed-off-by: zhujiaxin --- module_sample/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn index f9c8532..cf787ec 100644 --- a/module_sample/BUILD.gn +++ b/module_sample/BUILD.gn @@ -6,4 +6,5 @@ ohos_build_ko("ko_sample") { target_ko_name = "kosample" device_name = device_name device_arch = "arm64" + version = "1.0" } -- Gitee From 293415a65db1835f0626532a893a0559596ceb0e Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 10:45:24 +0800 Subject: [PATCH 3/9] --amned Signed-off-by: zhujiaxin --- BUILD.gn | 13 +++++++++++++ module_sample/BUILD.gn | 14 +++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index ebfb1bf..96bc0e4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,3 +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 = [ "//kernel/linux/common_modules/module_sample:ko_sample", diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn index cf787ec..8d3b8f1 100644 --- a/module_sample/BUILD.gn +++ b/module_sample/BUILD.gn @@ -1,3 +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. + import("//build/templates/kernel/ohos_kernel_build.gni") ohos_build_ko("ko_sample") { @@ -6,5 +19,4 @@ ohos_build_ko("ko_sample") { target_ko_name = "kosample" device_name = device_name device_arch = "arm64" - version = "1.0" } -- Gitee From f912f4d5aef0cf7dc85ac6d98dd8c9262fcc379c Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 11:35:38 +0800 Subject: [PATCH 4/9] --amend Signed-off-by: zhujiaxin --- BUILD.gn | 4 +--- module_sample/BUILD.gn | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 96bc0e4..0273c66 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,7 +12,5 @@ # limitations under the License. group("ko_build") { - deps = [ - "//kernel/linux/common_modules/module_sample:ko_sample", - ] + deps = [ "//kernel/linux/common_modules/module_sample:ko_sample" ] } diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn index 8d3b8f1..e661cd3 100644 --- a/module_sample/BUILD.gn +++ b/module_sample/BUILD.gn @@ -14,8 +14,10 @@ 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" ] + 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" -- Gitee From d6af095ca71aae7b74c4d12beae0987b4150ad7b Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 11:45:59 +0800 Subject: [PATCH 5/9] --amend Signed-off-by: zhujiaxin --- BUILD.gn | 2 +- module_sample/BUILD.gn | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 0273c66..88660ce 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,5 +12,5 @@ # limitations under the License. group("ko_build") { - deps = [ "//kernel/linux/common_modules/module_sample:ko_sample" ] + deps = [ "module_sample:ko_sample" ] } diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn index e661cd3..9e5715f 100644 --- a/module_sample/BUILD.gn +++ b/module_sample/BUILD.gn @@ -15,8 +15,8 @@ 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", + "ko_sample.c", + "sample_fun.c", ] target_ko_name = "kosample" device_name = device_name -- Gitee From 589ae6d6440a3b15b16191fe9f67b0528868773f Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 11:57:44 +0800 Subject: [PATCH 6/9] --amend Signed-off-by: zhujiaxin --- OAT.xml | 4 ++-- module_sample/ko_sample.c | 12 +++++++++--- module_sample/sample_fun.c | 7 ++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/OAT.xml b/OAT.xml index 607b5e6..a303aa1 100644 --- a/OAT.xml +++ b/OAT.xml @@ -64,7 +64,7 @@ Note:If the text contains special characters, please escape them according to th - + @@ -72,7 +72,7 @@ Note:If the text contains special characters, please escape them according to th - + diff --git a/module_sample/ko_sample.c b/module_sample/ko_sample.c index 7279360..c93f77c 100644 --- a/module_sample/ko_sample.c +++ b/module_sample/ko_sample.c @@ -1,9 +1,15 @@ -// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0-or-later /* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * * ko sample * + * Author: z-jax + * + * Data: 2023-11-25 */ + #include #include @@ -19,5 +25,5 @@ static void kosample_exit(void) module_init(kosample_init); module_exit(kosample_exit); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("zhujiaxin "); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("z-jax "); diff --git a/module_sample/sample_fun.c b/module_sample/sample_fun.c index 17d7298..a3fa679 100644 --- a/module_sample/sample_fun.c +++ b/module_sample/sample_fun.c @@ -1,7 +1,12 @@ -// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0-or-later /* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * * ko sample * + * Author: z-jax + * + * Data: 2023-11-25 */ #include -- Gitee From 76796a12686f871247b1108749b668b652cbb67d Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 17:43:51 +0800 Subject: [PATCH 7/9] --amend Signed-off-by: zhujiaxin --- OAT.xml | 6 ++++-- module_sample/ko_sample.c | 4 ++-- module_sample/sample_fun.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/OAT.xml b/OAT.xml index a303aa1..83d9fb9 100644 --- a/OAT.xml +++ b/OAT.xml @@ -64,7 +64,7 @@ Note:If the text contains special characters, please escape them according to th - + @@ -72,7 +72,7 @@ Note:If the text contains special characters, please escape them according to th - + @@ -80,6 +80,8 @@ Note:If the text contains special characters, please escape them according to th + + diff --git a/module_sample/ko_sample.c b/module_sample/ko_sample.c index c93f77c..b59fc84 100644 --- a/module_sample/ko_sample.c +++ b/module_sample/ko_sample.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2023 Huawei Device Co., Ltd. * @@ -25,5 +25,5 @@ static void kosample_exit(void) module_init(kosample_init); module_exit(kosample_exit); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("z-jax "); diff --git a/module_sample/sample_fun.c b/module_sample/sample_fun.c index a3fa679..6dc234d 100644 --- a/module_sample/sample_fun.c +++ b/module_sample/sample_fun.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2023 Huawei Device Co., Ltd. * -- Gitee From 6a484fb313bdc0e9222c9106ba305eb3a6965a58 Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 19:30:55 +0800 Subject: [PATCH 8/9] --amend Signed-off-by: zhujiaxin --- OAT.xml | 1 - module_sample/BUILD.gn | 22 ++++++++++------------ module_sample/ko_sample.c | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/OAT.xml b/OAT.xml index 83d9fb9..c024cf3 100644 --- a/OAT.xml +++ b/OAT.xml @@ -81,7 +81,6 @@ 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 index 9e5715f..f76c9d9 100644 --- a/module_sample/BUILD.gn +++ b/module_sample/BUILD.gn @@ -1,15 +1,13 @@ -# 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. +// 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") diff --git a/module_sample/ko_sample.c b/module_sample/ko_sample.c index b59fc84..feea4a5 100644 --- a/module_sample/ko_sample.c +++ b/module_sample/ko_sample.c @@ -15,12 +15,12 @@ static int kosample_init(void) { - pr_info("ko sample: %s\n", __func__); + pr_err("ko sample: %s\n", __func__); return 0; } static void kosample_exit(void) { - pr_info("ko sample: %s\n", __func__); + pr_err("ko sample: %s\n", __func__); } module_init(kosample_init); -- Gitee From 4c44e744654b6de3d58bb4e50246d1a723d06e34 Mon Sep 17 00:00:00 2001 From: zhujiaxin Date: Sat, 25 Nov 2023 20:13:30 +0800 Subject: [PATCH 9/9] --amend Signed-off-by: zhujiaxin --- module_sample/BUILD.gn | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/module_sample/BUILD.gn b/module_sample/BUILD.gn index f76c9d9..aaa9331 100644 --- a/module_sample/BUILD.gn +++ b/module_sample/BUILD.gn @@ -1,13 +1,13 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * - * ko build sample - * - * Author: z-jax - * - * Data: 2023-11-25 - */ +# 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") -- Gitee