Hi guys,
I'm working with Buildroot and an iMX6-based custom board.
I'm trying to change the owner and group of /dev/ttymxc0 and /dev/ttymxc1 using udev rules. Here is the rule :
KERNEL=="ttymxc[0-1]", SUBSYSTEM=="tty", ACTION=="add", OWNER="newowner", GROUP="newgroup"
It does work perfectly for ttymxc1, but ttymxc0 remains with ownership root/root.
I precise that Kernel commandline tells console=null, then ttymxc0 is not reserved to spawn a tty.
Do you know why there is this strange behavior ?
Pierre-Olivier
Hi,
I think udev did change ttymxc's ownership and permission, but it is overwritten by login program if you did use ttymxc0 for serial port connecting.
You can change the TTYGROUP and TTYPERM in login.defs which is located in /etc/login.defs on image's rootfs, and can be modified by bbappend or other ways in yocto project. (The original recipe is in path : poky/meta/recipes-extended/shadow/shadow-sysroot_XX.bb)
Wish I can help you.
Good luck.
Hello,
The kernel's devtmpfs
creates device nodes with a default name, owner and permissions. It also sends out a uevent
when the node is created, which allows a uevent handler to change the name, ownership or permissions, or do anything else it wants. Buildroot offers the choice between three uevent handlers: mdev
, which is part of busybox, eudev
which is a standalone udev
fork, and udev
which is part of the systemd
init system. These handlers are configured with rules files that specify what to do with a specific type of device when it appears. For your specific need, mdev
is the best choice since it is very simple, easy to understand, doesn't take up much space, and the default configuration is sufficient. In Buildroot's menuconfig, go to System configuration → /dev management and select Dynamic using mdev. Then rebuild your root filesystem. It will now be populated with the mdev
binary (part of busybox
), an init script to start it, and a default rules file in /etc/mdev.conf
. This default file contains:
tty[0-9]* root:tty 660
This means that the tty
devices will get their group changed to tty
and their permissions to group read and write. So you can just make sure that the logged in user belongs to the tty
group. If the default mdev.conf
file is not sufficient for you (for instance, if you really need the group to be dialout
), then you can create a filesystem overlay, copy package/busybox/mdev.conf
to /etc/mdev.conf
and modify it as needed. Full documentation on the mdev.conf
format can be found in the busybox sources.
Regards