Subject: Re: stand/.../newvers.sh
To: Chris G. Demetriou <cgd@netbsd.org>
From: Simon Burge <simonb@telstra.com.au>
List: tech-kern
Date: 04/13/1999 16:12:03
Chris G. Demetriou wrote:

> Simon Burge <simonb@telstra.com.au> writes:
> > The Alpha doesn't use the bootprog_name[] variable, but at first glance
> > looks like to could be changed to do so.  However, the Alpha does add
> > the building OS revision to what it uses for bootprog_name[], which I
> > don't think is a bad thing either.
>
>  [[ folloing paragraph not originally quoted by Chris ]]
>
> > I'm proposing that we copy the pmax newvers.sh (which does the ${MACHINE}
> > thang) to sys/stand/newvers.sh, add the OS release as per the Alpha, and
> > change all the version files to "mrg" syntax.  I will do this for all[*]
> > current newvers.sh ports, but obviously can't test every one further
> > than making a vers.c and seeing if it looks right.  I'll also look into
> > what the other ports that don't use a newvers.sh scheme are doing.
> 
> The alpha used to use bootprog_name[].  I changed it last night to not
> do so, because it's _unnecessary_ to do so.
> 
> There's no point in putting more in newvers.sh than has to be
> dynamically generated...

I've started looking at implementing this centralised versioning, and
want to come back to this point.  Why _don't_ we want to put more in
newvers.sh than is absolutely necessary?  From what I've seen of my
look through different ports usage of bootprog_name[] (and effectively
what the Alpha does), it would seem to me to be a good candidate for
autogeneration.  "Look and feel" and all that sort of stuff.

As a quick check, moving a complete version string ("NetBSD/pmax ... rev
1.1") to vers.c didn't change the code size at all - whether or not this
is true on all architectures or not and under all circumstances is a
totally different question...


From an implementation point of view, here's some code sizes on a pmax
of /boot with a couple of different representations of the version
strings:

     text    data   bss     dec    hex
(a)  33496   7056   240   40792   9f58   pure text in printf()
(b)  33496   7072   240   40808   9f68   #define'd text in printf()
(c)  33496   7072   240   40808   9f68   vars in boot.c
(d)  33512   7088   240   40840   9f88   alpha scheme
(e)  33528   7072   240   40840   9f88   pmax scheme (no NetBSD version)

I'm not sure why (a) and (b) are different - the output strings seem
identical.


From this, I'm tempted to nuke "vers.c" and make a "vers.h" that's
included by boot.c (or whatever) and make the printf()s would look like:

	printf("NetBSD/" MACHINE " " NETBSD_VERS " " BOOT_TYPE_NAME
	    " Bootstrap, Revision " BOOTPROG_VERS "\n");
	printf("(" BOOTPROG_MAKER ", " BOOTPROG_DATE ")\n");

This also have the "benefit" of not having anything in vers.h that's not
needed, and will keep Chris happy :-) :-)

Is everyone happy with a "vers.h" scheme with #defines instead of
"vers.c" with char[] variables?

Simon.