I need in my yocto image layer change some sysctl settings for example
net.ipv4.ip_unprivileged_port_start=502
I need to change sysctl.conf or customize it how can I do adding/changing only my variables?
I need in my yocto image layer change some sysctl settings for example
net.ipv4.ip_unprivileged_port_start=502
I need to change sysctl.conf or customize it how can I do adding/changing only my variables?
Hello @fabrizio.camagna,
The sysctl.conf
file is installed by the procps
recipe. On BSP 6 youâll find it in layers/openembedded-core/meta/recipes-extended/procps/procps_3.3.17.bb
.
You can create an append file for this recipe on your layer and put the following contents in it:
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
do_install:append() {
echo "net.ipv4.ip_unprivileged_port_start=502" >> ${D}${sysconfdir}/sysctl.conf
}
If you prefer to have the setting in a separate file, you can create a configuration snippet instead and place it in the /etc/sysctl.d/
directory for automatic inclusion. For example, create a file named 99-custom-sysctl.conf
with your settings and modify the do_install:append()
function to copy this file:
SRC_URI += "file://99-custom-sysctl.conf"
do_install:append() {
install -d ${D}${sysconfdir}/sysctl.d/
install -m 0644 ${WORKDIR}/99-custom-sysctl.conf ${D}${sysconfdir}/sysctl.d/
}
Regards,
Rafael
I tried but nothing, so I add only creation of a simple folder to test, the image is created properly (with kernel configuration changes in a bbappend file) but the folder in the bb recipe is not created
do_install:append() {
install -d ${D}/home/torizon/myfolder
}
I tried also with
do_install {
install -d ${D}/home/torizon/myfolder
}
this my orginal recipe
SUMMARY = âbitbake-layers recipeâ
DESCRIPTION = âRecipe created by bitbake-layersâ
LICENSE = âCLOSEDâ
FILESEXTRAPATHS:prepend := â${THISDIR}/sert-files:â
SRC_URI = âfile://99-sysctl.conf file://99-rtc1.rules file://network0.nmconnectionâ
python do_display_banner() {
bb.plain(ââ);
bb.plain(â* â);
bb.plain(â SERT LAYER â);
bb.plain(â *â);
bb.plain(ââ);
}
do_install:append() {
echo â===============================================================â
echo âSYSCTL CONFIGURATIONâ
install -d ${D}${sysconfdir}/sysctl.d/
install -m 0644 ${WORKDIR}/99-sysctl.conf ${D}${sysconfdir}/sysctl.d/
echo âFILE DI CONFIGURAZIONE RTCâ
install -d ${D}${sysconfdir}/udev/rules.d/
install -m 0644 ${WORKDIR}/99-rtc1.rules ${D}${sysconfdir}/udev/rules.d/
echo âDefault static IPâ
install -d ${D}${sysconfdir}/NetworkManager/system-connections/
install -m 0644 ${WORKDIR}/network0.nmconnection ${D}${sysconfdir}/NetworkManager/system-connections/
echo âCREATE MY FOLDERâ
install -d $/home/torizon/SeRT/
install -d $/home/torizon/SeRT/bootrel/
install -d ${/home/torizon/SeRT/bootdbg/
echo â===============================================================â
}
Whatâs the name of the recipe you created?
Did you check with bitbake-layers show-appends procps
whether your append is active?
meta-sert is the name of the layer recipe name sert_0.1.bb
bitbake-layers show-appends procps
NOTE: Starting bitbake serverâŚ
Loading cache: 100% |############################################| Time: 0:00:05
Loaded 4732 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:02
Parsing of 3142 .bb files complete (3141 cached, 1 parsed). 4733 targets, 649 skipped, 11 masked, 0 errors.
WARNING: No recipes in default available for:
/home/fabrizio/oe-core/buildtorizon-sert-imx8x/conf/âŚ/âŚ/layers/meta-toradex-nxp/recipes-bsp/imx-mkimage/imx-mkimage_1.0.bbappend
/home/fabrizio/oe-core/buildtorizon-sert-imx8x/conf/âŚ/âŚ/layers/meta-toradex-nxp/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.0.imx.bbappend
Summary: There was 1 WARNING message.
=== Matched appended recipes ===
procps_3.3.17.bb:
/home/fabrizio/oe-core/buildtorizon-sert-imx8x/conf/âŚ/âŚ/layers/meta-freescale/recipes-extended/procps/procps_%.bbappend
For the append to work it needs to be called procps_%.bbappend
like we see on the one on meta-freescale
. It would probably be good if you also replicate the directory structure inside your layer.
From the output of bitbake-layers show-appends procps
you donât have an active append on that recipe.
Your recipe should be located here:
meta-sert/recipes-extended/procps/procps_%.bbappend
Please make sure that the append is being properly recognized.
thanks!!! now it works, I have some warnings but it works.
but I see that my folders are created as root and not as torizon user, so I canât write file inside.
build history, why my fodlers owns from root and not torizon
drwxr-xr-x torizon torizon 4096 ./home/torizon
-rwxr-xr-x torizon torizon 286 ./home/torizon/.bashrc
-rwxr-xr-x torizon torizon 241 ./home/torizon/.profile
drwxr-xr-x root root 4096 ./home/torizon/SeRT
drwxr-xr-x root root 4096 ./home/torizon/SeRT/bootdbg
drwxr-xr-x root root 4096 ./home/torizon/SeRT/bootrel
You can use the -o
and -g
options of install
to control the ownership of the installed files.
I tried also with chown and also with -o and -g options, both gives me
invalid user âtorizonâ, is like if it doesnât know torizon user!!
Letâs try to go back to the beginning. Do you have a specific need for building your own Torizon image with yocto?
You can use torizon core builder to customize the contents of /etc/
and install the files you need.
Please let me know whatâs the reason for the custom yocto build, if itâs not necessary we could pivot to make this work using our standard Torizon images.
I began with Torizon Builder but I need to set some Kernel configuration variable like
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE=ârtc1â
and also set the default governor to performance (for realtime issue) so I think we have to use Yocto (now these configuration are working properly), and also we are not sure yet if is better using Torizon with docker, Torizon without docker or directely Toradex embedded linux bsp, so at the moment I would prefer use Yocto so we can have all the possibilities opened.
Moreover we would prefer use realtime patch, because our application should be deterministic even if with time of 25ms but deterministic.
I began with Torizon Builder but I need to set some Kernel configuration variable like
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE=ârtc1â
You can request these settings to be added to the standard Torizon kernel by creating a new community topic for this, listing the configuration options you need.
and also set the default governor to performance (for realtime issue)
That you can do by setting a kernel command line argument:
cpufreq.default_governor
Or you can create a new systemd service with a script that will set the necessary bits in /sys
.
We also have a Torizon build with the RT patch already applied:
You can also make the original changes on sysctl
by capturing changes done to /etc
: