mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-25 12:16:37 +00:00
chore: build armhf on GNU/Linux (#1482)
This commit makes use of the `resin/armv7hf-debian` Docker image to test and generate armhf builds. We needed to add a slash before `build` in `.gitignore` given that git was refusing to include any changes on `scripts/build` otherwise. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit is contained in:
parent
7b791d622f
commit
488f281ec7
132
Makefile
132
Makefile
@ -15,6 +15,72 @@ endif
|
|||||||
|
|
||||||
BUILD_TEMPORARY_DIRECTORY = $(BUILD_DIRECTORY)/.tmp
|
BUILD_TEMPORARY_DIRECTORY = $(BUILD_DIRECTORY)/.tmp
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------
|
||||||
|
# Operating system and architecture detection
|
||||||
|
# ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
# http://stackoverflow.com/a/12099167
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
PLATFORM = win32
|
||||||
|
|
||||||
|
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
|
||||||
|
HOST_ARCH = x64
|
||||||
|
else
|
||||||
|
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
|
||||||
|
HOST_ARCH = x64
|
||||||
|
endif
|
||||||
|
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
|
||||||
|
HOST_ARCH = x86
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(shell uname -s),Linux)
|
||||||
|
PLATFORM = linux
|
||||||
|
|
||||||
|
ifeq ($(shell uname -m),x86_64)
|
||||||
|
HOST_ARCH = x64
|
||||||
|
endif
|
||||||
|
ifneq ($(filter %86,$(shell uname -m)),)
|
||||||
|
HOST_ARCH = x86
|
||||||
|
endif
|
||||||
|
ifeq ($(shell uname -m),armv7l)
|
||||||
|
HOST_ARCH = armv7hf
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(shell uname -s),Darwin)
|
||||||
|
PLATFORM = darwin
|
||||||
|
|
||||||
|
ifeq ($(shell uname -m),x86_64)
|
||||||
|
HOST_ARCH = x64
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef PLATFORM
|
||||||
|
$(error We couldn't detect your host platform)
|
||||||
|
endif
|
||||||
|
ifndef HOST_ARCH
|
||||||
|
$(error We couldn't detect your host architecture)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Default to host architecture. You can override by doing:
|
||||||
|
#
|
||||||
|
# make <target> TARGET_ARCH=<arch>
|
||||||
|
#
|
||||||
|
TARGET_ARCH ?= $(HOST_ARCH)
|
||||||
|
|
||||||
|
# Support x86 builds from x64 in GNU/Linux
|
||||||
|
# See https://github.com/addaleax/lzma-native/issues/27
|
||||||
|
ifeq ($(PLATFORM),linux)
|
||||||
|
ifneq ($(HOST_ARCH),$(TARGET_ARCH))
|
||||||
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
|
export CFLAGS += -m32
|
||||||
|
else
|
||||||
|
$(error Can't build $(TARGET_ARCH) binaries on a $(HOST_ARCH) host)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
# Application configuration
|
# Application configuration
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
@ -71,72 +137,6 @@ ifndef APPLICATION_VERSION
|
|||||||
$(error Invalid release type: $(RELEASE_TYPE))
|
$(error Invalid release type: $(RELEASE_TYPE))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ---------------------------------------------------------------------
|
|
||||||
# Operating system and architecture detection
|
|
||||||
# ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
# http://stackoverflow.com/a/12099167
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
PLATFORM = win32
|
|
||||||
|
|
||||||
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
|
|
||||||
HOST_ARCH = x64
|
|
||||||
else
|
|
||||||
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
|
|
||||||
HOST_ARCH = x64
|
|
||||||
endif
|
|
||||||
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
|
|
||||||
HOST_ARCH = x86
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
ifeq ($(shell uname -s),Linux)
|
|
||||||
PLATFORM = linux
|
|
||||||
|
|
||||||
ifeq ($(shell uname -m),x86_64)
|
|
||||||
HOST_ARCH = x64
|
|
||||||
endif
|
|
||||||
ifneq ($(filter %86,$(shell uname -m)),)
|
|
||||||
HOST_ARCH = x86
|
|
||||||
endif
|
|
||||||
ifeq ($(shell uname -m),armv7l)
|
|
||||||
HOST_ARCH = armv7l
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(shell uname -s),Darwin)
|
|
||||||
PLATFORM = darwin
|
|
||||||
|
|
||||||
ifeq ($(shell uname -m),x86_64)
|
|
||||||
HOST_ARCH = x64
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef PLATFORM
|
|
||||||
$(error We couldn't detect your host platform)
|
|
||||||
endif
|
|
||||||
ifndef HOST_ARCH
|
|
||||||
$(error We couldn't detect your host architecture)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Default to host architecture. You can override by doing:
|
|
||||||
#
|
|
||||||
# make <target> TARGET_ARCH=<arch>
|
|
||||||
#
|
|
||||||
TARGET_ARCH ?= $(HOST_ARCH)
|
|
||||||
|
|
||||||
# Support x86 builds from x64 in GNU/Linux
|
|
||||||
# See https://github.com/addaleax/lzma-native/issues/27
|
|
||||||
ifeq ($(PLATFORM),linux)
|
|
||||||
ifneq ($(HOST_ARCH),$(TARGET_ARCH))
|
|
||||||
ifeq ($(TARGET_ARCH),x86)
|
|
||||||
export CFLAGS += -m32
|
|
||||||
else
|
|
||||||
$(error Can't build $(TARGET_ARCH) binaries on a $(HOST_ARCH) host)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
# Code signing
|
# Code signing
|
||||||
# ---------------------------------------------------------------------
|
# ---------------------------------------------------------------------
|
||||||
|
@ -25,7 +25,7 @@ function usage() {
|
|||||||
echo "Options"
|
echo "Options"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -r <architecture>"
|
echo " -r <architecture>"
|
||||||
echo " -t <type (debian|redhat|node)>"
|
echo " -t <type (debian|redhat|node|docker)>"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ if [ "$ARGV_TYPE" == "node" ]; then
|
|||||||
RESULT=ia32
|
RESULT=ia32
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
||||||
RESULT=x64
|
RESULT=x64
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "armv7l" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then
|
||||||
RESULT=arm
|
RESULT=arm
|
||||||
fi
|
fi
|
||||||
elif [ "$ARGV_TYPE" == "electron-builder" ]; then
|
elif [ "$ARGV_TYPE" == "electron-builder" ]; then
|
||||||
@ -59,7 +59,7 @@ elif [ "$ARGV_TYPE" == "electron-builder" ]; then
|
|||||||
RESULT=ia32
|
RESULT=ia32
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
||||||
RESULT=x64
|
RESULT=x64
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "armv7l" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then
|
||||||
RESULT=armv7l
|
RESULT=armv7l
|
||||||
fi
|
fi
|
||||||
elif [ "$ARGV_TYPE" == "debian" ]; then
|
elif [ "$ARGV_TYPE" == "debian" ]; then
|
||||||
@ -67,7 +67,7 @@ elif [ "$ARGV_TYPE" == "debian" ]; then
|
|||||||
RESULT=i386
|
RESULT=i386
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
||||||
RESULT=amd64
|
RESULT=amd64
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "armv7l" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then
|
||||||
RESULT=armhf
|
RESULT=armhf
|
||||||
fi
|
fi
|
||||||
elif [ "$ARGV_TYPE" == "redhat" ]; then
|
elif [ "$ARGV_TYPE" == "redhat" ]; then
|
||||||
@ -75,12 +75,24 @@ elif [ "$ARGV_TYPE" == "redhat" ]; then
|
|||||||
RESULT=i686
|
RESULT=i686
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
||||||
RESULT='x86_64'
|
RESULT='x86_64'
|
||||||
|
elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then
|
||||||
|
RESULT=armhfp
|
||||||
fi
|
fi
|
||||||
elif [ "$ARGV_TYPE" == "appimage" ]; then
|
elif [ "$ARGV_TYPE" == "appimage" ]; then
|
||||||
if [ "$ARGV_ARCHITECTURE" == "x86" ]; then
|
if [ "$ARGV_ARCHITECTURE" == "x86" ]; then
|
||||||
RESULT=i386
|
RESULT=i386
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
elif [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
||||||
RESULT='x86_64'
|
RESULT='x86_64'
|
||||||
|
elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then
|
||||||
|
RESULT=armhf
|
||||||
|
fi
|
||||||
|
elif [ "$ARGV_TYPE" == "docker" ]; then
|
||||||
|
if [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
||||||
|
RESULT=x86_64
|
||||||
|
elif [ "$ARGV_ARCHITECTURE" == "x86" ]; then
|
||||||
|
RESULT=i686
|
||||||
|
elif [ "$ARGV_ARCHITECTURE" == "armv7hf" ]; then
|
||||||
|
RESULT=armv7hf
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Unsupported architecture type: $ARGV_TYPE" 1>&2
|
echo "Unsupported architecture type: $ARGV_TYPE" 1>&2
|
||||||
|
52
scripts/build/docker/Dockerfile-armv7hf
Normal file
52
scripts/build/docker/Dockerfile-armv7hf
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
FROM resin/armv7hf-debian:jessie
|
||||||
|
|
||||||
|
# Setup APT sources
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
|
||||||
|
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
fuse \
|
||||||
|
git \
|
||||||
|
graphicsmagick \
|
||||||
|
icnsutils \
|
||||||
|
jq \
|
||||||
|
libasound2 \
|
||||||
|
libgconf-2-4 \
|
||||||
|
libgtk2.0-0 \
|
||||||
|
libx11-xcb1 \
|
||||||
|
libnss3 \
|
||||||
|
libxss1 \
|
||||||
|
libxtst6 \
|
||||||
|
libyaml-dev \
|
||||||
|
python \
|
||||||
|
python-pip \
|
||||||
|
python-dev \
|
||||||
|
python-software-properties \
|
||||||
|
unzip \
|
||||||
|
xorriso \
|
||||||
|
xvfb \
|
||||||
|
xz-utils \
|
||||||
|
zip \
|
||||||
|
rpm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# NodeJS
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
|
||||||
|
&& apt-get install -y nodejs
|
||||||
|
|
||||||
|
# See https://github.com/mapbox/node-pre-gyp/issues/165
|
||||||
|
RUN npm config set unsafe-perm=true
|
||||||
|
|
||||||
|
RUN npm config set spin=false
|
||||||
|
|
||||||
|
# Python
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
RUN pip install --quiet -r requirements.txt
|
@ -7,6 +7,7 @@ RUN sed s,ubuntu\.stu\.edu\.tw,archive.ubuntu.com, /etc/apt/sources.list > /tmp/
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
@ -36,11 +37,13 @@ RUN apt-get update \
|
|||||||
zip \
|
zip \
|
||||||
rpm
|
rpm
|
||||||
|
|
||||||
|
|
||||||
# Install a C++11 compiler
|
# Install a C++11 compiler
|
||||||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
|
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
|
||||||
&& apt-get update && apt-get install -y gcc-4.8 g++-4.8 \
|
&& apt-get update && apt-get install -y gcc-4.8 g++-4.8 \
|
||||||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
|
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
|
||||||
|
|
||||||
|
|
||||||
# NodeJS
|
# NodeJS
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
|
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
|
||||||
&& apt-get install -y nodejs
|
&& apt-get install -y nodejs
|
||||||
|
@ -6,6 +6,7 @@ FROM ubuntu:12.04
|
|||||||
RUN echo "deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse" >> /etc/apt/sources.list
|
RUN echo "deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse" >> /etc/apt/sources.list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
@ -35,11 +36,13 @@ RUN apt-get update \
|
|||||||
zip \
|
zip \
|
||||||
rpm
|
rpm
|
||||||
|
|
||||||
|
|
||||||
# Install a C++11 compiler
|
# Install a C++11 compiler
|
||||||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
|
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
|
||||||
&& apt-get update && apt-get install -y gcc-4.8 g++-4.8 \
|
&& apt-get update && apt-get install -y gcc-4.8 g++-4.8 \
|
||||||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
|
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
|
||||||
|
|
||||||
|
|
||||||
# NodeJS
|
# NodeJS
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
|
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
|
||||||
&& apt-get install -y nodejs
|
&& apt-get install -y nodejs
|
||||||
|
@ -8,6 +8,9 @@ RUN sed s,ubuntu\.stu\.edu\.tw,archive.ubuntu.com, /etc/apt/sources.list > /tmp/
|
|||||||
<% if (architecture == 'x86_64') { %>
|
<% if (architecture == 'x86_64') { %>
|
||||||
RUN echo "deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse" >> /etc/apt/sources.list
|
RUN echo "deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse" >> /etc/apt/sources.list
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<% if (architecture == 'armv7hf') { %>
|
||||||
|
RUN echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
|
||||||
|
<% } %>
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@ -38,10 +41,12 @@ RUN apt-get update \
|
|||||||
zip \
|
zip \
|
||||||
rpm
|
rpm
|
||||||
|
|
||||||
|
<% if (architecture != 'armv7hf') { %>
|
||||||
# Install a C++11 compiler
|
# Install a C++11 compiler
|
||||||
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
|
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
|
||||||
&& apt-get update && apt-get install -y gcc-4.8 g++-4.8 \
|
&& apt-get update && apt-get install -y gcc-4.8 g++-4.8 \
|
||||||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
|
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
|
||||||
|
<% } %>
|
||||||
|
|
||||||
# NodeJS
|
# NodeJS
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
|
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
|
||||||
|
@ -36,6 +36,10 @@ _.each([
|
|||||||
{
|
{
|
||||||
architecture: 'x86_64',
|
architecture: 'x86_64',
|
||||||
image: 'ubuntu:12.04'
|
image: 'ubuntu:12.04'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
architecture: 'armv7hf',
|
||||||
|
image: 'resin/armv7hf-debian:jessie'
|
||||||
}
|
}
|
||||||
], (options) => {
|
], (options) => {
|
||||||
const result = _.template(template)(options)
|
const result = _.template(template)(options)
|
||||||
|
@ -54,16 +54,9 @@ then
|
|||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ARGV_ARCHITECTURE" == "x64" ]; then
|
DOCKER_ARCHITECTURE=$(./scripts/build/architecture-convert.sh -r "$ARGV_ARCHITECTURE" -t docker)
|
||||||
DOCKERFILE="$HERE/Dockerfile-x86_64"
|
DOCKERFILE="$HERE/Dockerfile-$DOCKER_ARCHITECTURE"
|
||||||
elif [ "$ARGV_ARCHITECTURE" == "x86" ]; then
|
IMAGE_ID="etcher-build-$DOCKER_ARCHITECTURE"
|
||||||
DOCKERFILE="$HERE/Dockerfile-i686"
|
|
||||||
else
|
|
||||||
echo "Unsupported architecture: $ARGV_ARCHITECTURE" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
IMAGE_ID="etcher-build-$ARGV_ARCHITECTURE"
|
|
||||||
|
|
||||||
docker build -f "$DOCKERFILE" -t "$IMAGE_ID" "$ARGV_SOURCE_CODE_DIRECTORY"
|
docker build -f "$DOCKERFILE" -t "$IMAGE_ID" "$ARGV_SOURCE_CODE_DIRECTORY"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user