Skip to contentSkip to conversation

usb_modeswitch_data: install packed database

PATCH New Baruch Siach 2 participants 4 messages Feb 28, 2017 – Mar 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb_modeswitch_data: install packed database

The packed databased is significantly smaller than the unpacked. The unpacked database is made of hundreds of small files. So the benefit is larger filesystems that allocate a minimum of block per file. Database packing adds some overhead to every invocation of usb_modeswitch. This added overhead should not be noticeable in practice since usb_modeswitch normally runs only once per USB device insert event.

Before:

du -h output/target/usr/share/usb_modeswitch/
1.9M output/target/usr/share/usb_modeswitch/

After:

du -h output/target/usr/share/usb_modeswitch/
20K output/target/usr/share/usb_modeswitch/

---
 package/usb_modeswitch_data/usb_modeswitch_data.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/usb_modeswitch_data/usb_modeswitch_data.mk +1 -1
index 6d75b3198310..8373b6e2ca20 100644
@@ -14,7 +14,7 @@ USB_MODESWITCH_DATA_LICENSE_FILES = COPYING
 # Nothing to build, it is a pure data package
 
 define USB_MODESWITCH_DATA_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-packed
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 usb_modeswitch_data: install packed database

Hi Buildroot list,

Quoted 6 lines · Baruch Siach

The packed databased is significantly smaller than the unpacked. The unpacked database is made of hundreds of small files. So the benefit is larger filesystems that allocate a minimum of block per file. Database packing adds some overhead to every invocation of usb_modeswitch. This added overhead should not be noticeable in practice since usb_modeswitch normally runs only once per USB device insert event.

This turns out to be not such a great idea, since our Busybox tar build does not support the 'z' command line option. The tcl script embedded in usb_modeswitch_dispatcher relies on this option to extract device information entries from the packed database.

baruch

Quoted 29 lines

Before:

du -h output/target/usr/share/usb_modeswitch/
1.9M output/target/usr/share/usb_modeswitch/

After:

du -h output/target/usr/share/usb_modeswitch/
20K output/target/usr/share/usb_modeswitch/

---
 package/usb_modeswitch_data/usb_modeswitch_data.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/usb_modeswitch_data/usb_modeswitch_data.mk +1 -1
index 6d75b3198310..8373b6e2ca20 100644
@@ -14,7 +14,7 @@ USB_MODESWITCH_DATA_LICENSE_FILES = COPYING
 # Nothing to build, it is a pure data package
 
 define USB_MODESWITCH_DATA_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install-packed
 endef
 
 $(eval $(generic-package))
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 usb_modeswitch_data: install packed database

Hello,

Quoted 8 lines · Baruch Siach
Quoted 6 lines · Baruch Siach

The packed databased is significantly smaller than the unpacked. The unpacked database is made of hundreds of small files. So the benefit is larger filesystems that allocate a minimum of block per file. Database packing adds some overhead to every invocation of usb_modeswitch. This added overhead should not be noticeable in practice since usb_modeswitch normally runs only once per USB device insert event.

Quoted 4 lines

This turns out to be not such a great idea, since our Busybox tar build does not support the 'z' command line option. The tcl script embedded in usb_modeswitch_dispatcher relies on this option to extract device information entries from the packed database.

Can we adapt the TCL code to do:

gunzip -dc <file> | tar -xf -

Thomas

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

PATCH 1/1 usb_modeswitch_data: install packed database

Hi Thomas,

Quoted 9 lines · Thomas Petazzoni
Quoted 8 lines · Baruch Siach
Quoted 6 lines · Baruch Siach

The packed databased is significantly smaller than the unpacked. The unpacked database is made of hundreds of small files. So the benefit is larger filesystems that allocate a minimum of block per file. Database packing adds some overhead to every invocation of usb_modeswitch. This added overhead should not be noticeable in practice since usb_modeswitch normally runs only once per USB device insert event.

Quoted 8 lines
Quoted 4 lines

This turns out to be not such a great idea, since our Busybox tar build does not support the 'z' command line option. The tcl script embedded in usb_modeswitch_dispatcher relies on this option to extract device information entries from the packed database.

Can we adapt the TCL code to do:

gunzip -dc <file> | tar -xf -

Of course. But that is something for upstream to deal with. As I'm much more time constrained than space constrained at the moment, I'll leave that to someone else.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -