Auto Hostname

This section shows how to enable the lmp-auto-hostname recipe. This recipe customizes device hostnames at runtime, either by appending the serial number from the device tree of the hardware, or the mac address to the hostname.

The recipe lmp-auto-hostname is provided by meta-lmp and can be added by customizing your meta-subscriber-overrides.git.

Enabling Recipe

Clone your meta-subscriber-overrides.git repo and enter its directory:

git clone -b devel<factory>/meta-subscriber-overrides.git
cd meta-subscriber-overrides

Edit the recipes-samples/images/ file and add the recipe on the CORE_IMAGE_BASE_INSTALL list:

gedit recipes-samples/images/


diff --git a/recipes-samples/images/ b/recipes-samples/images/
--- a/recipes-samples/images/
+++ b/recipes-samples/images/
@@ -30,6 +30,7 @@ CORE_IMAGE_BASE_INSTALL += " \
     networkmanager-nmcli \
     git \
     vim \
+    lmp-auto-hostname \
     packagegroup-core-full-cmdline-extended \
     ${@bb.utils.contains('LMP_DISABLE_GPLV3', '1', '', '${CORE_IMAGE_BASE_INSTALL_GPLV3}', d)} \

LmP Auto Hostname Variables

The lmp-auto-hostname recipe can be configured through variables.

Default: serial

appends the serial number of the device.

Example Result: raspberrypi4-64-100000008305bbc3


appends the MAC address of a chosen network interface.

Example Result: raspberrypi4-64-dca6321669ea

Default: eth0

if using mac mode, provide the device network interface to retrieve a MAC address from.

Example Value: eth0 or wlan0

Configuring the LmP Auto Hostname

According to your needs, select the tab serial or MAC.

Serial is configured by default in the lmp-auto-hostname recipe, no need for extra changes.

Add the recipes-samples/images/ file, commit and push:

git commit -m "lmp-auto-hostname: Adding recipe" recipes-samples/images/
git push

Edit the conf/machine/include/ file and add the variables:

gedit recipes-samples/images/



Add the changed files, commit and push:

git add recipes-samples/images/
git add conf/machine/include/
git commit -m "lmp-auto-hostname: Adding recipe"
git push

The latest Target named platform-devel should be the CI job you just created.

When FoundriesFactory CI finishes all jobs, if your device is already registered, wait until the Over-the-Air update finishes, otherwise download and flash the image.

Testing Auto Hostname

Log in to the device via SSH and check the new hostname right after fio@.

Check also the file /etc/hostname to confirm the new hostname.

cat /etc/hostname

Example Output:

cat /etc/hostname

Example Output: