1# Device Driver Porting<a name="EN-US_TOPIC_0000001200252097"></a> 2 3This section describes how to port device drivers. 4 5## LCD Driver Porting<a name="section1574513454119"></a> 6 7To port an LCD driver, write the driver, create an instance of the corresponding model in the driver, and complete the registration. 8 9The LCD drivers are stored in **//drivers/framework/model/display/driver/panel**. 10 111. Create a panel driver. 12 13 Create an HDF driver and call the **RegisterPanel** method to register a model instance during driver initialization. 14 15 ``` 16 int32_t LCDxxEntryInit(struct HdfDeviceObject *object) 17 { 18 struct PanelData *panel = CreateYourPanel(); 19 // Register a model instance. 20 if (RegisterPanel(panel) != HDF_SUCCESS) { 21 HDF_LOGE("%s: RegisterPanel failed", __func__); 22 return HDF_FAILURE; 23 } 24 return HDF_SUCCESS; 25 } 26 27 struct HdfDriverEntry g_xxxxDevEntry = { 28 .moduleVersion = 1, 29 .moduleName = "LCD_XXXX", 30 .Init = LCDxxEntryInit, 31 }; 32 33 HDF_INIT(g_xxxxDevEntry); 34 ``` 35 362. Configure and load the panel driver. 37 38 Modify the source code file **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Add configurations for the device named **device\_lcd** for the display host. 39 40 >![](../public_sys-resources/icon-caution.gif) **CAUTION:** 41 >Make sure the value of **moduleName** is the same as that of **moduleName** in the panel driver. 42 43 ``` 44 root { 45 ... 46 display :: host { 47 device_lcd :: device { 48 deviceN :: deviceNode { 49 policy = 0; 50 priority = 100; 51 preload = 2; 52 moduleName = "LCD_XXXX"; 53 } 54 } 55 } 56 } 57 ``` 58 59 60## Touchscreen Driver Porting<a name="section20284142116422"></a> 61 62This section describes how to port a touchscreen driver. The touchscreen drivers are stored in the source code directory **//drivers/framework/model/input/driver/touchscreen**. To port a touchscreen driver, register a **ChipDevice** model instance with the system. 63 64For details about how to develop a touchscreen driver, see [Touchscreen Development Guidelines](../driver/driver-peripherals-touch-des.md). 65 661. Create a touchscreen driver. 67 68 Create the **touch\_ic\_name.c** file in the **touchscreen** directory. Write the following content: 69 70 ``` 71 #include "hdf_touch.h" 72 73 static int32_t HdfXXXXChipInit(struct HdfDeviceObject *device) 74 { 75 ChipDevice *tpImpl = CreateXXXXTpImpl(); 76 if(RegisterChipDevice(tpImpl) != HDF_SUCCESS) {// Register the ChipDevice model instance. 77 ReleaseXXXXTpImpl(tpImpl); 78 return HDF_FAILURE; 79 } 80 return HDF_SUCCESS; 81 } 82 83 struct HdfDriverEntry g_touchXXXXChipEntry = { 84 .moduleVersion = 1, 85 .moduleName = "HDF_TOUCH_XXXX", // Make sure the value is the same as that in the subsequent configuration. 86 .Init = HdfXXXXChipInit, 87 }; 88 89 HDF_INIT(g_touchXXXXChipEntry); 90 ``` 91 92 The following methods need to be implemented in **ChipDevice**: 93 94 <a name="table63781245516"></a> 95 <table><thead align="left"><tr id="row1639713218557"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p53981829557"><a name="p53981829557"></a><a name="p53981829557"></a>Method</p> 96 </th> 97 <th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p739811218557"><a name="p739811218557"></a><a name="p739811218557"></a>Description</p> 98 </th> 99 </tr> 100 </thead> 101 <tbody><tr id="row113981214559"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p339813214552"><a name="p339813214552"></a><a name="p339813214552"></a>int32_t (*Init)(ChipDevice *device)</p> 102 </td> 103 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1139810214552"><a name="p1139810214552"></a><a name="p1139810214552"></a>Initializes the device.</p> 104 </td> 105 </tr> 106 <tr id="row15398122145511"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1139820212557"><a name="p1139820212557"></a><a name="p1139820212557"></a>int32_t (*Detect)(ChipDevice *device)</p> 107 </td> 108 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p939820217555"><a name="p939820217555"></a><a name="p939820217555"></a>Detects the device.</p> 109 </td> 110 </tr> 111 <tr id="row183981216550"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p8398142165517"><a name="p8398142165517"></a><a name="p8398142165517"></a>int32_t (*Suspend)(ChipDevice *device)</p> 112 </td> 113 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p539815218558"><a name="p539815218558"></a><a name="p539815218558"></a>Places the device in sleep mode.</p> 114 </td> 115 </tr> 116 <tr id="row1239842115519"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p43981295511"><a name="p43981295511"></a><a name="p43981295511"></a>int32_t (*Resume)(ChipDevice *device)</p> 117 </td> 118 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p173985245515"><a name="p173985245515"></a><a name="p173985245515"></a>Wakes up the device.</p> 119 </td> 120 </tr> 121 <tr id="row5398326559"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p103981324554"><a name="p103981324554"></a><a name="p103981324554"></a>int32_t (*DataHandle)(ChipDevice *device)</p> 122 </td> 123 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p93980212554"><a name="p93980212554"></a><a name="p93980212554"></a>Reads data from the device and writes touch point data to <strong id="b576475914217"><a name="b576475914217"></a><a name="b576475914217"></a>device</strong> > <strong id="b976511597218"><a name="b976511597218"></a><a name="b976511597218"></a>driver</strong> > <strong id="b117661559162110"><a name="b117661559162110"></a><a name="b117661559162110"></a>frameData</strong>.</p> 124 </td> 125 </tr> 126 <tr id="row03987215550"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1039814295515"><a name="p1039814295515"></a><a name="p1039814295515"></a>int32_t (*UpdateFirmware)(ChipDevice *device)</p> 127 </td> 128 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p18398102105520"><a name="p18398102105520"></a><a name="p18398102105520"></a>Updates the firmware.</p> 129 </td> 130 </tr> 131 </tbody> 132 </table> 133 1342. Configure the product and load the driver. 135 136 All device information of the product is defined in the source code file **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Modify the file and add configurations to the **device** named **device\_touch\_chip** in the **host** of the **input** command. 137 138 >![](../public_sys-resources/icon-note.gif) **NOTE:** 139 >Make sure the value of **moduleName** is the same as that of **moduleName** in the touchscreen driver. 140 141 ``` 142 deviceN :: deviceNode { 143 policy = 0; 144 priority = 130; 145 preload = 0; 146 permission = 0660; 147 moduleName = "HDF_TOUCH_XXXX"; 148 deviceMatchAttr = "touch_XXXX_configs"; 149 } 150 ``` 151 152 153## WLAN Driver Porting<a name="section0969448164217"></a> 154 155The WLAN driver is divided into two parts. One of the parts manages WLAN devices, and the other part manages WLAN traffic. 156 157**Figure 1** OpenHarmony WLAN driver architecture<a name="fig155920160203"></a> 158 159 160![](figures/hdf_wifi.png) 161 162As shown in [Figure 1](#fig155920160203), the part on the left manages WLAN devices, and the part on the right manages WLAN traffic. The HDF WLAN framework abstracts these two parts. The porting process of the driver can be considered as the implementation of the APIs required by the two parts. These APIs are described as follows: 163 164<a name="table1349145511213"></a> 165<table><thead align="left"><tr id="row867115517211"><th class="cellrowborder" valign="top" width="17.28172817281728%" id="mcps1.1.4.1.1"><p id="p667255120"><a name="p667255120"></a><a name="p667255120"></a>API</p> 166</th> 167<th class="cellrowborder" valign="top" width="39.48394839483948%" id="mcps1.1.4.1.2"><p id="p9672551125"><a name="p9672551125"></a><a name="p9672551125"></a>Header File</p> 168</th> 169<th class="cellrowborder" valign="top" width="43.23432343234324%" id="mcps1.1.4.1.3"><p id="p166785515214"><a name="p166785515214"></a><a name="p166785515214"></a>API Description</p> 170</th> 171</tr> 172</thead> 173<tbody><tr id="row16671955128"><td class="cellrowborder" valign="top" width="17.28172817281728%" headers="mcps1.1.4.1.1 "><p id="p86712551023"><a name="p86712551023"></a><a name="p86712551023"></a>HdfChipDriverFactory</p> 174</td> 175<td class="cellrowborder" valign="top" width="39.48394839483948%" headers="mcps1.1.4.1.2 "><p id="p10671551126"><a name="p10671551126"></a><a name="p10671551126"></a>drivers\framework\include\wifi\hdf_wlan_chipdriver_manager.h</p> 176</td> 177<td class="cellrowborder" valign="top" width="43.23432343234324%" headers="mcps1.1.4.1.3 "><p id="p26725514220"><a name="p26725514220"></a><a name="p26725514220"></a>Factory of the <strong id="b88841282246"><a name="b88841282246"></a><a name="b88841282246"></a>ChipDriver</strong>, which is used to support multiple WLAN interfaces of a chip.</p> 178</td> 179</tr> 180<tr id="row186810552214"><td class="cellrowborder" valign="top" width="17.28172817281728%" headers="mcps1.1.4.1.1 "><p id="p11686551323"><a name="p11686551323"></a><a name="p11686551323"></a>HdfChipDriver</p> 181</td> 182<td class="cellrowborder" valign="top" width="39.48394839483948%" headers="mcps1.1.4.1.2 "><p id="p11686551723"><a name="p11686551723"></a><a name="p11686551723"></a>drivers\framework\include\wifi\wifi_module.h</p> 183</td> 184<td class="cellrowborder" valign="top" width="43.23432343234324%" headers="mcps1.1.4.1.3 "><p id="p26814555217"><a name="p26814555217"></a><a name="p26814555217"></a>Manages a specific WLAN interface.</p> 185</td> 186</tr> 187<tr id="row13686559215"><td class="cellrowborder" valign="top" width="17.28172817281728%" headers="mcps1.1.4.1.1 "><p id="p76810555214"><a name="p76810555214"></a><a name="p76810555214"></a>NetDeviceInterFace</p> 188</td> 189<td class="cellrowborder" valign="top" width="39.48394839483948%" headers="mcps1.1.4.1.2 "><p id="p166818551825"><a name="p166818551825"></a><a name="p166818551825"></a>drivers\framework\include\wifi\net_device.h</p> 190</td> 191<td class="cellrowborder" valign="top" width="43.23432343234324%" headers="mcps1.1.4.1.3 "><p id="p368195513213"><a name="p368195513213"></a><a name="p368195513213"></a>Communicates with the protocol stack, such as sending data and setting the status of network interfaces.</p> 192</td> 193</tr> 194</tbody> 195</table> 196 197>![](../public_sys-resources/icon-note.gif) **NOTE:** 198>For details about the API development, see [WLAN Development Guidelines](../driver/driver-peripherals-external-des.md). 199 200The porting procedure is as follows: 201 2021. Create a WLAN chip driver. 203 204 Create the **hdf\_wlan\_chip\_name.c** file in **/device/vendor\_name/peripheral/wifi/chip\_name/**. The sample code is as follows: 205 206 ``` 207 static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) { 208 static struct HdfChipDriverFactory factory = CreateChipDriverFactory(); // Implement the method. 209 struct HdfChipDriverManager *driverMgr = HdfWlanGetChipDriverMgr(); 210 if (driverMgr->RegChipDriver(&factory) != HDF_SUCCESS) {// Register the driver factory. 211 HDF_LOGE("%s fail: driverMgr is NULL!", __func__); 212 return HDF_FAILURE; 213 } 214 return HDF_SUCCESS; 215 } 216 217 struct HdfDriverEntry g_hdfXXXChipEntry = { 218 .moduleVersion = 1, 219 .Init = HdfWlanXXXChipDriverInit, 220 .Release = HdfWlanXXXChipRelease, 221 .moduleName = "HDF_WIFI_CHIP_XXX" // Make sure the name is the same as the configured one. 222 }; 223 224 HDF_INIT(g_hdfXXXChipEntry); 225 ``` 226 227 In the **CreateChipDriverFactory** method, create an object of the **HdfChipDriverFactory** type. This object provides the following methods: 228 229 <a name="table8351533595"></a> 230 <table><thead align="left"><tr id="row25693318916"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p125683311913"><a name="p125683311913"></a><a name="p125683311913"></a>Method</p> 231 </th> 232 <th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p1656103318919"><a name="p1656103318919"></a><a name="p1656103318919"></a>Description</p> 233 </th> 234 </tr> 235 </thead> 236 <tbody><tr id="row15612331994"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p185663314920"><a name="p185663314920"></a><a name="p185663314920"></a>const char *driverName</p> 237 </td> 238 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p7563330917"><a name="p7563330917"></a><a name="p7563330917"></a>Indicates the driver name.</p> 239 </td> 240 </tr> 241 <tr id="row20561733993"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p13561331297"><a name="p13561331297"></a><a name="p13561331297"></a>int32_t (*InitChip)(struct HdfWlanDevice *device)</p> 242 </td> 243 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p756163312914"><a name="p756163312914"></a><a name="p756163312914"></a>Initializes the chip.</p> 244 </td> 245 </tr> 246 <tr id="row155612337919"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p135633315917"><a name="p135633315917"></a><a name="p135633315917"></a>int32_t (*DeinitChip)(struct HdfWlanDevice *device)</p> 247 </td> 248 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p3566331094"><a name="p3566331094"></a><a name="p3566331094"></a>Deinitializes the chip.</p> 249 </td> 250 </tr> 251 <tr id="row18567337916"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p157203315917"><a name="p157203315917"></a><a name="p157203315917"></a>void (*ReleaseFactory)(struct HdfChipDriverFactory *factory)</p> 252 </td> 253 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p165716331596"><a name="p165716331596"></a><a name="p165716331596"></a>Releases the <strong id="b17274134462416"><a name="b17274134462416"></a><a name="b17274134462416"></a>HdfChipDriverFactory</strong> object.</p> 254 </td> 255 </tr> 256 <tr id="row1757143314912"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p105710331694"><a name="p105710331694"></a><a name="p105710331694"></a>struct HdfChipDriver *(*Build)(struct HdfWlanDevice *device, uint8_t ifIndex)</p> 257 </td> 258 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p457143320911"><a name="p457143320911"></a><a name="p457143320911"></a>Creates an <strong id="b118260459243"><a name="b118260459243"></a><a name="b118260459243"></a>HdfChipDriver</strong>. In the input parameters, <strong id="b28271845162411"><a name="b28271845162411"></a><a name="b28271845162411"></a>device</strong> indicates the device information, and <strong id="b16827144519241"><a name="b16827144519241"></a><a name="b16827144519241"></a>ifIndex</strong> indicates the sequence number of this interface in the chip.</p> 259 </td> 260 </tr> 261 <tr id="row1157153310912"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p155714334917"><a name="p155714334917"></a><a name="p155714334917"></a>void (*Release)(struct HdfChipDriver *chipDriver)</p> 262 </td> 263 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p95717338919"><a name="p95717338919"></a><a name="p95717338919"></a>Releases the chip driver.</p> 264 </td> 265 </tr> 266 <tr id="row1157143313914"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p19571433993"><a name="p19571433993"></a><a name="p19571433993"></a>uint8_t (*GetMaxIFCount)(struct HdfChipDriverFactory *factory)</p> 267 </td> 268 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p14571334915"><a name="p14571334915"></a><a name="p14571334915"></a>Obtains the maximum number of interfaces supported by the current chip.</p> 269 </td> 270 </tr> 271 </tbody> 272 </table> 273 274 The **Build** method creates an **HdfChipDriver** object that manages the specified network interface. This object needs to provide the following methods: 275 276 <a name="table16989183941017"></a> 277 <table><thead align="left"><tr id="row61014406100"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p111094011015"><a name="p111094011015"></a><a name="p111094011015"></a>Method</p> 278 </th> 279 <th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p11102040201014"><a name="p11102040201014"></a><a name="p11102040201014"></a>Description</p> 280 </th> 281 </tr> 282 </thead> 283 <tbody><tr id="row111014409104"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p21084017106"><a name="p21084017106"></a><a name="p21084017106"></a>int32_t (*init)(struct HdfChipDriver *chipDriver, NetDevice *netDev)</p> 284 </td> 285 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1310184012103"><a name="p1310184012103"></a><a name="p1310184012103"></a>Initializes the current network interface. The <strong id="b18435181416253"><a name="b18435181416253"></a><a name="b18435181416253"></a>NetDeviceInterFace</strong> needs to be provided for the <strong id="b1543511144251"><a name="b1543511144251"></a><a name="b1543511144251"></a>netDev</strong>.</p> 286 </td> 287 </tr> 288 <tr id="row210840101012"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p71064031013"><a name="p71064031013"></a><a name="p71064031013"></a>int32_t (*deinit)(struct HdfChipDriver *chipDriver, NetDevice *netDev)</p> 289 </td> 290 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p710144015101"><a name="p710144015101"></a><a name="p710144015101"></a>Deinitializes the current network interface.</p> 291 </td> 292 </tr> 293 <tr id="row151094011100"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1910340171018"><a name="p1910340171018"></a><a name="p1910340171018"></a>struct HdfMac80211BaseOps *ops</p> 294 </td> 295 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p31034071020"><a name="p31034071020"></a><a name="p31034071020"></a>Provides the WLAN basic capability interface set.</p> 296 </td> 297 </tr> 298 <tr id="row91012407102"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p191014051019"><a name="p191014051019"></a><a name="p191014051019"></a>struct HdfMac80211STAOps *staOps</p> 299 </td> 300 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p810104013106"><a name="p810104013106"></a><a name="p810104013106"></a>Provides the interface set required for supporting the STA mode.</p> 301 </td> 302 </tr> 303 <tr id="row17101840111020"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1010204081015"><a name="p1010204081015"></a><a name="p1010204081015"></a>struct HdfMac80211APOps *apOps</p> 304 </td> 305 <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p710184013105"><a name="p710184013105"></a><a name="p710184013105"></a>Provides the interface set required for supporting the AP mode.</p> 306 </td> 307 </tr> 308 </tbody> 309 </table> 310 3112. Create a configuration file to describe the chips supported by the driver. 312 313 Create a chip configuration file in the product configuration directory and save it to the source code path **//vendor/vendor\_name/product\_name/config/wifi/wlan\_chip\_chip\_name.hcs**. 314 315 The sample code is as follows: 316 317 ``` 318 root { 319 wlan_config { 320 chip_name :& chipList { 321 chip_name :: chipInst { 322 match_attr = "hdf_wlan_chips_chip_name"; /* Indicates the configuration matching attribute, which is used to provide the configuration root of the driver.*/ 323 driverName = "driverName"; /* Indicates the driver name, which must be the same as that of driverName in HdfChipDriverFactory.*/ 324 sdio { 325 vendorId = 0xXXXX; /* your vendor id */ 326 deviceId = [0xXXXX]; /*your supported devices */ 327 } 328 } 329 } 330 } 331 } 332 ``` 333 334 >![](../public_sys-resources/icon-note.gif) **NOTE:** 335 >Replace the values of **vendor\_name**, **product\_name**, and **chip\_name** in the path and file with the actual names. 336 >Set **vendorId** and **deviceId** to the actual vendor ID and chip ID, respectively. 337 3383. Edit the configuration file and load the driver. 339 340 All device information of the product is defined in the source code file **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Modify the file and add configurations to the **device** named **device\_wlan\_chips** in the **host** of the **network** command. The sample code is as follows: 341 342 ``` 343 deviceN :: deviceNode { 344 policy = 0; 345 preload = 2; 346 moduleName = "HDF_WLAN_CHIPS"; 347 deviceMatchAttr = "hdf_wlan_chips_chip_name"; 348 serviceName = "driverName"; 349 } 350 ``` 351 352 >![](../public_sys-resources/icon-note.gif) **NOTE:** 353 >Make sure the value of **moduleName** is the same as that of **moduleName** in the WLAN driver. 354 3554. Modify the **Kconfig** file to make the ported WLAN driver appear in the kernel configuration. 356 357 Add configurations to **device/vendor\_name/drivers/Kconfig**. The sample code is as follows: 358 359 ``` 360 config DRIVERS_HDF_WIFI_chip_name 361 bool "Enable chip_name Host driver" 362 default n 363 depends on DRIVERS_HDF_WLAN help 364 Answer Y to enable chip_name Host driver. 365 ``` 366 367 >![](../public_sys-resources/icon-note.gif) **NOTE:** 368 >Replace **chip\_name** with the actual chip name. 369 3705. Modify the build script to enable the driver to participate in the kernel build. 371 372 Add the following content to the end of the source code file **//device/vendor\_name/drivers/lite.mk**: 373 374 ``` 375 ifeq ($(LOSCFG_DRIVERS_HDF_WIFI_chip_name), y) 376 # After the build is complete, an object named hdf_wlan_chipdriver_chip_name needs to be linked. You are advised to use this name to prevent conflicts. 377 LITEOS_BASELIB += -lhdf_wlan_chipdriver_chip_name 378 # Add the build directory gpio. 379 LIB_SUBDIRS += ../peripheral/wifi/chip_name 380 endif 381 ``` 382 383 >![](../public_sys-resources/icon-note.gif) **NOTE:** 384 >Replace **chip\_name** with the actual chip name. 385 386 387