作者:付汉杰 hankf@amd.com
使用“wic ls”命令,ls”查看wic文件里的分区和文件。
使用“wic cp”命令,在Linux Host和wic文件的分区之间,复制文件。
使用“wic rm”删除wic文件里的文件。
wic是OpenEmbedded推出的新的制作带分区的SD卡映像的工具。起始原因,可参考Yocto Bug 3847。
使用命令“petalinux-package --wic”, 可以让PetaLinux产生wic文件。wic文件一般比较大。如果想查看、复制其中的文件,也是可以的。
执行下列命令,导入Yocto环境。
source ./components/yocto/environment-setup-cortexa72-cortexa53-xilinx-linux buildsource ./components/yocto/layers/core/oe-init-build-env
详细log如下:
hankf@XSZGS4:xilinx-vck190-base-trd$ source ./components/yocto/environment-setup-cortexa72-cortexa53-xilinx-linux build
Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'
but please check why this was set in the first place and that it's safe to unset.
The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set.For more references see:
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80
http://xahlee.info/UnixResource_dir/_/ldpath.html
hankf@XSZGS4:xilinx-vck190-base-trd$
hankf@XSZGS4:xilinx-vck190-base-trd$ source ./components/yocto/layers/core/oe-init-build-env
### Shell environment set up for builds. ###
You can now run 'bitbake
最常见的使用,是使用“wic ls”查看wic文件里的分区和文件。
hankf@XSZGS4:linux$ wic ls petalinux-sdimage.wicNum Start End Size Fstype 1 4096 2147487743 2147483648 fat32 2 2147487744 6442455039 4294967296 ext4hankf@XSZGS4:linux$ wic ls petalinux-sdimage.wic:1Volume in drive : is boot Volume Serial Number is AE46-841BDirectory for ::/BOOT BIN 12037984 2022-08-26 1:47 IMAGE 22276608 2022-08-26 1:47 ImageBINARY~1 XCL 21830648 2022-08-26 1:47 binary_container_1.xclbinboot scr 2777 2022-08-26 1:47 RAMDIS~1 U-B 5238724 2022-08-26 1:47 ramdisk.cpio.gz.u-boot 5 files 61 386 741 bytes 2 081 878 016 bytes free
最重要的命令是下面两个。它们可以在Linux Host和wic文件内部的分区之间,复制文件。dest-image是wic的文件名,partition是分区编号。
wic cp
比如命令“wic cp ./cp2wicpartion2 ./petalinux-sdimage.wic:2/media/”,把Linux Host当前目录下的文件cp2wicpartion2,复制wic文件中的分区2的media目录中。命令“wic cp ./petalinux-sdimage.wic:2/media/cp2wicpartion2 ./”则把wic文件中的分区2的media目录中的文件cp2wicpartion2,复制到Linux Host的当前目录下。
hankf@XSZGS4:linux$ wic ls ./petalinux-sdimage.wic:2/media/ debugfs 1.44.1 (24-Mar-2018) 1905 40755 (2) 0 0 4096 9-Mar-2018 20:34 . 2 40755 (2) 0 0 4096 26-Aug-2022 09:47 .. hankf@XSZGS4:linux$ touch ./cp2wicpartion2 hankf@XSZGS4:linux$ wic cp ./cp2wicpartion2 ./petalinux-sdimage.wic:2/media/ hankf@XSZGS4:linux$ wic ls ./petalinux-sdimage.wic:2/media/ debugfs 1.44.1 (24-Mar-2018) 1905 40755 (2) 0 0 4096 9-Mar-2018 20:34 . 2 40755 (2) 0 0 4096 26-Aug-2022 09:47 .. 60501 100664 (1) 0 0 0 30-Aug-2022 18:16 cp2wicpartion2 hankf@XSZGS4:linux$ rm cp2wicpartion2 hankf@XSZGS4:linux$ wic cp ./petalinux-sdimage.wic:2/media/cp2wicpartion2 ./ hankf@XSZGS4:linux$ ls -l cp2wicpartion2 -rw-rw-r-- 1 hankf hankf 0 Aug 30 18:16 cp2wicpartion2
使用命令“wic rm -r :
hankf@XSZGS4:linux$ wic ls ./petalinux-sdimage.wic:2/media/ debugfs 1.44.1 (24-Mar-2018) 1905 40755 (2) 0 0 4096 9-Mar-2018 20:34 . 2 40755 (2) 0 0 4096 26-Aug-2022 09:47 .. 60501 100664 (1) 0 0 0 30-Aug-2022 18:16 cp2wicpartion2 hankf@XSZGS4:linux$ wic rm ./petalinux-sdimage.wic:2/media/cp2wicpartion2 hankf@XSZGS4:linux$ wic ls ./petalinux-sdimage.wic:2/media/ debugfs 1.44.1 (24-Mar-2018) 1905 40755 (2) 0 0 4096 9-Mar-2018 20:34 . 2 40755 (2) 0 0 4096 26-Aug-2022 09:47 ..
更多详细信息,可以使用“wic help”查看wic的的帮助信息。
hankf@XSZGS4:linux$ wic help Creates a customized OpenEmbedded image. Usage: wic [--version] wic help [COMMAND or TOPIC] wic COMMAND [ARGS] usage 1: Returns the current version of Wic usage 2: Returns detailed help for a COMMAND or TOPIC usage 3: Executes COMMAND COMMAND: list - List available canned images and source plugins ls - List contents of partitioned image or partition rm - Remove files or directories from the vfat or ext* partitions help - Show help for a wic COMMAND or TOPIC write - Write an image to a device cp - Copy files and directories to the vfat or ext* partitions create - Create a new OpenEmbedded image TOPIC: overview - Presents an overall overview of Wic plugins - Presents an overview and API for Wic plugins kickstart - Presents a Wic kicstart file reference Examples: $ wic --version Returns the current version of Wic ...............