Skip to contentSkip to conversation

tools: fitmount: fuse mount fit images

RFC PATCH New Selva Muthukumar 4 participants 7 messages Jun 15, 2020 – Jun 24, 2020

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tools: fitmount: fuse mount fit images

Allow mounting of FIT images. If FIT images are used for firmware upgrade from linux, mouting can save space in comparison to using dumpimage.

---
 tools/Makefile   |   5 +-
 tools/fitmount.c | 254 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 258 insertions(+), 1 deletion(-)
 create mode 100644 tools/fitmount.c
tools/Makefile +4 -1
index 081383d7a7..c2c6e952ed 100644
@@ -53,7 +53,7 @@ HOSTCFLAGS_xway-swap-bytes.o := -pedantic
 hostprogs-y += mkenvimage
 mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
 
-hostprogs-y += dumpimage mkimage
+hostprogs-y += dumpimage mkimage fitmount
 hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
 
 hostprogs-$(CONFIG_CMD_BOOTEFI_SELFTEST) += file2include
@@ -124,6 +124,8 @@ dumpimage-mkimage-objs := aisimage.o \
 dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
 mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
+fitmount-objs   := $(dumpimage-mkimage-objs) fitmount.o
+HOSTCFLAGS_fitmount.o += $(shell pkg-config fuse --cflags)
 fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
 file2include-objs := file2include.o
 
@@ -167,6 +169,7 @@ HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
 HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
 HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
 HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
+HOSTLOADLIBES_fitmount := $(HOSTLOADLIBES_mkimage) $(shell pkg-config fuse --libs 2> /dev/null || echo "-lfuse")
 
 hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
 hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
tools/fitmount.c new file +254 -0

254 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

RFC PATCH 1/1 tools: fitmount: fuse mount fit images

Quoted 4 lines · Selva Muthukumar

Allow mounting of FIT images. If FIT images are used for firmware upgrade from linux, mouting can save space in comparison to using dumpimage.

Any comments on this? Is there any other way to get FIT image contents, without extracting it?

Thanks,
Selva

#2 lore raw

RFC PATCH 1/1 tools: fitmount: fuse mount fit images

Quoted 9 lines · selvamuthukumar v
Quoted 4 lines · Selva Muthukumar

Allow mounting of FIT images. If FIT images are used for firmware upgrade from linux, mouting can save space in comparison to using dumpimage.

Any comments on this? Is there any other way to get FIT image contents, without extracting it?

Sorry for the delay. For your program, there's a few things such as missing license header and being able to opt-in as otherwise we add a new build dependency for everyone.

For getting FIT image contents, the existing dumpimage tool handles this.

What is missing and would be greatly appreciated is updating some documentation to include what's described in:
commit 39931f966adaeadd66dc7a905f7dddb93f66bac3

Author: Guilherme Maciel Ferreira <[email protected]>
Date:   Thu Jan 15 02:54:42 2015 -0200

dumpimage: fit: extract FIT images

to be much more visible. What's documented there works today but I had to double check how myself as it's not as visible as it should be. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200623/292376ec/attachment.sig>
#3 lore raw

RFC PATCH 1/1 tools: fitmount: fuse mount fit images

Quoted 12 lines · Tom Rini
Quoted 9 lines · selvamuthukumar v
Quoted 4 lines · Selva Muthukumar

Allow mounting of FIT images. If FIT images are used for firmware upgrade from linux, mouting can save space in comparison to using dumpimage.

Any comments on this? Is there any other way to get FIT image contents, without extracting it?

Quoted 7 lines

Sorry for the delay. For your program, there's a few things such as missing license header and being able to opt-in as otherwise we add a new build dependency for everyone.

For getting FIT image contents, the existing dumpimage tool handles this.

dumpimage extracts image contents into new files. Current firmware upgrade process in our product is:

1. FIT image has kernel and rootfs. Get new FIT image in tmpfs.
2. dumpimage to extract the FIT image in tmpfs.
3. Write kernel and rootfs in partitions.

many times step2 fails because there is not enough space in tmpfs. FIT image and individual components need to be present in tmpfs. When we mount the FIT image, it does not take extra space tmpfs.

Thanks.
Selva

#4 lore raw

RFC PATCH 1/1 tools: fitmount: fuse mount fit images

Quoted 9 lines · selvamuthukumar v
Quoted 5 lines · Tom Rini

For getting FIT image contents, the existing dumpimage tool handles this.

dumpimage extracts image contents into new files. Current firmware upgrade process in our product is:

Quoted 7 lines

1. FIT image has kernel and rootfs. Get new FIT image in tmpfs.
2. dumpimage to extract the FIT image in tmpfs.
3. Write kernel and rootfs in partitions.

many times step2 fails because there is not enough space in tmpfs. FIT image and individual components need to be present in tmpfs. When we mount the FIT image, it does not take extra space tmpfs.

But, why do you use a FIT to bundle the kernel and rootfs? Wouldn't a squashfs image be a better container format? Depending on your rootfs image type, that might even cost even less in tmpfs (and transfer to target) than a FIT.

I don't have anything against your patch, except as Tom pointed out it really needs to be opt-in so not everybody needs to have libfuse present to build the host tools. Just curious why you've chosen FIT as the container format.

Rasmus

#5 lore raw

RFC PATCH 1/1 tools: fitmount: fuse mount fit images

Quoted 15 lines · Rasmus Villemoes
Quoted 13 lines · selvamuthukumar v
Quoted 5 lines · Tom Rini

For getting FIT image contents, the existing dumpimage tool handles this.

dumpimage extracts image contents into new files. Current firmware upgrade process in our product is:

1. FIT image has kernel and rootfs. Get new FIT image in tmpfs.
2. dumpimage to extract the FIT image in tmpfs.
3. Write kernel and rootfs in partitions.

Quoted 9 lines
Quoted 3 lines

many times step2 fails because there is not enough space in tmpfs. FIT image and individual components need to be present in tmpfs. When we mount the FIT image, it does not take extra space tmpfs.

But, why do you use a FIT to bundle the kernel and rootfs? Wouldn't a squashfs image be a better container format? Depending on your rootfs image type, that might even cost even less in tmpfs (and transfer to target) than a FIT.

Platform is based on OpenWRT which already has the FIT image support. Other than kernel and rootfs FIT image has some more contents, like script to upgrade the image from u-boot

Quoted 5 lines

I don't have anything against your patch, except as Tom pointed out it really needs to be opt-in so not everybody needs to have libfuse present to build the host tools. Just curious why you've chosen FIT as the container format.

I can make this tool as a configurable option.

Signature · 10 lines
_Disclaimer:?_? 2020 VVDN Technologies Pvt. Ltd. This e-mail contains 
PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the 
addressee(s). If you are not the intended recipient, please notify the 
sender by e-mail and delete the original message. Further, you are not to 
copy, disclose, or distribute this e-mail or its contents to any other 
person and any such actions are unlawful._
_
_
_
__
#6 lore raw

RFC PATCH 1/1 tools: fitmount: fuse mount fit images

In reply to selvamuthukumar v
Quoted 23 lines · selvamuthukumar v
Quoted 12 lines · Tom Rini
Quoted 9 lines · selvamuthukumar v
Quoted 4 lines · Selva Muthukumar

Allow mounting of FIT images. If FIT images are used for firmware upgrade from linux, mouting can save space in comparison to using dumpimage.

Any comments on this? Is there any other way to get FIT image contents, without extracting it?

Quoted 7 lines

Sorry for the delay. For your program, there's a few things such as missing license header and being able to opt-in as otherwise we add a new build dependency for everyone.

For getting FIT image contents, the existing dumpimage tool handles this.

dumpimage extracts image contents into new files. Current firmware upgrade process in our product is:

Quoted 7 lines

1. FIT image has kernel and rootfs. Get new FIT image in tmpfs.
2. dumpimage to extract the FIT image in tmpfs.
3. Write kernel and rootfs in partitions.

many times step2 fails because there is not enough space in tmpfs. FIT image and individual components need to be present in tmpfs. When we mount the FIT image, it does not take extra space tmpfs.

Ah, so that's your use-case. But in this case, couldn't you use a named pipe instead to stream from the image after step one? Or add a -q option to dumpimage (so it doesn't print anything) and use -o /dev/stdout and pipe that directly to whatever is writing to flash?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200624/73404aa5/attachment.sig>