github.com/oweisse/u-root@v0.0.0-20181109060735-d005ad25fef1/.circleci/images/integration/Dockerfile (about)

     1  # Copyright 2018 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  # Build:
     6  #
     7  #     sudo docker build . -t uroottest/x86-integration
     8  #
     9  # Run:
    10  #
    11  #     sudo docker run --rm -it uroottest/x86-integration
    12  #
    13  # More instructions:
    14  #
    15  #     https://circleci.com/docs/2.0/custom-images/
    16  
    17  FROM circleci/golang:1.11
    18  
    19  # Install dependencies
    20  RUN sudo apt-get update &&                          \
    21      sudo apt-get install -y --no-install-recommends \
    22          `# Linux dependencies`                      \
    23          git                                         \
    24          bc                                          \
    25          bison                                       \
    26          flex                                        \
    27          gcc                                         \
    28          make                                        \
    29          `# QEMU dependencies`                       \
    30          libglib2.0-dev                              \
    31          libfdt-dev                                  \
    32          libpixman-1-dev                             \
    33          zlib1g-dev                                  \
    34          `# Linux kernel build deps`                 \
    35          libelf-dev &&                               \
    36      sudo rm -rf /var/lib/apt/lists/*
    37  
    38  # Create working directory
    39  WORKDIR /home/circleci
    40  COPY config_linux4.17_amd64.txt .config
    41  
    42  # Build linux
    43  RUN set -eux;                                                             \
    44      git clone --depth=1 --branch=v4.17 https://github.com/torvalds/linux; \
    45      sudo chmod 0444 .config;                                              \
    46      mv .config linux/;                                                    \
    47      cd linux;                                                             \
    48      make -j$(($(nproc) * 2 + 1));                                         \
    49      cd ~;                                                                 \
    50      cp linux/arch/x86_64/boot/bzImage bzImage;                            \
    51      rm -rf linux/
    52  
    53  # Build QEMU
    54  RUN set -eux;                                                          \
    55      git clone --depth=1 --branch=v2.12.0 https://github.com/qemu/qemu; \
    56      cd qemu;                                                           \
    57      mkdir build;                                                       \
    58      cd build;                                                          \
    59      ../configure                                                       \
    60          --target-list=x86_64-softmmu                                   \
    61          --disable-docs                                                 \
    62          --disable-sdl                                                  \
    63          --disable-kvm;                                                 \
    64      make -j$(($(nproc) * 2 + 1));                                      \
    65      cd ~;                                                              \
    66      cp -rL qemu/build/pc-bios/ ~/pc-bios;                              \
    67      cp qemu/build/x86_64-softmmu/qemu-system-x86_64 .;                 \
    68      rm -rf qemu/
    69  
    70  # Export paths to binaries.
    71  ENV UROOT_KERNEL /home/circleci/bzImage
    72  ENV UROOT_QEMU "/home/circleci/qemu-system-x86_64 -L /home/circleci/pc-bios"