github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/.circleci/images/test-image-arm64/Dockerfile (about)

     1  # Copyright 2020-2021 the u-root Authors. All rights reserved
     2  # Use of this source code is governed by a BSD-style
     3  # license that can be found in the LICENSE file.
     4  
     5  FROM cimg/go:1.13
     6  
     7  # Install dependencies
     8  RUN sudo apt-get update &&                          \
     9      sudo apt-get install -y --no-install-recommends \
    10          `# Linux dependencies`                      \
    11          git                                         \
    12          bc                                          \
    13          bison                                       \
    14          flex                                        \
    15          gcc-aarch64-linux-gnu                       \
    16          libssl-dev                                  \
    17          make                                        \
    18          `# QEMU dependencies`                       \
    19          python                                      \
    20          libglib2.0-dev                              \
    21          libfdt-dev                                  \
    22          libpixman-1-dev                             \
    23          zlib1g-dev                                  \
    24          libcap-dev                                  \
    25          libattr1-dev                                \
    26          qemu-efi-aarch64                            \
    27          `# Linux kernel build deps`                 \
    28          libelf-dev &&                               \
    29      sudo rm -rf /var/lib/apt/lists/*
    30  
    31  # Create working directory
    32  WORKDIR /home/circleci
    33  COPY config_linux5.2.0_arm64.txt .config
    34  
    35  # Build linux
    36  RUN set -eux;                                                             \
    37      git clone --depth=1 --branch=v5.2  https://github.com/torvalds/linux; \
    38      sudo chmod 0444 .config;                                              \
    39      mv .config linux/;                                                    \
    40      cd linux;                                                             \
    41      export ARCH=arm64;                                                    \
    42      export CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-;                     \
    43      make olddefconfig;                                                    \
    44      make -j$(($(nproc) * 2 + 1));                                         \
    45      cd ~;                                                                 \
    46      cp linux/arch/arm64/boot/Image Image;                                 \
    47      rm -rf linux/
    48  
    49  # Build QEMU
    50  RUN set -eux;                                                          \
    51      git clone --depth=1 --branch=v3.1.0 https://github.com/qemu/qemu;  \
    52      cd qemu;                                                           \
    53      mkdir build;                                                       \
    54      cd build;                                                          \
    55      ../configure                                                       \
    56          --target-list=aarch64-softmmu                                  \
    57          --enable-virtfs                                                \
    58          --disable-docs                                                 \
    59          --disable-sdl                                                  \
    60          --disable-kvm;                                                 \
    61      make -j$(($(nproc) * 2 + 1));                                      \
    62      cd ~;                                                              \
    63      cp -rL qemu/build/pc-bios/ ~/pc-bios;                              \
    64      cp qemu/build/aarch64-softmmu/qemu-system-aarch64 .;               \
    65      rm -rf qemu/
    66  
    67  # Generate UEFI file images
    68  RUN dd if=/dev/zero bs=1M count=64 of=flash0.img;                                   \
    69      dd if=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd bs=1M of=flash0.img conv=notrunc;
    70  
    71  # Export paths to binaries.
    72  ENV UROOT_KERNEL /home/circleci/Image
    73  ENV UROOT_QEMU "/home/circleci/qemu-system-aarch64 -machine virt -cpu cortex-a57 -L /home/circleci/pc-bios -m 1G -pflash /home/circleci/flash0.img"
    74  ENV UROOT_TESTARCH arm64