Difference between revisions of "Creating an eMMC image using Storage Image Creator"

From SEGGER Wiki
Jump to: navigation, search
Line 21: Line 21:
 
[[File:SIC_File2Contents.png|thumb|center|upright=2.0|alt=Screenshot of the contents of the file stored in the subdirectory.|Contents of <code>File2.txt]</code>]]
 
[[File:SIC_File2Contents.png|thumb|center|upright=2.0|alt=Screenshot of the contents of the file stored in the subdirectory.|Contents of <code>File2.txt]</code>]]
   
In the next step, we start the Storage Image Creator utility either by double-clicking on the name of the executable or by selecting the executable and pressing the Enter key. At startup, the utility displays some general information such as the emFile version and the build date followed by a prompt that accepts commands from the user. The command is executed when the Enter key is pressed.
+
In the next step, we start the Storage Image Creator utility either by double-clicking on the name of the executable or by selecting the executable and pressing the Enter key. At startup, the utility displays some general information such as the emFile version and the build date followed by a prompt that accepts commands from the user. Similarly to a Windows command line prompt, the text of the command can be typed-in and edited. The command is executed only when the Enter key is pressed. The name of the commands is case insensitive. This means that <code>Help</code> and <code>help</code> are interpreted by the Storage Image Creator as the same command.
   
 
[[File:SIC_Start.png|thumb|center|upright=2.0|alt=Screenshot of the startup information of the Storage Image Creator.|Startup information]]
 
[[File:SIC_Start.png|thumb|center|upright=2.0|alt=Screenshot of the startup information of the Storage Image Creator.|Startup information]]

Revision as of 14:00, 24 November 2023

The Storage Image Creator is a command line utility that can be used to build a single file containing a complete FAT file system including directory structure and files ready to be stored and used without preparation apart from mounting the file system.

The utility operates by executing text commands that perform different operations related to the data stored on the image file such as formatting the storage and copying of files from the file system of the host PC to the file system stored in the image file. The utility can execute the commands either interactively by typing them in the same way as in a command line (interactive mode) or by reading them from a text file (batch mode). A description of all the supported commands can be found in the emFile user manual.

The interactive mode is entered if the utility is started without arguments. The utility enters batch mode if it is started with the file containing the commands to be executed as argument.

The following example shows how to create a FAT file system image for an eMMC device with the capacity of about 8 GB that contains two files an one directory. The example uses the interactive mode for the creation of the file system image. However, the same file system image can be created by saving the commands in a separate text file and by executing them in the batch mode.

We start by creating a folder on the host PC that will serve as work area. For convenience, we make a copy of the Storage Image Creator utility to this folder. This is possible because the Storage Image Creator is a standalone application that does not require any installation and that depends only on the standard system libraries.

Screenshot of the work folder containing the Storage Image Creator executable.
Initial work folder contents

Next, we create the file and directory structure that has to be present on the eMMC device mounted on the target hardware. For this purpose we create a folder called RootDir that contains all the files and directories that will be present in the root directory of the FAT file system stored on the eMMC device. The root directory contains a folder named SubDir and a file named File1.txt. The SubDir folder contains a file named File2.txt.

Screenshot of the root directory of the target file system.
Target root directory

We store some text data in the created files so that we can check later if the files were correctly copied to the image.

Screenshot of the contents of the file stored in the root directory.
Contents of File1.txt]
Screenshot of the contents of the file stored in the subdirectory.
Contents of File2.txt]

In the next step, we start the Storage Image Creator utility either by double-clicking on the name of the executable or by selecting the executable and pressing the Enter key. At startup, the utility displays some general information such as the emFile version and the build date followed by a prompt that accepts commands from the user. Similarly to a Windows command line prompt, the text of the command can be typed-in and edited. The command is executed only when the Enter key is pressed. The name of the commands is case insensitive. This means that Help and help are interpreted by the Storage Image Creator as the same command.

Screenshot of the startup information of the Storage Image Creator.
Startup information

The list of supported commands and a short description of them can be displayed by executing either the Help command or by pressing the ? key.

Screenshot of the help information of the Storage Image Creator.
Brief command information
Screenshot of the CreateImage command that configures the image to be created.
Image configuration
Screenshot of the ShowImageInfo command that shows information about the image to be created.
Image information
Screenshot of the Init command that initializes the image.
Image initialization
Screenshot of the Format command that formats the FAT file system stored in the image.
File system formatting
Screenshot of the work folder that contains the created image file.
Work folder with image file
Screenshot of the DiskInfo command that shows information about how the file system is formatted.
File system information
Screenshot of the AddFolder command that copies files and directories to the root directory of the file system stored in the image.
Adding folder contents
Screenshot of the Dir command that shows the contents of the root directory of the file system stored in the image.
Root directory contents
Screenshot of the Type command that shows the contents of the file stored in the root directory.
Contents of File1.txt
Screenshot of the Type command that shows the contents of the file stored in the subdirectory.
Contents of File2.txt
Screenshot of the CheckDisk command that verifies the consistency of the file system stored in the image.
Checking consistency of file system
Screenshot of the ExportImage command that saves the contents of all valid logical sectors to a separate file in Motorola S-record format.
Exporting valid logical sectors
Screenshot of the work folder that shows the file exported in Motorola S-record format.
Work folder with exported file