<div dir="ltr">Thanks a lot...<div><br></div><div>And you are right about 115200. tty don't have speed.</div><div>I didn't check when I reworked how the sed line is applied, and it was done that way previously...</div><div><br></div><div>sorry about that</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 23 mai 2020 à 00:11, Yann E. MORIN <<a href="mailto:yann.morin.1998@free.fr">yann.morin.1998@free.fr</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">commit: <a href="https://git.buildroot.net/buildroot/commit/?id=26c32d933eb4d841b7fbe9c1e0b61cef89665b15" rel="noreferrer" target="_blank">https://git.buildroot.net/buildroot/commit/?id=26c32d933eb4d841b7fbe9c1e0b61cef89665b15</a><br>
branch: <a href="https://git.buildroot.net/buildroot/commit/?id=refs/heads/master" rel="noreferrer" target="_blank">https://git.buildroot.net/buildroot/commit/?id=refs/heads/master</a><br>
<br>
When selecting "console" for the automatic getty, the buildroot logic<br>
would collide with systemd's internal console detection logic, resulting<br>
in two getty being started on the console.<br>
<br>
This commit fixes that by doing nothing when "console" is selected and<br>
letting systemd-getty-generator deal with starting the proper getty.<br>
<br>
Note that if something other than the console is selected<br>
* Things will work properly, even if the selected terminal is also the<br>
  console<br>
* A getty will still be started on the console.<br>
  This is what systemd has been doing on buildroot since the beginning. it<br>
  could be disabled but I left it for backward compatibility<br>
<br>
Fixes: #12361<br>
Signed-off-by: Jérémy Rosen <<a href="mailto:jeremy.rosen@smile.fr" target="_blank">jeremy.rosen@smile.fr</a>><br>
Signed-off-by: Yann E. MORIN <<a href="mailto:yann.morin.1998@free.fr" target="_blank">yann.morin.1998@free.fr</a>><br>
---<br>
 package/systemd/<a href="http://systemd.mk" rel="noreferrer" target="_blank">systemd.mk</a> | 46 +++++++++++++++++++++++++++-------------------<br>
 1 file changed, 27 insertions(+), 19 deletions(-)<br>
<br>
diff --git a/package/systemd/<a href="http://systemd.mk" rel="noreferrer" target="_blank">systemd.mk</a> b/package/systemd/<a href="http://systemd.mk" rel="noreferrer" target="_blank">systemd.mk</a><br>
index 50398e747e..92de540725 100644<br>
--- a/package/systemd/<a href="http://systemd.mk" rel="noreferrer" target="_blank">systemd.mk</a><br>
+++ b/package/systemd/<a href="http://systemd.mk" rel="noreferrer" target="_blank">systemd.mk</a><br>
@@ -497,37 +497,42 @@ define SYSTEMD_USERS<br>
 endef<br>
<br>
 ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)<br>
-# systemd needs getty.service for VTs and serial-getty.service for serial ttys<br>
-# note that console-getty.service should be used on /dev/console as it should not have dependencies<br>
-# also patch the file to use the correct baud-rate, the default baudrate is 115200 so look for that<br>
+# systemd provides multiple units to autospawn getty as neede<br>
+# * getty@.service to start a getty on normal TTY<br>
+# * sertial-getty@.service to start a getty on serial lines<br>
+# * console-getty.service for generic /dev/console<br>
+# * container-getty@.service for a getty on /dev/pts/*<br>
 #<br>
-# systemd defaults to only have getty@tty.service enabled<br>
-# * DefaultInstance=tty1 in getty@service<br>
-# * no DefaultInstance in serial-getty@.service<br>
-# * WantedBy=getty.target in console-getty.service<br>
-# * console-getty is not enabled because of 90-systemd.preset<br>
-# We want "systemctl preset-all" to do the right thing, even when run on the target after boot<br>
-# * remove the default instance of getty@.service via a drop-in in /usr/lib<br>
-# * set a new DefaultInstance for getty@.service instead, if needed<br>
-# * set a new DefaultInstance for serial-getty@.service, if needed<br>
-# * override the systemd-provided preset for console-getty.service if needed<br>
+# the generator systemd-getty-generator will<br>
+# * read the console= kernel command line parameter<br>
+# * enable one of the above units depending on what it finds<br>
+#<br>
+# Systemd defaults to enablinb getty@tty1.service<br>
+#<br>
+# What we want to do<br>
+# * Enable a getty on $BR2_TARGET_GENERIC_TTY_PATH<br>
+# * Set the baudrate for all units according to BR2_TARGET_GENERIC_GETTY_BAUDRATE<br>
+# * Always enable a getty on the console using systemd-getty-generator<br>
+#   (backward compatibility with previous releases of buildroot)<br>
+#<br>
+# What we do<br>
+# * disable getty@tty1 (enabled by upstream systemd)<br>
+# * enable getty@xxx if  $BR2_TARGET_GENERIC_TTY_PATH is a tty<br>
+# * enable serial-getty@xxx for other $BR2_TARGET_GENERIC_TTY_PATH<br>
+# * rewrite baudrates if a baudrate is provided<br>
 define SYSTEMD_INSTALL_SERVICE_TTY<br>
        mkdir $(TARGET_DIR)/usr/lib/systemd/system/getty@.service.d; \<br>
        printf '[Install]\nDefaultInstance=\n' \<br>
                >$(TARGET_DIR)/usr/lib/systemd/system/getty@.service.d/buildroot-console.conf; \<br>
        if [ $(BR2_TARGET_GENERIC_GETTY_PORT) = "console" ]; \<br>
        then \<br>
-               TARGET="console-getty.service"; \<br>
-               printf 'enable console-getty.service\n' \<br>
-                       >$(TARGET_DIR)/usr/lib/systemd/system-preset/81-buildroot-tty.preset; \<br>
+               : ; \<br>
        elif echo $(BR2_TARGET_GENERIC_GETTY_PORT) | egrep -q 'tty[0-9]*$$'; \<br>
        then \<br>
-               TARGET="getty@.service"; \<br>
                printf '[Install]\nDefaultInstance=%s\n' \<br>
                        $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) \<br>
                        >$(TARGET_DIR)/usr/lib/systemd/system/getty@.service.d/buildroot-console.conf; \<br>
        else \<br>
-               TARGET="serial-getty@.service"; \<br>
                mkdir $(TARGET_DIR)/usr/lib/systemd/system/serial-getty@.service.d;\<br>
                printf '[Install]\nDefaultInstance=%s\n' \<br>
                        $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) \<br>
@@ -535,7 +540,10 @@ define SYSTEMD_INSTALL_SERVICE_TTY<br>
        fi; \<br>
        if [ $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -gt 0 ] ; \<br>
        then \<br>
-               $(SED) 's,115200,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),' $(TARGET_DIR)/lib/systemd/system/$${TARGET}; \<br>
+               $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/getty@.service; \<br>
+               $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/serial-getty@.service; \<br>
+               $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/console-getty@.service; \<br>
+               $(SED) 's/115200/$(BR2_TARGET_GENERIC_GETTY_BAUDRATE),115200/' $(TARGET_DIR)/lib/systemd/system/container-getty@.service; \<br>
        fi<br>
 endef<br>
 endif<br>
_______________________________________________<br>
buildroot mailing list<br>
<a href="mailto:buildroot@busybox.net" target="_blank">buildroot@busybox.net</a><br>
<a href="http://lists.busybox.net/mailman/listinfo/buildroot" rel="noreferrer" target="_blank">http://lists.busybox.net/mailman/listinfo/buildroot</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><table border="0" style="border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Raleway,regular;font-size:14px;padding:20px"><tbody><tr><td style="padding:0px 30px 0px 0px;font-size:13px;color:rgb(255,128,84);text-align:center"><a href="http://www.smile.eu/" style="background-color:transparent;color:rgb(221,72,20)" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/Logo-new.png" alt="SMILE" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"> </a><br><br><p style="margin:0px 0px 10px">20 rue des Jardins<br>92600 Asnières-sur-Seine</p></td><td style="padding:0px 0px 0px 20px;border-left:1px solid rgb(59,127,254);font-size:13px;color:rgb(255,128,84)"><div style="font-size:14px"><b>Jérémy ROSEN</b></div><div style="color:rgb(59,127,254)">Architecte technique<br></div><br><div style="color:rgb(59,127,254)"><span style="white-space:nowrap"><img src="http://ftp.smile.fr/client/Communication/signature/img/mail.png" alt="email" width="12" height="10" style="border: 0px; vertical-align: middle; margin-right: 5px;"> <a href="mailto:jeremy.rosen@smile.fr" style="background-color:transparent;color:rgb(59,127,254)" target="_blank">jeremy.rosen@smile.fr</a> </span><br><span style="white-space:nowrap"><img src="http://ftp.smile.fr/client/Communication/signature/img/phone.png" alt="phone" width="10" height="10" style="border: 0px; vertical-align: middle; margin-right: 5px;"></span>  +33 6 88 25 87 42 <br><span style="white-space:nowrap"><img src="http://ftp.smile.fr/client/Communication/signature/img/web.png" alt="url" width="12" height="12" style="border: 0px; vertical-align: middle; margin-right: 5px;"> <a href="http://www.smile.eu/" style="background-color:transparent;color:rgb(59,127,254)" target="_blank">http://www.smile.eu</a></span></div><br><div><span><a href="https://twitter.com/GroupeSmile" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-twitter.png" alt="Twitter" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span> <span><a href="https://www.facebook.com/smileopensource" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-facebook.png" alt="Facebook" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span> <span><a href="https://www.linkedin.com/company/smile" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-linkedin.png" alt="LinkedIn" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span> <span><a href="https://github.com/Smile-SA" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-github.png" alt="Github" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span></div></td></tr></tbody></table><br style="color:rgb(51,51,51);font-family:Raleway,regular;font-size:14px"><div style="color:rgb(51,51,51);font-family:Raleway,regular;font-size:14px"><a href="https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature" style="background-color:transparent;color:rgb(221,72,20)" target="_blank"><img src="https://signature.smile.eu/assets/img/bandeaux_signature_mail_yocto.gif.gif" alt="Découvrez l’univers Smile, rendez-vous sur smile.eu" border="0" style="border: 0px; vertical-align: middle;"></a></div></div></div></div></div>