Skip to contentSkip to conversation

package/systemd: Respect BR2_TARGET_GENERIC_GETTY_BAUDRATE

PATCH Superseded Cyril Bur 3 participants 6 messages Mar 7, 2016 – Mar 31, 2016

lore
Share & tools
lore

Cyril Bur

author
#0 lore raw

PATCH v2 1/1 package/systemd: Respect BR2_TARGET_GENERIC_GETTY_BAUDRATE

Currently systemd getty services ignore baudrates set in buildroot in favour of a hardcoded 115200. This patch SEDs out that hardcoded value with what is selected.

---
V2: Address comments from Martin Bark and Maxime Hadjinlian
- Don't change the symlink
- Use qstrip (for consistency) around $(BR2_TARGET_GENERIC_GETTY_BAUDRATE) in shell test statement

---
 package/systemd/systemd.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
package/systemd/systemd.mk +6 -1
index 05121cf..0d52481 100644
@@ -169,6 +169,7 @@ endef
 
 ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
+# 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]*$$'; \
 	then \
@@ -177,7 +178,11 @@ define SYSTEMD_INSTALL_SERVICE_TTY
 		SERVICE="serial-getty"; \
 	fi; \
 	ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
-		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service
+		$(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
+	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; \
+	fi
 endef
 endif
 
Signature · 1 line
2.7.2
#1 lore raw

PATCH v2 1/1 package/systemd: Respect BR2_TARGET_GENERIC_GETTY_BAUDRATE

Hi Cyril, all,

Thanks for your patch.

Quoted 41 lines · Cyril Bur

Currently systemd getty services ignore baudrates set in buildroot in favour of a hardcoded 115200. This patch SEDs out that hardcoded value with what is selected.

---
V2: Address comments from Martin Bark and Maxime Hadjinlian
- Don't change the symlink
- Use qstrip (for consistency) around $(BR2_TARGET_GENERIC_GETTY_BAUDRATE) in shell test statement

---
 package/systemd/systemd.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
package/systemd/systemd.mk +6 -2
index 05121cf..0d52481 100644
@@ -169,6 +169,7 @@ endef
 
 ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
 # systemd needs getty.service for VTs and serial-getty.service for serial ttys
+# 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]*$$'; \
        then \
@@ -177,7 +178,11 @@ define SYSTEMD_INSTALL_SERVICE_TTY
                SERVICE="serial-getty"; \
        fi; \
        ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
-               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service
+               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
+       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; \
+       fi
 endef
 endif
 
--
Quoted 2 lines

2.7.2

I don't think it's a problem for getty, but still worth noting somewhere, this will replace '115200' (without the quotes) by say "9600" (with the quotes) because the quotes are present in system/Config.in (maybe they could be removed ? There's no type for that sort of things in Kconfig as far as I know (which is not much) ?

Other than that, it's fine by me.

#2 lore raw

PATCH v2 1/1 package/systemd: Respect BR2_TARGET_GENERIC_GETTY_BAUDRATE

Hello,

Quoted 14 lines · Maxime Hadjinlian
Quoted 11 lines
        ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
package/systemd/systemd.mk +5 -2
-               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service
+               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
+       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; \
+       fi
 endef
 endif
 
--
Quoted 2 lines

2.7.2

Quoted 5 lines

I don't think it's a problem for getty, but still worth noting somewhere, this will replace '115200' (without the quotes) by say "9600" (with the quotes) because the quotes are present in system/Config.in (maybe they could be removed ? There's no type for that sort of things in Kconfig as far as I know (which is not much) ?

I'm not sure to understand what you meant. Did you mean that he should be calling qstrip on the variable?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#3 lore raw

PATCH v2 1/1 package/systemd: Respect BR2_TARGET_GENERIC_GETTY_BAUDRATE

Quoted 18 lines · On Sun, 20 Mar 2016 23:38:23 +0100 Thomas Petazzoni…

Hello,

Quoted 14 lines · Maxime Hadjinlian
Quoted 13 lines
        ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
package/systemd/systemd.mk +5 -2
-               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service
+               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
+       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; \
+       fi
 endef
 endif
 
--

2.7.2

Quoted 9 lines
Quoted 5 lines

I don't think it's a problem for getty, but still worth noting somewhere, this will replace '115200' (without the quotes) by say "9600" (with the quotes) because the quotes are present in system/Config.in (maybe they could be removed ? There's no type for that sort of things in Kconfig as far as I know (which is not much) ?

I'm not sure to understand what you meant. Did you mean that he should be calling qstrip on the variable?

I think Maxime was just pointing out what my patch will 'add' quotes. I could have called qstrip but (I think this was mentioned in V1) AFAIK systemd is perfectly happy to accept quotes in service files.

If you or someone else would be more comfortable with a qstrip, I can add that.

Cyril

Quoted 3 lines

Thanks,

Thomas

#4 lore raw

PATCH v2 1/1 package/systemd: Respect BR2_TARGET_GENERIC_GETTY_BAUDRATE

Quoted 27 lines · Cyril Bur
Quoted 24 lines · On Sun, 20 Mar 2016 23:38:23 +0100 Thomas Petazzoni…

Hello,

Quoted 19 lines · Maxime Hadjinlian
Quoted 11 lines
        ln -fs ../../../../lib/systemd/system/$${SERVICE}@.service \
package/systemd/systemd.mk +5 -2
-               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service
+               $(TARGET_DIR)/etc/systemd/system/getty.target.wants/$${SERVICE}@$(BR2_TARGET_GENERIC_GETTY_PORT).service; \
+       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; \
+       fi
 endef
 endif
 
--
Quoted 2 lines

2.7.2

I don't think it's a problem for getty, but still worth noting somewhere, this will replace '115200' (without the quotes) by say "9600" (with the quotes) because the quotes are present in system/Config.in (maybe they could be removed ? There's no type for that sort of things in Kconfig as far as I know (which is not much) ?

Quoted 7 lines
Quoted 3 lines

I'm not sure to understand what you meant. Did you mean that he should be calling qstrip on the variable?

I think Maxime was just pointing out what my patch will 'add' quotes. I could have called qstrip but (I think this was mentioned in V1) AFAIK systemd is perfectly happy to accept quotes in service files.

That's exactly what I was pointing out. I really don't care about it, it should not pose any problems, just thought it was worth mentionning.

Quoted 9 lines

If you or someone else would be more comfortable with a qstrip, I can add that.

Cyril

Quoted 3 lines

Thanks,

Thomas

#5 lore raw

PATCH v2 1/1 package/systemd: Respect BR2_TARGET_GENERIC_GETTY_BAUDRATE

In reply to Cyril Bur

Hello,

Quoted 10 lines · Cyril Bur

Currently systemd getty services ignore baudrates set in buildroot in favour of a hardcoded 115200. This patch SEDs out that hardcoded value with what is selected.

---
V2: Address comments from Martin Bark and Maxime Hadjinlian
- Don't change the symlink
- Use qstrip (for consistency) around $(BR2_TARGET_GENERIC_GETTY_BAUDRATE) in shell test statement

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com