Modify zephyr's Driver with out of tree procedure

Hi

I have been using my out of tree driver for my BG95 module, which I have copy pasted from the zephyr's quectel_bg9x driver (drivers/modem/quectel-bg9x) and its required files into respective folders and renamed as quectel-bg95cd and made a few additions to the code. Following is my folder structure

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
boards
└── ...
drivers
└── modem
├── CMakeLists
├── Kconfig
├── Kconfig.quectel-bg95cd
├── modem_context.c
├── modem_cmd_handler.c
├── modem_iface_uart_async.c
├── modem_iface_uart_interrupt.c
├── modem_socket.c
└──quectel_bg95cd.c
└── zephyr
└── module.yml
dts
└── bindings
└── modem
└── quectel,bg95cd.yaml
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I set the following in my main CMakeLists

Fullscreen
1
2
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/drivers)
zephyr_include_directories(include/app/drivers)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I need the "quectel-bg95cd.h" to be included in my main.c file, that's why I have placed them in include/app/drivers/modem folder, so I can have access to my added functions and also to strcut's like sockaddr, modem_cmd from my main.c file

I have changed my #include "quectel-bg9x.h" into <quectel-bg95cd.h> in quectel-bg95cd.c file, and also able to include it in main.c as #include <modem/quectel-bg95cd.h>

It builds and works fine till ncs v2.5.2, when I upgraded to ncs v2.6.0, I face the following error

Fullscreen
1
/include/app/drivers/modem/modem_socket.h:20:10: fatal error: sockets_internal.h: No such file or directory
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I could able to see a change in the CMakeLists in zephyr's drivers/modem/CMakeLists , is that the reason I'm unable to build?? or am I doing it wrong??

For reference ,I attach my drivers/modem/CMakeLists.txt (I have tried many cmds trying to resolve but didn't help)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
#zephyr_library_sources_ifdef(CONFIG_MODEM_RECEIVER modem_receiver.c)
#zephyr_library_sources_ifdef(CONFIG_MODEM_SHELL modem_shell.c)
#zephyr_library_sources_ifdef(CONFIG_MODEM_CONTEXT modem_context.c)
#zephyr_library_sources_ifdef(CONFIG_MODEM_IFACE_UART_INTERRUPT modem_iface_uart_interrupt.c)
#zephyr_library_sources_ifdef(CONFIG_MODEM_IFACE_UART_ASYNC modem_iface_uart_async.c)
#zephyr_library_sources_ifdef(CONFIG_MODEM_CMD_HANDLER modem_cmd_handler.c)
#zephyr_library_sources_ifdef(CONFIG_MODEM_SOCKET modem_socket.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/ip)
zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/lib/sockets)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers/modem)
zephyr_library_include_directories(${APPLICATION_BASE}/include/app/drivers/modem)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Kindly guide me with this. Thanks.