Q: Why incorrectly?
A: Because configure script will thought what software will be built for host system, not for target. (for i386 instead of armeb)
Since we still can't cross compile FreeBSD ports, everyone use own workaround for that. So I decide to write my own notes to help some folks who don't yet have own workaround for that.
1. Toolchain
At first we need cross toolchain for building, there is many ways to do it, but I use this:
TARGET=arm
TARGET_ARCH=armeb
SRC_TREE=/usr/src
cd ${SRC_TREE}
make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} TARGET_CPUARCH=${TARGET} toolchain
When toolchain build done you will have toolchain binary (cc,cpp,gcc etc.) in directory:
/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin
2. Port dependency
Change dir to desire port, and get two lists of dependencies:
> cd /usr/ports/security/openvpn
> make run-depends-list
/usr/ports/archivers/lzo2
> make build-depends-list
/usr/ports/archivers/lzo2
/usr/ports/archivers/xz
Remove ports that exist in run-depends-list from build-depends-list, and you will get:
Install ports from build-depends-list. Then for every ports in run-depends-list run:
lzo2 which is dependency for openvpn have test target in port Makefile, so we need to comment out that requirement, because we can't run those binary's (you remember, we do compilation for system with different CPU). To do so we need remove target post-build from Makefile:
That for example only, because last commit add checking of variable WITHOUT_CHECKS. So we need only define WITHOUT_CHECKS to avoid those tests.
A: Because configure script will thought what software will be built for host system, not for target. (for i386 instead of armeb)
Since we still can't cross compile FreeBSD ports, everyone use own workaround for that. So I decide to write my own notes to help some folks who don't yet have own workaround for that.
1. Toolchain
At first we need cross toolchain for building, there is many ways to do it, but I use this:
TARGET=arm
TARGET_ARCH=armeb
SRC_TREE=/usr/src
cd ${SRC_TREE}
make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} TARGET_CPUARCH=${TARGET} toolchain
When toolchain build done you will have toolchain binary (cc,cpp,gcc etc.) in directory:
/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin
2. Port dependency
Change dir to desire port, and get two lists of dependencies:
> cd /usr/ports/security/openvpn
> make run-depends-list
/usr/ports/archivers/lzo2
> make build-depends-list
/usr/ports/archivers/lzo2
/usr/ports/archivers/xz
Remove ports that exist in run-depends-list from build-depends-list, and you will get:
- run-depends-list - list of ports that must be also cross-compiled.
- build-depends-list - list of ports that must be installed on build host to be able to build your desired port.
Install ports from build-depends-list. Then for every ports in run-depends-list run:
- make configure
- PATH=/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin:${PATH} make DESTDIR=${PATH_TO_TARGET_DEVICE_ROOTFS} install
lzo2 which is dependency for openvpn have test target in port Makefile, so we need to comment out that requirement, because we can't run those binary's (you remember, we do compilation for system with different CPU). To do so we need remove target post-build from Makefile:
post-build:
@${ECHO_MSG} "===> Running self-tests for ${PKGNAME} (can take a few minutes)"
@#: override MALLOC_OPTIONS, else tests take excessively long
cd ${WRKSRC} && ${SETENV} MALLOC_OPTIONS=jz ${MAKE} check test SHELL="${SH} -x"
That for example only, because last commit add checking of variable WITHOUT_CHECKS. So we need only define WITHOUT_CHECKS to avoid those tests.
- make configure
- PATH=/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin:${PATH} make WITHOUT_CHECKS=yes DESTDIR=${PATH_TO_TARGET_DEVICE_ROOTFS} install
Комментариев нет:
Отправить комментарий