Browse Source

Merge pull request #83 from apodogrocki/MEN-2399

Use a toolchain tuned for ARMv6 architecture to maintain support for …
1.1.x
Adam Podogrocki 6 years ago
committed by GitHub
parent
commit
032d61247d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .travis.yml
  2. 49
      Dockerfile
  3. 13
      README.md

1
.travis.yml

@ -10,3 +10,4 @@ script:
- mendertesting/check_commits.sh
# Check licenses
- mendertesting/check_license.sh
- ./docker-build

49
Dockerfile

@ -29,50 +29,57 @@ RUN apt-get update && apt-get install -y \
# to download mender-artifact
wget \
# to download mender-convert and U-Boot sources
git \
# To compile Mender client, U-boot or GRUB
gcc-arm-linux-gnueabihf
git
# Disable sanity checks made by mtools. These checks reject copy/paste operations on converted disk images.
RUN echo "mtools_skip_check=1" >> $HOME/.mtoolsrc
# To provide support for Raspberry Pi Zero W a toolchain tuned for ARMv6 architecture must be used.
# https://tracker.mender.io/browse/MEN-2399
# Assumes $(pwd) is /
RUN wget -nc -q https://toolchains.bootlin.com/downloads/releases/toolchains/armv6-eabihf/tarballs/armv6-eabihf--glibc--stable-2018.11-1.tar.bz2 \
&& tar -xjf armv6-eabihf--glibc--stable-2018.11-1.tar.bz2 \
&& rm armv6-eabihf--glibc--stable-2018.11-1.tar.bz2 \
&& echo export PATH=$PATH:/armv6-eabihf--glibc--stable-2018.11-1/bin >> /root/.bashrc
RUN wget -q -O /usr/bin/mender-artifact https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/$MENDER_ARTIFACT_VERSION/mender-artifact \
&& chmod +x /usr/bin/mender-artifact
# Build liblzma from source
RUN wget -q https://tukaani.org/xz/xz-5.2.4.tar.gz \
&& tar -C /root -xzf xz-5.2.4.tar.gz \
&& cd /root/xz-5.2.4 \
&& ./configure --host=arm-linux-gnueabihf --prefix=/root/xz-5.2.4/install \
&& make \
&& make install
ENV LIBLZMA_INSTALL_PATH "/root/xz-5.2.4/install"
# Golang environment, for cross-compiling the Mender client
RUN wget https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf go$GOLANG_VERSION.linux-amd64.tar.gz \
&& echo export PATH=$PATH:/usr/local/go/bin >> /root/.bashrc
ARG mender_client_version
ENV PATH "$PATH:/usr/local/go/bin:/armv6-eabihf--glibc--stable-2018.11-1/bin"
ENV GOPATH "/root/go"
# Download Mender client
ARG mender_client_version
ENV MENDER_CLIENT_VERSION=$mender_client_version
# NOTE: we are assuming generic ARM board here, needs to be extended later
ENV PATH "$PATH:/usr/local/go/bin"
ENV GOPATH "/root/go"
RUN go get -d github.com/mendersoftware/mender
WORKDIR $GOPATH/src/github.com/mendersoftware/mender
RUN git checkout $MENDER_CLIENT_VERSION
ENV CC "arm-buildroot-linux-gnueabihf-gcc"
# Build liblzma from source
RUN wget -q https://tukaani.org/xz/xz-5.2.4.tar.gz \
&& tar -C /root -xzf xz-5.2.4.tar.gz \
&& cd /root/xz-5.2.4 \
&& ./configure --host=arm-buildroot-linux-gnueabihf --prefix=/root/xz-5.2.4/install \
&& make \
&& make install
ENV LIBLZMA_INSTALL_PATH "/root/xz-5.2.4/install"
# NOTE: we are assuming generic ARM board here, needs to be extended later
RUN env CGO_ENABLED=1 \
CGO_CFLAGS="-I${LIBLZMA_INSTALL_PATH}/include" \
CGO_LDFLAGS="-L${LIBLZMA_INSTALL_PATH}/lib" \
CC=arm-linux-gnueabihf-gcc \
CC=$CC \
GOOS=linux \
GOARCH=arm make build
GOARM=6 GOARCH=arm make build
WORKDIR /

13
README.md

@ -73,11 +73,17 @@ TENANT_TOKEN="<INSERT-TOKEN-FROM Hosted Mender>"
--mender-disk-image $MENDER_DISK_IMAGE \
--device-type $DEVICE_TYPE \
--artifact-name $ARTIFACT_NAME \
--bootloader-toolchain arm-linux-gnueabihf \
--bootloader-toolchain arm-buildroot-linux-gnueabihf \
--server-url "https://hosted.mender.io" \
--tenant-token $TENANT_TOKEN
```
By default conversion in containter uses GCC 7.3.0 bootlin toolchain tuned for
ARMv6 architecture (especially for ARM1176(F)-S single-core processor).
The aim of that is to provide a support for the Raspberry Pi Zero W development board.
ARMv7 is backward compatible with ARMv6, so binaries compiled for ARMv6 should also work on ARMv7.
Note that the default Mender client is the latest stable and cross-compiled for generic ARM boards,
which should work well in most cases. If you would like to use a different Mender client,
place it in `input/` and adjust the `--mender-client` argument.
@ -89,7 +95,10 @@ After it finishes, you can find your images in the `output` directory on your ho
### Known issues
* Raspberrypi0w cpu isn't armv7+ architecture (it's armv6) and because of this mender client + u-boot fw_set/getenv tools are crashing when compiled with armv7 toolchain added in docker image. Pls use this forked [repo](https://github.com/nandra/mender-conversion-tools/commits/rpi0w-toolchain) to have it properly build with other armv6 toolchain.
* An issue for `Raspberry Pi Zero W` has been spotted with the `mender-convert` tool version 1.1.0.
After an initial boot, having last partition resized to the end of the SD card, the correct device
tree cannot be found. As a result the boot cannot succeed.
For more information and current status, see [issue tracker](https://tracker.mender.io/browse/MEN-2436).
* If building U-boot fails with:
```
D scripts/Kconfig

Loading…
Cancel
Save