Skip to content

Commit be57821

Browse files
committed
yang: add feature flags for wifi and gps in infix-hardware
1 parent f5ad6bc commit be57821

5 files changed

Lines changed: 35 additions & 0 deletions

File tree

package/confd/confd.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ CONFD_CONF_OPTS += --enable-wifi
3030
else
3131
CONFD_CONF_OPTS += --disable-wifi
3232
endif
33+
ifeq ($(BR2_PACKAGE_FEATURE_GPS),y)
34+
CONFD_CONF_OPTS += --enable-gps
35+
else
36+
CONFD_CONF_OPTS += --disable-gps
37+
endif
3338
define CONFD_INSTALL_EXTRA
3439
for fn in confd.conf resolvconf.conf; do \
3540
cp $(CONFD_PKGDIR)/$$fn $(FINIT_D)/available/; \
@@ -80,6 +85,12 @@ define CONFD_INSTALL_YANG_MODULES_WIFI
8085
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/wifi.inc
8186
endef
8287
endif
88+
ifeq ($(BR2_PACKAGE_FEATURE_GPS),y)
89+
define CONFD_INSTALL_YANG_MODULES_GPS
90+
$(COMMON_SYSREPO_ENV) \
91+
$(BR2_EXTERNAL_INFIX_PATH)/utils/srload $(@D)/yang/gps.inc
92+
endef
93+
endif
8394

8495
# PER_PACKAGE_DIR
8596
# Since the last package in the dependency chain that runs sysrepoctl is confd, we need to
@@ -109,6 +120,7 @@ CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_EXTRA
109120
CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_YANG_MODULES
110121
CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_YANG_MODULES_CONTAINERS
111122
CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_YANG_MODULES_WIFI
123+
CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_YANG_MODULES_GPS
112124
CONFD_POST_INSTALL_TARGET_HOOKS += CONFD_INSTALL_IN_ROMFS
113125
CONFD_TARGET_FINALIZE_HOOKS += CONFD_CLEANUP
114126

src/confd/configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ AC_ARG_ENABLE(wifi,
4646
AS_HELP_STRING([--enable-wifi], [Enable support for Wi-Fi]),,[
4747
enable_wifi=no])
4848

49+
AC_ARG_ENABLE(gps,
50+
AS_HELP_STRING([--enable-gps], [Enable support for GPS receivers]),,[
51+
enable_gps=no])
52+
4953
AC_ARG_WITH(login-shell,
5054
AS_HELP_STRING([--with-login-shell=shell], [Login shell for new users, default: /bin/false]),
5155
[login_shell=$withval], [login_shell=yes])
@@ -60,6 +64,9 @@ AS_IF([test "x$enable_containers" = "xyes"], [
6064
AS_IF([test "x$enable_wifi" = "xyes"], [
6165
AC_DEFINE(HAVE_WIFI, 1, [Built with Wi-Fi support])])
6266

67+
AS_IF([test "x$enable_gps" = "xyes"], [
68+
AC_DEFINE(HAVE_GPS, 1, [Built with GPS receiver support])])
69+
6370
AS_IF([test "x$with_login_shell" != "xno"], [
6471
AS_IF([test "x$login_shell" = "xyes"], [login_shell=/bin/false])
6572
AC_DEFINE_UNQUOTED(LOGIN_SHELL, "$login_shell", [Default: /bin/false])],[
@@ -131,6 +138,7 @@ cat <<EOF
131138
Optional features:
132139
Container support ....: $enable_containers
133140
Wi-Fi support ........: $enable_wifi
141+
GPS support ..........: $enable_gps
134142
Login shell ..........: $login_shell
135143
Default crypt algo ...: $crypt
136144

src/confd/yang/confd/infix-hardware.yang

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ module infix-hardware {
4545
description "Initial";
4646
reference "internal";
4747
}
48+
feature wifi {
49+
description "WiFi support is an optional build-time feature in Infix.";
50+
}
51+
52+
feature gps {
53+
description "GPS support is an optional build-time feature in Infix.";
54+
}
4855

4956
typedef country-code {
5057
type string {
@@ -104,11 +111,13 @@ module infix-hardware {
104111
description "This identity is used to a VPD memory on the device.";
105112
}
106113
identity wifi {
114+
if-feature wifi;
107115
base iahw:hardware-class;
108116
description "This identity is used to describe a WiFi radio/PHY";
109117
}
110118

111119
identity gps {
120+
if-feature gps;
112121
base iahw:hardware-class;
113122
description "GPS/GNSS receiver for time synchronization";
114123
}
@@ -211,6 +220,7 @@ module infix-hardware {
211220
*/
212221

213222
container wifi-radio {
223+
if-feature wifi;
214224
when "derived-from-or-self(../iehw:class, 'ih:wifi')";
215225
presence "WiFi radio configuration";
216226
description
@@ -534,6 +544,7 @@ module infix-hardware {
534544
*/
535545

536546
container gps-receiver {
547+
if-feature gps;
537548
when "derived-from-or-self(../iehw:class, 'ih:gps')";
538549
presence "GPS receiver configuration";
539550
description

src/confd/yang/gps.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MODULES=(
2+
"infix-hardware -e gps"
3+
)

src/confd/yang/wifi.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
MODULES=(
22
"infix-interfaces -e wifi"
3+
"infix-hardware -e wifi"
34
"infix-if-type -e wifi"
45
)

0 commit comments

Comments
 (0)