systemd: enable getty for framebuffer console (tty0)
Scenario: | Use an HDMI/DVI monitor and USB keyboard (instead of RS232 connection) to control the starterkit. |
---|---|
Tested with: | STKa6x Rev.02xx + BSP Rev.0109 |
May also work on: | STKLS102xA, STKa7x, STKa6ULx |
Run time
Use systemctl
to temporarily enable the getty on a running system.
This actually creates a symlink
/etc/systemd/system/getty.target.wants/getty@tty0.service → /lib/systemd/system/getty@.service
- Remount RootFS R/W
mount -o remount,rw /
- Enable systemd unit for getty@tty0
systemctl enable getty@tty0.service
- Remount RootFS read-only
mount -o remount,ro /
- Start unit
systemctl start getty@tty0.service
Compile time
To permanently enable the getty you need to create a new PTXdist package, which takes care of creating a proper symbolic link (see above) in the root filesystem.
- Create package files
Simply put an .in
and .make
file in the rules/
directory of the BSP.
For instance
- rules/systemd_getty.in
## SECTION=initmethod if INITMETHOD_SYSTEMD config INITMETHOD_SYSTEMD_GETTY bool prompt "start getty on tty0" help Enable this to start a getty on tty0 during system boot endif
- rules/systemd_getty.make
# -*-makefile-*- # # Copyright (C) 2012 by Daniel Gericke <daniel.gericke@tqs.de> # # See CREDITS for details about who has contributed to this project. # # For further information about the PTXdist project and license conditions # see the README file. # # # We provide this package # PACKAGES-$(PTXCONF_INITMETHOD_SYSTEMD_GETTY) += initmethod-systemd-getty INITMETHOD_SYSTEMD_GETTY_VERSION := 1 # ---------------------------------------------------------------------------- # Target-Install # ---------------------------------------------------------------------------- $(STATEDIR)/initmethod-systemd-getty.targetinstall: @$(call targetinfo) @$(call install_init, initmethod-systemd-getty) @$(call install_fixup,initmethod-systemd-getty,PRIORITY,optional) @$(call install_fixup,initmethod-systemd-getty,SECTION,base) @$(call install_fixup,initmethod-systemd-getty,AUTHOR,"TQ Embedded <support@tq-group.com>") @$(call install_fixup,initmethod-systemd-getty,DESCRIPTION,missing) ifdef PTXCONF_INITMETHOD_SYSTEMD @$(call install_link, initmethod-systemd-getty, ../../../lib/systemd/system/getty@service, \ /etc/systemd/system/getty.target.wants/getty@tty0.service) @$(call install_finish,initmethod-systemd-getty) @$(call touch) endif # vim: syntax=make
- Select new package
Call
./p menuconfig
and select the new package, in the example above at
Root Filesystem —> init —> start getty on tty0 (NEW)
- Rebuild images
Now rebuild the BSP to have the new package included in the build results (i.e. RootFS & SD card images)
./p images