Print more detailed info about the disk and partition chosen for booting.

No behavioral changes, just cosmetics.

A partition number of zero is not a wildcard, it's the 'a' partition in
a BSD slice, so don't print it as "<auto>".  (Only slices are 1-based,
unit and partition numbers are 0-based and -1 is their wildcard marker.)

Also, after doing all the probing and choosing, print the final result as
"Booting from <disk spec>" where disk spec has all the wildcards resolved
and looks like familiar BSD slice-and-partition notation (disk0s3a, etc).
This commit is contained in:
ian 2015-11-22 20:38:50 +00:00
parent 145522c381
commit ab03ed9af1

View File

@ -315,7 +315,7 @@ print_disk_probe_info()
else else
strcpy(slice, "<auto>"); strcpy(slice, "<auto>");
if (currdev.d_disk.partition > 0) if (currdev.d_disk.partition >= 0)
sprintf(partition, "%d", currdev.d_disk.partition); sprintf(partition, "%d", currdev.d_disk.partition);
else else
strcpy(partition, "<auto>"); strcpy(partition, "<auto>");
@ -382,7 +382,7 @@ probe_disks(int devidx, int load_type, int load_unit, int load_slice,
printf("\n"); printf("\n");
} }
printf(" Requested disk type/unit not found\n"); printf(" Requested disk type/unit/slice/partition not found\n");
return (-1); return (-1);
} }
@ -392,7 +392,7 @@ main(void)
struct api_signature *sig = NULL; struct api_signature *sig = NULL;
int load_type, load_unit, load_slice, load_partition; int load_type, load_unit, load_slice, load_partition;
int i; int i;
const char * loaderdev; const char *ldev;
/* /*
* If we can't find the magic signature and related info, exit with a * If we can't find the magic signature and related info, exit with a
@ -485,10 +485,10 @@ main(void)
return (0xbadef1ce); return (0xbadef1ce);
} }
env_setenv("currdev", EV_VOLATILE, uboot_fmtdev(&currdev), ldev = uboot_fmtdev(&currdev);
uboot_setcurrdev, env_nounset); env_setenv("currdev", EV_VOLATILE, ldev, uboot_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, uboot_fmtdev(&currdev), env_setenv("loaddev", EV_VOLATILE, ldev, env_noset, env_nounset);
env_noset, env_nounset); printf("Booting from %s %\n", ldev);
setenv("LINES", "24", 1); /* optional */ setenv("LINES", "24", 1); /* optional */
setenv("prompt", "loader>", 1); setenv("prompt", "loader>", 1);