Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for importing and exporting of "device" based images #234

Closed
erichelgeson opened this issue Sep 19, 2023 · 11 comments
Closed

Allow for importing and exporting of "device" based images #234

erichelgeson opened this issue Sep 19, 2023 · 11 comments

Comments

@erichelgeson
Copy link

erichelgeson commented Sep 19, 2023

A device based image is an image that is bit for bit what would be on a real device, eg, it has a partition map, SCSI driver, and HFS partition. The new SavedHD feature would make building disk images for devices such as the BlueSCSI easy as one could boot up and install or download software and export it right to their SD card. Many people struggle setting up these emulators on their computer.

I saw your patch to minivmac to allow ISO support, and have modified it to also allow booting a device image mihaip/minivmac#1. That should mean all emulators in this project could now handle these types of images.

I believe what we'd need to do next to allow this is to, on export, build a partition map, inject a scsi driver, and then append the hfs partition. @OneGeekArmy might be able to give us a few pointers as this is what his DiskJockey app does.

@that-ben
Copy link

Wow. +1 👍

@mihaip
Copy link
Owner

mihaip commented Sep 21, 2023

This would also be useful for #219. DingusPPC emulates a raw SCSI device, so the existing boot images do not work because they only have the HFS partition, they would also need to be wrapped with the partition map and SCSI driver.

https://diskjockey.onegeekarmy.eu/help/technicalinfo/ has some details as to how Disk Jockey operates, will need to track down the details of the partition map.

@OneGeekArmy
Copy link

I can probably help :)

@mihaip mihaip mentioned this issue Sep 23, 2023
58 tasks
@mihaip
Copy link
Owner

mihaip commented Sep 25, 2023

@erichelgeson I've merged in your PR and deployed it -- Mini vMac-based instances on infinitemac.org can now have .hda files dragged in and are able to mount them successfully.

@OneGeekArmy if you have any code or tips to share about formatting the partition table or embedding the driver I would appreciate it, otherwise I'll see what I can figure out.

mihaip added a commit that referenced this issue Sep 25, 2023
Picks up mihaip/minivmac#1 and also handles .hda extensions as disk images

For #234
@erichelgeson
Copy link
Author

Via my chat with @OneGeekArmy

This file contains a minimum header to get going with a single HFS partition, currently configured for a 1MB device image.

Things you need to change to make it dynamic:
Offset 0x0004: the 4 bytes are the size of the device in blocks, in big endian, including this minimum header (which is 96 blocks in size). So, for a 2048 blocks volume, the value here is 2144 (0x00000860).
Offset 0x060C: the 4 bytes here are the size of the HFS partition, in blocks, in big endian. In this minimum header, the value is 2048 (0x00000800).
Offset 0x0654: put in the same value you put in 0x060C

Your HFS partition must start at offset 0xC000 (49152). Note that an HFS partition starts with 2 empty blocks (full of zeroes) for an eventual boot block (a leftover from the floppy days).

The 0x4244 magic number identifying the HFS volume should therefore appear at offset 0xC400 (50176).

Minimum_header_3.dat.zip

@OneGeekArmy
Copy link

Wish I could help more right now but I'm a little tied up with some family issues. Sorry about this.

@erichelgeson
Copy link
Author

erichelgeson commented Sep 25, 2023

You can find datastructures in libhfs - https://github.com/JotaRandom/hfsutils/blob/master/libhfs/apple.h

I also made a ImHex Pattern if you want to poke around in a hex editor https://gist.github.com/erichelgeson/138ff8420917e99be57b6ce615f3400b

@mihaip
Copy link
Owner

mihaip commented Oct 1, 2023

I implemented an initial version of this - when exporting the "Saved HD" there is now an option to save it as a device image/.hda file:

image

Disk Jockey at least appears to be happy with the generated file, let me know if you're able to test it with BlueSCSI or other hardware.

mihaip added a commit that referenced this issue Oct 1, 2023
Required for allowing DingusPPC to boot from disk images. Also allows Saved
HD to be exported to an .hda file that can be used with BlueSCSI and other
software that expects a full device image.

The base device image header was generated by Disk Jockey 2.5.2.2 (it's the
first 0xc000 or 48 KB of an empty device image - the HFS image can be appended
to it and a couple of fields be updated).

Updates #219
Updates #234
@that-ben
Copy link

that-ben commented Oct 2, 2023

I own a SCSI2SD and a PiSCSI with a range of old 68K and PPC Macs, if any of those are required for testing. Mac models I own include a Mac Plus, a Mac IIci, a few beige PowerMacs, a few G3 and a MDD G4.

@mihaip
Copy link
Owner

mihaip commented Nov 13, 2023

Closing this out -- based on @RonsCompVids's demo this appears to work https://www.youtube.com/watch?v=2KCb7tuE9Io

@mihaip mihaip closed this as completed Nov 13, 2023
mihaip added a commit that referenced this issue Mar 25, 2024
The image added in bfc5b19 only had the
Apple SCSI 4.3 driver, but we also need the IDE driver for the Beige G3
and other machines with IDE built-in. Switch out the the device image
template to one with all the driver partitions that early Mac OS X would
generate (SCSI, IDE, etc.)

Updates #219
Updates #234
@joevt
Copy link

joevt commented Mar 25, 2024

This might be unrelated: macOS version of SheepShaver only connects the first HFS partition of a device image. Is it the same with Infinite Mac version? I suppose it doesn't matter if you never connect an image with multiple HFS partitions.

Regarding the partition map, you can use my dumpvols.sh script to dump that info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants