diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk index 7a46a50ed3..6f0e451b5b 100644 --- a/package/systemd/systemd.mk +++ b/package/systemd/systemd.mk @@ -397,19 +397,26 @@ endef ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),) # systemd needs getty.service for VTs and serial-getty.service for serial ttys +# note that console-getty.service should be used on /dev/console as it should not have dependencies # also patch the file to use the correct baud-rate, the default baudrate is 115200 so look for that define SYSTEMD_INSTALL_SERVICE_TTY - if echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \ + if [ $(BR2_TARGET_GENERIC_GETTY_PORT) = "console" ]; \ then \ - SERVICE="getty"; \ + TARGET="console-getty.service"; \ + LINK_NAME="console-getty.service"; \ + elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \ + then \ + TARGET="getty@.service"; \ + LINK_NAME="getty@$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)).service"; \ else \ - SERVICE="serial-getty"; \ + TARGET="serial-getty@.service"; \ + LINK_NAME="serial-getty@$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)).service"; \ fi; \ - ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \ - $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \ + ln -fs ../../../../lib/systemd/system/$${TARGET} \ + $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${LINK_NAME}; \ if [ $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -gt 0 ] ; \ then \ - $(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${SERVICE}@.service; \ + $(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${TARGET}; \ fi endef endif