Skip to contentSkip to conversation

udev: Create rules file to generate serial0/1

PATCH In review Andrei Gherzan 3 participants 10 messages Apr 18, 2017 – Apr 19, 2017 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 udev: Create rules file to generate serial0/1

---
 recipes-core/udev/udev-rules-rpi.bb           | 12 ++++++++++++
 recipes-core/udev/udev-rules-rpi/99-com.rules | 21 +++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-core/udev/udev-rules-rpi.bb
 create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules
recipes-core/udev/udev-rules-rpi.bb new file +12 -0
new file mode 100644
index 0000000..20443d3
@@ -0,0 +1,12 @@
+DESCRIPTION = "udev rules for Raspberry Pi Boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = " file://99-com.rules"
+
+S = "${WORKDIR}"
+
+do_install () {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
+}
recipes-core/udev/udev-rules-rpi/99-com.rules new file +21 -0
new file mode 100644
index 0000000..6bf019b
@@ -0,0 +1,21 @@
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+	ALIASES=/proc/device-tree/aliases; \
+	if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+		echo 0;\
+	elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+		echo 1; \
+	else \
+		exit 1; \
+	fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+	ALIASES=/proc/device-tree/aliases; \
+	if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+		echo 0; \
+	elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
+		echo 1; \
+	else \
+		exit 1; \
+	fi \
+'", SYMLINK+="serial%c"
Signature · 1 line
2.12.2
#1 lore raw

PATCH 2/3 rpi-base.inc: Recommend udev-rules-rpi

---
 conf/machine/include/rpi-base.inc | 3 +++
 1 file changed, 3 insertions(+)
conf/machine/include/rpi-base.inc +3 -0
index dc98099..50eebb4 100644
@@ -57,3 +57,6 @@ IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* ${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE
 # The kernel image is installed into the FAT32 boot partition and does not need
 # to also be installed into the rootfs.
 RDEPENDS_kernel-base = ""
+
+# Extra udev rules
+MACHINE_EXTRA_RRECOMMENDS += "udev-rules-rpi"
Signature · 1 line
2.12.2
#2 lore raw

PATCH 3/3 raspberrypi*.conf: Be able to overwrite SERIAL_CONSOLE

In reply to Andrei Gherzan
---
 conf/machine/raspberrypi.conf       | 2 +-
 conf/machine/raspberrypi0-wifi.conf | 2 +-
 conf/machine/raspberrypi0.conf      | 2 +-
 conf/machine/raspberrypi2.conf      | 2 +-
 conf/machine/raspberrypi3.conf      | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
conf/machine/raspberrypi.conf +1 -1
index ad3b061..ddd3801 100644
@@ -7,7 +7,7 @@ DEFAULTTUNE ?= "arm1176jzfshf"
 require conf/machine/include/tune-arm1176jzf-s.inc
 include conf/machine/include/rpi-base.inc
 
-SERIAL_CONSOLE = "115200 ttyAMA0"
+SERIAL_CONSOLE ?= "115200 ttyAMA0"
 
 UBOOT_MACHINE = "rpi_config"
 VC4_CMA_SIZE_raspberrypi ?= "cma-64"
conf/machine/raspberrypi0-wifi.conf +1 -1
index 2b7cea4..41be06b 100644
@@ -7,5 +7,5 @@ include conf/machine/raspberrypi.conf
 
 MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-bcm43430"
 
-SERIAL_CONSOLE = "115200 ttyS0"
+SERIAL_CONSOLE ?= "115200 ttyS0"
 VC4_CMA_SIZE ?= "cma-128"
conf/machine/raspberrypi0.conf +1 -1
index 7c2b811..3bd9e95 100644
@@ -5,5 +5,5 @@
 MACHINEOVERRIDES = "raspberrypi:${MACHINE}"
 include conf/machine/raspberrypi.conf
 
-SERIAL_CONSOLE = "115200 ttyAMA0"
+SERIAL_CONSOLE ?= "115200 ttyAMA0"
 VC4_CMA_SIZE ?= "cma-128"
conf/machine/raspberrypi2.conf +1 -1
index 9b4c02a..a17289c 100644
@@ -7,7 +7,7 @@ DEFAULTTUNE ?= "cortexa7thf-neon-vfpv4"
 require conf/machine/include/tune-cortexa7.inc
 include conf/machine/include/rpi-base.inc
 
-SERIAL_CONSOLE = "115200 ttyAMA0"
+SERIAL_CONSOLE ?= "115200 ttyAMA0"
 
 UBOOT_MACHINE = "rpi_2_config"
 VC4_CMA_SIZE ?= "cma-256"
conf/machine/raspberrypi3.conf +1 -1
index 1ac5928..b15621d 100644
@@ -7,5 +7,5 @@ include conf/machine/raspberrypi2.conf
 
 MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-bcm43430"
 
-SERIAL_CONSOLE = "115200 ttyS0"
+SERIAL_CONSOLE ?= "115200 ttyS0"
 VC4_CMA_SIZE ?= "cma-256"
Signature · 1 line
2.12.2
#3 lore raw
In reply to Andrei Gherzan
Quoted 4 lines · Andrei Gherzan
---
 recipes-core/udev/udev-rules-rpi.bb           | 12 ++++++++++++
 recipes-core/udev/udev-rules-rpi/99-com.rules | 21

perhaps a bbappend to udev-extraconf recipe is better ?

+++++++++++++++++++++

Quoted 57 lines
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-core/udev/udev-rules-rpi.bb
 create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules
recipes-core/udev/udev-rules-rpi.bb new file +12 -0
new file mode 100644
index 0000000..20443d3
@@ -0,0 +1,12 @@
+DESCRIPTION = "udev rules for Raspberry Pi Boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = " file://99-com.rules"
+
+S = "${WORKDIR}"
+
+do_install () {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
+}
recipes-core/udev/udev-rules-rpi/99-com.rules new file +21 -1
new file mode 100644
index 0000000..6bf019b
@@ -0,0 +1,21 @@
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+               echo 0;\
+       elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+               echo 1; \
+       else \
+               exit 1; \
+       fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+               echo 0; \
+       elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
+               echo 1; \
+       else \
+               exit 1; \
+       fi \
+'", SYMLINK+="serial%c"
--

2.12.2

--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#4 lore raw
Quoted 53 lines · Khem Raj
Quoted 4 lines · Andrei Gherzan
---
 recipes-core/udev/udev-rules-rpi.bb           | 12 ++++++++++++
 recipes-core/udev/udev-rules-rpi/99-com.rules | 21

perhaps a bbappend to udev-extraconf recipe is better ?

+++++++++++++++++++++

Quoted 44 lines
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-core/udev/udev-rules-rpi.bb
 create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules
recipes-core/udev/udev-rules-rpi.bb new file +12 -0
new file mode 100644
index 0000000..20443d3
@@ -0,0 +1,12 @@
+DESCRIPTION = "udev rules for Raspberry Pi Boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = " file://99-com.rules"
+
+S = "${WORKDIR}"
+
+do_install () {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
+}
recipes-core/udev/udev-rules-rpi/99-com.rules new file +16 -0
new file mode 100644
index 0000000..6bf019b
@@ -0,0 +1,21 @@
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+               echo 0;\
+       elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+               echo 1; \
+       else \
+               exit 1; \
+       fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+               echo 0; \
+       elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
Quoted 8 lines
Quoted 8 lines
recipes-core/udev/udev-rules-rpi/99-com.rules new file +5 -1
+               echo 1; \
+       else \
+               exit 1; \
+       fi \
+'", SYMLINK+="serial%c"
--

2.12.2

I was thinking about that but extraconf brings additional functionality (ex automount) that might not be of interest. I personally don't want that. What do you think?

--
Andrei Gherzan

#5 lore raw
Quoted 74 lines · Andrei Gherzan
Quoted 53 lines · Khem Raj
Quoted 4 lines · Andrei Gherzan
---
 recipes-core/udev/udev-rules-rpi.bb           | 12 ++++++++++++
 recipes-core/udev/udev-rules-rpi/99-com.rules | 21

perhaps a bbappend to udev-extraconf recipe is better ?

+++++++++++++++++++++

Quoted 44 lines
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-core/udev/udev-rules-rpi.bb
 create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules
recipes-core/udev/udev-rules-rpi.bb new file +12 -0
new file mode 100644
index 0000000..20443d3
@@ -0,0 +1,12 @@
+DESCRIPTION = "udev rules for Raspberry Pi Boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = " file://99-com.rules"
+
+S = "${WORKDIR}"
+
+do_install () {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
+}
recipes-core/udev/udev-rules-rpi/99-com.rules new file +16 -0
new file mode 100644
index 0000000..6bf019b
@@ -0,0 +1,21 @@
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+               echo 0;\
+       elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+               echo 1; \
+       else \
+               exit 1; \
+       fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+               echo 0; \
+       elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
Quoted 8 lines
Quoted 8 lines
recipes-core/udev/udev-rules-rpi/99-com.rules new file +5 -1
+               echo 1; \
+       else \
+               exit 1; \
+       fi \
+'", SYMLINK+="serial%c"
--

2.12.2

I was thinking about that but extraconf brings additional functionality (ex automount) that might not be of interest. I personally don't want that. What do you think?

--
Andrei Gherzan
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#6 lore raw
Quoted 68 lines · Andreas Müller
Quoted 67 lines · Andrei Gherzan
Quoted 53 lines · Khem Raj
Quoted 4 lines · Andrei Gherzan
---
 recipes-core/udev/udev-rules-rpi.bb           | 12 ++++++++++++
 recipes-core/udev/udev-rules-rpi/99-com.rules | 21

perhaps a bbappend to udev-extraconf recipe is better ?

+++++++++++++++++++++

Quoted 44 lines
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-core/udev/udev-rules-rpi.bb
 create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules
recipes-core/udev/udev-rules-rpi.bb new file +12 -0
new file mode 100644
index 0000000..20443d3
@@ -0,0 +1,12 @@
+DESCRIPTION = "udev rules for Raspberry Pi Boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = " file://99-com.rules"
+
+S = "${WORKDIR}"
+
+do_install () {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
+}
recipes-core/udev/udev-rules-rpi/99-com.rules new file +16 -0
new file mode 100644
index 0000000..6bf019b
@@ -0,0 +1,21 @@
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+               echo 0;\
+       elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+               echo 1; \
+       else \
+               exit 1; \
+       fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+               echo 0; \
+       elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
Quoted 8 lines
Quoted 8 lines
recipes-core/udev/udev-rules-rpi/99-com.rules new file +5 -1
+               echo 1; \
+       else \
+               exit 1; \
+       fi \
+'", SYMLINK+="serial%c"
--

2.12.2

I was thinking about that but extraconf brings additional functionality (ex automount) that might not be of interest. I personally don't want that. What do you think?

Quoted 7 lines
Quoted 7 lines

--
Andrei Gherzan
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

I don't see your comment. Could you resend?

--
Andrei Gherzan

#7 lore raw
In reply to Andrei Gherzan
Quoted 5 lines · Andrei Gherzan

I was thinking about that but extraconf brings additional functionality (ex automount) that might not be of interest. I personally don't want that. What do you think?

Ooops previous mail went out too early.

Agreed: Don't mix things which are unrelated and udev-extraconf breaks at least gvfs automount used by thunar and other file managers.

Andreas

#8 lore raw
In reply to Andrei Gherzan
Quoted 58 lines · Andrei Gherzan
Quoted 57 lines · Khem Raj
Quoted 4 lines · Andrei Gherzan
---
 recipes-core/udev/udev-rules-rpi.bb           | 12 ++++++++++++
 recipes-core/udev/udev-rules-rpi/99-com.rules | 21

perhaps a bbappend to udev-extraconf recipe is better ?

+++++++++++++++++++++

Quoted 48 lines
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-core/udev/udev-rules-rpi.bb
 create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules
recipes-core/udev/udev-rules-rpi.bb new file +12 -0
new file mode 100644
index 0000000..20443d3
@@ -0,0 +1,12 @@
+DESCRIPTION = "udev rules for Raspberry Pi Boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = " file://99-com.rules"
+
+S = "${WORKDIR}"
+
+do_install () {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
+}
recipes-core/udev/udev-rules-rpi/99-com.rules new file +20 -0
new file mode 100644
index 0000000..6bf019b
@@ -0,0 +1,21 @@
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+               echo 0;\
+       elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+               echo 1; \
+       else \
+               exit 1; \
+       fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+       ALIASES=/proc/device-tree/aliases; \
+       if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+               echo 0; \
+       elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
+               echo 1; \
+       else \
+               exit 1; \
+       fi \
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
recipes-core/udev/udev-rules-rpi/99-com.rules new file +1 -1
+'", SYMLINK+="serial%c"
--

2.12.2

I was thinking about that but extraconf brings additional functionality (ex automount) that might not be of interest. I personally don't want that. What do you think?

yeah that seems fine on second thought, since its quite pi specific rule

Quoted 2 lines

--
Andrei Gherzan

#9 lore raw
In reply to Andrei Gherzan
Quoted 54 lines · Andrei Gherzan
---
 recipes-core/udev/udev-rules-rpi.bb           | 12 ++++++++++++
 recipes-core/udev/udev-rules-rpi/99-com.rules | 21 +++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-core/udev/udev-rules-rpi.bb
 create mode 100644 recipes-core/udev/udev-rules-rpi/99-com.rules
recipes-core/udev/udev-rules-rpi.bb new file +12 -0
new file mode 100644
index 0000000..20443d3
@@ -0,0 +1,12 @@
+DESCRIPTION = "udev rules for Raspberry Pi Boards"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+SRC_URI = " file://99-com.rules"
+
+S = "${WORKDIR}"
+
+do_install () {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
+}
recipes-core/udev/udev-rules-rpi/99-com.rules new file +21 -1
new file mode 100644
index 0000000..6bf019b
@@ -0,0 +1,21 @@
+KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
+	ALIASES=/proc/device-tree/aliases; \
+	if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
+		echo 0;\
+	elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
+		echo 1; \
+	else \
+		exit 1; \
+	fi\
+'", SYMLINK+="serial%c"
+
+KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
+	ALIASES=/proc/device-tree/aliases; \
+	if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
+		echo 0; \
+	elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
+		echo 1; \
+	else \
+		exit 1; \
+	fi \
+'", SYMLINK+="serial%c"
--
Quoted 2 lines

2.12.2

Merged only this patch from this series as the other 2 need some more work.

--
Andrei Gherzan
gpg: rsa4096/D4D94F67AD0E9640 | t: @agherzan