I was running a small script I wrote to set up a jail. I've used it before and
it works. It does just the same thing that the manpage for jail tells you to
do.
make_jail.sh:
#!/bin/sh
D=$1
cd /usr/src
mkdir -p $D
make world DESTDIR=$D
cd etc
make distribution DESTDIR=$D
mount_devfs devfs $D/dev
cd $D
ln -sf dev/null kernel
Then I just run that script with ./make_jail.sh
/usr/jail/jail.henrikssons.net.
I get the exact same output if I run make world
DESTDIR=/usr/jail/jail.henrikssons.net manually or with any other path.
make.conf:
# $FreeBSD: src/share/examples/etc/make.conf,v 1.218 2003/09/24 04:19:26
gshapiro Exp $
#
# NOTE: Please would any committer updating this file also update the
# make.conf(5) manual page, if necessary, which is located in
# src/share/man/man5/make.conf.5.
#
# /etc/make.conf, if present, will be read by make (see
# /usr/share/mk/sys.mk). It allows you to override macro definitions
# to make without changing your source tree, or anything the source
# tree installs.
#
# This file must be in valid Makefile syntax.
#
# There are additional things you can put into /etc/make.conf.
# You have to find those in the Makefiles and documentation of
# the source tree.
#
#
# The CPUTYPE variable controls which processor should be targeted for
# generated code. This controls processor-specific optimizations in
# certain code (currently only OpenSSL) as well as modifying the value
# of CFLAGS to contain the appropriate optimization directive to gcc.
# The automatic setting of CFLAGS may be overridden using the
# NO_CPU_CFLAGS variable below.
# Currently the following CPU types are recognized:
# Intel x86 architecture:
# (AMD CPUs) athlon-mp athlon-xp athlon-4 athlon-tbird athlon k6-3
# k6-2 k6 k5
# (Intel CPUs)p4 p3 p2 i686 i586/mmx i586 i486 i386
# Alpha/AXP architecture: ev67 ev6 pca56 ev56 ev5 ev45 ev4
# Intel ia64 architecture: itanium
#
# (?= allows to buildworld for a different CPUTYPE.)
#
CPUTYPE=p3
#NO_CPU_CFLAGS= true# Don't add -march=cpu to CFLAGS automatically
#NO_CPU_COPTFLAGS=true # Don't add -march=cpu to COPTFLAGS automatically
#
# CFLAGS controls the compiler settings used when compiling C code.
# Note that optimization settings above -O (-O2, ...) are not recommended
# or supported for compiling the world or the kernel - please revert any
# nonstandard optimization settings to -O before submitting bug reports
# to the developers.
# Note also that at this time the -O2 setting is known to produce BROKEN
# CODE on the Alpha platform.
#
CFLAGS= -O -pipe
#
# CXXFLAGS controls the compiler settings used when compiling C++ code.
# Note that CXXFLAGS is initially set to the value of CFLAGS. If you wish
# to add to CXXFLAGS value, += must be used rather than =. Using =
# alone will remove the often needed contents of CFLAGS from CXXFLAGS.
#
#CXXFLAGS+= -fmemoize-lookups -fsave-memoized
#
# MAKE_SHELL controls the shell used internally by make(1) to process the
# command scripts in makefiles. Three shells are supported, sh, ksh, and
# csh. Using sh is most common, and advised. Using ksh *may* work, but is
# not guaranteed to. Using csh is absurd. The default is to use sh.
#
#MAKE_SHELL?=sh
#
# BDECFLAGS are a set of gcc warning settings that Bruce Evans has suggested
# for use in developing FreeBSD and testing changes. They can be used by
# putting CFLAGS+=${BDECFLAGS} in /etc/make.conf. -Wconversion is not
# included here due to compiler bugs, e.g., mkdir()'s mode_t argument.
#
#BDECFLAGS= -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align \
# -Wcast-qual -Wchar-subscripts -Winline \
# -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
# -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings
#
# To compile just the kernel with special optimizations, you should use
# this instead of CFLAGS (which is not applicable to kernel builds anyway).
# There is very little to gain by using higher optimization levels, and doing
# so can cause problems.
#
COPTFLAGS= -O -pipe
#
# To build the system compiler such that it forces high optimization levels to
# a lower one. GCC -O2+ is known to trigger known optimizer bugs at various
# times -- this is worse on the Alpha platform. The value assigned here will
# be the highest optimization value used.
#WANT_FORCE_OPTIMIZATION_DOWNGRADE=1
#
# Compare before install
#INSTALL=install -C
#
# Mtree will follow symlinks
#MTREE_FOLLOWS_SYMLINKS= -L
#
# To build ppp with normal permissions
#PPP_NOSUID=true
#
# To enable installing ssh(1) with the setuid bit turned on
#ENABLE_SUID_SSH= true
#
# To enable installing newgrp(1) with the setuid bit turned on.
# Without the setuid bit, newgrp cannot change users' groups.
#ENABLE_SUID_NEWGRP=true
#
# To avoid building various parts of the base system:
#NO_CVS=true# do not build CVS
#NO_CXX=true# do not build C++ and friends
NO_BIND=