The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
The make-world script 30 July 2000
Need more help on this topic? Click here
This article has 11 comments
Show me similar articles

Do you remember that makefile I had for my upgrade from FreeBSD 4.0-Release to FreeBSD 4.0-Stable. Well, gill wrote in with an improvement.  It doesn't make things any faster.  But it does make the script easier to configure.  I've updated the old script with his changes and the script is available here.

WARNING: Do not use copy/paste to get the makefile. Makefiles contains tabs.  The copy/paste process will convert the tabs to spaces.  You don't want that.  You need the tabs.  Instead, use fetch to get the file (e.g fetch <filename>).

Also remember that this script puts logs into /usr/tmp.  You may wish to delete those logs after you are finished.  They can get quite big.  You can modify the location by modifying a variable in the script.

Some people say there is no need for this script. Well, that's true. But I like it because it keeps the logs for you in case something goes wrong. "But you can do those logs yourself!". Well, yes, but if I use the script, it is done for me. If you don't like the idea, you won't be using it.

The assumptions
Using the script

On 26 August, 2001, I changed the script slightly. It now requires changes to /etc/make.conf (you should create that file if it doesn't already exist). Ensure the following entries exist in that file:

SUP_UPDATE=     yes
SUPFLAGS=       -g -z -L 2
SUPHOST=        xeon
SUPFILE=        /usr/share/examples/cvsup/stable-supfile

NOTE: I have not been able to get the above to work. I have had to resort to upgrading my source by issuing the cvsup command directly.

Here are the steps I go through to build my world.

Before you use the script, remember to change the variable in the script to suit your requirements.  You must set MYKERNEL to the appropriate value (see the following NOTE).  And you may wish to change the default location for the logs.  By default, they go to /usr/tmp.   If you don't change that value, make sure /usr/tmp exists.

NOTE: If you have not previously downloaded the kernel source and created a kernel configuration file, then you must create this file after step 2 and before step 5.   Please refer to the Configuring the FreeBSD Kernel section in the FreeBSD handbook.  Pay special attention to the section on Building and Installing a Custom Kernel.

If you have previously done a build world, you should remember to do a make clean first.  It clears out /usr/obj as well as deleting your old log files.

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).

These instructions are for the Makefile provided at the top of this page.

  1. su to root
  2. cd ~/make
  3. make update - updates your source, if it already exists!
  4. make build - does a build world.
  5. make kernelbuild
  6. make kernelinstall
  7. reboot*
  8. mergemaster -p
  9. make install - installs the results of the above builds
  10. make merge - merges the configuration file changes
  11. reboot

*WARNING! WARNING!:/usr/src/UPDATING recommends a reboot here just to make sure the kernel you just built is operational.  If it is not you can still reboot to kernel.old and still have your world and kernel in sync.  For what it's worth, I don't usually do this reboot. And once, when I was upgrading to 4.4, I actually broke my box big time. If you do this reboot, note that ipf will possibly break because you are (for example) using a 4.4 kernel with a 4.3 world. If you also use IPFILTER_DEFAULT_BLOCK, then you'll be locked out of the box. Your only way back in will be via the console. BE WARNED!

If you encounter the following error:

# make update
cd /usr/src; make update 2>&1 | tee /usr/tmp/update.`date "+%Y.%m.%d.%H.%M.%S"`.log;
make: don't know how to make update. Stop
then you don't have any source to be updated. I suggest you issue the following command instead:
cvsup -h xeon /usr/share/examples/cvsup/stable-supfile

where xeon is the name of your favorite cvsup server. I know I have to issue the above command when I first cvsup a box (e.g. I just installed 4.4-RELEASE and I want to upgrade the system to 4.4-STABLE.

It could also be that upgrading from an older version of FreeBSD which does not support make update. For example, I know 4.2-Release does not have this feature. In which case, you should run cvsup manually to upgrade your sources. There is a small example of how do this within Installing cvsup.

making a kernel when not making world
You can also use this script to build a kernel when you aren't building world.   You can use make kerneloldstyle.  If you try to make a kernel, and get an error like this:
/tmp/ccb33757.s:2468: Error: Subtraction of two symbols in different
sections "IdlePTD" {.data section} - "KERNBASE" {*UND* section} at
file address 1596.
*** Error code 1

then try make kerneloldstyle instead.

Using mergemaster
mergemaster is a most awesome piece of code.  It simplifies the process of merging system file changes to a level which is quite simple.  Without it, I would not like to do a build world.

mergemaster looks at the files in existing system and compares them to the new files, which are temporarily located in another directory.  For each new file which differs from the existing file, it prompts you for instructions.  The options are generally:

  • merge (take bits from each file)
  • delete (ignore the new file and keep the existing file)
  • insert (the new file, overwriting the existing file)

During the merge, you are presented with left and right images of the before and after images.  You may have to scroll back up to figure out which is the new file and which is the old file.  Quite often, the first line mergemaster shows you contains a version number.  That will differentiate the new file from the old file.  It takes a while to get used to it, but after a while you will get the hang of it.


Need more help on this topic? Click here
This article has 11 comments
Show me similar articles