Subject: Re: Not sure to understand the purpose of distribution vs. installworld
To: Jeremie Le Hen <>
From: Greg A. Woods <>
List: tech-toolchain
Date: 03/05/2007 17:45:25
I'm going to redirect you to netbsd-users -- this isn't really a
tech-toolchain question, at least not in the way I would describe
tech-toolchain.  I.e. it's not an issue with the build system per se,
but rather just an issue about understanding how to use it effectively.

At Mon, 5 Mar 2007 19:54:24 +0100,
Jeremie Le Hen wrote:
> I've read src/BUILDING as well as chapter 28 of the NetBSD guide,
> but I obviously lack sharpness because I'm experiencing difficulties
> to understand the point of having both the distribution/buildworld and
> installworld targets.

Well I suppose it depends on exactly what you're doing and what your
goals are, but in general NetBSD is, at least in my opinion, set up much
better for cross-builds and for building binary distributions which can
be used for updating production machines.

In general even if I update the build machine I still build a full
distribution set and then unpack it in single user mode.

Note that with this procedure it doesn't matter what/where your build
machine is.  You just copy by whatever means necessary the appropriate
kernel and binary/sets files over to the target machine to be upgraded,
and do the upgrade.

My actual builds are are done with yet another wrapper script around the script, just to set up all the right directories and get all
the various parameters the way I want them, and to do a second install
into a separate DESTDIR with a different setting for STRIPFLAG (I build
with -g then create a stripped binaries for installation so that I can
debug cores without having to rebuild anything -- the unstripped
binaries are a bit too big for some of my machines, and way too big to
fit on CD media).  Normally the invocation of is given the
"distribution" parameter.

Here are some excerpts from my "notes/netbsd-upgrading" file (take care
here -- there is some stuff that may be dependent on my own local changes):

  - manual upgrades easiest (except for handling /var/db/obsolete....):
    (assuming current bootblocks will load the new kernel)

    - install and boot a new kernel  (uncompress the kernel for savecore)

	gzcat < /path/to/netbsd-GENERIC.gz > /netbsd-1.6.2_STABLE.GENERIC.2006MMDD.0
	mv /netbsd /netbsd.old
	ln /netbsd-1.6.2_STABLE.GENERIC.2006MMDD.0 /netbsd
	shutdown -r now 'upgrading kernel to 1.6.2_STABLE.GENERIC.2006MMDD.0'

	(boot -s)	# always boot single user for quiescent upgrade of
			# production machines!!!!

    - unpack all the sets _except_ 'etc.tgz' (and 'xetc.tgz' on 3.x)
      (and probably not all the kernels either):

        mount -va	# if booted single user

	cd /
	pax -rz -p e -f /path/to/*-release-no-g/binary/sets/set_name.tgz

    - copy the "obsolete" lists to /var/db/obsolete (not yet possible on
      the netbsd-3 branch):

	mkdir -p /var/db/obsolete
	rm /var/db/obsolete/*
	cp /path/to/*-release-no-g/binary/obsolete/* /var/db/obsolete

    - follow INSTALL instructions for /etc/postinstall and etcupdate.
      postinstall works fine with /usr/src, but etcupdate needs etc.tgz,
      so may as well use it for both

	mkdir -p /root/tmp/etc-upgrade
	cd /root/tmp/etc-upgrade
	pax -rz -p e -f /path/to/*-release-no-g/binary/sets/etc.tgz
	pax -rz -p e -f /path/to/*-release-no-g/binary/sets/xetc.tgz
	cd /
	{/etc/,/usr/sbin/}postinstall -s /root/tmp/etc-upgrade check

	# WARNING:  verify that you want the fixes!!!!  Do each
	# individually to avoid those you don't want

	/etc/postinstall -s /root/tmp/etc-upgrade fix

	etcupdate -v -b /root/tmp/etc-upgrade

      if all is well then clean out /root/tmp/etc-upgrade

	rm -rf /root/tmp/etc-upgrade

    - install new bootblocks:

      NOTE: may need to be in single user mode!


	# install the bootstrap programs (note use of the 'c' partition)
	cp /usr/mdec/boot /boot
	installboot -v /dev/rsd0c /usr/mdec/bootxx /boot


	# install the bootstrap programs (note use of the 'c' partition)
	cp /usr/mdec/boot /boot
	installboot -v /dev/rsd0c /usr/mdec/bootxx_ffs /boot

      old i386 standard:

	/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/rsd0a

      old i386 serial console:

	/usr/mdec/installboot -v /usr/mdec/biosboot_com0.sym /dev/rsd0a

      old i386 with RAID-1 system disk:

	/usr/mdec/installboot -v /usr/mdec/biosboot.sym /dev/rsd0f

      i386 (1.6 and newer)

       - normal video consoles (set timeout to a unique value for boot
         volume identification)

	# installboot -o timeout=7 -v /dev/rsd1a /usr/mdec/bootxx_ffsv1

       - serial console:

	# installboot -v -o timeout=7,console=com0,speed=38400 /dev/rsd1a /usr/mdec/bootxx_ffsv1

    - re-run MAKEDEV (esp. if it's been a while):

	cd /dev
	/sbin/MAKEDEV all

    - reboot multi-user again to make sure the system config is still OK.

	shutdown -r now 'upgraded system to 1.6.2_STABLE 2006MMDD'

  - if this is the first re-install of 1.6.x on the build machine then
    rebuild xsrc now and re-install xsrc, then make a CD-ROM.

  - upgrade packages as needed:

    - need to upgrade devel/p5-perl-headers !!!

						Greg A. Woods

H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <>
Planix, Inc. <>       Secrets of the Weird <>