Bug 179289 - Sun Enterprise 450 fails to boot from install CD, "can't load 'kernel'"
Summary: Sun Enterprise 450 fails to boot from install CD, "can't load 'kernel'"
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: sparc64 (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-sparc64 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-04 08:20 UTC by Sergey
Modified: 2013-06-27 10:25 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey 2013-06-04 08:20:00 UTC
Bootstrap loader fails to load kernel.

For example, on Sun Enterprise 450 bootpath for CD-ROM is
"/pci@2f/scsi@2/disk@6,0:f" and does not contain the substring "cdrom".

Fix: 

sys/boot/sparc64/loader/main.c, line 867 (for revision 234898).

Please, remove the search "strstr(bootpath, "cdrom")".
Comment 1 dfilter service freebsd_committer freebsd_triage 2013-06-10 00:50:38 UTC
Author: marius
Date: Sun Jun  9 23:50:30 2013
New Revision: 251589
URL: http://svnweb.freebsd.org/changeset/base/251589

Log:
  - The method introduced as part of r234898 for not altering the boot path
    when booting from ZFS turned out to also cause the boot path not being
    adjusted if booting from CD-ROM with firmware versions that do not employ
    the "cdrom" alias in that case. So shuffle the code around instead in order
    to achieve the original intent. Ideally, we shouldn't fiddle with the boot
    path when booting from UFS on a disk either; unfortunately, there doesn't
    seem to be an universal way of telling disks and CD-ROMs apart, though. [1]
  - Use NULL instead of 0 for pointers.
  
  PR:		179289
  MFC after:	1 week

Modified:
  head/sys/boot/sparc64/loader/main.c

Modified: head/sys/boot/sparc64/loader/main.c
==============================================================================
--- head/sys/boot/sparc64/loader/main.c	Sun Jun  9 23:34:26 2013	(r251588)
+++ head/sys/boot/sparc64/loader/main.c	Sun Jun  9 23:50:30 2013	(r251589)
@@ -160,17 +160,19 @@ struct devsw *devsw[] = {
 #ifdef LOADER_ZFS_SUPPORT
 	&zfs_dev,
 #endif
-	0
+	NULL
 };
+
 struct arch_switch archsw;
 
 static struct file_format sparc64_elf = {
 	__elfN(loadfile),
 	__elfN(exec)
 };
+
 struct file_format *file_formats[] = {
 	&sparc64_elf,
-	0
+	NULL
 };
 
 struct fs_ops *file_system[] = {
@@ -198,19 +200,20 @@ struct fs_ops *file_system[] = {
 #ifdef LOADER_TFTP_SUPPORT
 	&tftp_fsops,
 #endif
-	0
+	NULL
 };
+
 struct netif_driver *netif_drivers[] = {
 #ifdef LOADER_NET_SUPPORT
 	&ofwnet,
 #endif
-	0
+	NULL
 };
 
 extern struct console ofwconsole;
 struct console *consoles[] = {
 	&ofwconsole,
-	0
+	NULL
 };
 
 #ifdef LOADER_DEBUG
@@ -854,24 +857,6 @@ main(int (*openfirm)(void *))
 	OF_getprop(chosen, "bootpath", bootpath, sizeof(bootpath));
 
 	/*
-	 * Sun compatible bootable CD-ROMs have a disk label placed
-	 * before the cd9660 data, with the actual filesystem being
-	 * in the first partition, while the other partitions contain
-	 * pseudo disk labels with embedded boot blocks for different
-	 * architectures, which may be followed by UFS filesystems.
-	 * The firmware will set the boot path to the partition it
-	 * boots from ('f' in the sun4u case), but we want the kernel
-	 * to be loaded from the cd9660 fs ('a'), so the boot path
-	 * needs to be altered.
-	 */
-	if (bootpath[strlen(bootpath) - 2] == ':' &&
-	    bootpath[strlen(bootpath) - 1] == 'f' &&
-	    strstr(bootpath, "cdrom") != NULL) {
-		bootpath[strlen(bootpath) - 1] = 'a';
-		printf("Boot path set to %s\n", bootpath);
-	}
-
-	/*
 	 * Initialize devices.
 	 */
 	for (dp = devsw; *dp != 0; dp++)
@@ -883,9 +868,24 @@ main(int (*openfirm)(void *))
 		(void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev),
 		    sizeof(bootpath) - 1);
 		bootpath[sizeof(bootpath) - 1] = '\0';
-	}
+	} else
 #endif
 
+	/*
+	 * Sun compatible bootable CD-ROMs have a disk label placed before
+	 * the ISO 9660 data, with the actual file system being in the first
+	 * partition, while the other partitions contain pseudo disk labels
+	 * with embedded boot blocks for different architectures, which may
+	 * be followed by UFS file systems.
+	 * The firmware will set the boot path to the partition it boots from
+	 * ('f' in the sun4u/sun4v case), but we want the kernel to be loaded
+	 * from the ISO 9660 file system ('a'), so the boot path needs to be
+	 * altered.
+	 */
+	if (bootpath[strlen(bootpath) - 2] == ':' &&
+	    bootpath[strlen(bootpath) - 1] == 'f')
+		bootpath[strlen(bootpath) - 1] = 'a';
+
 	env_setenv("currdev", EV_VOLATILE, bootpath,
 	    ofw_setcurrdev, env_nounset);
 	env_setenv("loaddev", EV_VOLATILE, bootpath,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-06-27 10:14:57 UTC
Author: marius
Date: Thu Jun 27 09:14:50 2013
New Revision: 252296
URL: http://svnweb.freebsd.org/changeset/base/252296

Log:
  MFC: r251589
  
  - The method introduced as part of r234898 (MFCed to stable/9 in r236076)
    for not altering the boot path when booting from ZFS turned out to also
    cause the boot path not being adjusted if booting from CD-ROM with firmware
    versions that do not employ the "cdrom" alias in that case. So shuffle the
    code around instead in order to achieve the original intent. Ideally, we
    shouldn't fiddle with the boot path when booting from UFS on a disk either;
    unfortunately, there doesn't seem to be an universal way of telling disks
    and CD-ROMs apart, though. [1]
  - Use NULL instead of 0 for pointers.
  
  PR:		179289 [1]

Modified:
  stable/9/sys/boot/sparc64/loader/main.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/sparc64/loader/main.c
==============================================================================
--- stable/9/sys/boot/sparc64/loader/main.c	Thu Jun 27 09:08:07 2013	(r252295)
+++ stable/9/sys/boot/sparc64/loader/main.c	Thu Jun 27 09:14:50 2013	(r252296)
@@ -160,17 +160,19 @@ struct devsw *devsw[] = {
 #ifdef LOADER_ZFS_SUPPORT
 	&zfs_dev,
 #endif
-	0
+	NULL
 };
+
 struct arch_switch archsw;
 
 static struct file_format sparc64_elf = {
 	__elfN(loadfile),
 	__elfN(exec)
 };
+
 struct file_format *file_formats[] = {
 	&sparc64_elf,
-	0
+	NULL
 };
 
 struct fs_ops *file_system[] = {
@@ -198,19 +200,20 @@ struct fs_ops *file_system[] = {
 #ifdef LOADER_TFTP_SUPPORT
 	&tftp_fsops,
 #endif
-	0
+	NULL
 };
+
 struct netif_driver *netif_drivers[] = {
 #ifdef LOADER_NET_SUPPORT
 	&ofwnet,
 #endif
-	0
+	NULL
 };
 
 extern struct console ofwconsole;
 struct console *consoles[] = {
 	&ofwconsole,
-	0
+	NULL
 };
 
 #ifdef LOADER_DEBUG
@@ -854,24 +857,6 @@ main(int (*openfirm)(void *))
 	OF_getprop(chosen, "bootpath", bootpath, sizeof(bootpath));
 
 	/*
-	 * Sun compatible bootable CD-ROMs have a disk label placed
-	 * before the cd9660 data, with the actual filesystem being
-	 * in the first partition, while the other partitions contain
-	 * pseudo disk labels with embedded boot blocks for different
-	 * architectures, which may be followed by UFS filesystems.
-	 * The firmware will set the boot path to the partition it
-	 * boots from ('f' in the sun4u case), but we want the kernel
-	 * to be loaded from the cd9660 fs ('a'), so the boot path
-	 * needs to be altered.
-	 */
-	if (bootpath[strlen(bootpath) - 2] == ':' &&
-	    bootpath[strlen(bootpath) - 1] == 'f' &&
-	    strstr(bootpath, "cdrom") != NULL) {
-		bootpath[strlen(bootpath) - 1] = 'a';
-		printf("Boot path set to %s\n", bootpath);
-	}
-
-	/*
 	 * Initialize devices.
 	 */
 	for (dp = devsw; *dp != 0; dp++)
@@ -883,9 +868,24 @@ main(int (*openfirm)(void *))
 		(void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev),
 		    sizeof(bootpath) - 1);
 		bootpath[sizeof(bootpath) - 1] = '\0';
-	}
+	} else
 #endif
 
+	/*
+	 * Sun compatible bootable CD-ROMs have a disk label placed before
+	 * the ISO 9660 data, with the actual file system being in the first
+	 * partition, while the other partitions contain pseudo disk labels
+	 * with embedded boot blocks for different architectures, which may
+	 * be followed by UFS file systems.
+	 * The firmware will set the boot path to the partition it boots from
+	 * ('f' in the sun4u/sun4v case), but we want the kernel to be loaded
+	 * from the ISO 9660 file system ('a'), so the boot path needs to be
+	 * altered.
+	 */
+	if (bootpath[strlen(bootpath) - 2] == ':' &&
+	    bootpath[strlen(bootpath) - 1] == 'f')
+		bootpath[strlen(bootpath) - 1] = 'a';
+
 	env_setenv("currdev", EV_VOLATILE, bootpath,
 	    ofw_setcurrdev, env_nounset);
 	env_setenv("loaddev", EV_VOLATILE, bootpath,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 3 Marius Strobl freebsd_committer freebsd_triage 2013-06-27 10:24:28 UTC
State Changed
From-To: open->closed

Close; fixed in head and stable/9