AGLとは
Automotive_Grade_Linux
Automotive Grade Linux(オートモーティブグレードリナックス、AGL)は、コネクテッドカー向けのオープンプラットフォームを開発するプロジェクトである
QEMUとは
QEMU
QEMU(キューエミュ)は、Fabrice Bellardが中心となって開発しているオープンソースのプロセッサエミュレータである。
環境
Ubuntu16.04
# uname -a
Linux ubuntu 4.4.0-179-generic #209-Ubuntu SMP Fri Apr 24 17:48:44 UTC 2020 x86_64 GNU/Linux
# cat /proc/version
Linux version 4.4.0-179-generic (buildd@lcy01-amd64-014) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) ) #209-Ubuntu SMP Fri Apr 24 17:48:44 UTC 2020
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
準備
ソースコードのダウンロード
Download and Build AGL Source Code
Prepare Repo Tool
mkdir ~/bin
export PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Download Latest on stable branch
repo init -b icefish -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
repo sync
ビルド
必要なツールをインストール
Ubuntu and Debian
The essential and graphical support packages you need for a supported Ubuntu or Debian distribution are shown in the following command:
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm cpio curl
source meta-agl/scripts/aglsetup.sh -f -m qemux86-64 agl-demo agl-devel
bitbake agl-demo-platform
起動
sudo apt-get install -y qemu-system-x86 ovmf
export OVMF_PATH=/usr/share/ovmf/OVMF.fd
以下を実行してQEMU上で起動する
ln -s agl-demo-platform-crosssdk-qemux86-64-20200602040939.rootfs.wic.vmdk agl-demo-platform-qemux86-64.wic.vmdk
qemu-system-x86_64 -enable-kvm -m 2048 \
-bios ${OVMF_PATH} \
-hda agl-demo-platform-qemux86-64.wic.vmdk \
-cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \
-vga virtio -show-cursor \
-device virtio-rng-pci \
-serial mon:stdio -serial null \
-soundhw hda \
-net nic \
-net user,hostfwd=tcp::2222-:22
build済imageを使う場合
wget https://download.automotivelinux.org/AGL/release/icefish/9.0.2/qemux86-64/deploy/images/qemux86-64/agl-demo-platform-crosssdk-qemux86-64-20200602040939.rootfs.wic.vmdk
ln -s agl-demo-platform-crosssdk-qemux86-64-20200602040939.rootfs.wic.vmdk agl-demo-platform-qemux86-64.wic.vmdk
以下を実行してQEMU関連ツールをインストールする
If your build host is running Debian or Ubuntu, use the following commands:
sudo apt-get install -y qemu-system-x86 ovmf
export OVMF_PATH=/usr/share/ovmf/OVMF.fd
以下を実行してQEMU上で起動する
qemu-system-x86_64 -enable-kvm -m 2048 \
-bios ${OVMF_PATH} \
-hda agl-demo-platform-qemux86-64.wic.vmdk \
-cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \
-vga virtio -show-cursor \
-device virtio-rng-pci \
-serial mon:stdio -serial null \
-soundhw hda \
-net nic \
-net user,hostfwd=tcp::2222-:22
qemu-system-x86_64: -machine accel=kvm: No accelerator found
QEMU上での起動時にエラーが出た場合は、
$ qemu-system-x86_64 -enable-kvm -m 2048 \
-bios ${OVMF_PATH} \
-hda agl-demo-platform-qemux86-64.wic.vmdk \
-cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \
-vga virtio -show-cursor \
-device virtio-rng-pci \
-serial mon:stdio -serial null \
-soundhw hda \
-net nic \
-net user,hostfwd=tcp::2222-:22
qemu-system-x86_64: -machine accel=kvm: No accelerator found
KVMサポートがない可能性があるため、オプションから -enable-kvm を削除する。
NOTE: KVM may not be supported within a virtualized environment such as VirtualBox. This is indicated by the qemu command above giving the error message Could not access KVM kernel module: No such file or directory or the kernel log output contains the error message kvm: no hardware support. The image can be booted in such an environment by removing -enable-kvm from the qemu command line, however this will result in lower perfromance within the AGL demo.
$ qemu-system-x86_64 -m 2048 \
-bios ${OVMF_PATH} \
-hda agl-demo-platform-qemux86-64.wic.vmdk \
-cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt \
-vga virtio -show-cursor \
-device virtio-rng-pci \
-serial mon:stdio -serial null \
-soundhw hda \
-net nic \
-net user,hostfwd=tcp::2222-:22
これで解決
ただし起動が遅くなる(数10分以上掛かった)
参考
Building for Emulation
https://github.com/automotive-grade-linux/docs-sources/blob/master/docs/getting-started/machines/qemu.md
Download and Build AGL Source Code
Automotive Grade Linuxことはじめ
AGL(Automotive Grade Linux)をVirtualBoxで試してみた
Index of /AGL/release
Building for Emulation