---
title: Building and Customizing Coreos - Creating images for NIFTY Cloud
tags:  #coreos  
author: [Yuya Kusakabe](https://convert.docswell.com/user/higebu)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/4EZVZVNRJ3.jpg?width=480
description: https://www.slideshare.net/higebu/building-andcustomizingcoreos のミラーです。
published: November 13, 14
canonical: https://convert.docswell.com/s/higebu/57VDDV-building-and-customizing-coreos
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/4EZVZVNRJ3.jpg)

Building and Customizing CoreOS
- Creating images for NIFTY Cloud Yuya Kusakabe - @higebu
NIFTY Corp.
Nov. 13, 2014
Copyright © NIFTY Corporation All Rights Reserved.


# Page. 2

![Page Image](https://bcdn.docswell.com/page/Y765Z581EV.jpg)

About me
Twitter / GitHub: @higebu
 Engineer at Nifty Corp.
 Desining NIFTY Cloud virtual network
services
 Hacking VyOS, Packer, Zabbix
and CoreOS &lt;- New!

Copyright © NIFTY Corporation All Rights Reserved.
Confidential
2


# Page. 3

![Page Image](https://bcdn.docswell.com/page/G75YWY9L74.jpg)

About NIFTY Cloud
Launched in 2010.
 IaaS, PaaS and SaaS.
 Based on VMware.
 Original cloud controller like OpenStack.

Copyright © NIFTY Corporation All Rights Reserved.
Confidential
3


# Page. 4

![Page Image](https://bcdn.docswell.com/page/9J2GQG23JR.jpg)

Why customize CoreOS?
To provide CoreOS images on NIFTY Cloud.
 We need to handle end-user cloud-config
files.

Copyright © NIFTY Corporation All Rights Reserved.
Confidential
4


# Page. 5

![Page Image](https://bcdn.docswell.com/page/DEYVWVY8EM.jpg)

Why build CoreOS?

Because we can not install packages on
CoreOS without building.
Read-only rootfs
 No classic package manager

Copyright © NIFTY Corporation All Rights Reserved.
Confidential
5


# Page. 6

![Page Image](https://bcdn.docswell.com/page/VJNM9MP978.jpg)

Building CoreOS
( not customized )
For more detail:
https://coreos.com/docs/sdk-distributors/sdk/modifying-coreos/
Copyright © NIFTY Corporation All Rights Reserved.


# Page. 7

![Page Image](https://bcdn.docswell.com/page/YE9N2N33E3.jpg)

Install depot_tools
% git clone
https://chromium.googlesource.com/chromium/tools/depot_tools.git
% export PATH=&quot;$PATH&quot;:`pwd`/depot_tools
For more details about depot_tools:
http://www.chromium.org/developers/how-tos/depottools
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
7


# Page. 8

![Page Image](https://bcdn.docswell.com/page/GE8K5KML7D.jpg)

Bootstrap the SDK chroot
% mkdir coreos; cd coreos
% git config --global color.ui false # avoid interactive question
% repo init -u https://github.com/coreos/manifest.git -g minilayout -repo-url https://chromium.googlesource.com/external/repo.git
% repo sync
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
8


# Page. 9

![Page Image](https://bcdn.docswell.com/page/LELZYZ3QJR.jpg)

Building an image
% cros_sdk
% cros_sdk --enter
% ./set_shared_user_password.sh
% echo amd64-usr &gt; .default_board
% ./setup_board
% ./build_packages
% ./build_image prod --group alpha # production and alpha channel
% ./image_to_vm.sh --from=../build/images/amd64-usr/latest -board=amd64-usr --prod_image --format vmware # convert to
VMware VMX and VMDK
% exit
Your image is in the following directory.
“src/build/images/amd64-usr/latest/”
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
9


# Page. 10

![Page Image](https://bcdn.docswell.com/page/4JMVNVMKJW.jpg)

Customizing CoreOS
Copyright © NIFTY Corporation All Rights Reserved.


# Page. 11

![Page Image](https://bcdn.docswell.com/page/PJR2D2V6E9.jpg)

Add support for NIFTY Cloud

Add oem-niftycloud to coreos-overlay


Add niftycloud format to
scripts/build_library/vm_image_util.sh


https://github.com/higebu/coreosoverlay/tree/niftycloud-494
https://github.com/higebu/scripts/tree/niftycloud-494
VMware Tools

Experimental support for open-vm-tools at
471.1.0
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
11


# Page. 12

![Page Image](https://bcdn.docswell.com/page/PEXD1DZD7X.jpg)

oem-niftycloud

https://github.com/higebu/coreosoverlay/tree/niftycloud-494/coreos-base/oem-niftycloud
% tree coreos-base/oem-niftycloud/
coreos-base/oem-niftycloud/
├── files
│ ├── cloud-config.yml # cloud-config for NIFTY Cloud
│ ├── coreos-setup-environment # set environment variables
│ ├── niftycloud-coreos-cloudinit # run coreos-cloudinit with user-data
│ ├── niftycloud-run-startup-scripts # run user scripts
│ └── niftycloud-ssh-key # set ssh key
└── oem-niftycloud-0.0.1.ebuild
1 directory, 6 files
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
12


# Page. 13

![Page Image](https://bcdn.docswell.com/page/3EKX2X8D7D.jpg)

niftycloud format

https://github.com/higebu/scripts/blob/niftycloud494/build_library/vm_image_util.sh
## niftycloud
IMG_niftycloud_DISK_FORMAT=vmdk_scsi
IMG_niftycloud_DISK_LAYOUT=vm
IMG_niftycloud_CONF_FORMAT=vmx
IMG_niftycloud_OEM_PACKAGE=oem-niftycloud
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
13


# Page. 14

![Page Image](https://bcdn.docswell.com/page/L735452PE5.jpg)

open-vm-tools
It’s me!
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
14


# Page. 15

![Page Image](https://bcdn.docswell.com/page/87DDQDZ37G.jpg)

Building CoreOS
( Customized )
For more detail:
https://coreos.com/docs/sdk-distributors/sdk/modifying-coreos/
Copyright © NIFTY Corporation All Rights Reserved.


# Page. 16

![Page Image](https://bcdn.docswell.com/page/VJPXLXDP78.jpg)

Modify manifests/release.xml
• Change repository names and revisions
&lt;project groups=&quot;minilayout&quot; name=&quot;higebu/coreos-overlay&quot;
path=&quot;src/third_party/coreos-overlay&quot; remote=&quot;private&quot; revision=&quot;niftycloud494&quot; upstream=&quot;refs/heads/master&quot;/&gt;
&lt;project groups=&quot;minilayout&quot; name=&quot;higebu/scripts&quot; path=&quot;src/scripts&quot;
remote=&quot;private&quot; revision=&quot;niftycloud-494&quot; upstream=&quot;refs/heads/master&quot;/&gt;
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
16


# Page. 17

![Page Image](https://bcdn.docswell.com/page/2EVLQL1VJQ.jpg)

Install depot_tools
% git clone
https://chromium.googlesource.com/chromium/tools/depot_tools.git
% export PATH=&quot;$PATH&quot;:`pwd`/depot_tools
For more details about depot_tools:
http://www.chromium.org/developers/how-tos/depottools
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
17


# Page. 18

![Page Image](https://bcdn.docswell.com/page/57GXWX21EL.jpg)

Bootstrap the SDK chroot
% mkdir coreos; cd coreos
% git config --global color.ui false # avoid interactive question
% repo init -u ssh://git@github.com/higebu/manifest.git -b niftycloud494 -g minilayout --repo-url
https://chromium.googlesource.com/external/repo.git
% repo init –m release.xml
% repo sync
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
18


# Page. 19

![Page Image](https://bcdn.docswell.com/page/4EQ838PNJP.jpg)

Building an image
• Use niftycloud format
• Use “cros_sdk --” for automation
% cros_sdk --download
% cros_sdk -- &quot;./set_shared_user_password.sh&quot; &quot;core&quot;
% echo &quot;amd64-usr&quot; &gt; src/scripts/.default_board
% cros_sdk -- &quot;./setup_board&quot;
% cros_sdk -- &quot;./build_packages&quot;
% cros_sdk -- &quot;./build_image&quot; &quot;prod&quot; &quot;--group&quot; &quot;alpha&quot;
% cros_sdk -- &quot;./image_to_vm.sh&quot; &quot;--from=../build/images/amd64usr/latest&quot; &quot;--board=amd64-usr&quot; &quot;--prod_image&quot; &quot;--format&quot;
&quot;niftycloud&quot;
Your image is in the following directory.
“src/build/images/amd64-usr/latest/”
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
19


# Page. 20

![Page Image](https://bcdn.docswell.com/page/KJ4212Y3E1.jpg)

NIFTY Cloud CoreOS images!
Copyright © NIFTY Corporation All Rights Reserved.
Confidential
20


# Page. 21

![Page Image](https://bcdn.docswell.com/page/LE1MGM6Z7G.jpg)

Thank you for listening!
We are hiring!
http://www.nifty.co.jp/recruit/
Copyright © NIFTY Corporation All Rights Reserved.


# Page. 22

![Page Image](https://bcdn.docswell.com/page/GEW3K3W6E2.jpg)

Copyright © NIFTY Corporation All Rights Reserved.
Confidential
22


