Howto build amd64-fbsd stages from x86-fbsd stages (8.0)

Note

This page is old. Please see How to make a new stage file.

Minimal Hardware Requirements

CPU
Any AMD64 CPU or EM64T CPU
Memory
512MB + 512MB (SWAP)
Diskspace
10 GB for /

Howto

You also use copy and paste, stages can be made easily. Now let's cook.

vanilla FreeBSD 8.0 is here. ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/ISO-IMAGES/8.0/8.0-RELEASE-amd64-disc1.iso

  1. Install Vanilla FreeBSD 8.0-RELEASE(AMD64) with base, kernels, lib32, and src ALL.
  2. kldload nullfs
  3. mkdir -p /mnt/gentoo
  4. cd /mnt/gentoo
  5. fetch http://dev.gentoo.org/~the_paya/8.0/stage3-i686-freebsd-8.0.tar.bz2
  6. fetch http://dev.gentoo.gr.jp/~nigoro/amd64-fbsd/files/portage-20110506.tar.bz2
  7. fetch -o 8.0-overlay.tar.bz2 http://dev.gentoo.gr.jp/~nigoro/amd64-fbsd/files/8.0-overlay-20110601.tar.bz2
  8. tar xpjf stage3-i686-freebsd-8.0.tar.bz2
  9. tar xpjf portage-20110506.tar.bz2 -C /mnt/gentoo/usr
  10. mkdir -p /mnt/gentoo/usr/portage/distfiles
  11. tar xpjf 8.0-overlay.tar.bz2 -C /mnt/gentoo/usr/local
  12. cp /etc/resolv.conf /mnt/gentoo/etc
  13. mount -t devfs devfs /mnt/gentoo/dev
  14. mount_nullfs /proc /mnt/gentoo/proc
  15. chroot /mnt/gentoo /bin/bash
  16. USE="-git" emerge catalyst
  17. emerge pkgconfig
  18. emerge --nodeps '<automake-1.10'
  19. cd /usr/bin
  20. rm addr2line ar as c++filt gprof ld nm objcopy objdump ranlib readelf size strings strip
  21. exit
  22. cd /tmp
  23. fetch ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.1-release/Latest/mpfr.tbz
  24. fetch ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.1-release/Latest/libffi.tbz
  25. fetch ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.1-release/Latest/pkg-config.tbz
  26. fetch ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.1-release/Latest/gmp.tbz
  27. fetch ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.1-release/devel/mpc-0.8.2.tbz
  28. pkg_add pkg-config.tbz gmp.tbz mpfr.tbz libffi.tbz mpc-0.8.2.tbz
  29. mv /mnt/gentoo/lib /mnt/gentoo/lib32
  30. mv /mnt/gentoo/usr/lib /mnt/gentoo/usr/lib32
  31. mkdir /mnt/gentoo/lib64 /mnt/gentoo/usr/lib64
  32. ln -s lib64 /mnt/gentoo/lib
  33. ln -s lib64 /mnt/gentoo/usr/lib
  34. cp -a /lib/* /mnt/gentoo/lib64
  35. cp -a /usr/lib/* /mnt/gentoo/usr/lib64
  36. chflags noschg /mnt/gentoo/libexec/*
  37. cp -a /libexec/* /mnt/gentoo/libexec/
  38. chflags noschg /mnt/gentoo/usr/bin/*
  39. cp -a /usr/bin/* /mnt/gentoo/usr/bin
  40. cp -a /usr/include/* /mnt/gentoo/usr/include/
  41. cp -a /usr/local/lib/* /mnt/gentoo/usr/lib
  42. cp -a /usr/local/include/* /mnt/gentoo/usr/include
  43. cp -a /usr/local/bin/* /mnt/gentoo/usr/bin
  44. cp -a /usr/local/libdata /mnt/gentoo/usr/local
  45. cp -a /usr/libexec/* /mnt/gentoo/usr/libexec/
  46. chroot /mnt/gentoo /bin/bash
  47. cd /usr/lib64
  48. ln -s ../lib32/portage .
  49. ln -s ../lib32/python* .
  50. ln -s ../lib32/perl5 .
  51. cp -a /usr/local/portage/profiles /usr/portage
  52. cd /etc
  53. rm make.profile
  54. ln -s ../usr/portage/profiles/default/bsd/fbsd/amd64/8.0 make.profile
  55. mkdir /etc/portage
  56. cp -a /usr/local/portage/etc/portage/* /etc/portage
  57. gsed -i 's:CFLAGS=.*:CFLAGS="-O2 -pipe":g' /etc/make.conf
  58. gsed -i 's:CXXFLAGS=.*:CXXFLAGS="-O2 -pipe":g' /etc/make.conf
  59. gsed -i 's:CHOST=.*:CHOST="x86_64-gentoo-freebsd8.0":g' /etc/make.conf
  60. echo 'PORTDIR_OVERLAY="/usr/local/portage"' >> /etc/make.conf
  61. gsed -i 's:/usr/local:/usr:g' /usr/local/libdata/pkgconfig/libffi.pc
  62. gsed -i 's:/usr/local/lib:/usr/lib:g' /usr/lib/libgmp.la /usr/lib/libmpfr.la
  63. emerge -1 --nodeps portage sys-devel/autoconf-wrapper sys-devel/automake-wrapper sys-freebsd/freebsd-mk-defs
  64. ACCEPT_KEYWORDS=amd64 emerge -1 --nodeps =catalyst-2.0.6.915
  65. gsed -i 's:virtual/portage:sys-apps/portage:g' /usr/lib/catalyst/targets/support/chroot-functions.sh
  66. mkdir /64ul
  67. ROOT=/64ul USE="-* build" emerge -1 --nodeps baselayout
  68. cd /lib64
  69. ln -s /64ul/lib64/libiconv.so .
  70. ln -s /64ul/lib64/libiconv.so.7 .
  71. ln -s /64ul/lib64/libintl.so . ; ln -s /64ul/lib64/libintl.so.9 .
  72. ln -s /64ul/usr/lib64/libxml2.a /usr/lib64 ; ln -s /64ul/usr/lib64/libxml2.la /usr/lib64 ; ln -s /64ul/usr/lib64/libxml2.so /usr/lib64 ; ln -s /64ul/usr/lib64/libxml2.so.2 /usr/lib64
  73. ROOT=/64ul USE="-* build" emerge -q1 --newuse --nodeps sys-libs/ncurses app-arch/bzip2 dev-libs/gmp sys-process/cronbase dev-libs/libiconv sys-apps/sed sys-devel/gcc-config dev-libs/expat app-misc/pax-utils dev-libs/popt sys-devel/binutils-config dev-libs/libffi net-mail/mailbase sys-apps/grep sys-devel/patch sys-devel/flex app-arch/gzip sys-apps/gawk sys-devel/make net-misc/wget sys-apps/diffutils sys-devel/gnuconfig dev-libs/libedit virtual/libffi virtual/libiconv app-shells/bash app-editors/nano dev-libs/mpfr dev-libs/libelf net-libs/libpcap sys-apps/ed sys-libs/readline sys-devel/m4 mail-mta/ssmtp sys-devel/binutils sys-apps/texinfo net-misc/rsync sys-apps/less sys-process/vixie-cron sys-devel/bison virtual/editor sys-devel/gcc sys-freebsd/freebsd-lib sys-freebsd/freebsd-contrib sys-freebsd/freebsd-libexec sys-freebsd/freebsd-bin sys-process/fuser-bsd sys-freebsd/freebsd-sbin virtual/init sys-apps/baselayout sys-apps/openrc sys-freebsd/freebsd-usbin sys-apps/debianutils sys-auth/openpam sys-freebsd/freebsd-pam-modules sys-auth/pambase sys-freebsd/freebsd-ubin dev-libs/openssl app-misc/ca-certificates sys-devel/libperl dev-lang/perl app-admin/perl-cleaner sys-apps/file app-admin/eselect app-admin/eselect-python dev-libs/libxml2 app-arch/libarchive sys-devel/gettext virtual/libintl dev-lang/python '<dev-lang/python-3' sys-apps/portage app-admin/python-updater dev-libs/mpc
  74. cp -p /etc/make.conf /64ul/etc
  75. cp -p /etc/resolv.conf /64ul/etc
  76. cd /64ul/lib64
  77. ln -s libncurses.so.5 libncurses.so.8
  78. cp /lib/libz.so.5 libz.so.5
  79. ln -s libedit.so.0 libedit.so.7
  80. ln -s libbz2.so.1 libbz2.so.4
  81. ln -s libiconv.so libiconv.so.3
  82. cd /64ul/usr/lib64
  83. ln -s libcrypto.so libcrypto.so.6
  84. mkdir -p /64ul/dev /64ul/usr/portage
  85. mount -t devfs devfs /64ul/dev
  86. mount_nullfs /proc /64ul/proc
  87. mount_nullfs /usr/portage /64ul/usr/portage
  88. cp -a /usr/local/portage /64ul/usr/local
  89. cp -a /usr/lib64 /tmp/lib64-new
  90. find /tmp/lib64-new -type l -delete
  91. find /tmp/lib64-new -name "*a" -delete
  92. cp -a /tmp/lib64-new/* /64ul/usr/lib64
  93. chroot /64ul /bin/bash
  94. gcc-config 1
  95. binutils-config 1
  96. gsed -i 's:elf64-x86-64:elf64-x86-64-freebsd:g' /usr/lib/libc.so
  97. ln -s /usr/portage/profiles/default/bsd/fbsd/amd64/8.0 /etc/make.profile
  98. cp -a /usr/local/portage/etc/portage /etc
  99. CFLAGS="-O2 -pipe -fPIC" CXXFLAGS="-O2 -pipe -fPIC" USE="-* build" emerge sys-libs/zlib ncurses libiconv gettext app-arch/xz-utils
  100. CFLAGS="-O2 -pipe -fPIC" CXXFLAGS="-O2 -pipe -fPIC" emerge bzip2 libarchive sys-devel/flex binutils
  101. CFLAGS="-O2 -pipe -fPIC" CXXFLAGS="-O2 -pipe -fPIC" emerge sys-freebsd/freebsd-lib
  102. CFLAGS="-O2 -pipe -fPIC" CXXFLAGS="-O2 -pipe -fPIC" emerge gcc
  103. CFLAGS="-O2 -pipe -fPIC" CXXFLAGS="-O2 -pipe -fPIC" emerge -qe world ; while true; do emerge --skipfirst && break; done
  104. emerge boot0
  105. etc-update
  106. emerge sys-devel/flex
  107. gcc-config 1
  108. binutils-config 1
  109. rm -rf /usr/local/portage
  110. rm /etc/resolv.conf
  111. exit
  112. umount /64ul/dev /64ul/usr/portage /64ul/proc
  113. mkdir -p /var/tmp/catalyst/builds/default
  114. cp -a /64ul/bin/bsdtar /bin
  115. cp /64ul/lib64/libarchive* /lib64
  116. cp /64ul/lib64/libz* /lib64
  117. cp -v /64ul/usr/lib64/liblzma* /usr/lib64
  118. cp -v /64ul/lib64/libbz2* /lib64
  119. cp -v /64ul/usr/lib64/libcrypto* /usr/lib64
  120. ACCEPT_KEYWORDS="~x86-fbsd" emerge app-arch/tar
  121. mv /bin/tar /bin/tar.orig ; ln -s gtar /bin/tar
  122. cd /64ul
  123. tar cjpf /var/tmp/catalyst/builds/default/stage3-amd64-fbsd-exp-tmp-tmp.tar.bz2 .
  124. cd /usr/bin
  125. mv python python.orig
  126. ln -s python2 python
  127. catalyst -C target=snapshot version_stamp=fbsd-amd64-exp
  128. catalyst -C target=stage1 version_stamp=fbsd-exp-tmp profile=default/bsd/fbsd/amd64/8.0 snapshot=fbsd-amd64-exp source_subpath=default/stage3-amd64-fbsd-exp-tmp-tmp subarch=amd64 rel_type=default portage_confdir=/usr/local/portage/etc/portage portage_overlay=/usr/local/portage chost=x86_64-gentoo-freebsd8.0
  129. rm /bin/tar ; mv /bin/tar.orig /bin/tar
  130. catalyst -C target=stage2 version_stamp=fbsd-exp-tmp profile=default/bsd/fbsd/amd64/8.0 snapshot=fbsd-amd64-exp source_subpath=default/stage1-amd64-fbsd-exp-tmp subarch=amd64 rel_type=default portage_confdir=/usr/local/portage/etc/portage portage_overlay=/usr/local/portage chost=x86_64-gentoo-freebsd8.0
  131. ln -s /usr/lib64/gcc/x86_64-gentoo-freebsd8.0/4.5.2/libstdc++.so.6 /var/tmp/catalyst/tmp/default/stage2-amd64-fbsd-exp-tmp/usr/lib64
  132. catalyst -C target=stage3 version_stamp=fbsd-exp-tmp profile=default/bsd/fbsd/amd64/8.0 snapshot=fbsd-amd64-exp source_subpath=default/stage2-amd64-fbsd-exp-tmp subarch=amd64 rel_type=default portage_confdir=/usr/local/portage/etc/portage portage_overlay=/usr/local/portage
  133. mv /bin/tar /bin/tar.orig ; ln -s gtar /bin/tar
  134. catalyst -C target=stage1 version_stamp=fbsd-exp profile=default/bsd/fbsd/amd64/8.0 snapshot=fbsd-amd64-exp source_subpath=default/stage3-amd64-fbsd-exp-tmp subarch=amd64 rel_type=default portage_confdir=/usr/local/portage/etc/portage portage_overlay=/usr/local/portage chost=x86_64-gentoo-freebsd8.0
  135. rm /bin/tar ; mv /bin/tar.orig /bin/tar
  136. catalyst -C target=stage2 version_stamp=fbsd-exp profile=default/bsd/fbsd/amd64/8.0 snapshot=fbsd-amd64-exp source_subpath=default/stage1-amd64-fbsd-exp subarch=amd64 rel_type=default portage_confdir=/usr/local/portage/etc/portage portage_overlay=/usr/local/portage chost=x86_64-gentoo-freebsd8.0
  137. catalyst -C target=stage3 version_stamp=fbsd-exp profile=default/bsd/fbsd/amd64/8.0 snapshot=fbsd-amd64-exp source_subpath=default/stage2-amd64-fbsd-exp subarch=amd64 rel_type=default portage_confdir=/usr/local/portage/etc/portage portage_overlay=/usr/local/portage
  138. ls /var/tmp/catalyst/builds/default/stage*-exp.tar.bz2*
  139. finish!
# ls /var/tmp/catalyst/builds/default/stage*-exp.tar.bz2*
/var/tmp/catalyst/builds/default/stage1-amd64-fbsd-exp.tar.bz2
/var/tmp/catalyst/builds/default/stage1-amd64-fbsd-exp.tar.bz2.CONTENTS
/var/tmp/catalyst/builds/default/stage1-amd64-fbsd-exp.tar.bz2.DIGESTS
/var/tmp/catalyst/builds/default/stage2-amd64-fbsd-exp.tar.bz2
/var/tmp/catalyst/builds/default/stage2-amd64-fbsd-exp.tar.bz2.CONTENTS
/var/tmp/catalyst/builds/default/stage2-amd64-fbsd-exp.tar.bz2.DIGESTS
/var/tmp/catalyst/builds/default/stage3-amd64-fbsd-exp.tar.bz2
/var/tmp/catalyst/builds/default/stage3-amd64-fbsd-exp.tar.bz2.CONTENTS
/var/tmp/catalyst/builds/default/stage3-amd64-fbsd-exp.tar.bz2.DIGESTS

Unofficial portage tree for Gentoo/FreeBSD AMD64

There is an experimental overlay tree for Gentoo/FreeBSD AMD64 on github.

Contact

Issues page on Github
https://github.com/nigoro/amd64-fbsd/issues
IRC
nigoro @ freenode

INDEX