1. 设置cvs路径:
代码: 全选
$ export CVS_RSH="ssh"
$ export CVSROOT="[email protected]:/cvsroot"
代码: 全选
$ cd /usr
$ cvs checkout -r netbsd-5 -P src
代码: 全选
$ cd /usr/src
$ cvs update -Pd
$ cd /usr/xsrc
$ cvs update -Pd
代码: 全选
# echo "LDSTATIC=-static" >> /etc/mk.conf
代码: 全选
mkdir /usr/obj
代码: 全选
# cd /usr/src
# ./build.sh -m i386 tools
代码: 全选
# ./build.sh -u -m i386 tools
代码: 全选
===> Tools built to /usr/src/tooldir.NetBSD-5.1-i386
===> build.sh ended: Thu Sep 15 00:41:02 CDT 2011
===> Summary of results:
build.sh command: ./build.sh -u -m i386 tools
build.sh started: Thu Sep 15 00:39:21 CDT 2011
NetBSD version: 5.1_STABLE
MACHINE: i386
MACHINE_ARCH: i386
Build platform: NetBSD 5.1 i386
HOST_SH: /bin/sh
No /usr/src/tooldir.NetBSD-5.1-i386/bin/nbmake, needs building.
Bootstrapping nbmake
TOOLDIR path: /usr/src/tooldir.NetBSD-5.1-i386
DESTDIR path: /usr/src/destdir.i386
RELEASEDIR path: /usr/src/releasedir
Created /usr/src/tooldir.NetBSD-5.1-i386/bin/nbmake
makewrapper: /usr/src/tooldir.NetBSD-5.1-i386/bin/nbmake-i386
Updated /usr/src/tooldir.NetBSD-5.1-i386/bin/nbmake-i386
Tools built to /usr/src/tooldir.NetBSD-5.1-i386
build.sh ended: Thu Sep 15 00:41:02 CDT 2011
===> .
代码: 全选
# ls /usr/src/tooldir.NetBSD-5.1-i386/bin
i386--netbsdelf-addr2line i386--netbsdelf-size nbhost-mkdep nbnroff
i386--netbsdelf-ar i386--netbsdelf-strings nbindxbib nbpax
i386--netbsdelf-as i386--netbsdelf-strip nbinstall-info nbpaxctl
i386--netbsdelf-c++ nbasn1_compile nbinstallboot nbpic
i386--netbsdelf-c++filt nbatf-compile nbjoin nbpwd_mkdb
i386--netbsdelf-cpp nbawk nblex nbrefer
i386--netbsdelf-dbsym nbcap_mkdb nblorder nbrpcgen
i386--netbsdelf-fdisk nbcat nbm4 nbsed
i386--netbsdelf-g++ nbcksum nbmake nbsoelim
i386--netbsdelf-gcc nbcompile_et nbmake-i386 nbstat
i386--netbsdelf-gcc-4.1.3 nbconfig nbmakefs nbstrfile
i386--netbsdelf-gccbug nbcrunchgen nbmakeinfo nbsunlabel
i386--netbsdelf-gcov nbctags nbmakewhatis nbtbl
i386--netbsdelf-install nbdb nbmenuc nbtexi2dvi
i386--netbsdelf-ld nbdisklabel-i386 nbmkcsmapper nbtexi2pdf
i386--netbsdelf-lint nbeqn nbmkdep nbtexindex
i386--netbsdelf-mdsetimage nbfile nbmkesdb nbtsort
i386--netbsdelf-nm nbgenassym nbmklocale nbuudecode
i386--netbsdelf-objcopy nbgencat nbmknod nbyacc
i386--netbsdelf-objdump nbgmake nbmktemp nbzic
i386--netbsdelf-ranlib nbgroff nbmsgc
i386--netbsdelf-readelf nbhexdump nbmtree
各人的平台需要不同,请自行优化和修建内核,这里只是示例,所以我们采用原有内核。
代码: 全选
# cd /usr/src/sys/arch/i386/conf
# cp GENERIC JIARUN
# vi JIARUN
# /usr/src/tooldir.NetBSD-5.1-i386/bin/nbconfig JIARUN
代码: 全选
# cd /usr/src
# ./build.sh -u -m i386 kernel=JIARUN
代码: 全选
===> Kernels built from JIARUN:
/usr/src/sys/arch/i386/compile/obj/JIARUN/netbsd
===> build.sh ended: Thu Sep 15 01:34:17 CDT 2011
===> Summary of results:
build.sh command: ./build.sh -u -m i386 kernel=JIARUN
build.sh started: Thu Sep 15 01:07:49 CDT 2011
NetBSD version: 5.1_STABLE
MACHINE: i386
MACHINE_ARCH: i386
Build platform: NetBSD 5.1 i386
HOST_SH: /bin/sh
TOOLDIR path: /usr/src/tooldir.NetBSD-5.1-i386
DESTDIR path: /usr/src/destdir.i386
RELEASEDIR path: /usr/src/releasedir
makewrapper: /usr/src/tooldir.NetBSD-5.1-i386/bin/nbmake-i386
Updated /usr/src/tooldir.NetBSD-5.1-i386/bin/nbmake-i386
Building kernel without building new tools
Building kernel: JIARUN
Build directory: /usr/src/sys/arch/i386/compile/obj/JIARUN
Kernels built from JIARUN:
/usr/src/sys/arch/i386/compile/obj/JIARUN/netbsd
build.sh ended: Thu Sep 15 01:34:17 CDT 2011
===> .
然后将内核复制到 /,因为构建用户岛和发行版时可能会有到新内核,所以我重新启动了主机。
重启后,
8. 构建用户岛和创建发行版
代码: 全选
# ./build.sh -u -m i386 release
....
===> Summary of results:
build.sh command: ./build.sh -u -m i386 release
build.sh started: Fri Sep 16 08:14:48 CDT 2011
NetBSD version: 5.1_STABLE
MACHINE: i386
MACHINE_ARCH: i386
Build platform: NetBSD 5.1_STABLE i386
HOST_SH: /bin/sh
No /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386/bin/nbmake, needs building.
Bootstrapping nbmake
TOOLDIR path: /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386
DESTDIR path: /usr/src/obj/destdir.i386
RELEASEDIR path: /usr/src/obj/releasedir
Created /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386/bin/nbmake
makewrapper: /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386/bin/nbmake-i386
Updated /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386/bin/nbmake-i386
Successful make release
build.sh ended: Fri Sep 16 16:20:37 CDT 2011
===> .
代码: 全选
# ./build.sh -x -u -m i386 release
......
===> Summary of results:
build.sh command: ./build.sh -x -u -m i386 release
build.sh started: Fri Sep 16 16:27:56 CDT 2011
NetBSD version: 5.1_STABLE
MACHINE: i386
MACHINE_ARCH: i386
Build platform: NetBSD 5.1_STABLE i386
HOST_SH: /bin/sh
TOOLDIR path: /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386
DESTDIR path: /usr/src/obj/destdir.i386
RELEASEDIR path: /usr/src/obj/releasedir
makewrapper: /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386/bin/nbmake-i386
Updated /usr/src/obj/tooldir.NetBSD-5.1_STABLE-i386/bin/nbmake-i386
Successful make release
build.sh ended: Fri Sep 16 19:20:22 CDT 2011
===> .
详细说明请参看:http://www.gobsd.org/thread2624.html