Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2016 18:14:33 +0000
From:      Poul-Henning Kamp <phk@phk.freebsd.dk>
To:        current@freebsd.org
Subject:   a dirty trick: i386 nanobsd ports on amd64
Message-ID:  <80831.1479665673@critter.freebsd.dk>

next in thread | raw e-mail | index | archive | help
I ran into a interesting problem, and want to share the solution, in
case anybody else can use it.

I'm upgrading a system which used to be i386 to amd64, but part of
its job is to compile i386 nanobsd images.

That's a solved problem, but I also needed a couple of ports installed,
which for reasons of paperwork, must be compiled from source.

Cross-compiling ports is not something I wanted to get into, but
happily amd64 cpus can run in i386 mode these days:

    phk_ports () (
        set -e
        cd ${NANO_WORLDDIR}
        mkdir -p usr/ports
        trap "umount ${NANO_WORLDDIR}/usr/ports ; umount ${NANO_WORLDDIR}/=
dev" 1 2 15 EXIT
        mount -t nullfs -o readonly /usr/ports ${NANO_WORLDDIR}/usr/ports
        mount -t devfs devfs ${NANO_WORLDDIR}/dev
        echo '
        ldconfig -elf
        for i in ports-mgmt/pkg sysutils/smartmontools net/trafshow
        do
                cd /usr/ports/${i}
                make \
                        WRKDIRPREFIX=3D/tmp \
                        BATCH=3DYES \
                        OPTIONS_UNSET=3D"DOCS NLS" \
                        all install clean
        done
        ' > ${NANO_WORLDDIR}/tmp/_job.sh
        chroot ${NANO_WORLDDIR} /bin/sh /tmp/_job.sh
        umount ${NANO_WORLDDIR}/usr/ports
        umount ${NANO_WORLDDIR}/dev
        trap - 1 2 15 EXIT
    )

    customize_cmd phk_ports

The same basic trick can of course be be used for any i386 software
which must be compiled from source.


-- =

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence=
.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?80831.1479665673>