Umberto
Umberto

Reputation: 21

Yocto recipe set hostname on raspberry

How can I set a hostname with Yocto recipe for raspberry pi 4? I'am trying to set up a personalized hostname and hosts files on yocto raspberry image but I don't know how to do it. Here is my file's examples. "hosts"

pi@raspberrypi:/etc $ sudo vim hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       my_personalized_hostname

and hostname

hostname

Any helps? thanks.

Upvotes: 0

Views: 3065

Answers (3)

Cord Elias
Cord Elias

Reputation: 41

hostname_pn-base-files = "your_hostname" in a .conf file works for yocto releases before "honister".

With "honister" and later you need to use hostname:pn-base-files = "your_hostname"

The override syntax was changed with "honister" (: instead _ as override operator). Chapter "Conditional Syntax (Overrides)" of the Bitbake manual has all the details.

Upvotes: 4

BarryTice
BarryTice

Reputation: 11

The local.conf entry doesn't do the trick, as suggested by the previous answer. The value is getting overridden somewhere else.

I found that the oe-core/meta/recipes-core/base-files/base-files_3.0.14.bb file in my layers directory contained a line like this:

hostname = "${MACHINE}"

When I changed ${MACHINE} to the value of my choice, my environment was created with my desired hostname.

Upvotes: 0

Cleiton Bueno
Cleiton Bueno

Reputation: 419

Set hostname_pn-base-files = "your_hostname" in local.conf.

Upvotes: 0

Related Questions