New community dev tool uploaded: mkcard
Posted: Thu Jan 07, 2021 11:18 pm
mkcard
View File
Someone asked for help creating new sdcard images to be used with the emulator, so I banged around in vim for a while and dug around in DDG until I found enough hints around using sfdisk and mtools to create a suitable file w/o needing any root permissions. Due to limits of the FAT32 filesystem, the smallest image you can format with FAT32 is 32 MB.
$ mkcard -f scratch.img -s 32
Checking that no-one is using this disk right now ... OK
Disk scratch.img: 34 MiB, 35651584 bytes, 69632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Created a new DOS disklabel with disk identifier 0x9983f409.
scratch.img1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 33 MiB.
scratch.img2: Done.
New situation:
Disklabel type: dos
Disk identifier: 0x9983f409
Device Boot Start End Sectors Size Id Type
scratch.img1 2048 69631 67584 33M c W95 FAT32 (LBA)
The partition table has been altered.
Syncing disks.
You'll need the mtools and util-linux packages installed to use the script. Unfortunately, this limits this to be only be usable by Linux users (maybe Windows 10 users with WSL as well, don't know, don't have a Win10 setup to try with), I don't see sfdisk in the macOS ported versions of util-linux packages.
To make things even easier to use these files with mtools, create a ~/.mtoolsrc file with something like:
mtools_skip_check=1
drive s: file="~/scratch.img" exclusive partition=1
drive x: file="~/basic-progs.img" exclusive partition=1
drive y: file="~/demos.img" exclusive partition=1
And now you can use mcopy to copy files to your s:, x: or y: drives. Just make sure you UPPERCASE the filenames so x16emu will display the filenames as you expect them to look.
Submitter
Submitted
01/07/21
Category