All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-fsl-ppc][PATCH] sysvinit: auto detect hostname for qoriq machines
@ 2014-08-01  7:36 ting.liu
  2014-08-01 11:07 ` Gary Thomas
  2014-08-01 13:01 ` Otavio Salvador
  0 siblings, 2 replies; 3+ messages in thread
From: ting.liu @ 2014-08-01  7:36 UTC (permalink / raw)
  To: meta-freescale

From: Ting Liu <ting.liu@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.

Also add support to set hostname via bootargs/cmdline.

Signed-off-by: Ting Liu <ting.liu@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=../ \
+"
+
-- 
1.8.3.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [meta-fsl-ppc][PATCH] sysvinit: auto detect hostname for qoriq machines
  2014-08-01  7:36 [meta-fsl-ppc][PATCH] sysvinit: auto detect hostname for qoriq machines ting.liu
@ 2014-08-01 11:07 ` Gary Thomas
  2014-08-01 13:01 ` Otavio Salvador
  1 sibling, 0 replies; 3+ messages in thread
From: Gary Thomas @ 2014-08-01 11:07 UTC (permalink / raw)
  To: meta-freescale

On 2014-08-01 01:36, ting.liu@freescale.com wrote:
> From: Ting Liu <ting.liu@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@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
------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [meta-fsl-ppc][PATCH] sysvinit: auto detect hostname for qoriq machines
  2014-08-01  7:36 [meta-fsl-ppc][PATCH] sysvinit: auto detect hostname for qoriq machines ting.liu
  2014-08-01 11:07 ` Gary Thomas
@ 2014-08-01 13:01 ` Otavio Salvador
  1 sibling, 0 replies; 3+ messages in thread
From: Otavio Salvador @ 2014-08-01 13:01 UTC (permalink / raw)
  To: Liu Ting-B28495; +Cc: meta-freescale@yoctoproject.org

On Fri, Aug 1, 2014 at 4:36 AM,  <ting.liu@freescale.com> wrote:
> From: Ting Liu <ting.liu@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.
>
> Also add support to set hostname via bootargs/cmdline.
>
> Signed-off-by: Ting Liu <ting.liu@freescale.com>

This patch is a behaviour not a BSP thing. Please don't include it.

Nack!

Check the discussion we're having in OE-Core mailing list about the hostname.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-01 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-01  7:36 [meta-fsl-ppc][PATCH] sysvinit: auto detect hostname for qoriq machines ting.liu
2014-08-01 11:07 ` Gary Thomas
2014-08-01 13:01 ` Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.