When I try to build for Raspberry Pi2
, the option is raspi-2
, right?
$ gyp_cobalt raspi-2
$ ninja -C out/raspi-2_debug cobalt
When I try to build for Raspberry Pi2
, the option is raspi-2
, right?
$ gyp_cobalt raspi-2
$ ninja -C out/raspi-2_debug cobalt
There currently is no raspi-2 configuration, but the raspi-1 configuration will run on a Raspberry Pi Zero, 1, 2, and 3. It won't take advantage of the Neon instruction set available on a Raspberry Pi 2, but it will run. Both the Broadcom 2835 (RasPi 0,1) and 2836 (RasPi 2) are 32-bit ARM chips, so binaries compiled to a common subset of the instruction set should run on both devices.
Creating a raspi-2 configuration wouldn't be too difficult.
$ cd src/starboard/raspi
$ cp -R 1/ 2
And modify src/starboard/rapi/2/gyp_configuration.gypi and src/starboard/rapi/2/gyp_configuration.py to refer to 'raspi-2' where they refer to 'raspi-1'.
Then one could furthet modify gyp_configuration.gypi to pass in more appropriate compiler flags for a Raspberry Pi 2. One might also want to set these properties, to enable Neon assembly optimizations in libwebp:
'arm_version': 7,
'armv7': 1,
'arm_neon': 1,
Thanks. I put it all together.
$ cd ~/
$ git clone https://cobalt.googlesource.com/cobalt
$ cd cobalt/src/startboard/raspi
$ cp -R 1/ 2
$ cd 2/
$ vi gyp_configuration.gypi
Edit line 37-40 and change rasp-1 to rasp-2 at line 167-180.
# RasPi 2 is ARMv7
'arm_version': 7,
'armv7': 1,
'arm_neon': 1,
....
'default_configuration': 'raspi-2_debug',
'configurations': {
'raspi-2_debug': {
'inherit_from': ['debug_base'],
},
'raspi-2_devel': {
'inherit_from': ['devel_base'],
},
'raspi-2_qa': {
'inherit_from': ['qa_base'],
},
'raspi-2_gold': {
'inherit_from': ['gold_base'],
},
Then,
$ vi gyp_configuration.py
Edit line 14 and change rasp-1 to rasp-2 at line 25.
"""Starboard Raspberry Pi 2 platform configuration for gyp_cobalt."""
....
return _PlatformConfig('raspi-2')
Then, set $RASPI_HOME like the description of a manual.
$ export RASPI_HOME=~/raspi-tools
$ cd ~/cobalt/src/
$ cobalt/build/gyp_cobalt raspi-2
$ ls out/
./
../
raspi-2_debug/
raspi-2_devel/
raspi-2_gold/
raspi-2_qa/
$ ninja -C out/raspi-2_debug cobalt
But clang++ command is not found. And there is not llvm-build in the following path
cobalt/src/third_party/
Where is it ?