: Fix CDROM booting on sparc64
PATCH 1/1 : Fix CDROM booting on sparc64
This is a fix (finally!) for the infamous CDROM boot failures a lot of folks reported. A good log of the situation exists in Debian bug #261824
It's seen mostly on SunBlade1000, V280R, and V240 systems. But other kinds of boxes can see it too.
SILO crashes trying to open the CDROM device, it dies deep in the OBP code for openning the device. You can see this clearly with "ftrace" at the "ok" prompt which gives a forth backtrace any time an error occurs during OBP execution.
I tinkered around a little bit and it's easy to trigger the "Fast Data Access MMU Miss" error by hand at the OBP prompt by simply going (this example is on my SB1000):
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-dev
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-dev
Fast Data Access MMU Miss
(that /pci@... path can be determined by asking for the cdrom device
alias, using "devalias cdrom" or similar)
Ie. try to open the cdrom device twice causes the crash. This actually works on most systems! And that's why the failure doesn't occur everywhere.
But why in the world would that be happening during a CDROM boot?
When OBP loads up the first stage boot block of SILO, it opens the CDROM, reads the boot block, and then closes the CDROM device before executing the bootblock. This makes sense and that's why we get to the first stage loader just fine and the first stage loader can open the CDROM. Changing the above test case shows that this is how you're supposed to do things:
ok showstack
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-devfff141014 ok fff141014 close-dev
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-devfff141014 ok
('showstack' prints the contents of the forth stack, this way we can
see the file-descriptor return value from open-dev which we need to pass into close-dev, another way is to say '.' which prints out the top of stack and also pops it off, we could have also just said 'close-dev' all by itself since the file descriptor was on the forth stack already)
So, close it before you open it again, and everything is fine.
I went and studied the first stage boot code of SILO and it looked OK. It's written in assembly and it closes the device node just fine. But then I remembered we use a different piece of code for the first stage boot block on CDROM devices, it's written in C, and indeed it forgets to close the device. So when the second stage bootloader tries to open the CDROM we go splat.
The SILO fix is obvious, and is included below.
BTW, a good source of information on all of the OBP forth mumbo-jumbo can be found in the OpenBoot Command Reference Manual(s):
http://docs.sun.com/app/docs/doc/801-7042 http://docs.sun.com/app/docs/doc/805-4434 http://docs.sun.com/app/docs/doc/805-4436 http://docs.sun.com/app/docs/doc/806-1379-10
Enjoy :)
isofs.c renamed from isofs.c.~1~ +19 -0
@@ -101,6 +101,23 @@return 0 ; } +static void cd_fini (void ) +{ +switch (prom_vers) { +case PROM_V0 : + romvec->pv_v0devops.v0_devclose (fd); +break ; + +case PROM_V2 : +case PROM_V3 : + romvec->pv_v2devops.v2_dev_close (fd); +break ; + +case PROM_P1275 : +p1275_cmd ("close" ,1 , fd); +break ; + }; +}static int cd_read_block (unsigned long long offset,int size,void *data) {
@@ -445,6 +462,8 @@ sinfo->conf_part =1 ;strcpy (sinfo->conf_file, silo_conf); +cd_fini (); +prom_putchar (sinfo->id);return dest;
Quoted 5 lines · David Miller
This is a fix (finally!) for the infamous CDROM boot failures a lot of folks reported. A good log of the situation exists in Debian bug #261824
Quoted 7 lines
It's seen mostly on SunBlade1000, V280R, and V240 systems. But other kinds of boxes can see it too.
SILO crashes trying to open the CDROM device, it dies deep in the OBP code for openning the device. You can see this clearly with "ftrace" at the "ok" prompt which gives a forth backtrace any time an error occurs during OBP execution.
Great news, Dave! Thank you so much for looking into it.
Unfortunately, I don't have any hardware which exhibits this problem. I've prepared a tiny Debian installer iso image, which includes the patched silo, so that people can test it easily (just burn it to a CD and give it a spin). It is available as
http://www.wooyd.org/debian/silo/sparc-mini.iso
This directory also contains an updated Debian silo package.
Best regards,
Jurij Smakov [email protected]
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC
P.S. In case someone will decide to use this iso to actually install Debian, note that you need to pass the parameter ramdisk_size 000 to the installer, as the default ramdisk size appears to be insufficient.
From: Jurij Smakov <[email protected]>
Date: Sun, 18 Jun 2006 20:43:02 -0700 (PDT)
Quoted 10 lines
Great news, Dave! Thank you so much for looking into it.
Unfortunately, I don't have any hardware which exhibits this problem. I've prepared a tiny Debian installer iso image, which includes the patched silo, so that people can test it easily (just burn it to a CD and give it a spin). It is available as
http://www.wooyd.org/debian/silo/sparc-mini.iso
This directory also contains an updated Debian silo package.
This image boots on my SB1000 just fine, and that's the machine where I could reproduce the bug.
From: David Miller <[email protected]>
Date: Sun, 18 Jun 2006 20:57:12 -0700 (PDT)
Quoted 9 lines
From: Jurij Smakov <[email protected]>
Date: Sun, 18 Jun 2006 20:43:02 -0700 (PDT)Quoted 3 lines
http://www.wooyd.org/debian/silo/sparc-mini.iso
This directory also contains an updated Debian silo package.
This image boots on my SB1000 just fine, and that's the machine where I could reproduce the bug.
It boots into the kernel, but something is wrong with the ramdisk image:
RAMDISK: Compressed image found at block 0
RAMDISK: incomplete write (-28 != 32768) 9437184
VFS: Mounted root (ext2 filesystem). Attempt to access beyond end of device
ram0: rw=0, want504, limit432
Attempt to access beyond end of device
ram0: rw=0, want504, limit432
Warning: unable to open an initial console.
Quoted 11 lines · David Miller
It boots into the kernel, but something is wrong with the ramdisk image:
RAMDISK: Compressed image found at block 0
RAMDISK: incomplete write (-28 != 32768) 9437184
VFS: Mounted root (ext2 filesystem). Attempt to access beyond end of device
ram0: rw=0, want504, limit432
Attempt to access beyond end of device
ram0: rw=0, want504, limit432
Warning: unable to open an initial console.
Yeah, default ramdisk size is too small, just type
install ramdisk_size 000
at the 'boot:' prompt, that should do the trick.
Best regards,
Jurij Smakov [email protected]
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC