About the Site

This weblog is edited and run by members of reallyenglish, a company offering a total English learning solution based in London, Beijing, Shanghai and Tokyo. Visit our corporate site to know more about what we do.

Notes are posted by members from various cultural and geographical backgrounds, and the topics range from education, business and international communication to software development, the internet culture, and more.

Staff

Masatomo Nakano http://twitter.com/masatomon /m/mt-static/support/assets_c/userpics/userpic-2-100x100.png simonl davida jeremyw Go Kameda gavin b No name tomoyukis

 

Recent Comments

  • Tomoyuki Sakurai: we've been using vether(4) successfully since 4.7. http://old.nabble.com/kernel-6318:-arp-cache-problem-bridge%284%29-with-vether%284%29-td27635451.html (the bug read more
  • RofR: Hi everyone Where about to setup serveral OBSD 4.9 or read more
  • Tomoyuki Sakurai: the above configuration has been working fine since 4.6. read more
  • Jean Aumont: Hi Tomoyuki, If you capture the packets with tcpdump and read more
  • Tomoyuki Sakurai: you will not see OSPF packets on physical interface. > read more
  • Jean Aumont: Hi everyone, I have been trying to pass OSPF in read more
  • Anonymous: without any other information, all i can say is doing read more
  • Jean Aumont: I have a similar set-up, but my 2 end points read more
  • illouca: thank you for the patch !! read more
  • Go Kameda: Glad to hear that - im afraid i cannot really read more

Recently in FreeBSD Category

We’ve been creating our own release for some time. Every new release or bugfix release, I just ssh to build servers and “make”. Here is what I wrote to release the latest version of OpenBSD and FreeBSD. Most of defaults are reasonably defined for many, but please grep “changeme” the Makefiles below and change the values. See release(8) for OpenBSD, release(7) for FreeBSD.

OpenBSD

The Makefile does the same thing documented at 5.4 - Building a Release in the FAQ.

Create /etc/src.supfile to update src. Change the tag to which release you want to build. In this example, it’s OPENBSD49.

*default release=cvs tag=OPENBSD_4_9
*default delete use-rel-suffix
*default umask=002
*default base=/var/db
*default prefix=/usr
OpenBSD-src

Install csup by “pkgadd csup”. Make sure to create a slice for /usr/obj and change DEVOBJ. Also, double check RELEASEROOTDIR has enough space (1GB is sufficient for 4.9) for all release files.

RELEASE_ROOT_DIR?=  /usr/release
DESTDIR?=           ${RELEASE_ROOT_DIR}/dest
RELEASEDIR?=        ${RELEASE_ROOT_DIR}/rel
CVSUP_HOST?=        changeme.cvsup.example.org
SRCDIR?=            /usr/src
OBJDIR?=            /usr/obj
# XXX this Makefile assumes ${OBJDIR} is on a dedicated slice
DEV_OBJ?=           /changeme/dev/rwd0g
SUPFILE?=           /etc/src.supfile
PATCHE_FILES?=
PATCHFLAGS?=
CONFIG?=            GENERIC

all: update patch buildkernel buildworld release checkflist make-index

init:
    pkg_add csup
    mkdir -p ${DESTDIR} ${RELEASEDIR}
    @echo "make init finished successfully"
    @echo "please create ${SUPFILE} for your own."
    @echo "make sure to create base dir for csup (*default base=/var/db)"

update:
    /usr/local/bin/csup -h ${CVSUP_HOST} -gsL2 ${SUPFILE}

patch:
.for P in ${PATCHES_FILES}
    (cd ${SRCDIR} && patch ${PATCHFLAGS} < ${P})
.endfor

buildkernel:
    (cd ${SRCDIR}/sys/arch/`uname -m`/conf && config ${CONFIG})
    (cd ${SRCDIR}/sys/arch/`uname -m`/conf/../compile/${CONFIG} && make clean && make depend && make && make install)

buildworld: clean-obj make-obj
    (cd ${SRCDIR}/etc && env DESTDIR=/ make distrib-dirs)
    (cd ${SRCDIR} && make build)

make-obj:
    (cd ${SRCDIR} && make obj BSDSRCDIR=${SRCDIR} BSDOBJDIR=${OBJDIR})

clean-obj:
    umount ${OBJDIR} || true
    newfs  ${DEV_OBJ}
    mount ${OBJDIR}

clean-destdir:
    test -d ${DESTDIR} && mv ${DESTDIR} ${DESTDIR}.old && rm -rf ${DESTDIR}.old &
    mkdir -p ${DESTDIR} ${RELEASEDIR}

release: clean-destdir
    (cd ${SRCDIR}/etc  && make release DESTDIR=${DESTDIR} RELEASEDIR=${RELEASEDIR})

checkflist:
    (cd ${SRCDIR}/distrib/sets && export DESTDIR=${DESTDIR} && sh checkflist)

make-index:
    (cd ${RELEASEDIR} && /bin/ls -1 >index.txt)

FreeBSD

As our FreeBSD nodes are mix of several release branch, the Makefile supports multiple releases. It also supports uploading the images to server, possibly useful for pxeboot server. Install git and subversion by running “pkg_add -r subversion git”. Then, “make init”.

# FreeBSD release(8) Makefile
#
# to initilize, "make init".
#
# * create all directories
# * checkout all sources
#
# "make all" creates release ISO and FTP directories for all
# FreeBSD $RELEASE_MAJOR.$RELEASE_MINOR_VERSIONS
#
# "make update-stable release-stable" creates one for -STABLE
#
# SEE ALSO
#   http://www.freebsd.org/doc/en/articles/releng/index.html (outdated but still useful)
#   release(7)
#   /usr/src/release/Makefile 

RELEASE_DIR?=       /usr/home/release
CHROOT_DIR?=        ${RELEASE_DIR}/chroot
RELEASE_MAJOR?=     8
RELEASE_MINOR_VERSIONS?=    2
SVNROOT?=       svn://svn.freebsd.org/base
EXTPORTSDIR?=       /usr/ports
SYSCTL=         /sbin/sysctl
ARCH!=          uname -m
NCPU!=          ${SYSCTL} -n kern.smp.cpus
MAKE_JOBS_NUMBER!=  echo ${NCPU} \* 2 | bc
LOCAL_PATCHES?=
PATCH_FLAGS?=
PXE_HOST?=      changem.pxe.example.org

.if defined(DEBUG)
SVN_FLAGS=
GIT_FLAGS=
.else
SVN_FLAGS=  --quiet
GIT_FLAGS=  --quiet
.endif

GIT!=           which git
SVN!=           which svn
.if !defined(GIT)
    @echo "git not found in PATH." 1>&2
    @echo "please install devel/git" 1>&2 && exit 1
.endif
.if !defined(SVN)
    @echo "svn not found in PATH." 1>&2
    @echo "please install devel/svn" 1>&2 && exit 1
.endif

PORTS_GIT_URL=      git://gitorious.org/freebsd/freebsd-ports.git

# release the latest RELEASE branches.
# to release -STABLE, "make update-stable release-stable"
all:    update release

# let's make release faster
#
# * copy local ports (EXTPORTSDIR)
# * do not fetch distfiles every build (RELEASEDISTFILES)
# * create ISO (MAKE_ISOS)
# * use svn (SVNROOT, SVNBRANCH)
# * use multiple cores (WORLD_FLAGS, KERNEL_FLAGS)
# * do not build doc (NODOC)
# * use FTP passive (FTP_PASSIVE_MODE)
release:
.for V in ${RELEASE_MINOR_VERSIONS}
    ${INSTALL} -d ${CHROOT_DIR}/releng/${RELEASE_MAJOR}.${V}
    make -C ${RELEASE_DIR}/sources/releng/${RELEASE_MAJOR}.${V}/src \
        -j${MAKE_JOBS_NUMBER} \
        buildworld
    make -C ${RELEASE_DIR}/sources/releng/${RELEASE_MAJOR}.${V}/src/release \
        release \
        CHROOTDIR=${CHROOT_DIR}/releng/${RELEASE_MAJOR}.${V} \
        RELEASETAG=RELENG_${RELEASE_MAJOR}_${V} \
        BUILDNAME=${RELEASE_MAJOR}.${V}-RELEASE \
        LOCAL_PATCHES="${LOCAL_PATCHES}" \
        PATCH_FLAGS="${PATCH_FLAGS}" \
        EXTPORTSDIR=${EXTPORTSDIR} \
        RELEASEDISTFILES=${EXTPORTSDIR}/distfiles \
        SVNROOT=${SVNROOT} \
        SVNBRANCH=releng/${RELEASE_MAJOR}.${V} \
        WORLD_FLAGS="-j${MAKE_JOBS_NUMBER}" \
        KERNEL_FLAGS="-j${MAKE_JOBS_NUMBER}" \
        MAKE_ISOS=1 NODOC=1 FTP_PASSIVE_MODE=1
.endfor
release-stable:
    ${INSTALL} -d ${CHROOT_DIR}/stable/${RELEASE_MAJOR}
    make -C ${RELEASE_DIR}/sources/stable/${RELEASE_MAJOR}/src \
        -j${MAKE_JOBS_NUMBER} \
        buildworld
    make -C ${RELEASE_DIR}/sources/stable/${RELEASE_MAJOR}/src/release \
        -j ${MAKE_JOBS_NUMBER} \
        release \
        CHROOTDIR=${CHROOT_DIR}/stable/${RELEASE_MAJOR} \
        RELEASETAG=RELENG_${RELEASE_MAJOR} \
        BUILDNAME=${RELEASE_MAJOR}-STABLE \
        LOCAL_PATCHES="${LOCAL_PATCHES}" \
        PATCH_FLAGS="${PATCH_FLAGS}" \
        EXTPORTSDIR=${EXTPORTSDIR} \
        RELEASEDISTFILES=${EXTPORTSDIR}/distfiles \
        SVNROOT=${SVNROOT} \
        SVNBRANCH=stable/${RELEASE_MAJOR} \
        WORLD_FLAGS="-j${MAKE_JOBS_NUMBER}" \
        KERNEL_FLAGS="-j${MAKE_JOBS_NUMBER}" \
        MAKE_ISOS=1 NODOC=1 FTP_PASSIVE_MODE=1

init:   create-dirs checkout checkout-stable checkout-head

create-dirs:
    ${INSTALL} -d ${RELEASE_DIR}/sources
    ${INSTALL} -d ${RELEASE_DIR}/sources/releng
    ${INSTALL} -d ${RELEASE_DIR}/sources/stable
    ${INSTALL} -d ${RELEASE_DIR}/portstrees
    ${INSTALL} -d ${RELEASE_DIR}/chroot
    ${INSTALL} -d ${RELEASE_DIR}/conf
    ${INSTALL} -d ${RELEASE_DIR}/conf/boot

checkout:
.for V in ${RELEASE_MINOR_VERSIONS}
    ${INSTALL} -d ${RELEASE_DIR}/sources/releng/${RELEASE_MAJOR}.${V}
    (cd ${RELEASE_DIR}/sources/releng/${RELEASE_MAJOR}.${V} && \
        ${SVN} checkout ${SVN_FLAGS} \
        ${SVNROOT}/releng/${RELEASE_MAJOR}.${V} src)
.endfor

checkout-stable:
    ${INSTALL} -d ${RELEASE_DIR}/sources/stable/${RELEASE_MAJOR}
    (cd ${RELEASE_DIR}/sources/stable/${RELEASE_MAJOR} && \
        ${SVN} checkout ${SVN_FLAGS} \
        ${SVNROOT}/stable/${RELEASE_MAJOR} src)

update:
.for V in ${RELEASE_MINOR_VERSIONS}
    if [ -d ${RELEASE_DIR}/sources/releng/${RELEASE_MAJOR}.${V}/src ]; then \
        (cd ${RELEASE_DIR}/sources/releng/${RELEASE_MAJOR}.${V}/src && \
            ${SVN} ${SVN_FLAGS} update); \
    else \
        echo "please make checkout first" 1>&2 && exit 1; \
    fi
.endfor

update-stable:
    if [ -d ${RELEASE_DIR}/sources/stable/${RELEASE_MAJOR}/src ]; then \
        (cd ${RELEASE_DIR}/sources/stable/${RELEASE_MAJOR}/src && \
            ${SVN} ${SVN_FLAGS} update); \
    else \
        echo "please make checkout-stable first" 1>&2 && exit 1; \
    fi

clone-ports:
    (cd ${RELEASE_DIR}/portstrees && \
        ${GIT} clone ${GIT_FLAGS} ${PORTS_GIT_URL})

pull-ports:
    if [ -d ${RELEASE_DIR}/portstrees/freebsd-ports ]; then \
        (cd ${RELEASE_DIR}/portstrees/freebsd-ports && \
            ${GIT} pull ${GIT_FLAGS}); \
    else \
        @echo "please make clone-ports first" 1>&2 && exit 1; \
    fi

# two targets to get HEAD sources.
# no release-head target because we don't need it.
# also, building HEAD on non-HEAD is not supported.
# use snapshot or build HEAD on your own host.
checkout-head:
    (cd ${RELEASE_DIR}/sources && \
        ${SVN} checkout ${SVN_FLAGS} ${SVNROOT}/head head)

update-head:
    (cd ${RELEASE_DIR}/sources/head && ${SVN} ${SVN_FLAGS} update)

upload:
.for V in ${RELEASE_MINOR_VERSIONS}
    # XXX [KNOWN BUG] gzipped mfsroot doesn't work
    if [ -f ${RELEASE_DIR}/chroot/releng/${RELEASE_MAJOR}.${RELEASE_MINOR_VERSIONS}/R/cdrom/disc1/boot/mfsroot.gz ]; then \
        gunzip ${RELEASE_DIR}/chroot/releng/${RELEASE_MAJOR}.${RELEASE_MINOR_VERSIONS}/R/cdrom/disc1/boot/mfsroot.gz ; \
    fi
    ssh ${PXE_HOST} \
        rm -rf /tftproot/pub/FreeBSD/${ARCH}/${RELEASE_MAJOR}.${RELEASE_MINOR_VERSIONS}-RELEASE
    scp -r \
        ${RELEASE_DIR}/chroot/releng/${RELEASE_MAJOR}.${RELEASE_MINOR_VERSIONS}/R/cdrom/disc1 \
        ${PXE_HOST}:/tftproot/pub/FreeBSD/${ARCH}/${RELEASE_MAJOR}.${RELEASE_MINOR_VERSIONS}-RELEASE
    # copy loader.conf for pxeboot
    scp ${RELEASE_DIR}/conf/boot/* \
        ${PXE_HOST}:/tftproot/pub/FreeBSD/${ARCH}/${RELEASE_MAJOR}.${RELEASE_MINOR_VERSIONS}-RELEASE/boot/
.endfor