The FreeBSD Diary |
(TM) | Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link. |
Build world on your fast box, install on your slow box
6 February 2001
|
||||||||||||||||
The build world process is used to upgrade FreeBSD from one version to
another (e.g. 4.2-RELEASE to 4.2-STABLE). This process involves downloading source
code, compiling it, installing it, and resolving any configuration file issues,
although not necessarily in that order. The best place to read about this process is
the FreeBSD Handbook
(just search for NFS). In my case, I have a fast dual Xeon box, and a much slower 486 box (see "my first" at the bottom right of this page). When I first did a build world, it took 57 hours on my 486 with 16MB of RAM. That's not something I'm likely to do very often. Fortunately, the build world process is divided up nicely into distinct sections which will me to build world on the Xeon, and then install to the 486. This process uses NFS, so we'll assume you have NFS configured on both boxes. I've configured my Xeon box as an NFS server and my 486 as an NFS client. Full instructions on how to do these configurations are included in the NFS link above 13 March 2000 - I updated the script file and modified this article
accordingly. Things have changed in the kernel building arena, so I've added
KERNCONF to the makefile. For more information on I also added three new options to the makefile:
I also changed the format of the log files:
The value of <action> depends on what you did:
You can also delete the logs with make cleanlogs. |
||||||||||||||||
A few warnings
|
||||||||||||||||
You must ensure that you use the same settings for building as for
installing . If you don't, you could be asking for trouble.
Those are the primary things you should consider. But some recent talk has been
about The other thing to note is that I am using a custom makefile for this process. You don't have to use this makefile, but I've found it quite useful. See the Resources section for details on this makefile. As much as is possible, I will give both sets of commands: the command for my makefile and the command the makefile actually issues. I use this makefile because it is easy, convenient, saves typing, and automatically creates logs for me. I normally put this makefile in /root/make but it can reside anywhere. I merely find that location convenient so I can easily do this:
From there, I can issue all the commands which appear in the following sections...unless otherwise stated. NOTE: I put this makefile on both boxes, the XEON and the 486. I configured each box accordingly:
If you don't set them correctly on each box, you might wind up installing the wrong kernel. That's no big deal. Just follow the instructions in the handbook for booting from an alternative kernel. Here's the short version: press space at the booting countdown, then enter unload, then enter boot kernel.old (or whatever kernel you want; type ls for a list). |
||||||||||||||||
I'm using my make world script
(originally from Jim Mock), which isn't necessary, but keeps the commands handy and keeps
nice logs. I will assume you have already downloaded this script, installed it, and
configured it. I found out how to do this type of install by reading the FreeBSD Handbook (available both online and in book form). In the handbook, I found this section on make world. Search the page for a reference to NFS (it's under 19.4.6.4. Version 2.2.5 and above). |
||||||||||||||||
NFS exports - on the Xeon (server)
|
||||||||||||||||
Here are the NFS exports I put on my Xeon box. 10.0.0.45 is the IP
address of my 486.
Note that all exported directories within the same file system must appear on one line.
By default, |
||||||||||||||||
NFS imports - on the 486 (client)
|
||||||||||||||||
My 486 already had a /usr/src and a /usr/obj .
But I didn't worry about that. These commands will not overwrite these files.
You may have to create these directories before issuing the following mounts.Here are the NFS mounts which I issued on the 486. These will allow the 486 to see the files on the Xeon.
Instead of |
||||||||||||||||
The quick and easy guide
|
||||||||||||||||
This section outlines the steps which are detailed below. This
intended to be a quick reference for those who are familiar with the steps and just need a
quick reminder of what to do. Again, this assumes you have installed the makefile in
~/make when you were su'd to root. Remember to create your kernel configuration file first and set the name of this file within the Makefile (see MYKERNEL).
|
||||||||||||||||
update sources and build world - on the XEON
|
||||||||||||||||
The build world is always done on the fast box. This involves
several steps:
These two steps update your source code and does a make world (compiles the base system). If you were issuing these commands manually, this is what you would type:
where supfile is the name of your cvsup configuration file. My elapsed time: 2.5 hours. I suspect it's my disks which are slowing me down. I know it takes only about an hour on a Pentium III (compared to the dual XEON I have) box a client has. But I know they have faster disks. |
||||||||||||||||
Build the 486 kernel on the XEON
|
||||||||||||||||
I upgraded the XEON first to 4.2-stable first. Mostly so I could use
it to build the kernel for the 486. I didn't want to do anything on the 486 which I
didn't have to do. I copied the 486 kernel configuration file to /usr/src/sys/i386/conf
on the Xeon.
This assumes the kernel configuration file for the 486 is named DUCKY and has been copied to the XEON box (i.e. /usr/src/sys/i386/conf). These are the commands you would type manually:
Now that doesn't look like much saving on keystrokes, but the script does create a log for you. Note that I did not do an install. The above commands were issued on the Xeon, not the 486. The install will be done on the 486. My elapsed time: 18 minutes. |
||||||||||||||||
kernel install on the 486
|
||||||||||||||||
I've already built the 486 kernel on the Xeon. I copied the
configuration file from the 486 to the XEON via FTP. Then I moved it into /usr/src/sys/i386/conf/ and
build a kernel as normal. Remember: I had my custom makefile on both boxes!
This time, I'm issuing the commands on the 486.
Remember: this directory actually resides on the XEON, because of the NFS mount. But it will install the kernel on the 486. The manual command for this is:
My elapsed time: 2 minutes. |
||||||||||||||||
Optional reboot
|
||||||||||||||||
This is where you can reboot to make sure you have a working kernel. If the box doesn't reboot, follow the instructions in the handbook for booking an old kernel. Basically, you press the space bar during the boot countdown, then type unload, then boot kernel.old. | ||||||||||||||||
install world on the 486
|
||||||||||||||||
In a previous section, I set up the NFS mounts on the 486. This
allows me to install the files from the Xeon onto the 486. This will still take
quite some time (the 486 isn't very fast, but at least it's not compiling world).
Actually, I had the make world script on the 486,
so all I did, as root, was The manual commands would be:
My elapsed time: 30 minutes. Since this was a production box, I actually did a |
||||||||||||||||
mergemaster
|
||||||||||||||||
The next step was do to the mergemaster
run on the 486. mergemaster I used my script for that:
If you're not using my script, I suggest you follow the normal mergemaster instructions for upgrading. But here's the extract from my makefile:
My elapsed time: 10 minutes. |
||||||||||||||||
reboot time
|
||||||||||||||||
After a shutdown -r now on the 486, it came up with FreeBSD
4.2-STABLE.Note: I do remember a problem with |
||||||||||||||||
Errors I have known
15 August 2003
| ||||||||||||||||
I got this error when I forgot to mount the NFS volumes on the slow box.
I solved the problem by mounting the NFS volumes and trying again. On the slow box, I actually had a fully
populated |
||||||||||||||||
Reminder
|
||||||||||||||||
After the upgrade is completed, you may wish to disable NFS on the client and server. |