CoreOS image creation
CoreOS can also create images yourself. You can say that you can set your password by creating your own image, or put the software in advance on the host side. (I do not know much benefit)
The concrete procedure of image creation is
https://coreos.com/docs/sdk-distributors/sdk/modifying-coreos/
It is as written on. This time I tried this as it was.
Work content
Premise
Distribution is not required for machines necessary for creating images, as long as they are x86-64 Linux.
Other
- Git
- Curl
Is required. However, it is in the main system, is not it?
Insert depot_tools
CoreOS builds using repo. This is what you are using for Android. Clone depot_tools and pass it through PATH.
% git clone
https://chromium.googlesource.com/chromium/tools/depot_tools.git
% export PATH="$PATH":`pwd`/depot_tools
Create SDK chroot
% mkdir coreos; cd coreos
# .repoディレクトリを初期化します
% repo init -u https://github.com/coreos/manifest.git -g minilayout --repo-url \
https://chromium.googlesource.com/external/repo.git
# manifestで指定されたgit repoをすべて取得します (結構な時間がかかります)
% repo sync
Create an image
I will download sdk. (Sudo is required)
% ./chromite/bin/cros_sdk
This also takes quite a while but if you wait for a while, it will come out like this.
cros_sdk:make_chroot: All set up. To enter the chroot, run:
$ cros_sdk --enter
CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind
mounts you may end up deleting your source tree too. To unmount and
delete the chroot cleanly, use:
$ cros_sdk --delete
(cr) ((c15791e...)) r_rudi@hamspam ~/trunk/src/scripts $
To set the "core" user's password type: (It is in coreos / chroot / usr / lib64 / crosutils)
./set_shared_user_password.sh
To make this image target amd64: It is possible to specify x86 and so on.
echo amd64-usr > .default_board
Board root To set the file system to / build / $ {BOARD}, type:
./setup_board
After a while, this will come out and complete.
INFO setup_board: Elapsed time (setup_board): 4m16s
INFO setup_board: The SYSROOT is: /build/amd64-usr
Build the binary package. This also takes about 30 minutes.
./build_packages
(省略)
>>> Using system located in ROOT tree /build/amd64-usr/
>>> No outdated packages were found on your system.
INFO build_packages: Checking build root
INFO build_packages: Builds complete
INFO build_packages: Elapsed time (build_packages): 27m55s
When finished I will create a binary package with developer overlay (?
./build_image --noenable_rootfs_verification dev
(省略)
2014/04/02 06:12:44 - generate_au_zip.py - INFO : Generated
/mnt/host/source/src/build/images/amd64-usr/274.0.0+2014-04-02-0604-a1/au-generator.zip
COREOS_BUILD=274
COREOS_BRANCH=0
COREOS_PATCH=0
COREOS_SDK_VERSION=273.0.0
Done. Image(s) created in
/mnt/host/source/src/build/images/amd64-usr/274.0.0+2014-04-02-0604-a1
Developer image created as coreos_developer_image.bin
To convert it to a virtual machine image, use:
./image_to_vm.sh --from=../build/images/amd64-usr/274.0.0+2014-04-02-0604-a1 --board=amd64-usr
The default type is qemu, see ./image_to_vm.sh --help for other options.
Since it was raw bin img, you can do it with. / Image_to_vm.sh.
./image_to_vm.sh --format virtualbox
(省略)
INFO build_image: Elasr/274.0.0+2014-04-02-0604-a1
INFO image_to_vm.sh: - coreos_developer_virtualbox_image.vmdk
INFO image_to_vm.sh: - coreos_developer_virtualbox.ovf
INFO image_to_vm.sh: - coreos_developer_virtualbox.README
Copy coreos_developer_virtualbox_image.vmdk and
coreos_developer_virtualbox.ovf to a VirtualBox host and run:
VBoxManage import coreos_developer_virtualbox.ovf
Although it appears at the end of build_image, qemu's image is created in default, but you can create other images like this one. Specifically, this version is like this. It seems that vagrant, ami, gce, etc. can also be done.
- Ami
- Pxe
- Iso
- Openstack
- Qemu
- Qemu_no_kexec
- Rackspace
- Rackspace_vhd
- Vagrant
- Vagrant_vmware_fusion
- Virtualbox
- Vmware
- Vmware_insecure
- Xen
- Gce
Since this time chose the virtualbox, coreos_developer_virtualbox_image.vmdk and coreos_developer_virtualbox.ovf file that it was completed.
% cd ~/trunk/src/build/images/amd64-usr/274.0.0+2014-04-02-0604-a1
% ls -l
-rw-r--r-- 1 r_rudi r_rudi 7.7M 4月 2 06:12 au-generator.zip
-rw-r--r-- 1 r_rudi r_rudi 2.9G 4月 2 06:12 coreos_developer_image.bin
-rw-r--r-- 1 r_rudi r_rudi 160 4月 2 06:27 coreos_developer_virtualbox.README
-rw-r--r-- 1 r_rudi r_rudi 11K 4月 2 06:27 coreos_developer_virtualbox.ovf
-rw-r--r-- 1 r_rudi r_rudi 471M 4月 2 06:27 coreos_developer_virtualbox_image.vmdk
drwxr-xr-x 2 root root 4.0K 4月 2 06:04 rootfs
-rw-r--r-- 1 r_rudi r_rudi 75 4月 2 06:12 version.txt
This is, ホスト側 In coreos/src/build/images/amd64-usr/274.0.0+2014-04-02-0604-a1 / amd64-usr / 274.0.0 + 2014-04-02-0604-a1` you Ri per in.
It is OK if you start this with virtualbox. The user name core and password can log in with the password you set yourself.
Summary
Actually, I have not used CoreOS properly yet, but I tried to create the first image.
The build script was properly maintained, and there was not anything to do with it at all.