Date: Fri, 2 Sep 2016 00:45:44 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r305266 - releng/11.0/sys/boot/powerpc/boot1.chrp Message-ID: <201609020045.u820jioT042642@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Fri Sep 2 00:45:43 2016 New Revision: 305266 URL: https://svnweb.freebsd.org/changeset/base/305266 Log: MFS11 r305249: MFC r305036: Some versions of SLOF do not append the partition number to the boot device argument to the stage-1 bootloader. In such cases, boot1 would only try to read the entire device rather than checking for partitions. Instead of panic'ing, fall back to reading the partitions as normal in such situations. This was preventing boot of installed systems on some versions of PowerKVM. PR: kern/211599 Approved by: re (gjb) Modified: releng/11.0/sys/boot/powerpc/boot1.chrp/boot1.c Directory Properties: releng/11.0/ (props changed) Modified: releng/11.0/sys/boot/powerpc/boot1.chrp/boot1.c ============================================================================== --- releng/11.0/sys/boot/powerpc/boot1.chrp/boot1.c Fri Sep 2 00:43:03 2016 (r305265) +++ releng/11.0/sys/boot/powerpc/boot1.chrp/boot1.c Fri Sep 2 00:45:43 2016 (r305266) @@ -137,7 +137,9 @@ ofw_init(void *vpd, int res, int (*openf p = bootpath; while (*p != '\0') { + /* Truncate partition ID */ if (*p == ':') { + ofw_close(bootdev); *(++p) = '\0'; break; } @@ -419,31 +421,40 @@ main(int ac, char **av) memcpy(bootpath_full,bootpath,len+1); - if (bootpath_full[len-1] == ':') { - for (i = 0; i < 16; i++) { - if (i < 10) { - bootpath_full[len] = i + '0'; - bootpath_full[len+1] = '\0'; - } else { - bootpath_full[len] = '1'; - bootpath_full[len+1] = i - 10 + '0'; - bootpath_full[len+2] = '\0'; - } - - if (domount(bootpath_full,1) >= 0) - break; - - if (bootdev > 0) - ofw_close(bootdev); + if (bootpath_full[len-1] != ':') { + /* First try full volume */ + if (domount(bootpath_full,1) == 0) + goto out; + + /* Add a : so that we try partitions if that fails */ + if (bootdev > 0) + ofw_close(bootdev); + bootpath_full[len] = ':'; + len += 1; + } + + /* Loop through first 16 partitions to find a UFS one */ + for (i = 0; i < 16; i++) { + if (i < 10) { + bootpath_full[len] = i + '0'; + bootpath_full[len+1] = '\0'; + } else { + bootpath_full[len] = '1'; + bootpath_full[len+1] = i - 10 + '0'; + bootpath_full[len+2] = '\0'; } + + if (domount(bootpath_full,1) >= 0) + break; - if (i >= 16) - panic("domount"); - } else { - if (domount(bootpath_full,0) == -1) - panic("domount"); + if (bootdev > 0) + ofw_close(bootdev); } + if (i >= 16) + panic("domount"); + +out: printf(" Boot volume: %s\n",bootpath_full); ofw_setprop(chosenh, "bootargs", bootpath_full, len+2); load(path);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609020045.u820jioT042642>