[Telink] Fix shell build and add shell target build to CI (#26787)

* [telink] Fix shell build

* [Telink] Add Shell target build to CI

---------

Co-authored-by: Andrii Bilynskyi <andrii.bilynskyi@telink-semi.com>
diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml
index 70784dd..bd7b5ab 100644
--- a/.github/workflows/examples-telink.yaml
+++ b/.github/workflows/examples-telink.yaml
@@ -144,6 +144,18 @@
             - name: clean out build output
               run: rm -rf ./out
 
+            - name: Build example Telink Lighting App with Shell
+              run: |
+                  ./scripts/run_in_build_env.sh \
+                    "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-shell' build"
+                  .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
+                    telink tlsr9518adk80d lighting-app-shell \
+                    out/telink-tlsr9518adk80d-light-shell/zephyr/zephyr.elf \
+                    /tmp/bloat_reports/
+
+            - name: clean out build output
+              run: rm -rf ./out
+
             - name: Build example Telink Lighting App with Factory Data
               run: |
                   ./scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux
diff --git a/examples/lighting-app/telink/shell.overlay b/examples/lighting-app/telink/shell.overlay
new file mode 100644
index 0000000..6c4922b
--- /dev/null
+++ b/examples/lighting-app/telink/shell.overlay
@@ -0,0 +1,21 @@
+#
+#    Copyright (c) 2023 Project CHIP Authors
+#
+#    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.
+#
+
+# This file should be used as a configuration overlay to enable Shell.
+
+# Enable Shell support. 
+CONFIG_SHELL=y
+CONFIG_CHIP_LIB_SHELL=y
diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py
index 7c62db1..56d6725 100755
--- a/scripts/build/build/targets.py
+++ b/scripts/build/build/targets.py
@@ -585,6 +585,7 @@
         TargetPart('window-covering', app=TelinkApp.WINDOW_COVERING),
     ])
 
+    target.AppendModifier('shell', enable_shell=True)
     target.AppendModifier('rpc', enable_rpcs=True)
     target.AppendModifier('factory-data', enable_factory_data=True)
 
diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py
index aec767a..66ce716 100644
--- a/scripts/build/builders/telink.py
+++ b/scripts/build/builders/telink.py
@@ -113,11 +113,13 @@
                  runner,
                  app: TelinkApp = TelinkApp,
                  board: TelinkBoard = TelinkBoard.TLSR9518ADK80D,
+                 enable_shell: bool = False,
                  enable_rpcs: bool = False,
                  enable_factory_data: bool = False):
         super(TelinkBuilder, self).__init__(root, runner)
         self.app = app
         self.board = board
+        self.enable_shell = enable_shell
         self.enable_rpcs = enable_rpcs
         self.enable_factory_data = enable_factory_data
 
@@ -140,6 +142,9 @@
             return
 
         flags = []
+        if self.enable_shell:
+            flags.append("-DOVERLAY_CONFIG=shell.overlay")
+
         if self.enable_rpcs:
             flags.append("-DOVERLAY_CONFIG=rpc.overlay")
 
diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt
index b948552..bfe1d1a 100644
--- a/scripts/build/testdata/all_targets_linux_x64.txt
+++ b/scripts/build/testdata/all_targets_linux_x64.txt
@@ -20,5 +20,5 @@
 nrf-native-posix-64-tests
 qpg-qpg6105-{lock,light,shell,persistent-storage}
 tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan]
-telink-tlsr9518adk80d-{all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,temperature-measurement,thermostat,window-covering}[-rpc][-factory-data]
+telink-tlsr9518adk80d-{all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,temperature-measurement,thermostat,window-covering}[-shell][-rpc][-factory-data]
 openiotsdk-{shell,lock}
diff --git a/src/lib/shell/MainLoopZephyr.cpp b/src/lib/shell/MainLoopZephyr.cpp
index b82b04c..5308006 100644
--- a/src/lib/shell/MainLoopZephyr.cpp
+++ b/src/lib/shell/MainLoopZephyr.cpp
@@ -28,11 +28,11 @@
     chip::Shell::streamer_set_shell(shell);
     return (Engine::Root().ExecCommand(argc - 1, argv + 1) == CHIP_NO_ERROR) ? 0 : -ENOEXEC;
 }
-#ifdef BOARD_TLSR9518ADK80D
+#ifdef CONFIG_BOARD_TLSR9518ADK80D
 static int RegisterCommands(void)
 #else
 static int RegisterCommands(const struct device * dev)
-#endif /* BOARD_TLSR9518ADK80D */
+#endif /* CONFIG_BOARD_TLSR9518ADK80D */
 {
     Engine::Root().RegisterDefaultCommands();
     return 0;