Introduction
This article describes SD card images with the .wic extension.
Traditionally, .img was used for SD card image extensions, but in relatively new environments, the .wic extension is being used in many cases. The latest SD card boot image of GSRD (Golden System Reference Design), a Linux reference for SoC FPGAs, is also in .wic format.
This article explains how to use SD card images in .wic format and how to edit them now that they are in .wic format.
1. How to write a .wic image
Writing an image to an SD card can be done in the same way as with a conventional .img format file. The same operation can be used to write an image to an SD card as with a conventional .img-format file. For details on how to write SD card images in each OS environment, please refer to the following article.
Reference:
How to create SD card image for SoC FPGA boot – Macnica Altera FPGA Insights
2. .wic image contents/writing result
When checking the contents of the SD card after writing is complete, the same partition structure can be seen as in the case of writing a conventional .img image. The user can use the created SD card image without having to be aware of the differences from the previous format.
The following shows the contents of the latest SD card image for GSRD that uses the .wic format (the partition structure is the same as before).
Figure 1. SD card image for GSRD - Stratix® 10 SoC / Agilex™ SoC (as of ver 21.1 pro)
Figure 2. SD Card Image for GSRD - Arria® 10 SoC (as of ver 21.1 pro)
3. Simple editing of .wic images (Linux environment only)
If the Yocto project is available in the Linux environment, you can use the wic command to perform simple editing operations such as replacing files in the .wic image.
3-1. Setup of the build environment for Yocto (executing oe-init-build-env)
When using the wic command, first execute the script for setting up the Yocto build environment.
$ source poky/oe-init-build-env <build directory>
The terminal image when executing the script is as follows.
Figure 3. Execution of the script for setting up the Yocto build environment
For more information on how to use the Yocto project, please refer to the official documentation and the following contents.
Reference:
Welcome to the Yocto Project Documentation - The Yocto Project® dev documentation
How to build Linux for Intel® SoC FPGA (edited by Yocto Poky) - Semiconductor Business -Macnica
3-2. Simple editing by executing the wic command
After the Yocto build environment has been successfully set up, the wic command can be used.
The wic command can be used to display, duplicate, and delete files contained in the wic image. Files in .wic format can be edited directly without the need to write the image to the SD card in advance. This is useful, for example, when you want to replace only the Linux device tree file with an existing .wic image.
Table 1. Simple editing operations available with the wic command
| Command | Meaning | Command line (How to specify arguments) |
| wic ls |
List (display) |
wic ls <image> wic ls <image>:<vfat or ext* partition> wic ls <image>:<vfat or ext* partition><path> wic ls < ;image>:<vfat or ext* partition><path> --native-sysroot <path> |
| wic cp |
Copy (duplicate) |
wic cp <src> <dest>:<partition> wic cp <src>:<partition> <dest> wic cp <src> <dest-image>:< ;partition><path> wic cp <src> <dest-image>:<partition><path> --native-sysroot <path> |
| wic rm |
Remove (delete) |
wic rm <src> <image>:<partition><path> wic rm <src> <image>:<partition><path> --native- sysroot <path> wic rm -r <image>:<partition><path> |
For more information, you can check the help display at "wic help". Detailed information on each command is also displayed by specifying the command followed by help, such as "wic help ls".
Figure 4. Help display for the wic command
Summary
We have introduced SD card images in .wic format. Even if the extension is changed to .wic, you can use it in the same way as the conventional .img format.
The .wic format was developed by the OpenEmbedded project and is included as a utility that can be used in the Yocto project. For more information, please refer to the following document.
Reference:
Common Tasks - Creating Partitioned Images Using Wic - The Yocto Project® dev documentation