Skip to content

Commit 68bcc53

Browse files
committed
feat: add wifi-commissioning-service recipe
Replace wifi-commissioning-gatt-service with wifi-commissioning-service, a complete rewrite that provides: - Dual transport: BLE GATT + Unix Domain Socket with JSON-RPC 2.0 - Multi-socket container access for UID 10000 (omnect_device_service_client) - Follows omnect patterns for user/group management Changes: - Add wifi-commissioning-service recipe infrastructure - Main recipe with cargo dependencies - Configuration .inc file with systemd unit installation - tmpfiles.d for runtime directory creation - BBClass for user/group management with pkg_postinst_ontarget - Update bluez5 integration to reference new service name - User/Group setup: - wifi_commissioning: service user and primary group - wifi_commissioning_client: socket access group - omnect_device_service_client added to wifi_commissioning_client at first boot to enable multi-socket container access - Socket configuration: - SocketGroup changed from wpa_supplicant to wifi_commissioning_client to enable container access (UID 10000) Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
1 parent d0267cf commit 68bcc53

File tree

9 files changed

+577
-400
lines changed

9 files changed

+577
-400
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ Depending on `MACHINE_FEATURES` we also set `3g`, `bluetooth` and `wifi`.
3232
- please see section [Flash Modes](#flash-modes) below
3333
- `resize-data`
3434
- expands the data partition to available space on first boot
35-
- [`wifi-commissioning`](https://github.com/omnect/wifi-commissioning-gatt-service.git)
36-
- adds a service which enables wifi commissioning via bluetooth
35+
- [`wifi-commissioning`](https://github.com/janzachmann/wifi-commissioning-service.git)
36+
- adds a service which enables wifi commissioning via BLE GATT and Unix socket
37+
- provides Bluetooth Low Energy interface for initial commissioning and HTTP REST API over Unix socket for programmatic access
3738
- depends on `DISTRO_FEATURES` `wifi` and `bluetooth` which are not added to `DISTRO_FEATURES` automatically!
38-
- **note**: this is only intended for demo purposes; this is not a production ready service
39+
- **note**: BLE interface is intended for demo/initial commissioning; Unix socket provides production-ready programmatic access
3940

4041
### `MACHINE_FEATURES`
4142
`meta-omnect` extends the following `MACHINE_FEATURES`:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
inherit useradd
2+
3+
USERADD_PACKAGES = "${PN}"
4+
5+
GROUPADD_PARAM:${PN} = "-r wifi_commissioning"
6+
7+
USERADD_PARAM:${PN} = "--no-create-home -r -s /bin/false -g wifi_commissioning wifi_commissioning;"

dynamic-layers/raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ do_install:append () {
33
# Error: Error { kind: Internal(DBus("org.freedesktop.DBus.Error.UnknownMethod")), message: "Method \"RegisterAdvertisement\" with signature \"oa{sv}\" on interface \"org.bluez.LEAdvertisingManager1\" doesn't exist\n" }
44
# only a restart of bluetooth helps
55
if ${@bb.utils.contains('DISTRO_FEATURES', 'wifi-commissioning', 'true', 'false', d)}; then
6-
sed -i -e 's/^ConditionPathIsDirectory=\(.*\)$/ConditionPathIsDirectory=\1\nPartOf=wifi-commissioning-gatt@wlan0.service/' \
6+
sed -i -e 's/^ConditionPathIsDirectory=\(.*\)$/ConditionPathIsDirectory=\1\nPartOf=wifi-commissioning-service@wlan0.service/' \
77
${D}${systemd_system_unitdir}/bluetooth.service
88
fi
99
}

kas/patches/oe.patch

Lines changed: 12 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,11 @@
1-
diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
2-
index 31b4bd9afd..0c304f62e1 100644
3-
--- a/meta/classes-recipe/rust-target-config.bbclass
4-
+++ b/meta/classes-recipe/rust-target-config.bbclass
5-
@@ -127,7 +127,7 @@ def llvm_features(d):
6-
llvm_features[vardepvalue] = "${@llvm_features(d)}"
7-
8-
## arm-unknown-linux-gnueabihf
9-
-DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
10-
+DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
11-
TARGET_ENDIAN[arm-eabi] = "little"
12-
TARGET_POINTER_WIDTH[arm-eabi] = "32"
13-
TARGET_C_INT_WIDTH[arm-eabi] = "32"
14-
@@ -135,7 +135,7 @@ MAX_ATOMIC_WIDTH[arm-eabi] = "64"
15-
FEATURES[arm-eabi] = "+v6,+vfp2"
16-
17-
## armv7-unknown-linux-gnueabihf
18-
-DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
19-
+DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
20-
TARGET_ENDIAN[armv7-eabi] = "little"
21-
TARGET_POINTER_WIDTH[armv7-eabi] = "32"
22-
TARGET_C_INT_WIDTH[armv7-eabi] = "32"
23-
@@ -143,14 +143,14 @@ MAX_ATOMIC_WIDTH[armv7-eabi] = "64"
24-
FEATURES[armv7-eabi] = "+v7,+vfp2,+thumb2"
25-
26-
## aarch64-unknown-linux-{gnu, musl}
27-
-DATA_LAYOUT[aarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
28-
+DATA_LAYOUT[aarch64] = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
29-
TARGET_ENDIAN[aarch64] = "little"
30-
TARGET_POINTER_WIDTH[aarch64] = "64"
31-
TARGET_C_INT_WIDTH[aarch64] = "32"
32-
MAX_ATOMIC_WIDTH[aarch64] = "128"
33-
34-
## x86_64-unknown-linux-{gnu, musl}
35-
-DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
36-
+DATA_LAYOUT[x86_64] = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
37-
TARGET_ENDIAN[x86_64] = "little"
38-
TARGET_POINTER_WIDTH[x86_64] = "64"
39-
TARGET_C_INT_WIDTH[x86_64] = "32"
40-
@@ -397,6 +397,15 @@ def rust_gen_target(d, thing, wd, arch):
41-
tspec['position-independent-executables'] = True
42-
tspec['panic-strategy'] = d.getVar("RUST_PANIC_STRATEGY")
43-
44-
+ # fix for: "Error loading target specification: ARM targets must set `llvm-floatabi` to `hard` or `soft`."
45-
+ if "arm" in tspec['arch']:
46-
+ tspec['llvm-floatabi'] = d.getVar('TARGET_FPU')
47-
+
48-
+ # Convert width fields from strings to integers for Rust 1.93+
49-
+ for field in ['target-pointer-width', 'target-c-int-width', 'max-atomic-width']:
50-
+ if field in tspec and isinstance(tspec[field], str):
51-
+ tspec[field] = int(tspec[field])
52-
+
53-
# write out the target spec json file
54-
with open(wd + rustsys + '.json', 'w') as f:
55-
json.dump(tspec, f, indent=4)
56-
@@ -404,7 +413,7 @@ def rust_gen_target(d, thing, wd, arch):
57-
# These are accounted for in tmpdir path names so don't need to be in the task sig
58-
rust_gen_target[vardepsexclude] += "ABIEXTENSION llvm_cpu"
59-
60-
-do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES"
61-
+do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES LLVM_TARGET"
62-
63-
RUST_TARGETS_DIR = "${WORKDIR}/rust-targets/"
64-
export RUST_TARGET_PATH = "${RUST_TARGETS_DIR}"
65-
diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf
66-
index 4d09619a28..495f51b602 100644
67-
--- a/meta/conf/layer.conf
68-
+++ b/meta/conf/layer.conf
69-
@@ -133,3 +133,5 @@ PATH := "${@'${BITBAKEPATH}:' if '${BITBAKEPATH}' != '' else ''}${HOSTTOOLS_DIR}
70-
BB_GLOBAL_PYMODULES = "os sys time"
71-
72-
addpylib ${LAYERDIR}/lib oe
73-
+
74-
+LAYERDIR_core = "${LAYERDIR}"
751
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
76-
index 37d07093f5..7a63453f2e 100644
2+
index 7cc5131541..4e899200f1 100644
773
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
784
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
795
@@ -297,113 +297,17 @@ class BootimgEFIPlugin(SourcePlugin):
80-
6+
817
hdddir = "%s/hdd/boot" % cr_workdir
82-
8+
839
- kernel = get_bitbake_var("KERNEL_IMAGETYPE")
8410
- if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
8511
- if get_bitbake_var("INITRAMFS_IMAGE"):
@@ -198,7 +124,7 @@ index 37d07093f5..7a63453f2e 100644
198124
+ for grub_efi_sb_file in grub_efi_sb_files:
199125
+ efi_install_cmd = "install -m 0644 -D %s/%s %s/EFI/BOOT/%s" % (deploy_dir_img, grub_efi_sb_file, hdddir, grub_efi_sb_file)
200126
+ exec_cmd(efi_install_cmd)
201-
127+
202128
if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
203129
for src_path, dst_path in cls.install_task:
204130
diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf
@@ -207,7 +133,7 @@ index efbf2610f9..330c964f87 100644
207133
+++ b/meta/conf/layer.conf
208134
@@ -132,3 +132,5 @@ PATH := "${@'${BITBAKEPATH}:' if '${BITBAKEPATH}' != '' else ''}${HOSTTOOLS_DIR}
209135
BB_GLOBAL_PYMODULES = "os sys time"
210-
136+
211137
addpylib ${LAYERDIR}/lib oe
212138
+
213139
+LAYERDIR_core = "${LAYERDIR}"
@@ -217,7 +143,7 @@ index 31b4bd9afd..0c304f62e1 100644
217143
+++ b/meta/classes-recipe/rust-target-config.bbclass
218144
@@ -127,7 +127,7 @@ def llvm_features(d):
219145
llvm_features[vardepvalue] = "${@llvm_features(d)}"
220-
146+
221147
## arm-unknown-linux-gnueabihf
222148
-DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
223149
+DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
@@ -226,7 +152,7 @@ index 31b4bd9afd..0c304f62e1 100644
226152
TARGET_C_INT_WIDTH[arm-eabi] = "32"
227153
@@ -135,7 +135,7 @@ MAX_ATOMIC_WIDTH[arm-eabi] = "64"
228154
FEATURES[arm-eabi] = "+v6,+vfp2"
229-
155+
230156
## armv7-unknown-linux-gnueabihf
231157
-DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
232158
+DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
@@ -235,15 +161,15 @@ index 31b4bd9afd..0c304f62e1 100644
235161
TARGET_C_INT_WIDTH[armv7-eabi] = "32"
236162
@@ -143,14 +143,14 @@ MAX_ATOMIC_WIDTH[armv7-eabi] = "64"
237163
FEATURES[armv7-eabi] = "+v7,+vfp2,+thumb2"
238-
164+
239165
## aarch64-unknown-linux-{gnu, musl}
240166
-DATA_LAYOUT[aarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
241167
+DATA_LAYOUT[aarch64] = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
242168
TARGET_ENDIAN[aarch64] = "little"
243169
TARGET_POINTER_WIDTH[aarch64] = "64"
244170
TARGET_C_INT_WIDTH[aarch64] = "32"
245171
MAX_ATOMIC_WIDTH[aarch64] = "128"
246-
172+
247173
## x86_64-unknown-linux-{gnu, musl}
248174
-DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
249175
+DATA_LAYOUT[x86_64] = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
@@ -253,7 +179,7 @@ index 31b4bd9afd..0c304f62e1 100644
253179
@@ -397,6 +397,15 @@ def rust_gen_target(d, thing, wd, arch):
254180
tspec['position-independent-executables'] = True
255181
tspec['panic-strategy'] = d.getVar("RUST_PANIC_STRATEGY")
256-
182+
257183
+ # fix for: "Error loading target specification: ARM targets must set `llvm-floatabi` to `hard` or `soft`."
258184
+ if "arm" in tspec['arch']:
259185
+ tspec['llvm-floatabi'] = d.getVar('TARGET_FPU')
@@ -269,9 +195,9 @@ index 31b4bd9afd..0c304f62e1 100644
269195
@@ -404,7 +413,7 @@ def rust_gen_target(d, thing, wd, arch):
270196
# These are accounted for in tmpdir path names so don't need to be in the task sig
271197
rust_gen_target[vardepsexclude] += "ABIEXTENSION llvm_cpu"
272-
198+
273199
-do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES"
274200
+do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES LLVM_TARGET"
275-
201+
276202
RUST_TARGETS_DIR = "${WORKDIR}/rust-targets/"
277203
export RUST_TARGET_PATH = "${RUST_TARGETS_DIR}"

recipes-omnect/images/omnect-os-image.bb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ IMAGE_INSTALL = "\
6060
${@bb.utils.contains('DISTRO_FEATURES', 'efi-secure-boot', ' mokutil', '', d)} \
6161
${@bb.utils.contains('DISTRO_FEATURES', 'iotedge', ' aziot-edged iotedge kernel-modules', '', d)} \
6262
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd-bash-completion', '', d)} \
63-
${@bb.utils.contains('DISTRO_FEATURES', 'wifi-commissioning', ' wifi-commissioning-gatt-service', '', d)} \
63+
${@bb.utils.contains('DISTRO_FEATURES', 'wifi-commissioning', ' wifi-commissioning-service', '', d)} \
6464
${CORE_IMAGE_BASE_INSTALL} \
6565
bootloader-env \
6666
bootloader-versioned \

recipes-omnect/wifi-commissioning-gatt-service/wifi-commissioning-gatt-service.inc

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)