package/swupdate: add option to enable USB install
PATCH 1/1 package/swupdate: add option to enable USB install
--- package/swupdate/Config.in | 7 +++++++ package/swupdate/swupdate-usb.rules | 2 ++ package/swupdate/swupdate.mk | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 package/swupdate/swupdate-usb.rules
package/swupdate/Config.in +7 -0
@@ -60,6 +60,13 @@ config BR2_PACKAGE_SWUPDATE_CONFIG I you wish to use your own modified swupdate configuration file specify the config file location with this option. +config BR2_PACKAGE_SWUPDATE_USB + bool "swupdate usb" + default y + depends on BR2_PACKAGE_SYSTEMD + help + Enable update from USB disk. + config BR2_PACKAGE_SWUPDATE_WEBSERVER bool "swupdate webserver" default y
package/swupdate/swupdate-usb.rules new file +2 -0
@@ -0,0 +1,2 @@ +ACTION=="add", KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="swupdate-usb@%k.service" +
package/swupdate/swupdate.mk +3 -0
@@ -252,6 +252,9 @@ define SWUPDATE_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/usr/lib/systemd/system/swupdate.socket $(INSTALL) -D -m 644 package/swupdate/[email protected] \ $(TARGET_DIR)/usr/lib/systemd/system/[email protected] + $(if $(BR2_PACKAGE_SWUPDATE_USB), \ + $(INSTALL) -D -m 644 package/swupdate/swupdate-usb.rules \ + $(TARGET_DIR)/lib/udev/rules.d/swupdate-usb.rules) $(INSTALL) -D -m 644 package/swupdate/swupdate-progress.service \ $(TARGET_DIR)/usr/lib/systemd/system/swupdate-progress.service $(INSTALL) -D -m 644 package/swupdate/tmpfiles-swupdate.conf \
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
James, All,
On 2021-09-11 09:10 -0600, James Hilliard spake thusly:
Quoted 13 lines
Signed-off-by James Hilliard <[email protected]>--- package/swupdate/Config.in | 7 +++++++ package/swupdate/swupdate-usb.rules | 2 ++ package/swupdate/swupdate.mk | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 package/swupdate/swupdate-usb.rulespackage/swupdate/Config.in +0
-0
package/swupdate/Config.in config BR2_PACKAGE_SWUPDATE_CONFIG · line 65
Quoted 6 lines
package/swupdate/Config.in +3
-0@@ -60,6 +60,13 @@ config BR2_PACKAGE_SWUPDATE_CONFIG I you wish to use your own modified swupdate configuration file specify the config file location with this option. +config BR2_PACKAGE_SWUPDATE_USB + bool "swupdate usb" + default y
Options should not default to 'y', unless there is a good reason for that, in which case it should be dully explained in the commit log.
Quoted 13 lines
package/swupdate/Config.in +4
-0+ depends on BR2_PACKAGE_SYSTEMD + help + Enable update from USB disk. + config BR2_PACKAGE_SWUPDATE_WEBSERVER bool "swupdate webserver" default ypackage/swupdate/swupdate-usb.rules new file +0
-0
package/swupdate/swupdate-usb.rules line 2
Quoted 2 lines
package/swupdate/swupdate-usb.rules new file +2
-0@@ -0,0 +1,2 @@ +ACTION=="add", KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="swupdate-usb@%k.service" +
Spurious trailing empty line.
Also, I concur with Arnout: this is a bit dangerous, and users must be made aware, in one form or another, that they should really setup a PKI to sign their swu, or anyone with physical access to the device will be able to update to arbitrary firmwares.
Regards,
Yann E. MORIN.
package/swupdate/swupdate.mk define SWUPDATE_INSTALL_INIT_SYSTEMD · line 256
Quoted 10 lines
package/swupdate/swupdate.mk +2
-0@@ -252,6 +252,9 @@ define SWUPDATE_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/usr/lib/systemd/system/swupdate.socket $(INSTALL) -D -m 644 package/swupdate/[email protected] \ $(TARGET_DIR)/usr/lib/systemd/system/[email protected] + $(if $(BR2_PACKAGE_SWUPDATE_USB), \ + $(INSTALL) -D -m 644 package/swupdate/swupdate-usb.rules \
I know this is not enforced everywhere, and that the CWD at runtime is always the top-level of the buildroot tree, but I'd really like that we refer to the package directory using the appropriate variable, rather than hard-coding it, like $(SWUPDATE_PKGDIR):
$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/swupdate-usb.rules ...
Regards,
Yann E. MORIN.
Quoted 11 lines
package/swupdate/swupdate.mk +1
-0+ $(TARGET_DIR)/lib/udev/rules.d/swupdate-usb.rules) $(INSTALL) -D -m 644 package/swupdate/swupdate-progress.service \ $(TARGET_DIR)/usr/lib/systemd/system/swupdate-progress.service $(INSTALL) -D -m 644 package/swupdate/tmpfiles-swupdate.conf \Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 20 lines · Yann E. MORIN
James, All,
On 2021-09-11 09:10 -0600, James Hilliard spake thusly:
Quoted 16 lines
Signed-off-by James Hilliard <[email protected]>--- package/swupdate/Config.in | 7 +++++++ package/swupdate/swupdate-usb.rules | 2 ++ package/swupdate/swupdate.mk | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 package/swupdate/swupdate-usb.rulespackage/swupdate/Config.in +0
-0@@ -60,6 +60,13 @@ config BR2_PACKAGE_SWUPDATE_CONFIG I you wish to use your own modified swupdate configuration file specify the config file location with this option.
Quoted 6 lines
package/swupdate/Config.in config BR2_PACKAGE_SWUPDATE_CONFIG · line 65
Quoted 3 lines
package/swupdate/Config.in +3
-0+config BR2_PACKAGE_SWUPDATE_USB + bool "swupdate usb" + default yOptions should not default to 'y', unless there is a good reason for that, in which case it should be dully explained in the commit log.
Hmm, I have this defaulting to yes for consistency with meta-swupdate.
Quoted 10 lines
Quoted 10 lines
package/swupdate/Config.in +4
-0+ depends on BR2_PACKAGE_SYSTEMD + help + Enable update from USB disk. + config BR2_PACKAGE_SWUPDATE_WEBSERVER bool "swupdate webserver" default ypackage/swupdate/swupdate-usb.rules new file +0
-0
Quoted 8 lines
package/swupdate/swupdate-usb.rules line 2
Quoted 6 lines
index 0000000000..b4efd0b733
package/swupdate/swupdate-usb.rules new file +2
-0@@ -0,0 +1,2 @@ +ACTION=="add", KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="swupdate-usb@%k.service" +Spurious trailing empty line.
Ah, that must have been in meta-swupdate as well.
Quoted 5 lines
Also, I concur with Arnout: this is a bit dangerous, and users must be made aware, in one form or another, that they should really setup a PKI to sign their swu, or anyone with physical access to the device will be able to update to arbitrary firmwares.
I mean, that's not really specific to this, swupdate has multiple install methods
that all have optional signature validation. For example the webserver is really no different than usb install when it comes to needing validation to prevent arbitrary firmwares from being installed.
Quoted 20 lines
Regards,
Yann E. MORIN.package/swupdate/swupdate.mk define SWUPDATE_INSTALL_INIT_SYSTEMD · line 256
Quoted 10 lines
package/swupdate/swupdate.mk +2
-0@@ -252,6 +252,9 @@ define SWUPDATE_INSTALL_INIT_SYSTEMD $(TARGET_DIR)/usr/lib/systemd/system/swupdate.socket $(INSTALL) -D -m 644 package/swupdate/[email protected] \ $(TARGET_DIR)/usr/lib/systemd/system/[email protected] + $(if $(BR2_PACKAGE_SWUPDATE_USB), \ + $(INSTALL) -D -m 644 package/swupdate/swupdate-usb.rules \I know this is not enforced everywhere, and that the CWD at runtime is always the top-level of the buildroot tree, but I'd really like that we refer to the package directory using the appropriate variable, rather than hard-coding it, like $(SWUPDATE_PKGDIR):
Quoted 1 line
$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/swupdate-usb.rules ...
Ah, I had just copied the existing style used here, I'll send a patch reworking that
for swupdate.
Quoted 16 lines
Regards,
Yann E. MORIN.Quoted 11 lines
package/swupdate/swupdate.mk +1
-1+ $(TARGET_DIR)/lib/udev/rules.d/swupdate-usb.rules) $(INSTALL) -D -m 644 package/swupdate/swupdate-progress.service \ $(TARGET_DIR)/usr/lib/systemd/system/swupdate-progress.service $(INSTALL) -D -m 644 package/swupdate/tmpfiles-swupdate.conf \ --2.25.1
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 7 lines
--
.-----------------.--------------------.------------------.--------------------.| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot