Virtualizing CD-ROM Drives with Raspberry Pi

Seeking Collaboration

A friend of mine is working on an exciting project to virtualize CD-ROM drives using a Raspberry Pi and they could use some help and advice from the community.

As optical drives become increasingly obsolete, they aim to create a custom Linux module that leverages a USB Gadget and possibly a mass storage device (in CD mode) to interface with a different CD-ROM device on a Raspberry Pi machine.

Project Goals

The main objective is to develop a way to expose a bin/cue file set (usually mixed-mode CDs) through a USB device. It currently works with the ISO format; however, many software programs in the 1990s included CD audio on the disc. 

My friend thinks there might be a few different approaches to getting to the goal:

Option One

Create a shim layer to pass SCSI commands for CD-ROM access to /dev/sr0 or another configurable target. This setup will allow the Raspberry Pi to manage CD-ROM devices through CDEMU, providing flexibility to handle various types of CDs, including Redbook audio and ISO files.

Option Two

Extending the f_mass_storage storage drivers to load bin/cue files and expose the CD audio tracks over USB. This approach would also require a way to playback audio (hopefully configurable, but requires ALSA support)

Option Three

Create a new bin/cue loading driver which can be compiled via DKMS, it would need to expose mixed mode disks through USB, including CD audio tracks, and requires a way to playback audio (hopefully configurable but definitely requires ALSA support)

Development Environment

They’re using a Raspberry Pi Zero 2 W and Raspberry Pi 3A+ for development, hoping to stick with Kernel 6.12.20 in the 32-bit configuration (currently the project supports Pi Zero W and Zero W 2). These devices should offer the necessary capabilities to support the custom module and ensure smooth operation.

Use Cases

  1. Virtualizing CD-ROM Drives for Older Applications: As optical drives become less reliable, virtualizing CD-ROM drives ensures that older applications can continue functioning without physical media.
  1. Installing Operating Systems: The custom module will also support OS installations, ensuring that CD-ROM drives can effectively perform OS boot functions.

Challenges

One of the main challenges they’ve encountered is mapping the existing kernel module to a physical device. The current module is designed to read ISO files, which limits its functionality.

To overcome this, they plan to include the existing module and extend its capabilities to handle SCSI commands for CD-ROM access.

Request for Assistance

If you have experience with USB Gadget, mass storage devices, or kernel module development, they would greatly appreciate your insights and suggestions. Specifically, they’re looking for advice on:

  • Extending the existing kernel module to handle SCSI commands for CD-ROM access.
  • Configuring the shim layer to pass commands to /dev/sr0 or another target.
  • Ensuring compatibility with Kernel 6.12.20.

Any tips, resources, or examples you can share would be invaluable. Thank you in advance for your support!

Feel free to share your thoughts or ask questions in the comments below or via the GitHub repository or on the USBODE Project Discord Server

Happy coding!


Posted

in

by

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.