diff options
author | Ed Maste <emaste@FreeBSD.org> | 2016-12-18 13:57:23 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2016-12-18 13:57:23 +0000 |
commit | 0bf23e313efc69325d447dfe7909a7703cd6d0a8 (patch) | |
tree | 539d3651270e2e9086618a9db0f4923b74eba0c4 /sys/boot | |
parent | de5cef6525c619754720a78b50e48dadf9be6186 (diff) | |
download | src-0bf23e313efc69325d447dfe7909a7703cd6d0a8.tar.gz src-0bf23e313efc69325d447dfe7909a7703cd6d0a8.zip |
Reduce boot loader version string duplication
Instead of repeating "%s, Revision %s" "(%s %s)" in each loader, just
create the full version string in vers.c
Reviewed by: bapt
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8823
Notes
Notes:
svn path=/head/; revision=310225
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/common/interp_forth.c | 5 | ||||
-rwxr-xr-x | sys/boot/common/newvers.sh | 6 | ||||
-rw-r--r-- | sys/boot/efi/loader/main.c | 9 | ||||
-rw-r--r-- | sys/boot/i386/loader/main.c | 6 | ||||
-rw-r--r-- | sys/boot/mips/beri/loader/loader.h | 3 | ||||
-rw-r--r-- | sys/boot/mips/beri/loader/main.c | 4 | ||||
-rw-r--r-- | sys/boot/ofw/common/main.c | 9 | ||||
-rw-r--r-- | sys/boot/pc98/loader/main.c | 6 | ||||
-rw-r--r-- | sys/boot/powerpc/kboot/main.c | 9 | ||||
-rw-r--r-- | sys/boot/powerpc/ps3/main.c | 9 | ||||
-rw-r--r-- | sys/boot/sparc64/loader/main.c | 6 | ||||
-rw-r--r-- | sys/boot/uboot/common/main.c | 9 | ||||
-rw-r--r-- | sys/boot/userboot/userboot/main.c | 9 |
13 files changed, 24 insertions, 66 deletions
diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c index 8efd887b5fa1..a3b77769d38a 100644 --- a/sys/boot/common/interp_forth.c +++ b/sys/boot/common/interp_forth.c @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "ficl.h" -extern char bootprog_rev[]; +extern unsigned bootprog_rev; /* #define BFORTH_DEBUG */ @@ -277,8 +277,7 @@ bf_init(const char *rc) /* Export some version numbers so that code can detect the loader/host version */ ficlSetEnv(bf_sys, "FreeBSD_version", __FreeBSD_version); - ficlSetEnv(bf_sys, "loader_version", - (bootprog_rev[0] - '0') * 10 + (bootprog_rev[2] - '0')); + ficlSetEnv(bf_sys, "loader_version", bootprog_rev); /* try to load and run init file if present */ if (rc == NULL) diff --git a/sys/boot/common/newvers.sh b/sys/boot/common/newvers.sh index ee2ac992e1dd..167b7cc655e4 100755 --- a/sys/boot/common/newvers.sh +++ b/sys/boot/common/newvers.sh @@ -40,8 +40,6 @@ u=${USER-root} h=${HOSTNAME-`hostname`} t=`date` #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` -echo "char bootprog_name[] = \"FreeBSD/${3} ${2}\";" > $tempfile -echo "char bootprog_rev[] = \"${r}\";" >> $tempfile -echo "char bootprog_date[] = \"${t}\";" >> $tempfile -echo "char bootprog_maker[] = \"${u}@${h}\";" >> $tempfile +echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} ${u}@${h})\\n\";" > $tempfile +echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile mv $tempfile vers.c diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c index b97f2afb8513..afa31c22f3a0 100644 --- a/sys/boot/efi/loader/main.c +++ b/sys/boot/efi/loader/main.c @@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; #ifdef BOOT_FORTH /* @@ -409,9 +406,7 @@ main(int argc, CHAR16 *argv[]) printf("EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); /* * Disable the watchdog timer. By default the boot manager sets diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c index bc325932d47e..9b034ab96b89 100644 --- a/sys/boot/i386/loader/main.c +++ b/sys/boot/i386/loader/main.c @@ -77,7 +77,7 @@ static void i386_zfs_probe(void); #endif /* from vers.c */ -extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; /* XXX debugging */ extern char end[]; @@ -215,9 +215,7 @@ main(void) /* detect PCI BIOS for future reference */ biospci_detect(); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); extract_currdev(); /* set $currdev and $loaddev */ setenv("LINES", "24", 1); /* optional */ diff --git a/sys/boot/mips/beri/loader/loader.h b/sys/boot/mips/beri/loader/loader.h index 31a42152c806..e4152e72df92 100644 --- a/sys/boot/mips/beri/loader/loader.h +++ b/sys/boot/mips/beri/loader/loader.h @@ -58,7 +58,6 @@ extern struct bootinfo boot2_bootinfo; int md_load64(char *args, vm_offset_t *modulep); /* vers.c */ -extern char bootprog_name[], bootprog_rev[]; -extern char bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; #endif /* !_BOOT_LOADER_H_ */ diff --git a/sys/boot/mips/beri/loader/main.c b/sys/boot/mips/beri/loader/main.c index 8253fb261d26..2d201d8011ee 100644 --- a/sys/boot/mips/beri/loader/main.c +++ b/sys/boot/mips/beri/loader/main.c @@ -144,9 +144,7 @@ main(int argc, char *argv[], char *envv[], struct bootinfo *bootinfop) } extract_currdev(bootinfop); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); #if 0 printf("bootpath=\"%s\"\n", bootpath); #endif diff --git a/sys/boot/ofw/common/main.c b/sys/boot/ofw/common/main.c index b15df5ff0d8a..3c0bbdf97a26 100644 --- a/sys/boot/ofw/common/main.c +++ b/sys/boot/ofw/common/main.c @@ -36,10 +36,7 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; /* MI/MD interface boundary */ extern char end[]; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; u_int32_t acells, scells; @@ -127,9 +124,7 @@ main(int (*openfirm)(void *)) if (devsw[i]->dv_init != NULL) (devsw[i]->dv_init)(); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("Memory: %lldKB\n", memsize() / 1024); OF_getprop(chosen, "bootpath", bootpath, 64); diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c index 39444ad2fad0..c31cc842a035 100644 --- a/sys/boot/pc98/loader/main.c +++ b/sys/boot/pc98/loader/main.c @@ -66,7 +66,7 @@ static void isa_outb(int port, int value); void exit(int code); /* from vers.c */ -extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; /* XXX debugging */ extern char end[]; @@ -186,9 +186,7 @@ main(void) initial_bootinfo->bi_extmem = bios_extmem / 1024; } - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); extract_currdev(); /* set $currdev and $loaddev */ setenv("LINES", "24", 1); /* optional */ diff --git a/sys/boot/powerpc/kboot/main.c b/sys/boot/powerpc/kboot/main.c index 50f63b11699b..7a24c163d5c4 100644 --- a/sys/boot/powerpc/kboot/main.c +++ b/sys/boot/powerpc/kboot/main.c @@ -38,10 +38,7 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; extern void *_end; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; int kboot_getdev(void **vdev, const char *devspec, const char **path); ssize_t kboot_copyin(const void *src, vm_offset_t dest, const size_t len); @@ -119,9 +116,7 @@ main(int argc, const char **argv) archsw.arch_autoload = kboot_autoload; archsw.arch_loadaddr = kboot_loadaddr; - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); setenv("currdev", bootdev, 1); setenv("loaddev", bootdev, 1); diff --git a/sys/boot/powerpc/ps3/main.c b/sys/boot/powerpc/ps3/main.c index bcfd7c9ef9ae..be8708aadefa 100644 --- a/sys/boot/powerpc/ps3/main.c +++ b/sys/boot/powerpc/ps3/main.c @@ -41,10 +41,7 @@ __FBSDID("$FreeBSD$"); struct arch_switch archsw; extern void *_end; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; int ps3_getdev(void **vdev, const char *devspec, const char **path); ssize_t ps3_copyin(const void *src, vm_offset_t dest, const size_t len); @@ -133,9 +130,7 @@ main(void) archsw.arch_readin = ps3_readin; archsw.arch_autoload = ps3_autoload; - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("Memory: %lldKB\n", maxmem / 1024); env_setenv("currdev", EV_VOLATILE, ps3_fmtdev(&currdev), diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index ae1e5597a3c8..d7b4e1e7abbb 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "dev_net.h" -extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; +extern char bootprog_info[]; enum { HEAPVA = 0x800000, @@ -891,9 +891,7 @@ main(int (*openfirm)(void *)) env_setenv("loaddev", EV_VOLATILE, bootpath, env_noset, env_nounset); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("bootpath=\"%s\"\n", bootpath); /* Give control to the machine independent loader code. */ diff --git a/sys/boot/uboot/common/main.c b/sys/boot/uboot/common/main.c index d5c76644b0c7..3b97a6eadd51 100644 --- a/sys/boot/uboot/common/main.c +++ b/sys/boot/uboot/common/main.c @@ -62,10 +62,7 @@ struct device_type { }; extern char end[]; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; extern unsigned char _etext[]; extern unsigned char _edata[]; @@ -431,9 +428,7 @@ main(int argc, char **argv) cons_probe(); printf("Compatible U-Boot API signature found @%p\n", sig); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); printf("\n"); dump_sig(sig); diff --git a/sys/boot/userboot/userboot/main.c b/sys/boot/userboot/userboot/main.c index 4fcf047e1dad..87733cd659a9 100644 --- a/sys/boot/userboot/userboot/main.c +++ b/sys/boot/userboot/userboot/main.c @@ -51,10 +51,7 @@ static int userboot_zfs_found; struct loader_callbacks *callbacks; void *callbacks_arg; -extern char bootprog_name[]; -extern char bootprog_rev[]; -extern char bootprog_date[]; -extern char bootprog_maker[]; +extern char bootprog_info[]; static jmp_buf jb; struct arch_switch archsw; /* MI/MD interface boundary */ @@ -101,9 +98,7 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) */ cons_probe(); - printf("\n"); - printf("%s, Revision %s\n", bootprog_name, bootprog_rev); - printf("(%s, %s)\n", bootprog_maker, bootprog_date); + printf("\n%s", bootprog_info); #if 0 printf("Memory: %ld k\n", memsize() / 1024); #endif |