Raspberrypi4向けにAGLをソースコードダウンロード、ビルドして起動する

# 目的
Raspberrypi4向けにAGLをソースコードダウンロード、ビルドして起動した際の備忘録です

# AGLとは

> [Automotive_Grade_Linux](https://ja.wikipedia.org/wiki/Automotive_Grade_Linux)
> Automotive Grade Linux（オートモーティブグレードリナックス、AGL）は、コネクテッドカー向けのオープンプラットフォームを開発するプロジェクトである

# Raspberrypi4とは

> [https://www.weblio.jp/content/Raspberrypi4](https://www.weblio.jp/content/Raspberrypi4)
> Raspberry Pi 4（ラズベリーパイ 4）とは、ラズベリーパイ財団（英語版）が開発、販売するシングルボードコンピュータ（SBC）である。

# 環境

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](https://wiki.automotivelinux.org/agl-distro/source-code#download_latest_stable_release)

### 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
```

# ビルド

> Raspberry Pi 4 (recommended)
> 
> To build AGL demo platform for Raspberry Pi 4 use machine raspberrypi4 and feature agl-demo:

```
source meta-agl/scripts/aglsetup.sh -m raspberrypi4 agl-demo agl-appfw-smack
bitbake agl-demo-platform
```

ビルドが完了したら以下ディレクトリにイメージが作られる

```
./build/tmp/work/raspberrypi4-agl-linux/agl-demo-platform/1.0-r0/deploy-agl-demo-platform-image-complete/agl-demo-platform-raspberrypi4.wic.xz
```

# 起動

書き込みソフト（[Etcher](https://www.balena.io/etcher)など）を使用して
イメージを16GBmicroSDカードに書き込み、
microSDカードをRaspberryPi4に挿して起動すればOK

# 参考
[AGL for Raspberry Pi](https://wiki.automotivelinux.org/agl-distro/agl-raspberrypi)
[Jira for AGL](https://wiki.automotivelinux.org/start/using-jira)
[agl-distro/release-notes](https://wiki.automotivelinux.org/agl-distro/release-notes)
[Download and Build AGL Source Code](https://wiki.automotivelinux.org/agl-distro/source-code#download_and_build_agl_source_code)
[AGL gerrit server](https://gerrit.automotivelinux.org/)
[Getting Started with AGL](https://wiki.automotivelinux.org/start/getting-started)
[https://lava.automotivelinux.org/results](https://lava.automotivelinux.org/results)
[Introduction: Building target AGL image with Yocto project](https://docs.huihoo.com/automotivelinux/docs/getting_started/en/dev/reference/source-code.html)
[Building a Remote Control Robot with Automotive Grade Linux](https://www.slideshare.net/leonanavi/building-a-remote-control-robot-with-automotive-grade-linux)
[https://github.com/leon-anavi/rpi-examples](https://github.com/leon-anavi/rpi-examples)
[LAVA stand for Linaro Automated Validation Architecture.](https://git.lavasoftware.org/lava)
[Linux Kernel Functional Testing](https://lkft.linaro.org/)
[Automated Linux Kernel Testing](https://kernelci.org)
[Building for Emulation](https://docs.automotivelinux.org/docs/en/master/getting_started/reference/getting-started/machines/qemu.html)
[https://github.com/automotive-grade-linux/docs-sources/blob/master/docs/getting-started/machines/qemu.md](https://github.com/automotive-grade-linux/docs-sources/blob/master/docs/getting-started/machines/qemu.md)
[Download and Build AGL Source Code](https://wiki.automotivelinux.org/agl-distro/source-code#download_latest_stable_release)
[Automotive Grade Linuxことはじめ](https://qiita.com/mbamba/items/6b302595e29d83e86ceb)
[AGL(Automotive Grade Linux)をVirtualBoxで試してみた](http://yu39n.hatenablog.com/entry/2016/01/31/221600)
[Index of /AGL/release](https://download.automotivelinux.org/AGL/release/)
[Building for Emulation](https://docs.automotivelinux.org/docs/en/master/getting_started/reference/getting-started/machines/qemu.html)