1# Copyright (c) 2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15 16if (is_standard_system) { 17 ohos_shared_library("libethernet_service_1.0") { 18 branch_protector_ret = "pac_ret" 19 sanitize = { 20 cfi = true # Enable/disable control flow integrity detection 21 boundary_sanitize = false # Enable boundary san detection 22 cfi_cross_dso = true # Cross-SO CFI Checks 23 integer_overflow = false # Enable integer overflow detection 24 ubsan = false # Enable some Ubsan options 25 cfi_vcall_icall_only = true 26 debug = false 27 } 28 include_dirs = [ 29 "./service_common", 30 "../../eth_client/include", 31 ] 32 sources = [ 33 "service_common/hdi_wpa_hal.c", 34 "service_common/wpa_common_cmd.c", 35 "ethernet_service.c", 36 ] 37 38 deps = [ "../../eth_client:ethernet_hdi_client" ] 39 40 defines = [ "__OHOS__USER__" ] 41 42 cflags = [ 43 "-Wall", 44 "-Wextra", 45 "-Werror", 46 "-fsigned-char", 47 "-fno-common", 48 "-fno-strict-aliasing", 49 "-DCONFIG_CTRL_IFACE", 50 "-DCONFIG_P2P", 51 "-DCONFIG_WEP", 52 "-DCONFIG_WPS", 53 ] 54 cflags += [ 55 "-fdata-sections", 56 "-ffunction-sections", 57 "-Os", 58 "-fno-merge-all-constants", 59 ] 60 ldflags = [ 61 "-Wl,--exclude-libs=ALL", 62 "-Wl,--gc-sections", 63 ] 64 external_deps = [ 65 "c_utils:utils", 66 "drivers_interface_ethernet:libethernet_stub_1.0", 67 "hdf_core:libhdf_ipc_adapter", 68 "hdf_core:libhdf_host", 69 "hdf_core:libhdf_utils", 70 "hilog:libhilog", 71 "wpa_supplicant:wpa", 72 "wpa_supplicant:wpa_client_vendor", 73 ] 74 75 install_images = [ 76 chipset_base_dir, 77 ] 78 subsystem_name = "hdf" 79 part_name = "drivers_peripheral_ethernet" 80 } 81 82 ohos_shared_library("libethernet_hdi_c_device") { 83 branch_protector_ret = "pac_ret" 84 sanitize = { 85 cfi = true # Enable/disable control flow integrity detection 86 boundary_sanitize = false # Enable boundary san detection 87 cfi_cross_dso = true # Cross-SO CFI Checks 88 integer_overflow = false # Enable integer overflow detection 89 ubsan = false # Enable some Ubsan options 90 cfi_vcall_icall_only = true 91 debug = false 92 } 93 include_dirs = [ "./service_common" ] 94 95 sources = [ "ethernet_driver.c" ] 96 97 deps = [ ":libethernet_service_1.0" ] 98 99 cflags = [ 100 "-Wall", 101 "-Wextra", 102 "-Werror", 103 "-fsigned-char", 104 "-fno-common", 105 "-fno-strict-aliasing", 106 ] 107 cflags += [ 108 "-fdata-sections", 109 "-ffunction-sections", 110 "-Os", 111 "-fno-merge-all-constants", 112 ] 113 ldflags = [ 114 "-Wl,--exclude-libs=ALL", 115 "-Wl,--gc-sections", 116 ] 117 external_deps = [ 118 "c_utils:utils", 119 "drivers_interface_ethernet:libethernet_stub_1.0", 120 "hdf_core:libhdf_host", 121 "hdf_core:libhdf_ipc_adapter", 122 "hdf_core:libhdf_utils", 123 "hdf_core:libhdi", 124 "hilog:libhilog", 125 ] 126 127 shlib_type = "hdi" 128 install_images = [ chipset_base_dir ] 129 subsystem_name = "hdf" 130 part_name = "drivers_peripheral_ethernet" 131 } 132} else { 133 ohos_shared_library("libethernet_service_1.0") { 134 branch_protector_ret = "pac_ret" 135 sanitize = { 136 cfi = true # Enable/disable control flow integrity detection 137 boundary_sanitize = true # Enable boundary san detection 138 cfi_cross_dso = true # Cross-SO CFI Checks 139 integer_overflow = true # Enable integer overflow detection 140 ubsan = true # Enable some Ubsan options 141 debug = false 142 } 143 include_dirs = [] 144 sources = [] 145 146 install_images = [ chipset_base_dir ] 147 subsystem_name = "hdf" 148 part_name = "drivers_peripheral_ethernet" 149 } 150 151 ohos_shared_library("libethernet_hdi_c_device") { 152 branch_protector_ret = "pac_ret" 153 sanitize = { 154 cfi = true # Enable/disable control flow integrity detection 155 boundary_sanitize = true # Enable boundary san detection 156 cfi_cross_dso = true # Cross-SO CFI Checks 157 integer_overflow = true # Enable integer overflow detection 158 ubsan = true # Enable some Ubsan options 159 debug = false 160 } 161 include_dirs = [] 162 sources = [] 163 164 install_images = [ chipset_base_dir ] 165 subsystem_name = "hdf" 166 part_name = "drivers_peripheral_ethernet" 167 } 168} 169 170group("ethernet_hdi_service") { 171 deps = [ 172 ":libethernet_hdi_c_device", 173 ":libethernet_service_1.0", 174 ] 175} 176