diff mbox

[1/1] skeleton: add default login port to /etc/securetty

Message ID 1369600825-19785-1-git-send-email-spenser@gillilanding.com
State Accepted
Headers show

Commit Message

Spenser Gilliland May 26, 2013, 8:40 p.m. UTC
From: Tzu-Jung Lee <tjlee@ambarella.com>

We ran into a "Login incorrect" problem when running the same rootfs
image across platforms with different loging ports ttyS0/1/2/3.

Simply assignning "console" to BR2_TARGET_GENERIC_GETTY_PORT, which in
turn modifies the /etc/inittab, is not enough because the "console" device
was missing in the /etc/securetty.

While current securetty has enumerated a lot of ttys, this patch should save
some efforts to enumerate more.

Signed-off-by: Tzu-Jung Lee <tjlee@ambarella.com>
Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 support/scripts/graph-depends |    1 +
 system/system.mk              |    8 ++++++++
 2 files changed, 9 insertions(+)

Comments

Spenser Gilliland May 26, 2013, 8:43 p.m. UTC | #1
On Sun, May 26, 2013 at 3:40 PM, Spenser Gilliland
<spenser@gillilanding.com> wrote:
> From: Tzu-Jung Lee <tjlee@ambarella.com>
>
> We ran into a "Login incorrect" problem when running the same rootfs
> image across platforms with different loging ports ttyS0/1/2/3.
>
> Simply assignning "console" to BR2_TARGET_GENERIC_GETTY_PORT, which in
> turn modifies the /etc/inittab, is not enough because the "console" device
> was missing in the /etc/securetty.
>
> While current securetty has enumerated a lot of ttys, this patch should save
> some efforts to enumerate more.
>
> Signed-off-by: Tzu-Jung Lee <tjlee@ambarella.com>
> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
>  support/scripts/graph-depends |    1 +
>  system/system.mk              |    8 ++++++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
> index 50b8670..ac24086 100755
> --- a/support/scripts/graph-depends
> +++ b/support/scripts/graph-depends
> @@ -161,6 +161,7 @@ def remove_redundant_deps(deps):
>      return newdeps
>
>  TARGET_EXCEPTIONS = [
> +    "target-generic-securetty",
>      "target-generic-issue",
>      "target-generic-getty-busybox",
>      "target-generic-do-remount-rw",
> diff --git a/system/system.mk b/system/system.mk
> index 44a33ae..3e11a51 100644
> --- a/system/system.mk
> +++ b/system/system.mk
> @@ -9,6 +9,10 @@ TARGET_GENERIC_GETTY:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT))
>  TARGET_GENERIC_GETTY_BAUDRATE:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE))
>  TARGET_GENERIC_GETTY_TERM:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM))
>
> +target-generic-securetty:
> +       grep -q ^$(TARGET_GENERIC_GETTY)$$ $(TARGET_DIR)/etc/securetty || \
> +               echo $(TARGET_GENERIC_GETTY) >> $(TARGET_DIR)/etc/securetty
> +
>  target-generic-hostname:
>         mkdir -p $(TARGET_DIR)/etc
>         echo "$(TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
> @@ -40,6 +44,10 @@ target-generic-do-remount-rw:
>  target-generic-dont-remount-rw:
>         $(SED) '/^[^#].*# REMOUNT_ROOTFS_RW$$/s~^~#~' $(TARGET_DIR)/etc/inittab
>
> +ifneq ($(TARGET_GENERIC_GETTY),)
> +TARGETS += target-generic-securetty
> +endif
> +
>  ifneq ($(TARGET_GENERIC_HOSTNAME),)
>  TARGETS += target-generic-hostname
>  endif
> --
> 1.7.9.5
>

Thomas,

Sorry, about that. That was actually an artifact from before I tested
it.  The patch above should work and I've included the changes you
asked for.

It's $$ for a single $ in make.

Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate
Peter Korsgaard May 26, 2013, 9 p.m. UTC | #2
>>>>> "Spenser" == Spenser Gilliland <spenser@gillilanding.com> writes:

 Spenser> From: Tzu-Jung Lee <tjlee@ambarella.com>

 Spenser> We ran into a "Login incorrect" problem when running the same
 Spenser> rootfs image across platforms with different loging ports
 Spenser> ttyS0/1/2/3.

 Spenser> Simply assignning "console" to BR2_TARGET_GENERIC_GETTY_PORT,
 Spenser> which in turn modifies the /etc/inittab, is not enough because
 Spenser> the "console" device was missing in the /etc/securetty.

 Spenser> While current securetty has enumerated a lot of ttys, this
 Spenser> patch should save some efforts to enumerate more.

 Spenser> Signed-off-by: Tzu-Jung Lee <tjlee@ambarella.com>
 Spenser> Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
 Spenser> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 Spenser> ---
 
 Spenser> +target-generic-securetty:
 Spenser> +	grep -q ^$(TARGET_GENERIC_GETTY)$$ $(TARGET_DIR)/etc/securetty || \
 Spenser> +		echo $(TARGET_GENERIC_GETTY) >> $(TARGET_DIR)/etc/securetty

I prefer to stick the TARGET_GENERIC_GETTY value inside single quotes to
ensure the shell won't get confused.

Committed to next with that corrected, thanks.
diff mbox

Patch

diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index 50b8670..ac24086 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -161,6 +161,7 @@  def remove_redundant_deps(deps):
     return newdeps
 
 TARGET_EXCEPTIONS = [
+    "target-generic-securetty",
     "target-generic-issue",
     "target-generic-getty-busybox",
     "target-generic-do-remount-rw",
diff --git a/system/system.mk b/system/system.mk
index 44a33ae..3e11a51 100644
--- a/system/system.mk
+++ b/system/system.mk
@@ -9,6 +9,10 @@  TARGET_GENERIC_GETTY:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT))
 TARGET_GENERIC_GETTY_BAUDRATE:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE))
 TARGET_GENERIC_GETTY_TERM:=$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM))
 
+target-generic-securetty:
+	grep -q ^$(TARGET_GENERIC_GETTY)$$ $(TARGET_DIR)/etc/securetty || \
+		echo $(TARGET_GENERIC_GETTY) >> $(TARGET_DIR)/etc/securetty
+
 target-generic-hostname:
 	mkdir -p $(TARGET_DIR)/etc
 	echo "$(TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
@@ -40,6 +44,10 @@  target-generic-do-remount-rw:
 target-generic-dont-remount-rw:
 	$(SED) '/^[^#].*# REMOUNT_ROOTFS_RW$$/s~^~#~' $(TARGET_DIR)/etc/inittab
 
+ifneq ($(TARGET_GENERIC_GETTY),)
+TARGETS += target-generic-securetty
+endif
+
 ifneq ($(TARGET_GENERIC_HOSTNAME),)
 TARGETS += target-generic-hostname
 endif