Allow udev rules & make it persistent (#210)

* Install default to lib

* Create hmip-rfusb.rules

* Create etc-udev-rules.d.mount

* Update hassos-config

* Update configuration.md

* Update rauc.sh

* Add ln
This commit is contained in:
Pascal Vizeli 2018-10-11 20:49:20 +02:00 committed by GitHub
parent faa371191f
commit dac76b1632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 4 deletions

View File

@ -8,12 +8,14 @@ Format a USB stick with FAT32/EXT4/NTFS and name it `CONFIG`. Use the following
```text ```text
network/ network/
modules/ modules/
udev/
authorized_keys authorized_keys
hassos-xy.raucb hassos-xy.raucb
``` ```
- The `network` folder can contain any kind of NetworkManager connection files. For more information see [Network][network.md]. - The `network` folder can contain any kind of NetworkManager connection files. For more information see [Network][network.md].
- The `modules` folder is for modules-load configuration files. - The `modules` folder is for modules-load configuration files.
- The `udev` folder is for udev rules files.
- The `authorized_keys` file activates debug SSH access on port `22222`. See [Debugging Hassio][debug-hassio]. - The `authorized_keys` file activates debug SSH access on port `22222`. See [Debugging Hassio][debug-hassio].
- The `hassos-*.raucb` file is a firmware OTA update which will be installed. These can be found on on the [release][hassos-release] page. - The `hassos-*.raucb` file is a firmware OTA update which will be installed. These can be found on on the [release][hassos-release] page.
@ -30,6 +32,10 @@ You can edit or create a `cmdline.txt` in your boot partition. That will be read
The kernel module folder `/etc/modules-load.d` is persistent and you can add your configuration files there. See [Systemd modules load][systemd-modules]. The kernel module folder `/etc/modules-load.d` is persistent and you can add your configuration files there. See [Systemd modules load][systemd-modules].
### Udev rules
The udev rules folder `/etc/udev/rules.d` is persistent and you can add your configuration files there.
### Network ### Network
You can manual add, edit or remove connections configurations from `/etc/NetworkManager/system-connections`. You can manual add, edit or remove connections configurations from `/etc/NetworkManager/system-connections`.

View File

@ -24,8 +24,8 @@ define BLUETOOTH_BCM43XX_INSTALL_TARGET_CMDS
$(INSTALL) -d $(TARGET_DIR)/lib/firmware/brcm $(INSTALL) -d $(TARGET_DIR)/lib/firmware/brcm
$(INSTALL) -m 0644 $(@D)/*.hcd $(TARGET_DIR)/lib/firmware/brcm/ $(INSTALL) -m 0644 $(@D)/*.hcd $(TARGET_DIR)/lib/firmware/brcm/
$(INSTALL) -d $(TARGET_DIR)/etc/udev/rules.d $(INSTALL) -d $(TARGET_DIR)/usr/lib/udev/rules.d
$(INSTALL) -m 0644 $(@D)/bluetooth-bcm43xx.rules $(TARGET_DIR)/etc/udev/rules.d/ $(INSTALL) -m 0644 $(@D)/bluetooth-bcm43xx.rules $(TARGET_DIR)/usr/lib/udev/rules.d/
endef endef
$(eval $(generic-package)) $(eval $(generic-package))

View File

@ -0,0 +1 @@
/usr/lib/systemd/system/etc-udev-rules.d.mount

View File

@ -0,0 +1,14 @@
[Unit]
Description=Udev persistent rules.d
Requires=mnt-overlay.mount
After=mnt-overlay.mount
Before=systemd-udevd.service hassos-config.service
[Mount]
What=/mnt/overlay/etc/udev/rules.d
Where=/etc/udev/rules.d
Type=None
Options=bind
[Install]
WantedBy=hassos-bind.target

View File

@ -0,0 +1 @@
ACTION=="add", ATTRS{idVendor}=="1b1f", ATTRS{idProduct}=="c020", RUN+="/sbin/modprobe cp210x" RUN+="/bin/sh -c 'echo 1b1f c020 >/sys/bus/usb-serial/drivers/cp210x/new_id'"

View File

@ -33,6 +33,15 @@ if [ -d /mnt/config/modules ]; then
cp -f /mnt/config/modules/* /etc/modules-load.d/* cp -f /mnt/config/modules/* /etc/modules-load.d/*
fi fi
##
# Udev
if [ -d /mnt/config/udev ]; then
echo "[Info] Update Udev configuration!"
rm -rf /etc/udev/rules.d/*
cp -f /mnt/config/udev/* /etc/udev/rules.d/*
fi
## ##
# SSH know hosts # SSH know hosts
if [ -f /mnt/config/authorized_keys ]; then if [ -f /mnt/config/authorized_keys ]; then

View File

@ -86,7 +86,7 @@ function install_bootloader_config() {
# Fix MBR # Fix MBR
if [ "${BOOT_SYS}" == "mbr" ]; then if [ "${BOOT_SYS}" == "mbr" ]; then
mkdir -p ${TARGET_DIR}/etc/udev/rules.d mkdir -p ${TARGET_DIR}/usr/lib/udev/rules.d
cp -f ${BR2_EXTERNAL_HASSOS_PATH}/misc/mbr-part.rules ${TARGET_DIR}/etc/udev/rules.d/ cp -f ${BR2_EXTERNAL_HASSOS_PATH}/misc/mbr-part.rules ${TARGET_DIR}/usr/lib/udev/rules.d/
fi fi
} }