Scripts to make sd card images on Windows
Posted: Mon May 06, 2024 1:14 am
Hello,
I've been struggling with this for a while as my Win10 laptop doesn't support virtualization in the BIOS and so I can't use WSL. I finally figured out a combination of tools to create sd card images for use with the emulator to get more accurate behavior.
There are three files in the zip folder. This one is a cmd script to mount/attach the image and then copy all files from a subdirectory called mnt (of course you can change it) and then converts the image afterwards:
The other two are inputs to be redirected into diskpart:
This does require qemu-convert to convert the .vhdx images windows likes to raw .img file but it is pretty easy to install. hope this helps somebody!
I've been struggling with this for a while as my Win10 laptop doesn't support virtualization in the BIOS and so I can't use WSL. I finally figured out a combination of tools to create sd card images for use with the emulator to get more accurate behavior.
There are three files in the zip folder. This one is a cmd script to mount/attach the image and then copy all files from a subdirectory called mnt (of course you can change it) and then converts the image afterwards:
del C:\x16image.vhdx diskpart < scripts/diskpart_mount.in copy mnt/* -r V:\ diskpart < scripts/diskpart_detach.in qemu-img convert -f vhdx "C:\x16image.vhdx" -O raw x16image.img
The other two are inputs to be redirected into diskpart:
create vdisk file=c:\x16image.vhdx maximum=50 type=fixed attach vdisk create partition primary format FS=FAT32 quick label=vhdx assign letter=v exitThe second:
select vdisk file=C:\x16image.vhdx detach vdisk exit
This does require qemu-convert to convert the .vhdx images windows likes to raw .img file but it is pretty easy to install. hope this helps somebody!