Skip to contentSkip to conversation

How to handle user network configuration on a OTA environment

DISCUSSION Renato Mendes 2 participants 2 messages Dec 6, 2023 – Dec 7, 2023

lore
Share & tools
lore
#0 lore raw

Using a Raspberry Pi Zero W, I have build an image with the following layers:

# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf

# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
/home/release_1/src/poky/meta \
/home/release_1/src/poky/meta-poky \
/home/release_1/src/poky/meta-yocto-bsp \
/home/release_1/src/meta-openembedded/meta-oe \
/home/release_1/src/meta-openembedded/meta-python \
/home/release_1/src/meta-openembedded/meta-multimedia \
/home/release_1/src/meta-openembedded/meta-networking \
/home/release_1/src/meta-raspberrypi \
/home/release_1/src/meta-mender/meta-mender-core \
/home/release_1/src/meta-mender/meta-mender-raspberrypi \
"

I'm using Mender for OTA.

The image is fine and runs Yocto Distro at my Raspi.

As this is my first project using OTA, I'm now about to setup networking. I've build a custom captive portal using Nodejs what will allow user to choose the WiFi network.

Here is the logic I need:
a) If there is network configuration stored (in a file, ie), device goes to Access Point mode with fixed IP (ex: 192.168.0.1). Then the user will connect, choose WiFi network and save it to a file

b) If there is WiFi configuration, will connect automatically

c) If user reset the device (a physical push button), the WiFi configuration is erased and device goes back to (a) mode

My questions are how to exactly handle the desired scenario. My doubts:

a) How will the device knows on boot if there is a network configuration file to load

b) How can the device choose between AP ou WiFi mode based on the existance of the given file

c) How will this file behave on a OTA update (Mender.io says, must be stored at /media/ directory to be preserved on updates)

Thanks for helping... I've read several different articles for some days and I'm very confused on where to start from...

#1 lore raw

Hi Renato,

I would suggest to start with the tutorial we have exactly for this usecase here:
https://hub.mender.io/t/how-to-configure-networking-using-systemd-in-yocto-project/1097.
Once you have it replicated and working, add and modify the bits and pieces that are specific to your requirements.

Greetz,
Josef

Quoted 68 lines · Renato Mendes

Using a Raspberry Pi Zero W, I have build an image with the following layers:

# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf

# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
/home/release_1/src/poky/meta \
/home/release_1/src/poky/meta-poky \
/home/release_1/src/poky/meta-yocto-bsp \
/home/release_1/src/meta-openembedded/meta-oe \
/home/release_1/src/meta-openembedded/meta-python \
/home/release_1/src/meta-openembedded/meta-multimedia \
/home/release_1/src/meta-openembedded/meta-networking \
/home/release_1/src/meta-raspberrypi \
/home/release_1/src/meta-mender/meta-mender-core \
/home/release_1/src/meta-mender/meta-mender-raspberrypi \
"

I'm using Mender for OTA.

The image is fine and runs Yocto Distro at my Raspi.

As this is my first project using OTA, I'm now about to setup networking. I've build a custom captive portal using Nodejs what will allow user to choose the WiFi network.

Here is the logic I need:
a) If there is network configuration stored (in a file, ie), device goes to Access Point mode with fixed IP (ex: 192.168.0.1). Then the user will connect, choose WiFi network and save it to a file

b) If there is WiFi configuration, will connect automatically

c) If user reset the device (a physical push button), the WiFi configuration is erased and device goes back to (a) mode

My questions are how to exactly handle the desired scenario. My doubts:

a) How will the device knows on boot if there is a network configuration file to load

b) How can the device choose between AP ou WiFi mode based on the existance of the given file

c) How will this file behave on a OTA update (Mender.io says, must be stored at /media/ directory to be preserved on updates)

Thanks for helping... I've read several different articles for some days and I'm very confused on where to start from...

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
You automatically follow any topics you start or reply to. View/Reply Online (#61819):
https://lists.yoctoproject.org/g/yocto/message/61819
Mute This Topic: https://lists.yoctoproject.org/mt/103022968/4689568
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-