Wic image manipulation allows you to shorten turnaround time during image development. For example, you can use Wic to delete the kernel partition of a Wic image and then insert a newly built kernel. This saves you time from having to rebuild the entire image each time you modify the kernel.
mtools
package installed.
The following example examines the contents of the Wic image, deletes the existing kernel, and then inserts a new kernel:
List the Partitions:
Use the wic ls
command to list
all the partitions in the Wic image:
$ wic ls tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic Num Start End Size Fstype 1 1048576 25041919 23993344 fat16 2 25165824 72157183 46991360 ext4
The previous output shows two partitions in the
core-image-minimal-qemux86.wic
image.
Examine a Particular Partition:
Use the wic ls
command again
but in a different form to examine a particular
partition.
$ wic help command
For example, the following command shows you
the various ways to use the
wic ls
command:
$ wic help ls
The following command shows what is in Partition one:
$ wic ls tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1 Volume in drive : is boot Volume Serial Number is E894-1809 Directory for ::/ libcom32 c32 186500 2017-10-09 16:06 libutil c32 24148 2017-10-09 16:06 syslinux cfg 220 2017-10-09 16:06 vesamenu c32 27104 2017-10-09 16:06 vmlinuz 6904608 2017-10-09 16:06 5 files 7 142 580 bytes 16 582 656 bytes free
The previous output shows five files, with the
vmlinuz
being the kernel.
~/.mtoolsrc
file and
be sure to have the line “mtools_skip_check=1“
in the file.
Then, run the Wic command again:
ERROR: _exec_cmd: /usr/bin/mdir -i /tmp/wic-parttfokuwra ::/ returned '1' instead of 0 output: Total number of sectors (47824) not a multiple of sectors per track (32)! Add mtools_skip_check=1 to your .mtoolsrc file to skip this test
Remove the Old Kernel:
Use the wic rm
command to
remove the vmlinuz
file
(kernel):
$ wic rm tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1/vmlinuz
Add In the New Kernel:
Use the wic cp
command to
add the updated kernel to the Wic image.
Depending on how you built your kernel, it could
be in different places.
If you used devtool
and
an SDK to build your kernel, it resides in the
tmp/work
directory of the
extensible SDK.
If you used make
to build the
kernel, the kernel will be in the
workspace/sources
area.
The following example assumes
devtool
was used to build
the kernel:
cp ~/poky_sdk/tmp/work/qemux86-poky-linux/linux-yocto/4.12.12+git999-r0/linux-yocto-4.12.12+git999/arch/x86/boot/bzImage \ ~/poky/build/tmp/deploy/images/qemux86/core-image-minimal-qemux86.wic:1/vmlinuz
Once the new kernel is added back into the image,
you can use the dd
command or
bmaptool
to flash your wic image onto an SD card
or USB stick and test your target.
bmaptool
is
generally 10 to 20 times faster than using
dd
.