Page 1 of 1

Scripts to make sd card images on Windows

Posted: Mon May 06, 2024 1:14 am
by totodilespy
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:

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
exit

The 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!

Re: Scripts to make sd card images on Windows

Posted: Mon May 06, 2024 2:38 am
by TomXP411
You can also create VHD images in Disk Management.

  • Start+X
  • Disk Management
  • Action -> Create VHD
Turns out, the VHD format is compatible with the X16 Emu's SD card images, since VHDs put the metadata at the tail of the image file. Back before HostFS was reliable, that's how I created all the images I used with the emulator.

We used to have a tutorial here, but it seems that the forum software silently nuked all the posts imported from the old forum.