Begin with a baserock development system, probably x86_64, deployed on OpenStack (or elsewhere).
Read and follow the instruction on the quick start guide.
Create a cross bootstrap system:
vi /src/definitions/systems/cross-bootstrap-system-armv7bhf.morph
Add the following:
name: cross-bootstrap-system-armv7bhf
kind: system
description: A system that produces the minimum needed to build a devel system
arch: armv7bhf
strata:
- name: build-essential
morph: strata/build-essential.morph
- name: core
morph: strata/core.morph
- name: morph-utils
morph: strata/morph-utils.morph
- name: cross-bootstrap
morph: strata/cross-bootstrap.morph
Add support for armv7bhf:
sed -i 's/armv7b|armv7l|armv7lhf)/armv7b|armv7l|armv7lhf|armv7bhf)/g' /src/definitions/strata/build-essential/stage2-linux-api-headers.morph
sed -i "s/'armv7b', 'testarch'/'armv7b', 'armv7bhf','testarch'/g" /usr/lib/python2.7/site-packages/morphlib/__init__.py
sed -i "s/'armv7b', 'testarch'/'armv7b', 'armv7bhf','testarch'/g" /src/morph/morphlib/__init__.py
sed -i "s|return 'armv7lhf'|return 'armv7lhf'\n if machine == 'armv7b' and has_hardware_fp():\n return 'armv7bhf'|g" /src/morph/morphlib/util.py
Then run.
cd /src/definitions
git add systems/cross-bootstrap-system-armv7bhf.morph
git commit -a -m"Cross boostrap for armv7hf big endian"
rm -rf /src/cache/artifacts
morph cross-bootstrap armv7bhf file:///src/definitions HEAD systems/cross-bootstrap-system-armv7bhf.morph
Error during the cross boot:
config.status: executing depdir commands
mkdir .deps
make[1]: Leaving directory '/src/tmp/staging/tmpDFCdMZ/stage1-gcc.build/o'
Makefile:846: recipe for target 'all' failed
make: *** [all] Error 2
ERROR: In staging area /src/tmp/failed/tmpDFCdMZ: Command failed: sh -c '
# GCC is not passing the correct host/target flags to GMP'"'"'s configure
# script, which causes it to not use the machine-dependent code for
# the platform and use the generic one instead. However, the generic
# code results on an undefined reference to `__gmpn_invert_limb'"'"' in
# ARMv7. Fix the invocation of GMP'"'"'s configure script so that GMP can
# use the machine-dependent code.
case "$MORPH_ARCH" in
armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile
sed -i "s/--target=none/--target=armv7a/" o/Makefile ;;
esac
cd o && make
':
Containerisation settings: {'binds': (('/src/cache/ccache/gcc-tarball', '/src/tmp/staging/tmpDFCdMZ/tmp/ccache'),), 'mount_proc': False, 'mounts': [], 'writable_paths': ['/src/tmp/staging/tmpDFCdMZ/stage1-gcc.build', '/src/tmp/staging/tmpDFCdMZ/stage1-gcc.inst', '/tmp'], 'root': '/', 'cwd': '/src/tmp/staging/tmpDFCdMZ/stage1-gcc.build'}
This is due to a bug in gcc. A workaround was attempted, but didn't work. http://git.baserock.org/cgit/baserock/baserock/definitions.git/tree/strata/build-essential/stage1-gcc.morph#n72
The problem here could be that --host is incorrect when cross-building.
Possible fixing. See:
vi /src/definitions/strata/build-essential/stage1-gcc.morph
and perhaps add settings something like:
armv7bhf) ARCH_FLAGS="--with-arch=armv7-a \
--with-cpu=cortex-a9 \
--with-tune=cortex-a9 \
--with-fpu=vfpv3-d16 \
--with-float=hard" ;;
also search for where the --host option gets set.