Finger info for marco@icculus.org...


TheC64 - Formatting USB drive under OpenBSD

My brother bought TheC64 by Retro Games Ltd. last year.

Trying most USB flash drives we had lying around, it turned out that most don't work at all out of the box.
This is because the device expects the flash drive to have a Master Boot Record with the first partition (explicitly) being FAT32.

Luckily, fdisk can handle it all. Check xconsole which disk number your
flash drive is (mine was sd1).

First, let's create a new MBR partition table:

> M73# fdisk -i sd1
> Do you wish to write new MBR and partition table? [n] y
> Writing MBR at offset 0.

Then let's use fdisk to modify:

> M73# fdisk -e sd1
> Enter 'help' for information
> sd1: 1>

Use the 'print' command to see which partitions are in use.
We need all partitions to be gone. So if you see any paritions that are
not marked 'unused', delete them with 'edit X':

> sd1: 1> print
> Disk: sd1 geometry: 1937/255/63 [31129600 Sectors]
> Offset: 0 Signature: 0xAA55
> Starting Ending LBA Info:
> #: id C H S - C H S [ start: size ]
> ------------------------------------------------------------------------------
> 0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> *3: A6 0 1 2 - 1936 254 63 [ 64: 31117841 ] OpenBSD
> sd1: 1> edit 3

Then you'll be asked what you want to edit the partition to be.
Set it to '0' to disable the partition entirely.

The 'print' command should now give you the desired result:

> sd1*: 1> print
> Disk: sd1 geometry: 1937/255/63 [31129600 Sectors]
> Offset: 0 Signature: 0xAA55
> Starting Ending LBA Info:
> #: id C H S - C H S [ start: size ]
> ----------------------------------------------------------------------------
> 0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused

And now we can mark partition 0 as FAT32:

> sd1*: 1> edit 0

Which will ask us, what the type should be, which we set to '0B' (FAT32):
> Partition id ('0' to disable) [01 - FF]: [0] (? for help) 0B

> Do you wish to edit in CHS mode? [n] n

> Partition offset [0 - 31129599]: [0] 0

> Partition size [1 - 31129600]: [1] *

And a final print should give us the following result:

> sd1*: 1> print
> Disk: sd1 geometry: 1937/255/63 [31129600 Sectors]
> Offset: 0 Signature: 0xAA55
> Starting Ending LBA Info:
> #: id C H S - C H S [ start: size ]
> ----------------------------------------------------------------------------
> 0: 0B 0 0 1 - 1937 185 40 [ 0: 31129600 ] FAT32
> 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
> 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused

Now use the 'write' command to write your changes, then 'quit'. You're done!

-- Marco

When this .plan was written: 2020-07-23 06:23:21
.plan archives for this user are here (RSS here).
Powered by IcculusFinger v2.1.27
Stick it in the camel and go.