diff mbox series

[meta-arago,kirkstone/master,v3] systemd: Add udev rules for persistent naming of the can devices

Message ID 20240207192950.1761572-1-a-limaye@ti.com
State Superseded
Delegated to: Ryan Eatmon
Headers show
Series [meta-arago,kirkstone/master,v3] systemd: Add udev rules for persistent naming of the can devices | expand

Commit Message

Aniket Limaye Feb. 7, 2024, 7:29 p.m. UTC
When multiple CAN's are present, then names that are getting assigned
change after every boot even after providing alias in the device
tree.
So add udev rules to specify the interface name to use for
each mcan device, to make it persistent across reboots.

Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
Signed-off-by: Aniket Limaye <a-limaye@ti.com>
---
v3: Fix typos in the filename being installed in v2
v2:
    - Switch to udev rules instead of systemd network links, as per
      feedback from v1: https://lists.yoctoproject.org/g/meta-arago/message/15104
    - Also, extend to Sitara devices as well
---
 .../systemd/systemd/k3/37-can-am62.rules      |  4 ++
 .../systemd/systemd/k3/37-can-j7.rules        | 20 +++++++
 .../recipes-core/systemd/systemd_%.bbappend   | 58 +++++++++++++++++++
 3 files changed, 82 insertions(+)
 create mode 100644 meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
 create mode 100644 meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules

Comments

Jon Cormier Feb. 7, 2024, 8:37 p.m. UTC | #1
On Wed, Feb 7, 2024 at 2:30 PM Aniket Limaye via lists.yoctoproject.org
<a-limaye=ti.com@lists.yoctoproject.org> wrote:

> When multiple CAN's are present, then names that are getting assigned
> change after every boot even after providing alias in the device
> tree.
> So add udev rules to specify the interface name to use for
> each mcan device, to make it persistent across reboots.
>
> Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
> Signed-off-by: Aniket Limaye <a-limaye@ti.com>
> ---
> v3: Fix typos in the filename being installed in v2
> v2:
>     - Switch to udev rules instead of systemd network links, as per
>       feedback from v1:
> https://lists.yoctoproject.org/g/meta-arago/message/15104
>     - Also, extend to Sitara devices as well
> ---
>  .../systemd/systemd/k3/37-can-am62.rules      |  4 ++
>  .../systemd/systemd/k3/37-can-j7.rules        | 20 +++++++
>  .../recipes-core/systemd/systemd_%.bbappend   | 58 +++++++++++++++++++
>  3 files changed, 82 insertions(+)
>  create mode 100644
> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>  create mode 100644
> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>
> diff --git
> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> new file mode 100644
> index 00000000..59dc8075
> --- /dev/null
> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> @@ -0,0 +1,4 @@
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e08000.can", NAME="mcu_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e18000.can", NAME="mcu_mcan1"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20701000.can",
> NAME="main_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20711000.can",
> NAME="main_mcan1"
> diff --git
> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> new file mode 100644
> index 00000000..f2804ecd
> --- /dev/null
> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> @@ -0,0 +1,20 @@
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40528000.can", NAME="mcu_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40568000.can", NAME="mcu_mcan1"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2701000.can", NAME="main_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2711000.can", NAME="main_mcan1"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2721000.can", NAME="main_mcan2"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2731000.can", NAME="main_mcan3"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2741000.can", NAME="main_mcan4"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2751000.can", NAME="main_mcan5"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2761000.can", NAME="main_mcan6"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2771000.can", NAME="main_mcan7"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2781000.can", NAME="main_mcan8"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2791000.can", NAME="main_mcan9"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27a1000.can",
> NAME="main_mcan10"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27b1000.can",
> NAME="main_mcan11"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27c1000.can",
> NAME="main_mcan12"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27d1000.can",
> NAME="main_mcan13"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2681000.can",
> NAME="main_mcan14"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2691000.can",
> NAME="main_mcan15"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26a1000.can",
> NAME="main_mcan16"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26b1000.can",
> NAME="main_mcan17"
> diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> index f38606f2..248ad5e4 100644
> --- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> +++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> @@ -14,6 +14,11 @@ SRC_URI:append = " \
>      file://timesyncd.conf \
>  "
>
> +SRC_URI:append:k3 = " \
> +    file://37-can-j7.rules \
> +    file://37-can-am62.rules \
> +"
>
Butting in here but is there any reason not to just combine the two can
rules files and install the same file (37-can-k3.rules) to all k3 devices?
It would make the bbappend file much shorter...

> +
>  do_install:append() {
>      install -d ${D}${sysconfdir}/udev/rules.d/
>      install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/
> @@ -43,3 +48,56 @@ do_install:append() {
>      install -d ${D}${sysconfdir}/systemd/
>      install -m 0644 ${WORKDIR}/timesyncd.conf ${D}${sysconfdir}/systemd/
>  }
> +
> +do_install:append:j721e() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j7200() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j721s2() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j784s4() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am65xx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am62xx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am62pxx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am62axx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am64xx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j722s() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +FILES:udev += "${libdir}/udev/rules.d/37-can.rules"
> +
> --
> 2.34.1
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15125):
> https://lists.yoctoproject.org/g/meta-arago/message/15125
> Mute This Topic: https://lists.yoctoproject.org/mt/104225388/7902621
> Group Owner: meta-arago+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub [
> jcormier@criticallink.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
>
Ryan Eatmon Feb. 7, 2024, 8:41 p.m. UTC | #2
On 2/7/2024 1:29 PM, Aniket Limaye wrote:
> When multiple CAN's are present, then names that are getting assigned
> change after every boot even after providing alias in the device
> tree.
> So add udev rules to specify the interface name to use for
> each mcan device, to make it persistent across reboots.
> 
> Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
> Signed-off-by: Aniket Limaye <a-limaye@ti.com>
> ---
> v3: Fix typos in the filename being installed in v2
> v2:
>      - Switch to udev rules instead of systemd network links, as per
>        feedback from v1: https://lists.yoctoproject.org/g/meta-arago/message/15104
>      - Also, extend to Sitara devices as well
> ---
>   .../systemd/systemd/k3/37-can-am62.rules      |  4 ++
>   .../systemd/systemd/k3/37-can-j7.rules        | 20 +++++++
>   .../recipes-core/systemd/systemd_%.bbappend   | 58 +++++++++++++++++++
>   3 files changed, 82 insertions(+)
>   create mode 100644 meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>   create mode 100644 meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> 
> diff --git a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> new file mode 100644
> index 00000000..59dc8075
> --- /dev/null
> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> @@ -0,0 +1,4 @@
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e08000.can", NAME="mcu_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e18000.can", NAME="mcu_mcan1"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20701000.can", NAME="main_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20711000.can", NAME="main_mcan1"
> diff --git a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> new file mode 100644
> index 00000000..f2804ecd
> --- /dev/null
> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> @@ -0,0 +1,20 @@
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40528000.can", NAME="mcu_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40568000.can", NAME="mcu_mcan1"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2701000.can", NAME="main_mcan0"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2711000.can", NAME="main_mcan1"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2721000.can", NAME="main_mcan2"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2731000.can", NAME="main_mcan3"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2741000.can", NAME="main_mcan4"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2751000.can", NAME="main_mcan5"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2761000.can", NAME="main_mcan6"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2771000.can", NAME="main_mcan7"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2781000.can", NAME="main_mcan8"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2791000.can", NAME="main_mcan9"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27a1000.can", NAME="main_mcan10"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27b1000.can", NAME="main_mcan11"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27c1000.can", NAME="main_mcan12"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27d1000.can", NAME="main_mcan13"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2681000.can", NAME="main_mcan14"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2691000.can", NAME="main_mcan15"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26a1000.can", NAME="main_mcan16"
> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26b1000.can", NAME="main_mcan17"

On the surface, I like this patch better because it only contains 
plaintext files and not binary ones... =)


> diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> index f38606f2..248ad5e4 100644
> --- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> +++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> @@ -14,6 +14,11 @@ SRC_URI:append = " \
>       file://timesyncd.conf \
>   "
>   
> +SRC_URI:append:k3 = " \
> +    file://37-can-j7.rules \
> +    file://37-can-am62.rules \
> +"

Is this patch for all k3 devices?  Or the big list of platforms below? 
It *seems* like you are breaking them up differently for Sitara vs 
Jacinto devices...


Would a cleaner approach be to define two new variables and use them in 
all of the places?



CAN_RULES_SRC = ""
CAN_RULES_SRC:j721e = "37-can-j7.rules"
CAN_RULES_SRC:j721e = "37-can-j7.rules"
CAN_RULES_SRC:j721e = "37-can-j7.rules"
<snip>

CAN_RULES_TGT = "udev/rules.d/37-can.rules"

SRC_URI:append = "file://${CAN_RULES}"

do_install:append:k3() {
   install -d ${D}/${libdir}/udev/rules.d
   install -m 0644 ${WORKDIR}/${CAN_RULES} ${D}${libdir}/${CAN_RULES_TGT}
}

FILES:udev += "${libdir}/${CAN_RULES_TGT}"




>   do_install:append() {
>       install -d ${D}${sysconfdir}/udev/rules.d/
>       install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/
> @@ -43,3 +48,56 @@ do_install:append() {
>       install -d ${D}${sysconfdir}/systemd/
>       install -m 0644 ${WORKDIR}/timesyncd.conf ${D}${sysconfdir}/systemd/
>   }
> +
> +do_install:append:j721e() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j7200() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j721s2() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j784s4() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am65xx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am62xx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am62pxx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am62axx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:am64xx() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +do_install:append:j722s() {
> +    install -d ${D}/${libdir}/udev/rules.d
> +    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
> +}
> +
> +FILES:udev += "${libdir}/udev/rules.d/37-can.rules"
> +
Ryan Eatmon Feb. 7, 2024, 8:46 p.m. UTC | #3
On 2/7/2024 2:41 PM, Ryan Eatmon via lists.yoctoproject.org wrote:
> 
> 
> On 2/7/2024 1:29 PM, Aniket Limaye wrote:
>> When multiple CAN's are present, then names that are getting assigned
>> change after every boot even after providing alias in the device
>> tree.
>> So add udev rules to specify the interface name to use for
>> each mcan device, to make it persistent across reboots.
>>
>> Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
>> Signed-off-by: Aniket Limaye <a-limaye@ti.com>
>> ---
>> v3: Fix typos in the filename being installed in v2
>> v2:
>>      - Switch to udev rules instead of systemd network links, as per
>>        feedback from v1: 
>> https://lists.yoctoproject.org/g/meta-arago/message/15104
>>      - Also, extend to Sitara devices as well
>> ---
>>   .../systemd/systemd/k3/37-can-am62.rules      |  4 ++
>>   .../systemd/systemd/k3/37-can-j7.rules        | 20 +++++++
>>   .../recipes-core/systemd/systemd_%.bbappend   | 58 +++++++++++++++++++
>>   3 files changed, 82 insertions(+)
>>   create mode 100644 
>> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>>   create mode 100644 
>> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>>
>> diff --git 
>> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules 
>> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>> new file mode 100644
>> index 00000000..59dc8075
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>> @@ -0,0 +1,4 @@
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e08000.can", 
>> NAME="mcu_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e18000.can", 
>> NAME="mcu_mcan1"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20701000.can", 
>> NAME="main_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20711000.can", 
>> NAME="main_mcan1"
>> diff --git 
>> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules 
>> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>> new file mode 100644
>> index 00000000..f2804ecd
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>> @@ -0,0 +1,20 @@
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40528000.can", 
>> NAME="mcu_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40568000.can", 
>> NAME="mcu_mcan1"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2701000.can", 
>> NAME="main_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2711000.can", 
>> NAME="main_mcan1"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2721000.can", 
>> NAME="main_mcan2"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2731000.can", 
>> NAME="main_mcan3"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2741000.can", 
>> NAME="main_mcan4"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2751000.can", 
>> NAME="main_mcan5"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2761000.can", 
>> NAME="main_mcan6"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2771000.can", 
>> NAME="main_mcan7"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2781000.can", 
>> NAME="main_mcan8"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2791000.can", 
>> NAME="main_mcan9"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27a1000.can", 
>> NAME="main_mcan10"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27b1000.can", 
>> NAME="main_mcan11"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27c1000.can", 
>> NAME="main_mcan12"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27d1000.can", 
>> NAME="main_mcan13"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2681000.can", 
>> NAME="main_mcan14"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2691000.can", 
>> NAME="main_mcan15"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26a1000.can", 
>> NAME="main_mcan16"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26b1000.can", 
>> NAME="main_mcan17"
> 
> On the surface, I like this patch better because it only contains 
> plaintext files and not binary ones... =)
> 
> 
>> diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend 
>> b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
>> index f38606f2..248ad5e4 100644
>> --- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
>> +++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
>> @@ -14,6 +14,11 @@ SRC_URI:append = " \
>>       file://timesyncd.conf \
>>   "
>> +SRC_URI:append:k3 = " \
>> +    file://37-can-j7.rules \
>> +    file://37-can-am62.rules \
>> +"
> 
> Is this patch for all k3 devices?  Or the big list of platforms below? 
> It *seems* like you are breaking them up differently for Sitara vs 
> Jacinto devices...
> 
> 
> Would a cleaner approach be to define two new variables and use them in 
> all of the places?
> 


Oops...  I hit send too fast...  Updated code:

CAN_RULES_SRC = ""
CAN_RULES_SRC:j721e = "37-can-j7.rules"
CAN_RULES_SRC:j7200 = "37-can-j7.rules"
CAN_RULES_SRC:j721s2 = "37-can-j7.rules"
CAN_RULES_SRC:j784s4 = "37-can-j7.rules"
CAN_RULES_SRC:am65xx = "37-can-j7.rules"
CAN_RULES_SRC:am62xx = "37-can-am62.rules"
CAN_RULES_SRC:am62pxx = "37-can-am62.rules"
CAN_RULES_SRC:am62axx = "37-can-am62.rules"
CAN_RULES_SRC:am64xx = "37-can-am62.rules"
CAN_RULES_SRC:j722s = "37-can-am62.rules"
CAN_RULES_TGT = "udev/rules.d/37-can.rules"

SRC_URI:append:k3 = "file://${CAN_RULES_SRC}"

do_install:append:k3() {
    install -d ${D}/${libdir}/udev/rules.d
    install -m 0644 ${WORKDIR}/${CAN_RULES} ${D}${libdir}/${CAN_RULES_TGT}
}

FILES:udev += "${libdir}/${CAN_RULES_TGT}"


Make sure you double check my quick hackery and not take it as is....


> 
> 
>>   do_install:append() {
>>       install -d ${D}${sysconfdir}/udev/rules.d/
>>       install -m 0644 ${WORKDIR}/local.rules 
>> ${D}${sysconfdir}/udev/rules.d/
>> @@ -43,3 +48,56 @@ do_install:append() {
>>       install -d ${D}${sysconfdir}/systemd/
>>       install -m 0644 ${WORKDIR}/timesyncd.conf 
>> ${D}${sysconfdir}/systemd/
>>   }
>> +
>> +do_install:append:j721e() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j7200() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j721s2() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j784s4() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am65xx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am62xx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am62pxx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am62axx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am64xx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j722s() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules 
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +FILES:udev += "${libdir}/udev/rules.d/37-can.rules"
>> +
>
Andrew Davis Feb. 7, 2024, 10:11 p.m. UTC | #4
On 2/7/24 2:37 PM, Jon Cormier via lists.yoctoproject.org wrote:
> On Wed, Feb 7, 2024 at 2:30 PM Aniket Limaye via lists.yoctoproject.org
> <a-limaye=ti.com@lists.yoctoproject.org> wrote:
> 
>> When multiple CAN's are present, then names that are getting assigned
>> change after every boot even after providing alias in the device
>> tree.
>> So add udev rules to specify the interface name to use for
>> each mcan device, to make it persistent across reboots.
>>
>> Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
>> Signed-off-by: Aniket Limaye <a-limaye@ti.com>
>> ---
>> v3: Fix typos in the filename being installed in v2
>> v2:
>>      - Switch to udev rules instead of systemd network links, as per
>>        feedback from v1:
>> https://lists.yoctoproject.org/g/meta-arago/message/15104
>>      - Also, extend to Sitara devices as well
>> ---
>>   .../systemd/systemd/k3/37-can-am62.rules      |  4 ++
>>   .../systemd/systemd/k3/37-can-j7.rules        | 20 +++++++
>>   .../recipes-core/systemd/systemd_%.bbappend   | 58 +++++++++++++++++++
>>   3 files changed, 82 insertions(+)
>>   create mode 100644
>> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>>   create mode 100644
>> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>>
>> diff --git
>> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>> new file mode 100644
>> index 00000000..59dc8075
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
>> @@ -0,0 +1,4 @@
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e08000.can", NAME="mcu_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e18000.can", NAME="mcu_mcan1"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20701000.can",
>> NAME="main_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20711000.can",
>> NAME="main_mcan1"
>> diff --git
>> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>> new file mode 100644
>> index 00000000..f2804ecd
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
>> @@ -0,0 +1,20 @@
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40528000.can", NAME="mcu_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40568000.can", NAME="mcu_mcan1"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2701000.can", NAME="main_mcan0"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2711000.can", NAME="main_mcan1"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2721000.can", NAME="main_mcan2"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2731000.can", NAME="main_mcan3"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2741000.can", NAME="main_mcan4"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2751000.can", NAME="main_mcan5"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2761000.can", NAME="main_mcan6"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2771000.can", NAME="main_mcan7"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2781000.can", NAME="main_mcan8"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2791000.can", NAME="main_mcan9"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27a1000.can",
>> NAME="main_mcan10"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27b1000.can",
>> NAME="main_mcan11"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27c1000.can",
>> NAME="main_mcan12"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27d1000.can",
>> NAME="main_mcan13"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2681000.can",
>> NAME="main_mcan14"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2691000.can",
>> NAME="main_mcan15"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26a1000.can",
>> NAME="main_mcan16"
>> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26b1000.can",
>> NAME="main_mcan17"
>> diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
>> b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
>> index f38606f2..248ad5e4 100644
>> --- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
>> +++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
>> @@ -14,6 +14,11 @@ SRC_URI:append = " \
>>       file://timesyncd.conf \
>>   "
>>
>> +SRC_URI:append:k3 = " \
>> +    file://37-can-j7.rules \
>> +    file://37-can-am62.rules \
>> +"
>>
> Butting in here but is there any reason not to just combine the two can
> rules files and install the same file (37-can-k3.rules) to all k3 devices?
> It would make the bbappend file much shorter...
> 

+1, that would also help in keeping this package from becoming
machine specific, this could be deployed unconditionally, shouldn't
hurt anything.

Andrew

>> +
>>   do_install:append() {
>>       install -d ${D}${sysconfdir}/udev/rules.d/
>>       install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/
>> @@ -43,3 +48,56 @@ do_install:append() {
>>       install -d ${D}${sysconfdir}/systemd/
>>       install -m 0644 ${WORKDIR}/timesyncd.conf ${D}${sysconfdir}/systemd/
>>   }
>> +
>> +do_install:append:j721e() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j7200() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j721s2() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j784s4() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am65xx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am62xx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am62pxx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am62axx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:am64xx() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +do_install:append:j722s() {
>> +    install -d ${D}/${libdir}/udev/rules.d
>> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
>> ${D}${libdir}/udev/rules.d/37-can.rules
>> +}
>> +
>> +FILES:udev += "${libdir}/udev/rules.d/37-can.rules"
>> +
>> --
>> 2.34.1
>>
>>
>>
>>
>>
>>
>>
>
Jon Cormier Feb. 7, 2024, 10:47 p.m. UTC | #5
I'd appreciate it if you would also add the dra7(am57x) and 335x platforms.

+++ 37-can-dra7.rules
SUBSYSTEM=="net", ACTION=="add", KERNELS=="4ae3c000.can", NAME="main_dcan1"
SUBSYSTEM=="net", ACTION=="add", KERNELS=="48480000.can", NAME="main_dcan2"

+++ 37-can-ti33x.rules
SUBSYSTEM=="net", ACTION=="add", KERNELS=="481cc000.can", NAME="main_dcan0"
SUBSYSTEM=="net", ACTION=="add", KERNELS=="481d0000.can", NAME="main_dcan1"

+++ meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
CAN_RULES_SRC:dra7 = "37-can-dra7.rules"
CAN_RULES_SRC:ti33x = "37-can-ti33x.rules"


On Wed, Feb 7, 2024 at 3:46 PM Ryan Eatmon via lists.yoctoproject.org
<reatmon=ti.com@lists.yoctoproject.org> wrote:
>
>
>
> On 2/7/2024 2:41 PM, Ryan Eatmon via lists.yoctoproject.org wrote:
> >
> >
> > On 2/7/2024 1:29 PM, Aniket Limaye wrote:
> >> When multiple CAN's are present, then names that are getting assigned
> >> change after every boot even after providing alias in the device
> >> tree.
> >> So add udev rules to specify the interface name to use for
> >> each mcan device, to make it persistent across reboots.
> >>
> >> Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
> >> Signed-off-by: Aniket Limaye <a-limaye@ti.com>
> >> ---
> >> v3: Fix typos in the filename being installed in v2
> >> v2:
> >>      - Switch to udev rules instead of systemd network links, as per
> >>        feedback from v1:
> >> https://lists.yoctoproject.org/g/meta-arago/message/15104
> >>      - Also, extend to Sitara devices as well
> >> ---
> >>   .../systemd/systemd/k3/37-can-am62.rules      |  4 ++
> >>   .../systemd/systemd/k3/37-can-j7.rules        | 20 +++++++
> >>   .../recipes-core/systemd/systemd_%.bbappend   | 58 +++++++++++++++++++
> >>   3 files changed, 82 insertions(+)
> >>   create mode 100644
> >> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> >>   create mode 100644
> >> meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> >>
> >> diff --git
> >> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> >> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> >> new file mode 100644
> >> index 00000000..59dc8075
> >> --- /dev/null
> >> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
> >> @@ -0,0 +1,4 @@
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e08000.can",
> >> NAME="mcu_mcan0"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e18000.can",
> >> NAME="mcu_mcan1"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20701000.can",
> >> NAME="main_mcan0"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="20711000.can",
> >> NAME="main_mcan1"
> >> diff --git
> >> a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> >> b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> >> new file mode 100644
> >> index 00000000..f2804ecd
> >> --- /dev/null
> >> +++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
> >> @@ -0,0 +1,20 @@
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40528000.can",
> >> NAME="mcu_mcan0"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="40568000.can",
> >> NAME="mcu_mcan1"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2701000.can",
> >> NAME="main_mcan0"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2711000.can",
> >> NAME="main_mcan1"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2721000.can",
> >> NAME="main_mcan2"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2731000.can",
> >> NAME="main_mcan3"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2741000.can",
> >> NAME="main_mcan4"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2751000.can",
> >> NAME="main_mcan5"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2761000.can",
> >> NAME="main_mcan6"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2771000.can",
> >> NAME="main_mcan7"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2781000.can",
> >> NAME="main_mcan8"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2791000.can",
> >> NAME="main_mcan9"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27a1000.can",
> >> NAME="main_mcan10"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27b1000.can",
> >> NAME="main_mcan11"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27c1000.can",
> >> NAME="main_mcan12"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="27d1000.can",
> >> NAME="main_mcan13"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2681000.can",
> >> NAME="main_mcan14"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="2691000.can",
> >> NAME="main_mcan15"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26a1000.can",
> >> NAME="main_mcan16"
> >> +SUBSYSTEM=="net", ACTION=="add", KERNELS=="26b1000.can",
> >> NAME="main_mcan17"
> >
> > On the surface, I like this patch better because it only contains
> > plaintext files and not binary ones... =)
> >
> >
> >> diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> >> b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> >> index f38606f2..248ad5e4 100644
> >> --- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> >> +++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> >> @@ -14,6 +14,11 @@ SRC_URI:append = " \
> >>       file://timesyncd.conf \
> >>   "
> >> +SRC_URI:append:k3 = " \
> >> +    file://37-can-j7.rules \
> >> +    file://37-can-am62.rules \
> >> +"
> >
> > Is this patch for all k3 devices?  Or the big list of platforms below?
> > It *seems* like you are breaking them up differently for Sitara vs
> > Jacinto devices...
> >
> >
> > Would a cleaner approach be to define two new variables and use them in
> > all of the places?
> >
>
>
> Oops...  I hit send too fast...  Updated code:
>
> CAN_RULES_SRC = ""
> CAN_RULES_SRC:j721e = "37-can-j7.rules"
> CAN_RULES_SRC:j7200 = "37-can-j7.rules"
> CAN_RULES_SRC:j721s2 = "37-can-j7.rules"
> CAN_RULES_SRC:j784s4 = "37-can-j7.rules"
> CAN_RULES_SRC:am65xx = "37-can-j7.rules"
> CAN_RULES_SRC:am62xx = "37-can-am62.rules"
> CAN_RULES_SRC:am62pxx = "37-can-am62.rules"
> CAN_RULES_SRC:am62axx = "37-can-am62.rules"
> CAN_RULES_SRC:am64xx = "37-can-am62.rules"
> CAN_RULES_SRC:j722s = "37-can-am62.rules"
> CAN_RULES_TGT = "udev/rules.d/37-can.rules"
>
> SRC_URI:append:k3 = "file://${CAN_RULES_SRC}"
>
> do_install:append:k3() {
>     install -d ${D}/${libdir}/udev/rules.d
>     install -m 0644 ${WORKDIR}/${CAN_RULES} ${D}${libdir}/${CAN_RULES_TGT}
> }
>
> FILES:udev += "${libdir}/${CAN_RULES_TGT}"
>
>
> Make sure you double check my quick hackery and not take it as is....
>
>
> >
> >
> >>   do_install:append() {
> >>       install -d ${D}${sysconfdir}/udev/rules.d/
> >>       install -m 0644 ${WORKDIR}/local.rules
> >> ${D}${sysconfdir}/udev/rules.d/
> >> @@ -43,3 +48,56 @@ do_install:append() {
> >>       install -d ${D}${sysconfdir}/systemd/
> >>       install -m 0644 ${WORKDIR}/timesyncd.conf
> >> ${D}${sysconfdir}/systemd/
> >>   }
> >> +
> >> +do_install:append:j721e() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:j7200() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:j721s2() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:j784s4() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:am65xx() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-j7.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:am62xx() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:am62pxx() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:am62axx() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:am64xx() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +do_install:append:j722s() {
> >> +    install -d ${D}/${libdir}/udev/rules.d
> >> +    install -m 0644 ${WORKDIR}/37-can-am62.rules
> >> ${D}${libdir}/udev/rules.d/37-can.rules
> >> +}
> >> +
> >> +FILES:udev += "${libdir}/udev/rules.d/37-can.rules"
> >> +
> >
>
> --
> Ryan Eatmon                reatmon@ti.com
> -----------------------------------------
> Texas Instruments, Inc.  -  LCPD  -  MGTS
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15128): https://lists.yoctoproject.org/g/meta-arago/message/15128
> Mute This Topic: https://lists.yoctoproject.org/mt/104225388/7902621
> Group Owner: meta-arago+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub [jcormier@criticallink.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
new file mode 100644
index 00000000..59dc8075
--- /dev/null
+++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-am62.rules
@@ -0,0 +1,4 @@ 
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e08000.can", NAME="mcu_mcan0"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="4e18000.can", NAME="mcu_mcan1"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="20701000.can", NAME="main_mcan0"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="20711000.can", NAME="main_mcan1"
diff --git a/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
new file mode 100644
index 00000000..f2804ecd
--- /dev/null
+++ b/meta-arago-distro/recipes-core/systemd/systemd/k3/37-can-j7.rules
@@ -0,0 +1,20 @@ 
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="40528000.can", NAME="mcu_mcan0"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="40568000.can", NAME="mcu_mcan1"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2701000.can", NAME="main_mcan0"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2711000.can", NAME="main_mcan1"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2721000.can", NAME="main_mcan2"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2731000.can", NAME="main_mcan3"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2741000.can", NAME="main_mcan4"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2751000.can", NAME="main_mcan5"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2761000.can", NAME="main_mcan6"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2771000.can", NAME="main_mcan7"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2781000.can", NAME="main_mcan8"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2791000.can", NAME="main_mcan9"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="27a1000.can", NAME="main_mcan10"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="27b1000.can", NAME="main_mcan11"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="27c1000.can", NAME="main_mcan12"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="27d1000.can", NAME="main_mcan13"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2681000.can", NAME="main_mcan14"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="2691000.can", NAME="main_mcan15"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="26a1000.can", NAME="main_mcan16"
+SUBSYSTEM=="net", ACTION=="add", KERNELS=="26b1000.can", NAME="main_mcan17"
diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
index f38606f2..248ad5e4 100644
--- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
+++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
@@ -14,6 +14,11 @@  SRC_URI:append = " \
     file://timesyncd.conf \
 "
 
+SRC_URI:append:k3 = " \
+    file://37-can-j7.rules \
+    file://37-can-am62.rules \
+"
+
 do_install:append() {
     install -d ${D}${sysconfdir}/udev/rules.d/
     install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/
@@ -43,3 +48,56 @@  do_install:append() {
     install -d ${D}${sysconfdir}/systemd/
     install -m 0644 ${WORKDIR}/timesyncd.conf ${D}${sysconfdir}/systemd/
 }
+
+do_install:append:j721e() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:j7200() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:j721s2() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:j784s4() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:am65xx() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-j7.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:am62xx() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:am62pxx() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:am62axx() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:am64xx() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+do_install:append:j722s() {
+    install -d ${D}/${libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/37-can-am62.rules ${D}${libdir}/udev/rules.d/37-can.rules
+}
+
+FILES:udev += "${libdir}/udev/rules.d/37-can.rules"
+