[meta-freescale] [meta-fsl-ppc][PATCH] sysvinit: auto detect hostname for qoriq machines

Gary Thomas gary at mlbassoc.com
Fri Aug 1 04:07:44 PDT 2014


On 2014-08-01 01:36, ting.liu at freescale.com wrote:
> From: Ting Liu <ting.liu at freescale.com>
>
> If a rootfs only contains core specific pkgs (no machine specific
> ones), it is convenient and possible to share a common rootfs image
> for all the machines with same core.
>
> Add a patch (only works for fsl qoriq boards) to auto set hostname.

What if one wanted to have a permanent setting of /etc/hostname that
is neither from the boot command line nor the automatic setting?  I
don't think your patch allows for that.

>
> Also add support to set hostname via bootargs/cmdline.
>
> Signed-off-by: Ting Liu <ting.liu at freescale.com>
> ---
>   .../sysvinit/qoriq-ppc/auto-detect-hostname.patch      | 18 ++++++++++++++++++
>   recipes-core/sysvinit/sysvinit_2.88dsf.bbappend        |  7 ++++++-
>   2 files changed, 24 insertions(+), 1 deletion(-)
>   create mode 100644 recipes-core/sysvinit/sysvinit/qoriq-ppc/auto-detect-hostname.patch
>
> diff --git a/recipes-core/sysvinit/sysvinit/qoriq-ppc/auto-detect-hostname.patch b/recipes-core/sysvinit/sysvinit/qoriq-ppc/auto-detect-hostname.patch
> new file mode 100644
> index 0000000..533f92e
> --- /dev/null
> +++ b/recipes-core/sysvinit/sysvinit/qoriq-ppc/auto-detect-hostname.patch
> @@ -0,0 +1,18 @@
> +diff -uNr sysvinit/rcS sysvinit-new/rcS
> +--- sysvinit/rcS	2014-07-09 11:19:59.000000000 +0800
> ++++ sysvinit-new/rcS	2014-08-01 15:01:54.000000000 +0800
> +@@ -21,6 +21,14 @@
> + #
> + . /etc/default/rcS
> +
> ++# auto detect hostname
> ++#
> ++if test -r /proc/cmdline && grep -q hostname= /proc/cmdline; then
> ++  sed -e "s,.*hostname=\(\S*\)\s*.*,\1," /proc/cmdline >/etc/hostname
> ++elif test -r /proc/cpuinfo && grep -q ^model.*, /proc/cpuinfo; then
> ++  grep ^model /proc/cpuinfo | cut -d, -f2 | tr [A-Z] [a-z] >/etc/hostname
> ++fi
> ++
> + #
> + #	Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
> + #
> diff --git a/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend b/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend
> index 72d991c..b87dd6b 100644
> --- a/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend
> +++ b/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend
> @@ -1 +1,6 @@
> -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
> +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
> +
> +SRC_URI_append_qoriq-ppc = " \
> +    file://auto-detect-hostname.patch;patchdir=../ \
> +"
> +
>

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


More information about the meta-freescale mailing list