Author Topic: How to "losetup" in windows? (a tool for filesystem in a binary image file)  (Read 7693 times)

0 Members and 1 Guest are viewing this topic.

Offline YansiTopic starter

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Hi guys,
for simplification of embeded designs with filesystems, is there any tool for windows capable of creating/mounting a binary image of  a filesystem in a single file (binary blob)?

Let us consider I have some design including a NAND FLASH device, which I have a filesystem on. The design doesn't have any interface for bulk data transfers like SDcard, USB or so to copy the data from. The only means for moving the initial data into the NAND is by using an in-circuit programmer/debugger.
It is quite easy to write a bunch of code as a "flashloader" for the NAND, so I am able to download a binary blob to the NAND with my JTAG programmer.

So is there any software tool for windows (like "losetup" command in linux) which would help me to build the binary blob of the filesystem (including putting in the desired files) which I would later upload to the NAND?

Maybe this question is too much specific or too much unspecific, so if I have not explained good enough, please tell me, I will try to fix it.
I am sure such tool should be quite helpful also for other people, if you know about one, please share.

Thank you for help.
Yan
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8413
What filesystem, specifically? Windows doesn't have "loopback" device support built into its driver model.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4193
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
You can probably binary dump a ramdisk.
Or you binary copy an actual SD card or thumb drive with USBit.
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6966
  • Country: nl
There's RomFs for windows and FileDisk, the latter is more like losetup. RomFs is a virtualization layer and filesystem in one and a very simple one at that, which is probably what you want.

http://www.acc.umu.se/~bosse/

Embedded Lua might be interesting, it has RomFs build in.
 

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1768
  • Country: se
Windows, since W8 at least, has some directly accessible support for a loop device.
This is limited to mounting .iso and .vhd(x).

While the former is just a CD-ROM image, the latter can contain partitions with any supported filesystem (NTFS and the various flavors of FAT).
As suggested by Jeroen3, you could also use a RAM disk (e.g. https://www.softperfect.com/products/ramdisk/).

Any disk can then be dumped to a file using dd (http://www.chrysocome.net/dd).

So, if you intend to use a Windows compatible FS (FATnn) you should be good to go with just a dd utility:
- Create you RAM or virtual disk, format as (e.g.) FAT
- Write your files
- Dump the disk with dd

If, instead, you want to format the image with a different FS (and that might be the case for easier access from your device) I would really try to use a Linux VM (any time I tried installable FS in windows I had a bad experience...); W8 and later include Hyper-V, which works pretty well also with Linux, so no extra virtualization SW is needed.
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline YansiTopic starter

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Hello,
sorry for the late reply, I have been busy. I appreciate your suggestion, will look into them.

I do not exactly need looped devices, just only the possibility to make a whole file system image stored in a file, which should be a binary image, so no vhd nor iso. Also I do not require the binary image file to be mounted in the OS, if there is just a win32 program that is capable of doing that on its own - that would be enough help!

The losetup was only the example, because as far as I know this linux command has the functionality I need and I didn't know what better example I should choose.

Thank you,
Yan
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28013
  • Country: nl
    • NCT Developments
There is a Windows tool for reading/writing SD card images. Google for something like that; I have used something like that several years ago but I cannot find it.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline eas

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: us
    • Tech Obsessed
    So I/we better understand your requirements and application, this is what I think you are saying:

    • You'd like to streamline your Windows-hosted embedded development work.
    • The embedded platform you are developing for has a (read only?) filesystem on a nand device.
    • It is easy for you to make changes by writing an updated filesystem image to the nand by writing a binary blob.
    • You are looking for an easier way to update the binary blob.
    • To that end, you'd like to mount a file containing the binary blob as the windows equivalent of a block device.
    • You'd like to mount that block device as a filesystem so you can read and write to it using standard windows filesystem tools/calls


    Have I got that all right? If so, and if the filesystem you are using is something that windows already supports (FAT,FAT32,VFAT,exFAT, NTFS), then really the key piece here is using a monolithic image file as its own block I/O device. I don't know, but I suspect that any tool that lets you read/write mount a disk image on Windows should do the job, provided it supports the simplest possible type of image file format, a monolithic file. I think .IMG files fit this criteria.
 

Offline YansiTopic starter

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Yes, exactly right.  But what tool can mount tha binary image? I don't know about any, thats why I am asking in the first place  :)

If you know about one, please  tell us!

Thanks
Yan
 

Offline eas

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: us
    • Tech Obsessed
Google for "windows mount disk img" turned up a bunch of options, including this one, which claims to read and write IMG files:  http://www.osforensics.com/tools/mount-disk-images.html

I've never used it, so I can't vouch for it.
 

Offline YansiTopic starter

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Seems definitely interesting, worth a try maybe, but not sure if I can create images with it. The tool seems only to be able to read existing and investigate them.  :-//
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6966
  • Country: nl
Filedisk and the ramdisk approach will do what you want for FAT32, cygwin has genromfs I think (for if you don't want to implement fat32 on the micro).
 

Offline eas

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: us
    • Tech Obsessed
Seems definitely interesting, worth a try maybe, but not sure if I can create images with it. The tool seems only to be able to read existing and investigate them.  :-//

An image is just a binary file, so you just need a file with the proper size. Once you have the file, mount it, then create a partition table, then format it with your file system and zero it out.

If you already have an image from linux or some other source, copy it over to windows, add the .IMG file extension, and try mounting it. If you don't, one option is to install this port of dd. Then use it to copy from its built in emulation of /dev/zero to a new file. Use the count= option to limit to the size you need (note that it interprets the value you set as blocks, not bytes), otherwise it will keep going until it has filled the disk.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf