[U-Boot] [Patch] Update filesize environment variable on ubifs_load

Rod Boyce rod at teamboyce.co.uk
Sat Jun 18 12:30:18 CEST 2011


Add functionality to update filesize environment variable when
ubifs_load is called to read a file from filesystem

Signed-off-by: Rod Boyce <uboot at teamboyce.co.uk>
------------------------------- fs/ubifs/ubifs.c 
------------------------------
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 61f70b2..17097f2 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -686,6 +686,7 @@
      int i;
      int count;
      int last_block_size = 0;
+    char buf[32];

      c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY);
      /* ubifs_findfile will resolve symlinks, so we know that we get
@@ -716,6 +717,8 @@
      count = (size + UBIFS_BLOCK_SIZE - 1) >> UBIFS_BLOCK_SHIFT;
      printf("Loading file '%s' to addr 0x%08x with size %d (0x%08x)...\n",
             filename, addr, size, size);
+    sprintf( buf, "%X", size );
+    setenv( "filesize", buf );

      page.addr = (void *)addr;
      page.index = 0;



More information about the U-Boot mailing list