mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
de5cef6525
commit
0bf23e313e
13 changed files with 24 additions and 66 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue