16 January 2013, 21:05 | #1 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
SCSI CD-ROM drive emulation
After trying to install various versions of NetBSD, it occurred to me that being able to emulate a SCSI CD-ROM drive would be quite helpful. Then rather than having to create an FFS partition and copy the installation sets to it, I could instead point WinUAE to the appropriate ISO image. The OS installer would read the files from there.
I'd only need emulation of single-session 2048 bytes/sector discs, no audio tracks or other sector types. Currently I can add an ISO image as a hardfile connected to the emulated A2091/A3000 SCSI controller, set block size to 2048 and make it read-only. But then it appears as a hard disk (device type 0) to the Amiga. The CD-ROM detection code in NetBSD, Linux etc. probably only works with CD-ROM drives (type 5). It might be enough to simply add an option to make the emulated drive report itself as type 5. Or would support need to be added for e.g. returning fake TOC data etc.? |
17 January 2013, 15:20 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
I am going to do it correctly soon, using internal CD mount system which already has CD SCSI emulator, used by uaescsi.device.
Mounting CD image using HD SCSI emulation won't work if program uses any CD-only commands or assumes CD-like inquiry results etc.. |
17 January 2013, 18:26 | #3 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
winuae.zip updated with scsi cd support.
Add something like following in config file: uaehf1=cd,ro,:,0,0,0,0,0,,scsi1 (only important values are "cd" and "scsix", others are there just for config file compatibility) Now normal WinUAE CD GUI can be used to select image or real CD. No GUI harddrives panel support (probably not safe to edit via GUI and saving config is not supported either. EDIT: saving seems to work but you need to manually remove matching hardfile2 line). Most likely does not work if program uses or expects scsi connect/disconnections while another device is processing previous command. Also whole emulation stops while command is executing (for example using real CD and it is spinning up), command processing will be moved to separate thread in future. EDIT: ATAPI CD is also coming soon. Last edited by Toni Wilen; 17 January 2013 at 21:18. |
18 January 2013, 15:22 | #4 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
That's great, I've currently got NetBSD 6.0.1 installing from CD-ROM. There were a couple of error messages relating to command opcode 0x43 (READ TOC/PMA/ATIP) but those were non-fatal to the installer.
Update: the installer seemed to complete with no problems. There was this line in the log just before I quit WinUAE; no idea whether or not it's CD-ROM related: BUG unit 0 close: opencnt=0! Last edited by mark_k; 18 January 2013 at 18:29. |
18 January 2013, 20:49 | #5 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
What is the exact CD image you used? 0x43 error is confusing because basic read toc is emulated and I don't see how it can cause this error.
|
18 January 2013, 20:53 | #6 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
ftp://ftp.netbsd.org/pub/NetBSD/iso/....0.1-amiga.iso
Update: I've attached the config file I used in case that helps. Last edited by mark_k; 18 January 2013 at 23:10. |
19 January 2013, 12:25 | #7 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
Sorry, installation is too boring, I am not going to bother with preparing the HDF for installation. Please create one, thanks
|
19 January 2013, 14:04 | #8 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
I already did! Get the HDF from this posting. When the installer asks for installation medium (CD/disk/FTP etc.) select CD-ROM.
|
19 January 2013, 17:14 | #9 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
You didn't say it was real installation image
READ TOC fixed (returned error if allocated buffer was too small, it should simply truncate data in this situation) Some kind of CD selection GUI added, quite minimal.. ATAPI does not yet work. btw, is this image also supposed to work in IDE emulation mode? It reads totally different HDF blocks (0,1,2,3,32 and then block numbers around 1000) after "root file system type: ffs" appears, also it fails to find init. Same image in SCSI emulation mode works (0,1,2,3,32 and then block numbers 4200000-something) |
19 January 2013, 17:58 | #10 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
With an emulated A4000/030 using the NetBSD_install_A4000.uae attached here it doesn't seem to find the root device by itself. You can enter wd0b then press return three times, then select a keymap and the installer continues. With an emulated A4000/040 however (config attached below), it hangs after printing
init: trying /sbin/init Maybe some 68040 MMU bug is responsible for the difference? If you want to proceed with the installation without an emulated CD drive, you can download a ~162MB archive of an HDF with the NetBSD installation files on an FFS partition. See this posting for that. |
19 January 2013, 19:10 | #11 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
Ok, root is different (wd0a vs wd0b) but it never asks for root device. It just keeps asking for path to init.
(I noticed this 040 issue days ago, this is another useless test case, it does not hang, it just runs some long piece of code forever, probably because it got bad parameters) |
19 January 2013, 21:25 | #12 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
ATAPI CD implemented. Only tested with idefix, it seems to send and receive correct looking ATAPI packets..
|
20 January 2013, 15:53 | #13 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
I couldn't get the NetBSD installer to see the CD-ROM drive with emulated A4000/030, IDE HD and CD drives. I think it is supposed to work with ATAPI CD-ROM connected to A4000 IDE connector. Config attached.
Edit: Never mind, I did get it to detect the CD drive when connected to IDE0 (with HD connected to A2091). I'll do some more testing. Update: With the CD drive on IDE0 (and HD on A2091 SCSI) the NetBSD installer does detect the CD drive and I can select it, but the installer reports mount_cd9660: /dev/cd0a on /mnt2: Invalid argument Cannot mount CD-ROM drive. Aborting. In the WinUAE log output there are a number of ATAPI packet command lines, and also a couple of CDEMU: unsupported scsi command 0x35 Use the attached NetBSD_install_A4000_A2091_IDE_CD.uae config to test. Note that at least with the Kickstart 3.1 ROM, there's a long wait at a black screen while Kickstart waits for a not-connected IDE HD. Last edited by mark_k; 20 January 2013 at 16:16. |
20 January 2013, 17:21 | #14 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
I still get same init path error. Difficult to do any tests with IDE HD and CD.
EDIT: 0x35 is syncronize cache, it shouldn't cause any problems. |
20 January 2013, 17:26 | #15 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
Did you replace the NetSBD HDF with a fresh copy (i.e. unpack it again from the archive I uploaded)? Because it seems that if you abort the installer part-way through, it can leave the HDF in a state where it doesn't boot properly next time. That may be why you're seeing the error message. It's best to start off with a fresh HDF each time.
For me, booting with the NetBSD_install_A4000_A2091_IDE_CD.uae config it goes straight to the keymap selection prompt. I just tried again and this time it did properly mount the CD and installation began. But there was an error after extracting a few files. Last edited by mark_k; 20 January 2013 at 17:41. |
20 January 2013, 18:49 | #16 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
Using the latest winuae.zip (2013-01-20 17:09) I loaded the NetBSD_install_A4000_A2091_IDE_CD config. On booting it seems to hang at a black screen. (Either that or the initial delay while Kickstart waits for IDE drives is much longer than normal.)
Then I changed the CD drive from IDE0 to SCSI2 by double-clicking its entry in the Hard drives list to open the CD Settings window, changing to SCSI 2 and clicked Add CD Drive. Then click Reset. On booting the NetBSD installer detects the SCSI CD drive but thinks it's empty, printing: Code:
cd0(atzsc0:0:2:0): Check Condition on CDB: 0x00 00 00 00 00 00 SENSE KEY: Not Ready ASC/ASCQ: Medium Not Present wine: Unhandled page fault on read access to 0x359edd6c at address 0x82af07 (thread 0009), starting debugger... Unhandled exception: page fault on read access to 0x359edd6c in 32-bit code (0x0082af07). |
20 January 2013, 20:32 | #17 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
Don't try to change device types on the fly, it won't work. It isn't even supposed to work.
winuae.zip updated, ATAPI signature/reset should now work better, at least netbsd detects both HD and CD now. I get same extraction error, it may be caused by MMU emulation bug. (I remember similar exctraction errors when testing debian long long time ago). SCSI vs IDE can have different memory layout and SCSI is DMA, IDE isn't which can explain the difference. Unpacking the image fixed the init problem, interestingly same "ide-broken" image booted fine when using SCSI. Does it have different files for different hardware? |
20 January 2013, 21:04 | #18 | |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
Quote:
mount -o noatime,ro,loop,ufstype=44bsd -t ufs miniroot.fs /media/test With the latest winuae.exe I still get the "Cannot mount CD-ROM drive. Aborting." message some of the time. Other times it does mount okay. If the install sets are on the HDF (in an Amiga FFS partition), the installer does work then. So the extraction error is not specifically IDE-related. Could it be due to successive read-IDE1, write-IDE0 accesses messing up somehow, when trying to install from IDE CD? (When the installer tries to mount the FFS partition it also initially says it cannot mount it. But it actually did and you can continue with installation by specifying the path /mnt2. I think I mentioned that in the NetBSD thread.) Last edited by mark_k; 20 January 2013 at 21:10. |
|
20 January 2013, 21:14 | #19 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,540
|
I left part of IDE debugging enabled in latest version, could you check if there are interesting differences?
|
20 January 2013, 21:52 | #20 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,346
|
I got logs for booting the NetBSD installer and starting installation from files on the HD (exiting WinUAE after a couple of screens-worth of files extracted), and installing from CD (exiting WinUAE shortly after the first extraction error message appeared).
Nothing really stood out for me, as you said this might be a symptom of an MMU-related bug. But the logs are attached if you want to look at them. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CyberstormPPC SCSI issue with CD-Rom Drive | nobodyii | support.Hardware | 23 | 08 October 2014 14:47 |
For Sale: Cyberstorm Mk2 060 + 128MB RAM + SCSI II Module + 18GB SCSI Drive | Zetr0 | MarketPlace | 9 | 27 June 2012 22:41 |
Can I use a wide scsi drive on a narrow scsi bus? | gulliver | support.Hardware | 4 | 17 September 2010 04:50 |
SCSI CD ROM Drive | Washac | support.Hardware | 2 | 18 February 2010 19:19 |
Wanted - External SCSI CD ROM Drive | fitzsteve | MarketPlace | 0 | 01 December 2009 11:50 |
|
|