From 76ba6075ac52e325c5668f6a9067ebe9323fa299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Sat, 29 Aug 2015 18:11:11 +0100 Subject: [PATCH 1/3] setup: add cross compiling machine Currently supports Raspberry Pi 1. Based on Ubuntu 14.04. --- setup/ansible-inventory | 3 + setup/cross-compiler/README.md | 19 +++++ setup/cross-compiler/ansible-playbook.yaml | 83 ++++++++++++++++++++ setup/cross-compiler/ansible-vars.yaml | 17 ++++ setup/cross-compiler/host_vars/.gitignore | 2 + setup/cross-compiler/resources/set-rpi-cc.sh | 2 + 6 files changed, 126 insertions(+) create mode 100644 setup/cross-compiler/README.md create mode 100644 setup/cross-compiler/ansible-playbook.yaml create mode 100644 setup/cross-compiler/ansible-vars.yaml create mode 100644 setup/cross-compiler/host_vars/.gitignore create mode 100644 setup/cross-compiler/resources/set-rpi-cc.sh diff --git a/setup/ansible-inventory b/setup/ansible-inventory index 878b64149..6c0e7ecb6 100644 --- a/setup/ansible-inventory +++ b/setup/ansible-inventory @@ -70,6 +70,9 @@ iojs-ns-pi2-3 iojs-ns-pi2-4 iojs-ns-pi2-5 +[nodejs-cross-compiler] +node-msft-cross-compiler-1.cloudapp.net + [iojs-www] iojs-www diff --git a/setup/cross-compiler/README.md b/setup/cross-compiler/README.md new file mode 100644 index 000000000..311068ec2 --- /dev/null +++ b/setup/cross-compiler/README.md @@ -0,0 +1,19 @@ +# Node.js Build Cross Compiler Setup + +For setting up a Ubuntu 14.04 box as a cross compiler. Current setup includes Raspberry Pi. + +```text +Host node-msft-cross-compiler-1.cloudapp.net + HostName node-msft-cross-compiler-1.cloudapp.net + User root +``` + +Note that these hostnames are also used in the *ansible-inventory* file. The IP addresses will need to be updated each time the servers are reprovisioned. + +To set up a host, run: + +```text +$ ansible-playbook -i ../ansible-inventory ansible-playbook.yaml +``` + +**Users**: The ansible-vars.yaml file contains a list of users who's GitHub public keys are pulled and placed into authorized_keys for both root and iojs users. This file should be updates when new users are added to the build project who are able to help maintain the containerized builds. diff --git a/setup/cross-compiler/ansible-playbook.yaml b/setup/cross-compiler/ansible-playbook.yaml new file mode 100644 index 000000000..2ac278bee --- /dev/null +++ b/setup/cross-compiler/ansible-playbook.yaml @@ -0,0 +1,83 @@ +--- +- hosts: nodejs-cross-compiler + + remote_user: azureuser + sudo: yes + + tasks: + + - include_vars: ansible-vars.yaml + tags: vars + + - name: General | Install updated git PPA + apt_repository: repo='ppa:git-core/ppa' + tags: general + + - name: General | APT Update + apt: update_cache=yes + tags: general + + - name: General | APT Upgrade + apt: upgrade=full + tags: general + + - name: General | Install required packages + apt: name={{ item }} update_cache=yes state=latest + with_items: packages + tags: general + + - name: General | Increase file descriptor limits + lineinfile: dest=/etc/security/limits.conf line="{{ item }}" + with_items: + - "* hard nofile 500000" + - "* soft nofile 500000" + - "root hard nofile 500000" + - "root soft nofile 500000" + tags: general + + - include: ../ansible-tasks/ccache.yaml version=3.2.3 + tags: ccache + + - name: User | Add {{ server_user }} user + user: name="{{ server_user }}" shell=/bin/bash + tags: user + + - name: Raspberry | Clone raspberry tools repository + git: repo=https://github.com/raspberrypi/tools.git dest=/opt/raspberrypi/tools + tags: raspberry + + - name: Raspberry | Copy set-rpi-cc.sh script + copy: src=./resources/set-rpi-cc.sh dest=/opt/raspberrypi/set-rpi-cc.sh mode=0755 + tags: raspberry + + - name: User | Download pubkey(s) + get_url: url=https://github.com/{{ item }}.keys dest=/tmp/{{ item }}.keys + delegate_to: 127.0.0.1 + become: no + with_items: ssh_users + tags: user + + - name: General | Create authorized_keys for root + authorized_key: user="root" key="{{ lookup('file', '/tmp/' + item + '.keys') }}" + with_items: ssh_users + tags: user + + - name: General | Create authorized_keys for azureuser + authorized_key: user="azureuser" key="{{ lookup('file', '/tmp/' + item + '.keys') }}" + with_items: ssh_users + tags: user + + - name: General | Create authorized_keys for {{ server_user }} + authorized_key: user="{{ server_user }}" key="{{ lookup('file', '/tmp/' + item + '.keys') }}" + with_items: ssh_users + tags: user + + - name: User | Download Jenkins pubkey + get_url: url=https://gist.githubusercontent.com/nodejs-ci/cea606894437b45e99d0/raw/ci-iojs-org-id_rsa-slaves.pub dest=/tmp/nodejs-ci.keys + delegate_to: 127.0.0.1 + become: no + tags: user + + - name: General | Add Jenkins to authorized_keys for {{ server_user }} + authorized_key: user="{{ server_user }}" key="{{ lookup('file', '/tmp/nodejs-ci.keys') }}" + tags: user diff --git a/setup/cross-compiler/ansible-vars.yaml b/setup/cross-compiler/ansible-vars.yaml new file mode 100644 index 000000000..ea59f7801 --- /dev/null +++ b/setup/cross-compiler/ansible-vars.yaml @@ -0,0 +1,17 @@ +--- +server_user: iojs +ssh_users: + - rvagg + - jbergstroem + - joaocgreis + - orangemocha +packages: + - openjdk-7-jre + - git + - build-essential + - python-all + - python-software-properties + - automake + - libtool + - curl + - monit diff --git a/setup/cross-compiler/host_vars/.gitignore b/setup/cross-compiler/host_vars/.gitignore new file mode 100644 index 000000000..e75f53c17 --- /dev/null +++ b/setup/cross-compiler/host_vars/.gitignore @@ -0,0 +1,2 @@ +iojs-build-* +nodejs-* diff --git a/setup/cross-compiler/resources/set-rpi-cc.sh b/setup/cross-compiler/resources/set-rpi-cc.sh new file mode 100644 index 000000000..2630b8d34 --- /dev/null +++ b/setup/cross-compiler/resources/set-rpi-cc.sh @@ -0,0 +1,2 @@ +export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc" +export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++" From d58b39e1d2e767f02bf6d6f4a7a6eeb7d22779b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Sat, 23 Apr 2016 17:37:16 +0100 Subject: [PATCH 2/3] host compiler needs to be 32 bit (-m32) Because of v8: deps/v8/src/base/build_config.h:156:2: error: #error Target architecture arm is only supported on arm and ia32 host --- setup/cross-compiler/ansible-vars.yaml | 2 ++ setup/cross-compiler/resources/set-rpi-cc.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/setup/cross-compiler/ansible-vars.yaml b/setup/cross-compiler/ansible-vars.yaml index ea59f7801..551d16479 100644 --- a/setup/cross-compiler/ansible-vars.yaml +++ b/setup/cross-compiler/ansible-vars.yaml @@ -9,6 +9,8 @@ packages: - openjdk-7-jre - git - build-essential + - gcc-multilib + - g++-multilib - python-all - python-software-properties - automake diff --git a/setup/cross-compiler/resources/set-rpi-cc.sh b/setup/cross-compiler/resources/set-rpi-cc.sh index 2630b8d34..a0142d9bd 100644 --- a/setup/cross-compiler/resources/set-rpi-cc.sh +++ b/setup/cross-compiler/resources/set-rpi-cc.sh @@ -1,2 +1,4 @@ +export CC_host='ccache gcc -m32' +export CXX_host='ccache g++ -m32' export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc" export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++" From 67de51ae053315d250d88d94fb4345fa88291fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Tue, 26 Apr 2016 12:35:44 +0100 Subject: [PATCH 3/3] support armv6 and armv7 --- setup/cross-compiler/ansible-playbook.yaml | 8 ++++++-- .../resources/{set-rpi-cc.sh => cc-armv6.sh} | 4 ++-- setup/cross-compiler/resources/cc-armv7.sh | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) rename setup/cross-compiler/resources/{set-rpi-cc.sh => cc-armv6.sh} (55%) mode change 100644 => 100755 create mode 100755 setup/cross-compiler/resources/cc-armv7.sh diff --git a/setup/cross-compiler/ansible-playbook.yaml b/setup/cross-compiler/ansible-playbook.yaml index 2ac278bee..33592c341 100644 --- a/setup/cross-compiler/ansible-playbook.yaml +++ b/setup/cross-compiler/ansible-playbook.yaml @@ -46,8 +46,12 @@ git: repo=https://github.com/raspberrypi/tools.git dest=/opt/raspberrypi/tools tags: raspberry - - name: Raspberry | Copy set-rpi-cc.sh script - copy: src=./resources/set-rpi-cc.sh dest=/opt/raspberrypi/set-rpi-cc.sh mode=0755 + - name: Raspberry | Copy cc-armv6.sh script + copy: src=./resources/cc-armv6.sh dest=/opt/raspberrypi/cc-armv6.sh mode=0755 + tags: raspberry + + - name: Raspberry | Copy cc-armv7.sh script + copy: src=./resources/cc-armv7.sh dest=/opt/raspberrypi/cc-armv7.sh mode=0755 tags: raspberry - name: User | Download pubkey(s) diff --git a/setup/cross-compiler/resources/set-rpi-cc.sh b/setup/cross-compiler/resources/cc-armv6.sh old mode 100644 new mode 100755 similarity index 55% rename from setup/cross-compiler/resources/set-rpi-cc.sh rename to setup/cross-compiler/resources/cc-armv6.sh index a0142d9bd..1b531f991 --- a/setup/cross-compiler/resources/set-rpi-cc.sh +++ b/setup/cross-compiler/resources/cc-armv6.sh @@ -1,4 +1,4 @@ export CC_host='ccache gcc -m32' export CXX_host='ccache g++ -m32' -export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc" -export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++" +export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc -march=armv6zk" +export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -march=armv6zk" diff --git a/setup/cross-compiler/resources/cc-armv7.sh b/setup/cross-compiler/resources/cc-armv7.sh new file mode 100755 index 000000000..c3d785e9d --- /dev/null +++ b/setup/cross-compiler/resources/cc-armv7.sh @@ -0,0 +1,4 @@ +export CC_host='ccache gcc -m32' +export CXX_host='ccache g++ -m32' +export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc -march=armv7-a" +export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -march=armv7-a"