kata qemu

 https://github.com/kata-containers/kata-containers/tree/2.0-dev/tools/packaging/qemu/patches/5.1.x

    QEMU_PATCHES_PATH="${GOPATH}/src/${packaging_repo}/qemu/patches/${QEMU_PATCHES_TAG}.x"
    for patch in ${QEMU_PATCHES_PATH}/*.patch; do
        echo "Applying patch: $patch"
        git apply "$patch"
    done
$ go get -d github.com/kata-containers/packaging
$ cd $your_qemu_directory
$ ${GOPATH}/src/github.com/kata-containers/packaging/scripts/configure-hypervisor.sh qemu > kata.cfg
$ eval ./configure "$(cat kata.cfg)"
$ make -j $(nproc)
$ sudo -E make install

解决方法

    1. 在Makefile中找到 -Werror项,删除即可。删除后重新编译。
    2. 或设置环境变量 c工程设置
      export CFLAGS = "-Wno-error"
      c++工程设置
      export CXXFLAGS = "-Wno-error"

    3. 或自动化配置工具添加选项 ./config -no-warnings-are-errors

git fetch --all --tags

 

/opt/gopath/src/github.com/qemu/qemu /opt/gopath/src/github.com/kata-containers/tests/.ci
Applying patch: /opt/gopath/src/github.com/kata-containers/packaging/obs-packaging/qemu-aarch64/patches/0001-arm-enable-cold-plug-nvdimm-using-DT.patch
patching file hw/arm/boot.c
Hunk #1 succeeded at 19 with fuzz 2 (offset -1 lines).
Hunk #2 succeeded at 492 with fuzz 2 (offset -33 lines).
Hunk #3 succeeded at 641 with fuzz 1 (offset -21 lines).
patching file hw/arm/virt.c
Hunk #1 FAILED at 2189.
Hunk #2 FAILED at 2224.
2 out of 2 hunks FAILED -- saving rejects to file hw/arm/virt.c.rej
Failed at 68: patch -p1 < "$patch"
root@ubuntu:/opt/gopath/src/github.com/kata-containers# rm packaging -rf
root@ubuntu:/opt/gopath/src/github.com/kata-containers# cd -
bash: cd: /opt/gopath/src/github.com/kata-containers/packaging: No such file or directory
root@ubuntu:/opt/gopath/src/github.com/kata-containers# cd /home/ubuntu
root@ubuntu:/home/ubuntu# git clone https://github.com/kata-containers/packaging.git
Cloning into 'packaging'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 7676 (delta 6), reused 21 (delta 3), pack-reused 7639
Receiving objects: 100% (7676/7676), 7.35 MiB | 5.73 MiB/s, done.
Resolving deltas: 100% (4291/4291), done.
root@ubuntu:/home/ubuntu# ls
anotherping     cup   dirB  eoan-arm64.img                  go              kata-linux-5.4.60-89  kernel_module  nfsroot  packaging  qemu_learn      qemu.sh      runc       soft_s   test            txt    work
containerddemo  dirA  dirC  eoan-server-cloudimg-arm64.img  image_build.sh  kata.log              mysock         overlay  qemu5.1    qemu_learn.tgz  qemu.sh.bak  server.py  stat.sh  test_container  v1.18
root@ubuntu:/home/ubuntu# cd packaging/
root@ubuntu:/home/ubuntu/packaging# go get -d -v ./...
github.com/marcov/obsgo (download)
root@ubuntu:/home/ubuntu/packaging# go get -d -v ./...
github.com/marcov/obsgo (download)
unrecognized import path "golang.org/x/sys/unix": https fetch: Get "https://golang.org/x/sys/unix?go-get=1": dial tcp 216.239.37.1:443: i/o timeout
get "gopkg.in/cheggaaa/pb.v1": found meta tag get.metaImport{Prefix:"gopkg.in/cheggaaa/pb.v1", VCS:"git", RepoRoot:"https://gopkg.in/cheggaaa/pb.v1"} at //gopkg.in/cheggaaa/pb.v1?go-get=1
gopkg.in/cheggaaa/pb.v1 (download)
github.com/mattn/go-runewidth (download)
github.com/mlafeldt/pkgcloud (download)
github.com/peterhellberg/link (download)
root@ubuntu:/home/ubuntu/packaging# cd  /opt/gopath/src/github.com/kata-containers/packaging
bash: cd: /opt/gopath/src/github.com/kata-containers/packaging: No such file or directory
root@ubuntu:/home/ubuntu/packaging# ls
artifact-list.sh  ccloudvm  cmd  CODE_OF_CONDUCT.md  CODEOWNERS  CONTRIBUTING.md  Jenkinsfiles  kata-deploy  kernel  LICENSE  Makefile  obs-packaging  qemu  README.md  release  scripts  snap  static-build  tests  VERSION
root@ubuntu:/home/ubuntu/packaging# cd ..
root@ubuntu:/home/ubuntu# mv packaging/ /opt/gopath/src/github.com/kata-containers/
root@ubuntu:/home/ubuntu# cd qemu5.1/qemu/
root@ubuntu:/home/ubuntu/qemu5.1/qemu#  ${GOPATH}/src/github.com/kata-containers/packaging/scripts/configure-hypervisor.sh qemu > kata.cfg
root@ubuntu:/home/ubuntu/qemu5.1/qemu# 
The following packages were automatically installed and are no longer required:
  golang-1.10-go golang-1.10-src golang-src
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  ninja-build
0 upgraded, 1 newly installed, 0 to remove and 180 not upgraded.
Need to get 82.2 kB of archives.
After this operation, 271 kB of additional disk space will be used.
Get:1 http://hk.ports.ubuntu.com/ubuntu-ports bionic/universe arm64 ninja-build arm64 1.8.2-1 [82.2 kB]
Fetched 82.2 kB in 2s (35.1 kB/s)                     
Selecting previously unselected package ninja-build.
(Reading database ... 127105 files and directories currently installed.)
Preparing to unpack .../ninja-build_1.8.2-1_arm64.deb ...
Unpacking ninja-build (1.8.2-1) ...
Install a hypervisor
When setting up Kata using a packaged installation method, the QEMU VMM is installed automatically. Cloud-Hypervisor and Firecracker VMMs are available from the release tarballs. You may choose to manually build your VMM/hypervisor.

Build a custom QEMU
Kata Containers makes use of upstream QEMU branch. The exact version and repository utilized can be found by looking at the runtime's versions file

Kata often utilizes patches for not-yet-upstream fixes for components, including QEMU. These can be found in the packaging repository in the QEMU directory.

To build utilizing the same options as Kata, you should make use of the configure-hypervisor.sh script. For example:

$ go get -d github.com/kata-containers/packaging
$ cd $your_qemu_directory
$ ${GOPATH}/src/github.com/kata-containers/packaging/scripts/configure-hypervisor.sh qemu > kata.cfg
$ eval ./configure "$(cat kata.cfg)"
$ make -j $(nproc)
$ sudo -E make install
See the static-build script for QEMU for a reference on how to get, setup, configure and build QEMU for Kata.

Build a custom QEMU for aarch64/arm64 - REQUIRED
Note:

You should only do this step if you are on aarch64/arm64.
You should include Eric Auger's latest PCDIMM/NVDIMM patches which are under upstream review for supporting NVDIMM on aarch64.
You could build the custom qemu-system-aarch64 as required with the following command:

$ go get -d github.com/kata-containers/tests
$ script -fec 'sudo -E ${GOPATH}/src/github.com/kata-containers/tests/.ci/install_qemu.sh'
 apt-get install gcc-5 g++-5
root@cloud:/home/ubuntu/glib-2.40.0# rm /usr/bin/gcc
root@cloud:/home/ubuntu/glib-2.40.0# rm /usr/bin/g++
root@cloud:/home/ubuntu/glib-2.40.0# ln -s /usr/bin/gcc-5 /usr/bin/gcc
root@cloud:/home/ubuntu/glib-2.40.0# ln -s /usr/bin/g++-5 /usr/bin/g++
root@cloud:/home/ubuntu/glib-2.40.0# 

 其他版本gcc有问题

原文地址:https://www.cnblogs.com/dream397/p/14110063.html