From 97378908a7cd99e78798233936eb55248756bbb1 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Mon, 16 Apr 2018 21:01:03 +1000 Subject: [PATCH] ansible: refresh cross compiler, include new 4.9.4 toolchain & new selector script --- ansible/inventory.yml | 3 +- ansible/playbooks/create-cross-compiler.yml | 15 ----- ansible/playbooks/jenkins/worker/create.yml | 12 ++++ .../cross-compiler/files/cc-armv6-4.8.sh | 4 -- .../cross-compiler/files/cc-armv6-4.9.sh | 4 -- .../cross-compiler/files/cc-armv7-4.8.sh | 4 -- .../cross-compiler/files/cc-armv7-4.9.sh | 4 -- .../roles/cross-compiler/files/cc-selector.sh | 42 +++++++++++++ ansible/roles/cross-compiler/tasks/main.yml | 62 ++++++------------- ansible/roles/cross-compiler/vars/main.yml | 10 +-- 10 files changed, 77 insertions(+), 83 deletions(-) delete mode 100644 ansible/playbooks/create-cross-compiler.yml delete mode 100755 ansible/roles/cross-compiler/files/cc-armv6-4.8.sh delete mode 100755 ansible/roles/cross-compiler/files/cc-armv6-4.9.sh delete mode 100755 ansible/roles/cross-compiler/files/cc-armv7-4.8.sh delete mode 100755 ansible/roles/cross-compiler/files/cc-armv7-4.9.sh create mode 100755 ansible/roles/cross-compiler/files/cc-selector.sh diff --git a/ansible/inventory.yml b/ansible/inventory.yml index b2ee2303d..c41a87a65 100644 --- a/ansible/inventory.yml +++ b/ansible/inventory.yml @@ -33,10 +33,10 @@ hosts: centos6-x86-1: {ip: 162.243.248.28} - joyent: - smartos13-x64-1: {ip: 72.2.114.225} smartos14-x64-1: {ip: 72.2.113.193} smartos15-x64-1: {ip: 165.225.131.14} smartos17-x64-1: {ip: 72.2.114.225} + ubuntu1604_arm_cross-x64-1: {ip: 72.2.114.100, user: ubuntu} - requireio: rvagg-debian9-armv6l_pi1p-1: {ip: 192.168.2.40, user: pi} @@ -118,6 +118,7 @@ hosts: ubuntu1604_docker-x64-1: {ip: 165.225.138.30, user: ubuntu} ubuntu1710-x64-1: {ip: 37.153.110.33, user: ubuntu} ubuntu1710-x64-2: {ip: 8.19.32.121, user: ubuntu} + ubuntu1604_arm_cross-x64-1: {ip: 165.225.136.6, user: ubuntu} - marist: zos13-s390x-1: {ip: 148.100.36.133, user: Unix1} diff --git a/ansible/playbooks/create-cross-compiler.yml b/ansible/playbooks/create-cross-compiler.yml deleted file mode 100644 index 5aa02b1b6..000000000 --- a/ansible/playbooks/create-cross-compiler.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- - -# -# create cross copmiler -# - -- hosts: - - test-azure_msft-ubuntu1404-x64-1 - - roles: - - bootstrap - - package-upgrade - - baselayout - - java-base - - cross-compiler diff --git a/ansible/playbooks/jenkins/worker/create.yml b/ansible/playbooks/jenkins/worker/create.yml index 302661d43..dcb1622ca 100644 --- a/ansible/playbooks/jenkins/worker/create.yml +++ b/ansible/playbooks/jenkins/worker/create.yml @@ -39,3 +39,15 @@ roles: - jenkins-workspace + +# +# Set up ARM cross compiler servers +# + +- hosts: + - test-azure_msft-ubuntu1404-x64-1 + - test-joyent-ubuntu1604_arm_cross-x64-1 + - release-joyent-ubuntu1604_arm_cross-x64-1 + + roles: + - cross-compiler \ No newline at end of file diff --git a/ansible/roles/cross-compiler/files/cc-armv6-4.8.sh b/ansible/roles/cross-compiler/files/cc-armv6-4.8.sh deleted file mode 100755 index eb232d319..000000000 --- a/ansible/roles/cross-compiler/files/cc-armv6-4.8.sh +++ /dev/null @@ -1,4 +0,0 @@ -export CC_host='ccache gcc-4.8 -m32' -export CXX_host='ccache g++-4.8 -m32' -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/ansible/roles/cross-compiler/files/cc-armv6-4.9.sh b/ansible/roles/cross-compiler/files/cc-armv6-4.9.sh deleted file mode 100755 index a53084a01..000000000 --- a/ansible/roles/cross-compiler/files/cc-armv6-4.9.sh +++ /dev/null @@ -1,4 +0,0 @@ -export CC_host='ccache gcc-4.9 -m32' -export CXX_host='ccache g++-4.9 -m32' -export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -march=armv6zk" -export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -march=armv6zk" diff --git a/ansible/roles/cross-compiler/files/cc-armv7-4.8.sh b/ansible/roles/cross-compiler/files/cc-armv7-4.8.sh deleted file mode 100755 index 45a72756e..000000000 --- a/ansible/roles/cross-compiler/files/cc-armv7-4.8.sh +++ /dev/null @@ -1,4 +0,0 @@ -export CC_host='ccache gcc-4.8 -m32' -export CXX_host='ccache g++-4.8 -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" diff --git a/ansible/roles/cross-compiler/files/cc-armv7-4.9.sh b/ansible/roles/cross-compiler/files/cc-armv7-4.9.sh deleted file mode 100755 index 2101d673b..000000000 --- a/ansible/roles/cross-compiler/files/cc-armv7-4.9.sh +++ /dev/null @@ -1,4 +0,0 @@ -export CC_host='ccache gcc-4.9 -m32' -export CXX_host='ccache g++-4.9 -m32' -export CC="ccache /opt/raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -march=armv7-a" -export CXX="ccache /opt/raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -march=armv7-a" diff --git a/ansible/roles/cross-compiler/files/cc-selector.sh b/ansible/roles/cross-compiler/files/cc-selector.sh new file mode 100755 index 000000000..3158edbbe --- /dev/null +++ b/ansible/roles/cross-compiler/files/cc-selector.sh @@ -0,0 +1,42 @@ +# create CC, CXX, CC_host and CXX_host environment variables appropriate for the +# worker label in use. Of the form: cross-compiler-(armv[67])-gcc-(4.[89](\.4)?) +# e.g. cross-compiler-armv6-gcc-4.8, or cross-compiler-armv7-gcc-4.9.4 + +rpi_tools_base="/opt/raspberrypi/tools/" +rpi_newer_tools_base="/opt/raspberrypi/rpi-newer-crosstools/" +base_4_8_armv6="${rpi_tools_base}arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-" +base_4_8_armv7="${rpi_tools_base}arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-" +base_4_9_armv6="${rpi_tools_base}arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-" +base_4_9_armv7="${rpi_tools_base}arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-" +base_4_9_4_armv6="${rpi_newer_tools_base}x64-gcc-4.9.4-binutils-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-" +base_4_9_4_armv7="${rpi_newer_tools_base}x64-gcc-4.9.4-binutils-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-" +flags_armv6="-march=armv6zk" +flags_armv7="-march=armv7-a" + +export arm_type=$(echo $1 | sed -E 's/^cross-compiler-(armv[67])-gcc-(4.[89](\.4)?)/\1/') +export gcc_version=$(echo $1 | sed -E 's/^cross-compiler-(armv[67])-gcc-4\.([89](\.4)?)/4.\2/') +export git_branch="cc-${arm_type}" + +if [[ ! "$arm_type" =~ ^armv[67]$ ]]; then + echo "Could not determine ARM type from '$1'" + exit 1 +fi +if [[ ! "$gcc_version" =~ ^4\.[89](\.4)?$ ]]; then + echo "Could not determine ARM type from '$1'" + exit 1 +fi + +gcc_version_safe="$(echo $gcc_version | sed -E 's/\./_/g')" +gcc_host_version="$(echo $gcc_version | sed -E 's/\.4//g')" # 4.9.4 -> 4.9 + +echo "ARM type: $arm_type, GCC version: $gcc_version" + +base_varname="base_${gcc_version_safe}_${arm_type}" +flags_varname="flags_${arm_type}" + +export ARCH="${arm_type}l" +export DESTCPU=arm +export CC_host="ccache gcc-${gcc_host_version} -m32" +export CXX_host="ccache g++-${gcc_host_version} -m32" +export CC="ccache ${!base_varname}gcc ${!flags_varname}" +export CXX="ccache ${!base_varname}g++ ${!flags_varname}" diff --git a/ansible/roles/cross-compiler/tasks/main.yml b/ansible/roles/cross-compiler/tasks/main.yml index 9e910f98a..e933a162c 100644 --- a/ansible/roles/cross-compiler/tasks/main.yml +++ b/ansible/roles/cross-compiler/tasks/main.yml @@ -4,14 +4,22 @@ # sets up cross compiler machine # -- name: General | Install required packages +- name: add ubuntu toolchain ppa + apt_repository: + repo: ppa:ubuntu-toolchain-r/test + +- name: upgrade installed packages + apt: + upgrade: dist + update_cache: yes + +- name: install required packages apt: - name: "{{ item }}" + name: "{{ packages }}" update_cache: yes state: latest - with_items: "{{ packages }}" -- name: General | Increase file descriptor limits +- name: increase file descriptor limits lineinfile: dest: /etc/security/limits.conf line: "{{ item }}" @@ -21,48 +29,18 @@ - "root hard nofile 500000" - "root soft nofile 500000" -- name: User | Add "{{ server_user }}" user - user: - name: "{{ server_user }}" - shell: /bin/bash - -- name: Raspberry | Clone raspberry tools repository +- name: clone raspberry tools repository git: repo: https://github.com/raspberrypi/tools.git dest: /opt/raspberrypi/tools -- name: Raspberry | Copy cc-armv6-4.8.sh script - copy: - src: ./files/cc-armv6-4.8.sh - dest: /opt/raspberrypi/cc-armv6-4.8.sh - mode: 0755 - -- name: Raspberry | Copy cc-armv7-4.8.sh script - copy: - src: ./files/cc-armv7-4.8.sh - dest: /opt/raspberrypi/cc-armv7-4.8.sh - mode: 0755 - -- name: Raspberry | Copy cc-armv6-4.9.sh script - copy: - src: ./files/cc-armv6-4.9.sh - dest: /opt/raspberrypi/cc-armv6-4.9.sh - mode: 0755 +- name: clone newer raspberry tools repository + git: + repo: https://github.com/rvagg/rpi-newer-crosstools.git + dest: /opt/raspberrypi/rpi-newer-crosstools -- name: Raspberry | Copy cc-armv7-4.9.sh script +- name: copy cc-selector.sh script copy: - src: ./files/cc-armv7-4.9.sh - dest: /opt/raspberrypi/cc-armv7-4.9.sh + src: ./files/cc-selector.sh + dest: /opt/raspberrypi/cc-selector.sh mode: 0755 - -- 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 - -- name: General | Add Jenkins to authorized_keys for "{{ server_user }}" - authorized_key: - user: "{{ server_user }}" - key: "{{ lookup('file', '/tmp/nodejs-ci.keys') }}" diff --git a/ansible/roles/cross-compiler/vars/main.yml b/ansible/roles/cross-compiler/vars/main.yml index 0e928e39c..40524ab53 100644 --- a/ansible/roles/cross-compiler/vars/main.yml +++ b/ansible/roles/cross-compiler/vars/main.yml @@ -1,12 +1,4 @@ --- -packages: - - gcc-4.8-multilib - - g++-4.8-multilib - - gcc-4.9-multilib - - g++-4.9-multilib - - python-all - - python-software-properties - - curl - - monit +packages: make,gcc-4.8-multilib,g++-4.8-multilib,gcc-4.9-multilib,g++-4.9-multilib,python2.7,python-all,python-software-properties,curl server_user: iojs