udev: Create rules file to generate serial0/1
PATCH 1/3 udev: Create rules file to generate serial0/1
Signed-off-by Andrei Gherzan <[email protected]>
--- 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
@@ -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
@@ -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
PATCH 2/3 rpi-base.inc: Recommend udev-rules-rpi
Signed-off-by Andrei Gherzan <[email protected]>
--- conf/machine/include/rpi-base.inc | 3 +++ 1 file changed, 3 insertions(+)
conf/machine/include/rpi-base.inc +3 -0
@@ -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
PATCH 3/3 raspberrypi*.conf: Be able to overwrite SERIAL_CONSOLE
In reply to Andrei GherzanSigned-off-by Andrei Gherzan <[email protected]>
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Quoted 54 lines · Andrei Gherzan
Signed-off-by Andrei Gherzan <[email protected]>--- 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.rulesrecipes-core/udev/udev-rules-rpi.bb new file +12
-0@@ -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@@ -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 to morty as the other two need additional work.
--
Andrei Gherzan
gpg: rsa4096/D4D94F67AD0E9640 | t: @agherzan