Success with i386 jails on amd64

Dmitry Marakasov amdmi3 at
Wed Jun 4 08:46:55 EDT 2008


I think this may be of interest to tinderbox users - I have hacked
tinderbox to make i386 jails work on amd64.

The mandatory prerequisites to make i386 jails work on amd64 are:

1) Use `-a i386' (iirc, maybe -A, see docs) argument for ./tc createJail

2) Add ${tb}/scripts/etc/env/build.${buildname} with following contents:
export ARCH=i386
export MACHINE_ARCH=i386

(I'm using tinderbox from CVS, and on older versions that was
${tb}/builds/${buildname}/env instead, iirc)

3) Add /libexec/ as a symlink to /libexec/

(note that you can't just do this in ${tb}/${buildname}, as it will be
rewritten by unpacking jail tarball on the next tinderbuild, so it's
best to do it from tinderbox script - see patch below)

After this done, you'll be able to build packages in i386 jail, but some
ports still fail (qt4, for example). I've solved this with such dirty
trick: I've changed /usr/bin/uname and /sbin/sysctl to wrapper scripts that
call real binaries piped through sed -e 's|amd64|i386|g'. Now qt4 builds
without problems, and other `clever' ports that use sysctl/uname/other
stuff to determine machine architecture should as well.

As you should understand, this doesn't guarantee all ports to build
without problems, and this can even break other ports and resulting
packages, but I see it as a nice option to have all-in-one tinderbox
for both archs on a single powerful amd64 server. For testing my own
ports its perfectly suitable. Some more testing of this hack will
of course be useful.

And here's the patch thad modifies i386 jails as described.
Please note that i386 jails are detected by `i386' in their names.

--- begins here ---
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/,v
retrieving revision 1.68
diff -u -r1.68
---	3 Jun 2008 02:33:01 -0000	1.68
+++	4 Jun 2008 12:32:51 -0000
@@ -899,6 +899,14 @@
+wrapFile () {
+    cp $1 $1.orig
+    cat > $1 << _END
+\$0.orig \$@ | sed -e 's|amd64|i386|g'
 makeBuild () {
     # set up defaults
@@ -952,6 +960,12 @@
     echo "makeBuild: extracting jail tarball"
     tar -C ${BUILD_DIR} -xpf ${JAIL_TARBALL}
+    if echo ${jailName} | grep -q i386; then
+        ln -s ${BUILD_DIR}/libexec/
+        wrapFile ${BUILD_DIR}/usr/bin/uname
+        wrapFile ${BUILD_DIR}/sbin/sysctl
+    fi
     execute_hook "postBuildExtract" "BUILD=${buildName} DESTDIR=${BUILD_DIR} JAIL=${jailName} PB=${pb} RC=0"
     # Finalize environment
--- ends here ---

Dmitry A. Marakasov    | jabber: amdmi3 at
amdmi3 at       |

More information about the tinderbox-list mailing list