From ab03ed9af14adefe0d0e270a8836b55c7d1421ad Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 22 Nov 2015 20:38:50 +0000 Subject: [PATCH] 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 "". (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 " where disk spec has all the wildcards resolved and looks like familiar BSD slice-and-partition notation (disk0s3a, etc). --- sys/boot/uboot/common/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/boot/uboot/common/main.c b/sys/boot/uboot/common/main.c index 0c9853cfe60c..aac7bf819787 100644 --- a/sys/boot/uboot/common/main.c +++ b/sys/boot/uboot/common/main.c @@ -315,7 +315,7 @@ print_disk_probe_info() else strcpy(slice, ""); - if (currdev.d_disk.partition > 0) + if (currdev.d_disk.partition >= 0) sprintf(partition, "%d", currdev.d_disk.partition); else strcpy(partition, ""); @@ -382,7 +382,7 @@ probe_disks(int devidx, int load_type, int load_unit, int load_slice, printf("\n"); } - printf(" Requested disk type/unit not found\n"); + printf(" Requested disk type/unit/slice/partition not found\n"); return (-1); } @@ -392,7 +392,7 @@ main(void) struct api_signature *sig = NULL; int load_type, load_unit, load_slice, load_partition; int i; - const char * loaderdev; + const char *ldev; /* * If we can't find the magic signature and related info, exit with a @@ -485,10 +485,10 @@ main(void) return (0xbadef1ce); } - env_setenv("currdev", EV_VOLATILE, uboot_fmtdev(&currdev), - uboot_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, uboot_fmtdev(&currdev), - env_noset, env_nounset); + ldev = uboot_fmtdev(&currdev); + env_setenv("currdev", EV_VOLATILE, ldev, uboot_setcurrdev, env_nounset); + env_setenv("loaddev", EV_VOLATILE, ldev, env_noset, env_nounset); + printf("Booting from %s %\n", ldev); setenv("LINES", "24", 1); /* optional */ setenv("prompt", "loader>", 1);