[Buildroot] [PATCH v5 03/13] package/systemd: fix tty handling

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sat May 16 14:28:49 UTC 2020


Hello Jérémy,

On Mon, 16 Dec 2019 11:30:42 +0100
Jérémy Rosen <jeremy.rosen at smile.fr> wrote:

> +# systemd defaults to only have getty at tty.service enabled
> +# * DefaultInstance=tty1 in getty at service
> +# * no DefaultInstance in serial-getty at .service
> +# * WantedBy=getty.target in console-getty.service
> +# * console-getty is not enabled because of 90-systemd.preset
> +# We want "systemctl preset-all" to do the right thing, even when run on the target after boot
> +# * remove the default instance of getty at .service via a drop-in in /usr/lib
> +# * set a new DefaultInstance for getty at .service instead, if needed
> +# * set a new DefaultInstance for serial-getty at .service, if needed
> +# * override the systemd-provided preset for console-getty.service if needed
>  define SYSTEMD_INSTALL_SERVICE_TTY
> +	mkdir $(TARGET_DIR)/usr/lib/systemd/system/getty at .service.d;\
> +	printf '[Install]\nDefaultInstance=\n' > $(TARGET_DIR)/usr/lib/systemd/system/getty at .service.d/buildroot-console.conf;\
>  	if [ $(BR2_TARGET_GENERIC_GETTY_PORT) = "console" ]; \
>  	then \
>  		TARGET="console-getty.service"; \
> -		LINK_NAME="console-getty.service"; \
> +		printf 'enable console-getty.service\n' > $(TARGET_DIR)/usr/lib/systemd/system-preset/81-buildroot-tty.preset;\
>  	elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \
>  	then \
>  		TARGET="getty at .service"; \
> -		LINK_NAME="getty@$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)).service"; \
> +		printf '[Install]\nDefaultInstance=%s\n' $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) > $(TARGET_DIR)/usr/lib/systemd/system/getty at .service.d/buildroot-console.conf;\
>  	else \
>  		TARGET="serial-getty at .service"; \
> -		LINK_NAME="serial-getty@$(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)).service"; \
> +		mkdir $(TARGET_DIR)/usr/lib/systemd/system/serial-getty at .service.d;\
> +		printf '[Install]\nDefaultInstance=%s\n' $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) > $(TARGET_DIR)/usr/lib/systemd/system/serial-getty at .service.d/buildroot-console.conf;\
>  	fi; \
> -	mkdir -p $(TARGET_DIR)/etc/systemd/system/getty.target.wants/; \
> -	ln -fs ../../../../lib/systemd/system/$${TARGET} \
> -		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${LINK_NAME}; \

I am not sure exactly if it is this change causing the issue, but there
is an issue in this code. See the bug report at:

  https://bugs.busybox.net/show_bug.cgi?id=12786

I must say now that I read the comment on top of this code, I don't
understand at all what is being explained. Could you give a bit more
details about what we are trying to do here, and hopefully help resolve
bug 12786 ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the buildroot mailing list