diff --git a/Documentation/configuration.md b/Documentation/configuration.md index 330c0d77a..9d909c773 100644 --- a/Documentation/configuration.md +++ b/Documentation/configuration.md @@ -8,12 +8,14 @@ Format a USB stick with FAT32/EXT4/NTFS and name it `CONFIG`. Use the following ```text network/ modules/ +udev/ authorized_keys hassos-xy.raucb ``` - 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 `udev` folder is for udev rules files. - 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. @@ -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]. +### Udev rules + +The udev rules folder `/etc/udev/rules.d` is persistent and you can add your configuration files there. + ### Network You can manual add, edit or remove connections configurations from `/etc/NetworkManager/system-connections`. diff --git a/buildroot-external/package/bluetooth-bcm43xx/bluetooth-bcm43xx.mk b/buildroot-external/package/bluetooth-bcm43xx/bluetooth-bcm43xx.mk index 37cfcf1fb..ce9829450 100644 --- a/buildroot-external/package/bluetooth-bcm43xx/bluetooth-bcm43xx.mk +++ b/buildroot-external/package/bluetooth-bcm43xx/bluetooth-bcm43xx.mk @@ -24,8 +24,8 @@ define BLUETOOTH_BCM43XX_INSTALL_TARGET_CMDS $(INSTALL) -d $(TARGET_DIR)/lib/firmware/brcm $(INSTALL) -m 0644 $(@D)/*.hcd $(TARGET_DIR)/lib/firmware/brcm/ - $(INSTALL) -d $(TARGET_DIR)/etc/udev/rules.d - $(INSTALL) -m 0644 $(@D)/bluetooth-bcm43xx.rules $(TARGET_DIR)/etc/udev/rules.d/ + $(INSTALL) -d $(TARGET_DIR)/usr/lib/udev/rules.d + $(INSTALL) -m 0644 $(@D)/bluetooth-bcm43xx.rules $(TARGET_DIR)/usr/lib/udev/rules.d/ endef $(eval $(generic-package)) diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/etc-udev-rules.d.mount b/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/etc-udev-rules.d.mount new file mode 120000 index 000000000..c148f8000 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/hassos-bind.target.wants/etc-udev-rules.d.mount @@ -0,0 +1 @@ +/usr/lib/systemd/system/etc-udev-rules.d.mount \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-udev-rules.d.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-udev-rules.d.mount new file mode 100644 index 000000000..5e6badb81 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-udev-rules.d.mount @@ -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 diff --git a/buildroot-external/rootfs-overlay/usr/lib/udev/rules.d/hmip-rfusb.rules b/buildroot-external/rootfs-overlay/usr/lib/udev/rules.d/hmip-rfusb.rules new file mode 100644 index 000000000..8d43adc3d --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/udev/rules.d/hmip-rfusb.rules @@ -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'" diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config index 99c295520..f633c4cab 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-config +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-config @@ -33,6 +33,15 @@ if [ -d /mnt/config/modules ]; then cp -f /mnt/config/modules/* /etc/modules-load.d/* 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 if [ -f /mnt/config/authorized_keys ]; then diff --git a/buildroot-external/scripts/rauc.sh b/buildroot-external/scripts/rauc.sh index b130564e0..ade1b9205 100755 --- a/buildroot-external/scripts/rauc.sh +++ b/buildroot-external/scripts/rauc.sh @@ -86,7 +86,7 @@ function install_bootloader_config() { # Fix MBR if [ "${BOOT_SYS}" == "mbr" ]; then - mkdir -p ${TARGET_DIR}/etc/udev/rules.d - cp -f ${BR2_EXTERNAL_HASSOS_PATH}/misc/mbr-part.rules ${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}/usr/lib/udev/rules.d/ fi }