Scripts to make sd card images on Windows

All aspects of programming on the Commander X16.
Post Reply
totodilespy
Posts: 29
Joined: Sun Nov 01, 2020 7:23 pm
Location: United States

Scripts to make sd card images on Windows

Post 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!
Attachments
win_sd_copy.zip
(654 Bytes) Downloaded 90 times
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: Scripts to make sd card images on Windows

Post 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.
Post Reply