Re: Booting from g_file_storage in cdrom mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 9 Dec 2009, Andreas Kemnade wrote:

> On Sat, 5 Dec 2009 15:34:07 -0500 (EST)
> Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> > > The following patch solves the problem for the BIOS. I am able to load
> > > a kernel and an initrd with it correctly. Of course, it breaks everything
> > > else but it can be considered as a proof of concept. I can boot from my
> > > my g_file_storage cdrom drive with it on that thinkpad X31, on a mainboard with award
> > > bios (with an AMD Geode 1700+ on it) and also on an INTEL D945GCLF board.
> > 
> > No, this isn't a good approach.  A better fix would be to change the
> > byte mask in do_scsi_command()'s SC_READ_TOC case.  In the fourth
> > argument to check_command(), change (7<<6) to (0xf<<6).  It's hard to 
> > know whether this will fix the incorrect block size, though.
> > 
> The X31 BIOS issues the READ_TOC command several times,
> if it failes, no further attempts are made to boot from cd.

Reissuing the command several times doesn't help if each time the 
command contains invalid data.

> > But that's just a workaround.  The fact is, the BIOS is sending 
> > incorrect data.  The same is true with the 12-byte READ(10) command, 
> > although here g_file_storage accepts the bad length with only a 
> > warning.
> > 
> Of course, it is a workaround. 
> With my first patch, which should break everything which cares about
> the actual sector size (since I'm using 2048 only in the READ(x) command
>  but not in the READ_CAPACITY) but there seems to be no BIOS
> using the sector size from the READ_CAPACITY command. Linux does honor
> it and does not work with my patched g_file_storage.

Originally I wrote the cdrom additions using a 2048-byte block size.  
This turned out to be quite messy, and when I realized that the SCSI
spec allows a CD drive to use 512-byte blocks I gladly removed all the
support for larger sectors.

> I cleaned up the patch especially the sector size stuff and with that patch 
> I have installed ubuntu from a g_file_storage_gadget in cdrom mode successfully.

Of course you didn't bother to change do_write() and a bunch of other 
places.  Doing it properly means reintroducing all that mess, which I'm 
not anxious to do.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux