[yocto] [meta-raspberrypi][PATCH 1/3] udev: Create rules file to generate serial0/1

Andrei Gherzan andrei at gherzan.ro
Wed Apr 19 03:41:25 PDT 2017


On Tue, Apr 18, 2017 at 7:55 PM, Khem Raj <raj.khem at gmail.com> wrote:
> On Tue, Apr 18, 2017 at 11:13 AM, Andrei Gherzan <andrei at gherzan.ro> wrote:
>> Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
>> ---
>>  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 ?
>
> +++++++++++++++++++++
>>  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
>>
>> diff --git a/recipes-core/udev/udev-rules-rpi.bb b/recipes-core/udev/udev-rules-rpi.bb
>> new file mode 100644
>> index 0000000..20443d3
>> --- /dev/null
>> +++ b/recipes-core/udev/udev-rules-rpi.bb
>> @@ -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/
>> +}
>> diff --git a/recipes-core/udev/udev-rules-rpi/99-com.rules b/recipes-core/udev/udev-rules-rpi/99-com.rules
>> new file mode 100644
>> index 0000000..6bf019b
>> --- /dev/null
>> +++ b/recipes-core/udev/udev-rules-rpi/99-com.rules
>> @@ -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
>>

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



More information about the yocto mailing list