Subject: Re: A question about build.sh
To: None <netbsd-help@netbsd.org>
From: Frederick Bruckman <fredb@immanent.net>
List: netbsd-help
Date: 03/28/2005 15:08:33
In article <200503281427.57960.th.lacoste@wanadoo.fr>,
	Thierry Lacoste <th.lacoste@wanadoo.fr> writes:
> I'm confused by the difference between 'build.sh build'
> and 'build.sh distribution '.

Build installs to the root file system, but doesn't overwrite your
installed "/etc" and "/root".  It's there for traditionalists who
are accustomed to the old way of upgrading, which was "make build",
(after building and installing the kernel manually).
 
> =46rom /usr/src/BUILDING, I read:
>   build         Build the entire NetBSD system

I guess that should say "build and install".

>   distribution  Do a ``make build'', and then install a full distribution
>                      into DESTDIR, including files in DESTDIR/dev, =09
>                      DESTDIR/etc, DESTDIR/root and DESTDIR/var.
> 
> =46rom http://www.netbsd.org/Documentation/current/ I see that:
> 
> 1) if I want to update kernel+userland, I must
>     - 'build.sh distribution'
>     - 'build.sh kernel'

That would be "./build.sh kernel=FOO" (FOO could be GENERIC, or
some custom configuration file).  You could also do both steps
at once, as "./build.sh distribution ... kernel=FOO".

>     - install new kernel
>     - reboot
>     - 'build.sh install' the distribution

One reason for this is, if perhaps userland doesn't build today,
you might want to just wait on the whole thing. Another is that
if you boot from the new kernel before building, the autoconf'd
toolchain will contain the uname of the new kernel, which isn't
accurate.

> 2) if I want to update userland only, I can (must?)
>     - 'build.sh build'
>     - 'build.sh install' the new userland

No, no, no. Never update only userland. "./build.sh build" will
overwrite your system binaries, and if you haven't updated your
kernel first, you're likely to get segfaults all over the place.
Best not to use "make build" at all.

> Is this the installation of the new kernel in situation 1
> that requires 'build.sh distribution' instead of 'build.sh build'?
> What if I 'build.sh build' instead of 'build.sh distribution'
> in situation 1?
> What are the additional steps performed by 'build.sh distribution'
> which allow installation of a new kernel between building
> and installing userland? Population of /dev /etc and /var ?

Mainly, "build" goes ahead and installs the new userland to "/",
which isn't desirable, if you're still running on the old kernel.

If you want to update only the kernel, that's fine.  You can use
"./build.sh [-u] toolchain kernel=FOO".  The kernel should always
lead userland.  Changes to the kernel are made in a backwards
compatible way, but it's not possible for libc to know about
syscalls that weren't in existence when it was compiled.

-- 
Frederick