How to configure networking using systemd in Yocto Project

Here’s a thread from the Yocto mailing list that discusses this a bit: https://yocto.yoctoproject.narkive.com/4SX0Ghao/basic-question-core-image-minimal-v-s-core-image-base

Basically core-image-minimal is intended to be the absolute bare minimum to get a system to boot. core-image-base is intended to be more usable as a full-fledged Linux system.

Looking at a diff between core-image-minimal.bb and core-image-base.bb it appears that the substantive difference in core-image-base is:

IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}"

So adding those two packages should get you what you need. But that will be virtually the same as just using core-image-base. Is there a reason you want to modify core-image-minimal instead of using core-image-base?

Drew

Actually core-image-minimal is 16MB size but core-image-base is 92.5MB. And also I didn’t need all the services of core-image-base. I only have minimum requirement like enable ethernet driver and also I have size constraint. I have tried with those package update. If you append "IMAGE_INSTALL = “packagegroup-extended”, then the core-image-minimal also having the 92.5MB size. I have tried by adding the individual packages from the package extendend but nothing is working fine.

In that case you probably need to investigate what Variscite has set for the MACHINE_EXTRA_RRECOMMENDS variable. That may contain the packages needed. I suggest a followup on their forums since it will be heavily dependent on how they implemented the platform layer.

Drew

To whome it may concern: My problems from above seem to have been because I was running thud. I just upgraded to zeus which broke my network config. Changing back to your filename for the conf file worked.

So everthing worked for me on thud using the filename “wpa_supplicant-wlan0.conf” and now it works on zeus with filename “wpa_supplicant-nl80211-wlan0.conf”.

Hi Hub Members,
According to Variscite (http://variwiki.com/index.php?title=Static_IP_Address):
ConnMan is the default Yocto network manager.
Systemd-networkd will conflict with it.
Do you recommend to use it and turn off ConnMan? Why? How?
Thank You
Israel

This is really going to be driven by your products requirements as to what you need and which gives you what you need. :slight_smile:

Personally i use Systemd-networkd (on variscite products as well custom ones) as i have to use it so heavily for others parts of my headless embedded products, local and cloud corporate servers. I had no need for anything else. But as i mentioned your requirements may differ.

@drewmoseley,
I found your excellent slides that can be helpful for this page’s visitors.

Thanks for finding that. It slipped my mind.

I didn’t realize that connman was the default but my local setups mostly use systemd-networkd. connman and NetworkManager may be better for devices that are going to be used in more dynamic situations as systemd-networkd doesn’t have any good frontends that I am aware of and mainly require editing config files.

Drew

10 posts were split to a new topic: Issues with systemd-networkd

How does this work when I am using a read only root file system. And I have to modify my .network file?

You’ll need to arrange for the .network file to be moved to the data partition and replaced with a symlink. Alternatively, if the changes are static, you can simply modify it in the Yocto build.
Drew

If I do that. I have restart systemd-networkd service after boot.

Well normally these kind of changes will be done in the Yocto build rather than on the target to avoid such issues. Do you have a requirement where it must be done on the target?
Drew

Well the requirement is to change wired.network as I have to switch between static and dynamic profile.

I am not an expert on yocto. I am still learning it
Do you mean instead of getting creating a separate recipe I need to create a bbappend file of that system recipe ?

Yes, that is the right approach.

I tried it with a systemd-conf bbappend file. That did not work. I am now trying to use systemd bbappend file

I would recommend searching the yocto workdir for the wired file to see which recipe installed it, just in case you are trying to extend the wrong recipe.

To give a brief context. I had added that file by creating a bbappend file for systemd-conf. That was before mender integration and r/w rootFile system.

So that’s the reason I tried systemd-conf_%.bbappend file but that did not work. But I will check out my work dir

Edit1:
Sorry. I will re-attach my systemd-conf file. I am having some issues while running it in bitbake

Edit2:
My systemd-conf_%.bbappend file

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI+= "\
	file://wired.network \
	"

FILES_${PN} += " \
	/data/network/wired.network \
	"

do_install_append() {
	install -d ${D}${sysconfdir}/systemd/network
	install -d ${D}/data/network
	install -m 0644 ${WORKDIR}/wired.network ${D}/data/network
	ln -s /data/network/wired.network ${D}${sysconfdir}/systemd/network/wired.network
}

when you say its not working, are you saying the symlink isnt appearing where you expect it?