Skip to contentSkip to conversation

mingetty: add package

PATCH New Trevor Woerner 2 participants 4 messages Nov 23, 2011 – Nov 28, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mingetty: add package

---
 package/Config.in            |    1 +
 package/mingetty/Config.in   |    7 +++++++
 package/mingetty/inittab     |   32 ++++++++++++++++++++++++++++++++
 package/mingetty/mingetty.mk |   28 ++++++++++++++++++++++++++++
 target/generic/Makefile.in   |    9 ++++++++-
 5 files changed, 76 insertions(+), 1 deletions(-)
 create mode 100644 package/mingetty/Config.in
 create mode 100644 package/mingetty/inittab
 create mode 100644 package/mingetty/mingetty.mk
package/Config.in +1 -0
index 4b5e5d8..9d01d0b 100644
@@ -528,6 +528,7 @@ source "package/bootutils/Config.in"
 endif
 source "package/htop/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+source "package/mingetty/Config.in"
 source "package/module-init-tools/Config.in"
 source "package/procps/Config.in"
 source "package/psmisc/Config.in"
package/mingetty/Config.in new file +7 -0
new file mode 100644
index 0000000..adc95a8
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_MINGETTY
+	bool "mingetty"
+	help
+	  mingetty is a minimal getty for use on virtual consoles and is not
+	  suitable for use on serial lines.
+
+	  http://sourceforge.net/projects/mingetty/
package/mingetty/inittab new file +32 -0
new file mode 100644
index 0000000..b59fc12
@@ -0,0 +1,32 @@
+# /etc/inittab
+#
+# This inittab is a basic inittab sample for mingetty,
+# which mimics sysvinit's inittab,
+# which mimics Buildroot's inittab for Busybox.
+id:1:initdefault:
+
+proc::sysinit:/bin/mount -t proc proc /proc
+rwmo::sysinit:/bin/mount -o remount,rw / # REMOUNT_ROOTFS_RW
+dpts::sysinit:/bin/mkdir -p /dev/pts
+moun::sysinit:/bin/mount -a
+host::sysinit:/bin/hostname -F /etc/hostname
+init::sysinit:/etc/init.d/rcS
+
+1:1:respawn:/sbin/mingetty --noclear tty1
+2:1:respawn:/sbin/mingetty --noclear tty2
+
+# S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
+
+# Logging junk
+mess::sysinit:/bin/touch /var/log/messages
+sysl:1:respawn:/sbin/syslogd -n -m 0
+klog:1:respawn:/sbin/klogd -n
+
+# Stuff to do for the 3-finger salute
+rebo::ctrlaltdel:/sbin/reboot
+
+# Stuff to do before rebooting
+sklo:6:wait:/usr/bin/killall klogd
+ssys:6:wait:/usr/bin/killall syslogd
+umou:6:wait:/bin/umount -a -r
+swap:6:wait:/sbin/swapoff -a
package/mingetty/mingetty.mk new file +28 -0
new file mode 100644
index 0000000..d2ec924
@@ -0,0 +1,28 @@
+#############################################################
+#
+# mingetty
+#
+#############################################################
+MINGETTY_VERSION = 1.08
+MINGETTY_SOURCE  = mingetty-$(MINGETTY_VERSION).tar.gz
+MINGETTY_SITE    = http://downloads.sourceforge.net/project/mingetty/mingetty/$(MINGETTY_VERSION)
+
+# Override sysvinit's implementations if it is enabled.
+ifeq ($(BR2_PACKAGE_SYSVINIT),y)
+MINGETTY_DEPENDENCIES = sysvinit
+endif
+
+define MINGETTY_BUILD_CMDS
+	$(MAKE) CC=$(TARGET_CC) -C $(@D)
+endef
+
+define MINGETTY_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/mingetty $(TARGET_DIR)/sbin
+	$(INSTALL) -D -m 0644 package/mingetty/inittab $(TARGET_DIR)/etc/inittab
+endef
+
+define MINGETTY_CLEAN_CMDS
+	$(MAKE) -C $(@D) clean
+endef
+
+$(eval $(call GENTARGETS))
target/generic/Makefile.in +8 -1
index 4185202..5ce1447 100644
@@ -23,6 +23,11 @@ target-generic-getty-sysvinit:
 	$(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) vt100 #~' \
 		$(TARGET_DIR)/etc/inittab
 
+# Set the getty to mingetty
+target-generic-getty-mingetty:
+	$(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/mingetty --noclear $(TARGET_GENERIC_GETTY) #~' \
+		$(TARGET_DIR)/etc/inittab
+
 # Find commented line, if any, and remove leading '#'s
 target-generic-do-remount-rw:
 	$(SED) '/^#.*# REMOUNT_ROOTFS_RW$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
@@ -40,7 +45,9 @@ TARGETS += target-generic-issue
 endif
 
 ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
-ifeq ($(BR2_PACKAGE_SYSVINIT),y)
+ifeq ($(BR2_PACKAGE_MINGETTY),y)
+TARGETS += target-generic-getty-mingetty
+else ifeq ($(BR2_PACKAGE_SYSVINIT),y)
 TARGETS += target-generic-getty-sysvinit
 else
 TARGETS += target-generic-getty-busybox
Signature · 1 line
1.7.6.233.gd79bc
#1 lore raw

PATCH 1/1 mingetty: add package

Is there any interest in this patch?

Quoted 139 lines · Trevor Woerner

---

?package/Config.in ? ? ? ? ? ?| ? ?1 +
?package/mingetty/Config.in ? | ? ?7 +++++++
?package/mingetty/inittab ? ? | ? 32 ++++++++++++++++++++++++++++++++
?package/mingetty/mingetty.mk | ? 28 ++++++++++++++++++++++++++++
?target/generic/Makefile.in ? | ? ?9 ++++++++-

?5 files changed, 76 insertions(+), 1 deletions(-) ?create mode 100644 package/mingetty/Config.in ?create mode 100644 package/mingetty/inittab ?create mode 100644 package/mingetty/mingetty.mk

package/Config.in +0 -0
index 4b5e5d8..9d01d0b 100644
@@ -528,6 +528,7 @@ source "package/bootutils/Config.in"

?endif
?source "package/htop/Config.in"
?if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
+source "package/mingetty/Config.in"
?source "package/module-init-tools/Config.in"
?source "package/procps/Config.in"
?source "package/psmisc/Config.in"

package/mingetty/Config.in new file +7 -0
new file mode 100644
index 0000000..adc95a8
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_MINGETTY
+ ? ? ? bool "mingetty"
+ ? ? ? help
+ ? ? ? ? mingetty is a minimal getty for use on virtual consoles and is not
+ ? ? ? ? suitable for use on serial lines.
+
+ ? ? ? ? http://sourceforge.net/projects/mingetty/
package/mingetty/inittab new file +32 -0
new file mode 100644
index 0000000..b59fc12
@@ -0,0 +1,32 @@
+# /etc/inittab
+#
+# This inittab is a basic inittab sample for mingetty,
+# which mimics sysvinit's inittab,
+# which mimics Buildroot's inittab for Busybox.
+id:1:initdefault:
+
+proc::sysinit:/bin/mount -t proc proc /proc
+rwmo::sysinit:/bin/mount -o remount,rw / # REMOUNT_ROOTFS_RW
+dpts::sysinit:/bin/mkdir -p /dev/pts
+moun::sysinit:/bin/mount -a
+host::sysinit:/bin/hostname -F /etc/hostname
+init::sysinit:/etc/init.d/rcS
+
+1:1:respawn:/sbin/mingetty --noclear tty1
+2:1:respawn:/sbin/mingetty --noclear tty2
+
+# S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
+
+# Logging junk
+mess::sysinit:/bin/touch /var/log/messages
+sysl:1:respawn:/sbin/syslogd -n -m 0
+klog:1:respawn:/sbin/klogd -n
+
+# Stuff to do for the 3-finger salute
+rebo::ctrlaltdel:/sbin/reboot
+
+# Stuff to do before rebooting
+sklo:6:wait:/usr/bin/killall klogd
+ssys:6:wait:/usr/bin/killall syslogd
+umou:6:wait:/bin/umount -a -r
+swap:6:wait:/sbin/swapoff -a
package/mingetty/mingetty.mk new file +28 -0
new file mode 100644
index 0000000..d2ec924
@@ -0,0 +1,28 @@
+#############################################################
+#
+# mingetty
+#
+#############################################################
+MINGETTY_VERSION = 1.08
+MINGETTY_SOURCE ?= mingetty-$(MINGETTY_VERSION).tar.gz
+MINGETTY_SITE ? ?= http://downloads.sourceforge.net/project/mingetty/mingetty/$(MINGETTY_VERSION)
+
+# Override sysvinit's implementations if it is enabled.
+ifeq ($(BR2_PACKAGE_SYSVINIT),y)
+MINGETTY_DEPENDENCIES = sysvinit
+endif
+
+define MINGETTY_BUILD_CMDS
+ ? ? ? $(MAKE) CC=$(TARGET_CC) -C $(@D)
+endef
+
+define MINGETTY_INSTALL_TARGET_CMDS
+ ? ? ? $(INSTALL) -D -m 0755 $(@D)/mingetty $(TARGET_DIR)/sbin
+ ? ? ? $(INSTALL) -D -m 0644 package/mingetty/inittab $(TARGET_DIR)/etc/inittab
+endef
+
+define MINGETTY_CLEAN_CMDS
+ ? ? ? $(MAKE) -C $(@D) clean
+endef
+
+$(eval $(call GENTARGETS))
target/generic/Makefile.in +0 -0
index 4185202..5ce1447 100644
@@ -23,6 +23,11 @@ target-generic-getty-sysvinit:
 ? ? ? ?$(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) vt100 #~' \

? ? ? ? ? ? ? ?$(TARGET_DIR)/etc/inittab

target/generic/Makefile.in +5 -0
+# Set the getty to mingetty
+target-generic-getty-mingetty:
+ ? ? ? $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/mingetty --noclear $(TARGET_GENERIC_GETTY) #~' \
+ ? ? ? ? ? ? ? $(TARGET_DIR)/etc/inittab
+

?# Find commented line, if any, and remove leading '#'s ?target-generic-do-remount-rw:
? ? ? ?$(SED) '/^#.*# REMOUNT_ROOTFS_RW$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab

target/generic/Makefile.in +0 -0
@@ -40,7 +45,9 @@ TARGETS += target-generic-issue

?endif

?ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)

target/generic/Makefile.in +3 -1
-ifeq ($(BR2_PACKAGE_SYSVINIT),y)
+ifeq ($(BR2_PACKAGE_MINGETTY),y)
+TARGETS += target-generic-getty-mingetty
+else ifeq ($(BR2_PACKAGE_SYSVINIT),y)

?TARGETS += target-generic-getty-sysvinit
?else
?TARGETS += target-generic-getty-busybox
--
1.7.6.233.gd79bc

#2 lore raw

PATCH 1/1 mingetty: add package

In reply to Trevor Woerner
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Trevor" == Trevor Woerner <[email protected]> writes:

Trevor> ---

 Trevor>  package/Config.in            |    1 +
 Trevor>  package/mingetty/Config.in   |    7 +++++++
 Trevor>  package/mingetty/inittab     |   32 ++++++++++++++++++++++++++++++++
 Trevor>  package/mingetty/mingetty.mk |   28 ++++++++++++++++++++++++++++
 Trevor>  target/generic/Makefile.in   |    9 ++++++++-
 Trevor>  5 files changed, 76 insertions(+), 1 deletions(-)
 Trevor>  create mode 100644 package/mingetty/Config.in
 Trevor>  create mode 100644 package/mingetty/inittab
 Trevor>  create mode 100644 package/mingetty/mingetty.mk

Trevor> +++ b/package/mingetty/mingetty.mk
Trevor> @@ -0,0 +1,28 @@
Trevor> +############################################################# Trevor> +#
Trevor> +# mingetty
Trevor> +#
Trevor> +############################################################# Trevor> +MINGETTY_VERSION = 1.08
Trevor> +MINGETTY_SOURCE = mingetty-$(MINGETTY_VERSION).tar.gz
Trevor> +MINGETTY_SITE = http://downloads.sourceforge.net/project/mingetty/mingetty/$(MINGETTY_VERSION)

Use the mirror support we have, E.G.

http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/mingetty

Trevor> +
Trevor> +# Override sysvinit's implementations if it is enabled.

sysvinit doesn't contain a getty implementation. What you mean is that you want to run after sysvinit so it doesn't overwrite your inittab.

Trevor> +ifeq ($(BR2_PACKAGE_SYSVINIT),y)
Trevor> +MINGETTY_DEPENDENCIES = sysvinit
Trevor> +endif
Trevor> +
Trevor> +define MINGETTY_BUILD_CMDS
Trevor> + $(MAKE) CC=$(TARGET_CC) -C $(@D)
Trevor> +endef
Trevor> +
Trevor> +define MINGETTY_INSTALL_TARGET_CMDS
Trevor> + $(INSTALL) -D -m 0755 $(@D)/mingetty $(TARGET_DIR)/sbin
Trevor> + $(INSTALL) -D -m 0644 package/mingetty/inittab $(TARGET_DIR)/etc/inittab

Please don't do that. People might have a custom inittab (I know sysvinit does so as well, but as the syntax is different than busybox's there isn't really much else it can do).

The nicest thing would be instead to replace /sbin/getty with /sbin/mingetty in the existing inittab, but as mingetty doesn't handle the same arguments as busybox getty, this gets quite tricky.

Perhaps the best would just do nothing and let people tweak their inittab themselves if they want.

Trevor> diff --git a/target/generic/Makefile.in b/target/generic/Makefile.in Trevor> index 4185202..5ce1447 100644
Trevor> --- a/target/generic/Makefile.in
Trevor> +++ b/target/generic/Makefile.in

And drop this.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 mingetty: add package

Thanks for having a look at my patch.

Quoted 3 lines · Peter Korsgaard

?Trevor> +MINGETTY_SITE ? ?= http://downloads.sourceforge.net/project/mingetty/mingetty/$(MINGETTY_VERSION)

Use the mirror support we have

Thanks, I wasn't sure how to use it.

Quoted 5 lines

?Trevor> +
?Trevor> +# Override sysvinit's implementations if it is enabled.

sysvinit doesn't contain a getty implementation. What you mean is that you want to run after sysvinit so it doesn't overwrite your inittab.

Yes, that's correct.

Quoted 7 lines

?Trevor> +define MINGETTY_INSTALL_TARGET_CMDS
?Trevor> + ? ? ?$(INSTALL) -D -m 0755 $(@D)/mingetty $(TARGET_DIR)/sbin ?Trevor> + ? ? ?$(INSTALL) -D -m 0644 package/mingetty/inittab $(TARGET_DIR)/etc/inittab

Please don't do that. People might have a custom inittab (I know sysvinit does so as well, but as the syntax is different than busybox's there isn't really much else it can do).

Okay, no problem. [I had actually used inittab as the template upon which I based this new package, so that's why I was doing the same as it was doing.]

Quoted 10 lines

The nicest thing would be instead to replace /sbin/getty with /sbin/mingetty in the existing inittab, but as mingetty doesn't handle the same arguments as busybox getty, this gets quite tricky.

?Trevor> diff --git a/target/generic/Makefile.in b/target/generic/Makefile.in ?Trevor> index 4185202..5ce1447 100644
?Trevor> --- a/target/generic/Makefile.in
?Trevor> +++ b/target/generic/Makefile.in

And drop this.

I'm confused by this last request. If the nicest thing to do would be to replace /sbin/getty with /sbin/mingetty wouldn't my modification to target/generic/Makefile.in be the way to go about it?

I have copied my original modifications to target/generic/Makefile.in below:

target/generic/Makefile.in +0 -0
index 4185202..5ce1447 100644
@@ -23,6 +23,11 @@ target-generic-getty-sysvinit:
       $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo

$(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/getty -L

$(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) vt100 #~' \
               $(TARGET_DIR)/etc/inittab

+# Set the getty to mingetty +target-generic-getty-mingetty:
+ $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo
$(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/mingetty --noclear $(TARGET_GENERIC_GETTY) #~' \
+ $(TARGET_DIR)/etc/inittab
+
# Find commented line, if any, and remove leading '#'s target-generic-do-remount-rw:

       $(SED) '/^#.*# REMOUNT_ROOTFS_RW$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab

@@ -40,7 +45,9 @@ TARGETS += target-generic-issue
endif

ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
-ifeq ($(BR2_PACKAGE_SYSVINIT),y)
+ifeq ($(BR2_PACKAGE_MINGETTY),y)
+TARGETS += target-generic-getty-mingetty
+else ifeq ($(BR2_PACKAGE_SYSVINIT),y)
TARGETS += target-generic-getty-sysvinit
else
TARGETS += target-generic-getty-busybox