Skip to contentSkip to conversation

package/systemd: Optionally disable hwdb

PATCH New Marcin Niestroj 4 participants 8 messages Apr 15, 2016 – Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

Add config option to disable hwdb in systemd, for smaller images and better boot performance.

---
 package/systemd/Config.in  | 11 +++++++++++
 package/systemd/systemd.mk |  6 ++++++
 2 files changed, 17 insertions(+)
package/systemd/Config.in +11 -0
index 97d48c4..324e884 100644
@@ -84,6 +84,17 @@ config BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY
 
 	  http://www.freedesktop.org/software/systemd/man/systemd-journal-gatewayd.service.html
 
+config BR2_PACKAGE_SYSTEMD_HWDB
+	bool "enable hwdb installation"
+	default y
+	help
+	  Enables hardware database installation to /usr/lib/udev/hwdb.d
+
+	  Disabling this option improves first boot time (or every boot
+	  time in case of initramfs images) and saves several MB space.
+
+	  https://www.freedesktop.org/software/systemd/man/hwdb.html
+
 config BR2_PACKAGE_SYSTEMD_BINFMT
 	bool "enable binfmt tool"
 	help
package/systemd/systemd.mk +6 -0
index 79e657e..29b62c0 100644
@@ -127,6 +127,12 @@ else
 SYSTEMD_CONF_OPTS += --disable-microhttpd
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
+SYSTEMD_CONF_OPTS += --enable-hwdb
+else
+SYSTEMD_CONF_OPTS += --disable-hwdb
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD_BINFMT),y)
 SYSTEMD_CONF_OPTS += --enable-binfmt
 else
Signature · 1 line
2.8.0
#1 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

Hello Marcin Niestroj,

Quoted 9 lines · Marcin Niestroj

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

Perfect for this case would be 'systemd-hwdb update' run at built time to create the hwdb files once, but maybe stuff for a follow up patch...

Regards,
Peter

Quoted 48 lines

Add config option to disable hwdb in systemd, for smaller images and better boot performance.

---
 package/systemd/Config.in  | 11 +++++++++++
 package/systemd/systemd.mk |  6 ++++++
 2 files changed, 17 insertions(+)
package/systemd/Config.in +11 -0
index 97d48c4..324e884 100644
@@ -84,6 +84,17 @@ config BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY
 
 	  http://www.freedesktop.org/software/systemd/man/systemd-journal-gatewayd.service.html
 
+config BR2_PACKAGE_SYSTEMD_HWDB
+	bool "enable hwdb installation"
+	default y
+	help
+	  Enables hardware database installation to /usr/lib/udev/hwdb.d
+
+	  Disabling this option improves first boot time (or every boot
+	  time in case of initramfs images) and saves several MB space.
+
+	  https://www.freedesktop.org/software/systemd/man/hwdb.html
+
 config BR2_PACKAGE_SYSTEMD_BINFMT
 	bool "enable binfmt tool"
 	help
package/systemd/systemd.mk +6 -0
index 79e657e..29b62c0 100644
@@ -127,6 +127,12 @@ else
 SYSTEMD_CONF_OPTS += --disable-microhttpd
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
+SYSTEMD_CONF_OPTS += --enable-hwdb
+else
+SYSTEMD_CONF_OPTS += --disable-hwdb
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD_BINFMT),y)
 SYSTEMD_CONF_OPTS += --enable-binfmt
 else
#2 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

Hi,

Quoted 9 lines · Peter Seiderer

Hello Marcin Niestroj,

Quoted 5 lines · Marcin Niestroj

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

Quoted 7 lines
Quoted 4 lines

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

Perfect for this case would be 'systemd-hwdb update' run at built time to create the hwdb files once, but maybe stuff for a follow up patch...

I thought about it. This would propably require compiling part of systemd for the host PC, so the build time would be significally increased. This can be implemented if someone finds use case for it. For now it is ok for me that we totally disable hwdb and save additional space of the binary hwdb file.

For OpenEmbedded I saw a patch that was running QEMU to just generate the binary hwdb file at build time. I don't think this is an option for us.

Signature · 2 lines
Regards,
Marcin
#3 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

In reply to Marcin Niestroj

ping

Quoted 58 lines · Marcin Niestroj

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

Add config option to disable hwdb in systemd, for smaller images and better boot performance.

---
 package/systemd/Config.in  | 11 +++++++++++
 package/systemd/systemd.mk |  6 ++++++
 2 files changed, 17 insertions(+)
package/systemd/Config.in +11 -0
index 97d48c4..324e884 100644
@@ -84,6 +84,17 @@ config BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY
 
 	  http://www.freedesktop.org/software/systemd/man/systemd-journal-gatewayd.service.html
 
+config BR2_PACKAGE_SYSTEMD_HWDB
+	bool "enable hwdb installation"
+	default y
+	help
+	  Enables hardware database installation to /usr/lib/udev/hwdb.d
+
+	  Disabling this option improves first boot time (or every boot
+	  time in case of initramfs images) and saves several MB space.
+
+	  https://www.freedesktop.org/software/systemd/man/hwdb.html
+
 config BR2_PACKAGE_SYSTEMD_BINFMT
 	bool "enable binfmt tool"
 	help
package/systemd/systemd.mk +6 -0
index 79e657e..29b62c0 100644
@@ -127,6 +127,12 @@ else
 SYSTEMD_CONF_OPTS += --disable-microhttpd
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
+SYSTEMD_CONF_OPTS += --enable-hwdb
+else
+SYSTEMD_CONF_OPTS += --disable-hwdb
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD_BINFMT),y)
 SYSTEMD_CONF_OPTS += --enable-binfmt
 else
Signature · 1 line
Marcin Niestroj
#4 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

In reply to Marcin Niestroj

Marcin, All,

On 2016-04-15 12:46 +0200, Marcin Niestroj spake thusly:

Quoted 8 lines

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

So that's where my boot time goes! ;-)

Quoted 4 lines

Add config option to disable hwdb in systemd, for smaller images and better boot performance.

I'm looking at all systemd-related pending patches, since I'm working on cleaning up our systemd handling...

I have had a look at the systemd code to update the hwdb, and it is not trivially replaced, so we would indeed need a host-systemd if we wanted to generate the hwdb at build time.

I don't think this warrants the complexity of a host-systemd, however...

Yet, I'd like to know what would be the impact of not having hwdb support at runtime. Care to shed some light, please?

Otherwise:

Regards,
Yann E. MORIN.

Quoted 51 lines
---
 package/systemd/Config.in  | 11 +++++++++++
 package/systemd/systemd.mk |  6 ++++++
 2 files changed, 17 insertions(+)
package/systemd/Config.in +11 -0
index 97d48c4..324e884 100644
@@ -84,6 +84,17 @@ config BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY
 
 	  http://www.freedesktop.org/software/systemd/man/systemd-journal-gatewayd.service.html
 
+config BR2_PACKAGE_SYSTEMD_HWDB
+	bool "enable hwdb installation"
+	default y
+	help
+	  Enables hardware database installation to /usr/lib/udev/hwdb.d
+
+	  Disabling this option improves first boot time (or every boot
+	  time in case of initramfs images) and saves several MB space.
+
+	  https://www.freedesktop.org/software/systemd/man/hwdb.html
+
 config BR2_PACKAGE_SYSTEMD_BINFMT
 	bool "enable binfmt tool"
 	help
package/systemd/systemd.mk +6 -0
index 79e657e..29b62c0 100644
@@ -127,6 +127,12 @@ else
 SYSTEMD_CONF_OPTS += --disable-microhttpd
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
+SYSTEMD_CONF_OPTS += --enable-hwdb
+else
+SYSTEMD_CONF_OPTS += --disable-hwdb
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD_BINFMT),y)
 SYSTEMD_CONF_OPTS += --enable-binfmt
 else
Signature · 6 lines
2.8.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

Hi,

Quoted 22 lines · Yann E. MORIN

Marcin, All,

On 2016-04-15 12:46 +0200, Marcin Niestroj spake thusly:

Quoted 8 lines

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

So that's where my boot time goes! ;-)

Quoted 4 lines

Add config option to disable hwdb in systemd, for smaller images and better boot performance.

I'm looking at all systemd-related pending patches, since I'm working on cleaning up our systemd handling...

Quoted 8 lines

I have had a look at the systemd code to update the hwdb, and it is not trivially replaced, so we would indeed need a host-systemd if we wanted to generate the hwdb at build time.

I don't think this warrants the complexity of a host-systemd, however...

Yet, I'd like to know what would be the impact of not having hwdb support at runtime. Care to shed some light, please?

HWDB is mainly a database of device classes and vendors (for PCI, SDIO, USB). This is helpfull during development, because tools like lsusb are able to show vendor and usb class for each device. However we don't need this in production most of the time.
Additionally there are some files for input devices, like mouse, keyboard and pointstick. In keyboard files for example there are defined some special keys, like play/pause, volumeup etc.

Regards,
Marcin

Quoted 60 lines

Otherwise:

Regards,
Yann E. MORIN.

Quoted 51 lines
---
 package/systemd/Config.in  | 11 +++++++++++
 package/systemd/systemd.mk |  6 ++++++
 2 files changed, 17 insertions(+)
package/systemd/Config.in +11 -0
index 97d48c4..324e884 100644
@@ -84,6 +84,17 @@ config BR2_PACKAGE_SYSTEMD_JOURNAL_GATEWAY
 
 	  http://www.freedesktop.org/software/systemd/man/systemd-journal-gatewayd.service.html
 
+config BR2_PACKAGE_SYSTEMD_HWDB
+	bool "enable hwdb installation"
+	default y
+	help
+	  Enables hardware database installation to /usr/lib/udev/hwdb.d
+
+	  Disabling this option improves first boot time (or every boot
+	  time in case of initramfs images) and saves several MB space.
+
+	  https://www.freedesktop.org/software/systemd/man/hwdb.html
+
 config BR2_PACKAGE_SYSTEMD_BINFMT
 	bool "enable binfmt tool"
 	help
package/systemd/systemd.mk +6 -1
index 79e657e..29b62c0 100644
@@ -127,6 +127,12 @@ else
 SYSTEMD_CONF_OPTS += --disable-microhttpd
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
+SYSTEMD_CONF_OPTS += --enable-hwdb
+else
+SYSTEMD_CONF_OPTS += --disable-hwdb
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD_BINFMT),y)
 SYSTEMD_CONF_OPTS += --enable-binfmt
 else
--

2.8.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 1 line
Marcin Niestroj
#6 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

Marcin, All,

On 2016-06-13 11:20 +0200, Marcin Niestroj spake thusly:

Quoted 10 lines · Yann E. MORIN
Quoted 9 lines

On 2016-04-15 12:46 +0200, Marcin Niestroj spake thusly:

Quoted 8 lines

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

[--SNIP--]

Quoted 10 lines
Quoted 2 lines

Yet, I'd like to know what would be the impact of not having hwdb support at runtime. Care to shed some light, please?

HWDB is mainly a database of device classes and vendors (for PCI, SDIO, USB). This is helpfull during development, because tools like lsusb are able to show vendor and usb class for each device. However we don't need this in production most of the time.
Additionally there are some files for input devices, like mouse, keyboard and pointstick. In keyboard files for example there are defined some special keys, like play/pause, volumeup etc.

OK, thanks for the info, definitively usefull.

So, it seems this is not systematically needed on production systems, but mostly a "debugging" aid in most cases. And for those that need it, it's still an option.

However, people that do need it and that are working either on a read-only filesystem or a transient one (initramfs) would need a mean to avoid building this hwdb at every boot... That would be so cool...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 1/1 package/systemd: Optionally disable hwdb

In reply to Marcin Niestroj

Hello,

Quoted 9 lines · Marcin Niestroj

By default hwdb files are installed in /usr/lib/udev/hwdb.d Currently they take about ~5MB. After first boot, systemd-hwdb tool parses them and creates a binary in /etc/udev/hwdb.bin, which takes another ~6.5MB.

In case of initramfs images, hwdb parsing is done every boot. This adds about 2-3 seconds to boot time in case of rootfs on SDHC class 10 card (benchmarked with am335x board). NAND boot takes even longer.

Quoted 8 lines

Add config option to disable hwdb in systemd, for smaller images and better boot performance.

---
 package/systemd/Config.in  | 11 +++++++++++
 package/systemd/systemd.mk |  6 ++++++
 2 files changed, 17 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com