ZYBO用のLinuxイメージを作る

# 環境
- Ubuntu16.04 X64
- Zybo Digilent製（秋月で購入）
- kernel versionは4.14

# 手順
2018/8/16時点で最新のソースをかき集めてくる
リリースノートは下記
https://wiki.yoctoproject.org/wiki/Releases

どうやらsumoブランチが最新ぽい


```bash
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping libsdl1.2-dev xterm

mkdir work
cd work
#sumoブランチからclone
git clone -b sumo git://git.yoctoproject.org/poky.git
git clone git://git.yoctoproject.org/meta-xilinx.git
cd poky
source oe-init-build-env
vi conf/local.conf
#下記2つの記述を追加
MACHINE ?= "zybo-zynq7"
#参考URLいわく、スペース削減だそう
INHERIT += "rm_work"

vi conf/bblayers.conf
#下記を追加する
/home/<user>/work/meta-xilinx/meta-xilinx-bsp \
#buildディレクトリでbitbake実行
bitbake core-image-minimal
```
#Logs
```bash
Build Configuration:
BB_VERSION           = "1.38.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-16.04"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "zybo-zynq7"
DISTRO               = "poky"
DISTRO_VERSION       = "2.5.1"
TUNE_FEATURES        = "arm armv7a vfp thumb neon callconvention-hard cortexa9"
TARGET_FPU           = "hard"
meta
meta-poky
meta-yocto-bsp       = "sumo:bb91b2ae3ee5cf108aa2f9b78abb14d5aa00831d"
meta-xilinx-bsp      = "master:fa996fbc301039755779d98fabbadb9dab93ef05"
```
# 生成物の確認
```
cd work/poky/build/tmp/deploy/images/zybo-zynq7

#上記生成物をmicroSDにいれて、bootさせてみる
#partitionは1st sectionをvfat/2nd sectionをext4にして
/work/meta-xilinx/meta-xilinx-bsp/README.booting.md
の内容のとおり配置する

Loading via SD
---------------------
**(Note: This section only applies to Zynq and ZynqMP.)**

### Preparing SD/MMC
Setup the card with the first partition formatted as FAT16. If you intend to
boot with the root filesystem located on the SD card, also create a second
partition formatted as EXT4.

It is recommended that the first partition be at least 64MB in size, however
this value will depend on whether using a ramdisk for the root filesystem and
how large the ramdisk is.

This section describes how to manually prepare and populate an SD card image.
There are automation tools in OpenEmbedded that can generate disk images already
formatted and prepared such that they can be written directly to a disk. Refer
to the Yocto Project Development Manual for more details:
        http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#creating-partitioned-images

### Installing U-Boot (Zynq)
Add the following files to the first partition:

* `boot.bin`
* `u-boot.img`

### Installing U-Boot (ZynqMP)
Add the following files to the first partition:

* `boot.bin`
* `u-boot.bin`

### Installing Kernel and Device Tree (Zynq)
Add the following files to the first partition:

* `uImage`
* `<machine name>.dtb`

### Installing Kernel and Device Tree (ZynqMP)
Add the following files to the first partition:
* `uImage`
* `<machine name>.dtb`

### Installing Kernel and Device Tree (ZynqMP)
Add the following files to the first partition:

* `Image`
* `<machine name>.dtb`

### Install ARM Trusted Firmware (ZynqMP)
Add the following file to the first partition:

 * `atf-uboot.ub`

### Install U-boot environment file (ZynqMP)
Add the following file to the first partition:

 * `uEnv.txt`

### Installing Root Filesystem
If using a ramdisk also add the `.cpio.gz.u-boot` type of root filesystem image
to the first partition.

* `core-image-minimal-<machine name>.cpio.gz.u-boot`

If using the SD card as the root filesystem, populate the second partition with
the content of the root filesystem. To install the root filesystem extract the
corresponding tarball into the root of the second partition (the following
command assumes that the second partition is mounted at /media/root).

        tar x -C /media/root -f core-image-minimal-<machine name>.tar.gz

### U-Boot Configuration File
Also create the file `uEnv.txt` on the first partition of the SD card partition,
with the following contents. Replacing the names of files where appropriate.

        kernel_image=uImage
        devicetree_image=<machine name>.dtb

If using a ramdisk root filesystem setup the `ramdisk_image` variable.

        ramdisk_image=core-image-minimal-<machine name>.cpio.gz.u-boot

If using the SD card as the root filesystem setup the kernel boot args, and
`uenvcmd` variable.

        bootargs=root=/dev/mmcblk0p2 rw rootwait
        uenvcmd=fatload mmc 0 0x3000000 ${kernel_image} && fatload mmc 0 0x2A00000 ${devicetree_image} && bootm 0x3000000 - 0x2A00000

### Booting
Insert the SD card and connect UART to a terminal program and power on the
board. (For boards that have configurable boot jumper/switches ensure the board
is configured for SD).

Initially U-Boot SPL will load, which will in turn load U-Boot. U-Boot will use
the `uEnv.txt` to automatically load and execute the kernel.
```


# 参考URL
https://qiita.com/Rohira/items/de246219b82bfededd35
を参考にさせていただきました。