<commit_before>---
layout: docs
slug: sdk
title: Documentation
---

# CoreOS Developer SDK Guide

These are the instructions for building CoreOS itself. By the end of
the guide you will build a developer image that you can run under
KVM and have tools for making changes to the code.

CoreOS is an open source project. All of the source for CoreOS is
available on [github][github-coreos]. If you find issues with these docs
or the code please send a pull request.

You can direct questions to the [IRC channel][irc] or [mailing list][coreos-dev].

[github-coreos]: https://github.com/coreos/
[irc]: irc://irc.freenode.org:6667/#coreos
[coreos-dev]: https://groups.google.com/forum/#!forum/coreos-dev

## Getting Started

Let's get set up with an SDK chroot and build a bootable image of CoreOS. The
SDK chroot has a full toolchain and isolates the build process from quirks and
differences between host OSes.

### Install depot_tools

`repo`, one of the `depot_tools`, helps to manage the collection of git
repositories that makes up CoreOS. Pull down the code and add it to your
path:

```
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH":`pwd`/depot_tools
```

You may want to add this to your .bashrc or /etc/profile.d/ so that you don’t
need to reset your $PATH manually each time you open a new shell.

### Bootstrap the SDK chroot

Create a project directory. This will hold all of your git repos and the SDK
chroot. A few gigs of space will be necessary.

```
mkdir coreos; cd coreos
```

Initialize the .repo directory with the manifest that describes all of the git
repos required to get started.

```
repo init -u https://github.com/coreos/manifest.git -g minilayout --repo-url  https://git.chromium.org/git/external/repo.git
```

Synchronize all of the required git repos from the manifest.

```
repo sync
```

### Building an image

Download and enter the SDK chroot which contains all of the compilers and
tooling.

```
./chromite/bin/cros_sdk
```

**WARNING:** If you ever need to delete the SDK chroot use
`./chromite/bin/cros_sdk --delete`. Otherwise, you will delete `/dev`
entries that are bind mounted into the chroot.

Set up the "core" user's password.

```
./set_shared_user_password.sh
```

Target amd64-generic for this image:

```
echo amd64-generic > .default_board
```

Setup a board root filesystem in /build/${BOARD}:

```
./setup_board
```

Build all of the target binary packages:

```
./build_packages
```

Build an image based on the built binary packages along with the developer
overlay:

```
./build_image --noenable_rootfs_verification dev
```

After this finishes up commands for converting the raw bin into
a bootable vm will be printed. Run the `image_to_vm.sh` command.

### Booting

Once you build an image you can launch it with KVM (instructions will
print out after `image_to_vm.sh` runs).

To demo the general direction we are starting in now the OS starts two
small daemons that you can access over an HTTP interface. The first,
systemd-rest, allows you to stop and stop units via HTTP. The other is a
small server that you can play with shutting off and on called
motd-http. You can try these daemons with:
<commit_msg>Typo in sdk/index.md<commit_after>---
layout: docs
slug: sdk
title: Documentation
---

# CoreOS Developer SDK Guide

These are the instructions for building CoreOS itself. By the end of
the guide you will build a developer image that you can run under
KVM and have tools for making changes to the code.

CoreOS is an open source project. All of the source for CoreOS is
available on [github][github-coreos]. If you find issues with these docs
or the code please send a pull request.

You can direct questions to the [IRC channel][irc] or [mailing list][coreos-dev].

[github-coreos]: https://github.com/coreos/
[irc]: irc://irc.freenode.org:6667/#coreos
[coreos-dev]: https://groups.google.com/forum/#!forum/coreos-dev

## Getting Started

Let's get set up with an SDK chroot and build a bootable image of CoreOS. The
SDK chroot has a full toolchain and isolates the build process from quirks and
differences between host OSes.

### Install depot_tools

`repo`, one of the `depot_tools`, helps to manage the collection of git
repositories that makes up CoreOS. Pull down the code and add it to your
path:

```
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH":`pwd`/depot_tools
```

You may want to add this to your .bashrc or /etc/profile.d/ so that you don’t
need to reset your $PATH manually each time you open a new shell.

### Bootstrap the SDK chroot

Create a project directory. This will hold all of your git repos and the SDK
chroot. A few gigs of space will be necessary.

```
mkdir coreos; cd coreos
```

Initialize the .repo directory with the manifest that describes all of the git
repos required to get started.

```
repo init -u https://github.com/coreos/manifest.git -g minilayout --repo-url  https://git.chromium.org/git/external/repo.git
```

Synchronize all of the required git repos from the manifest.

```
repo sync
```

### Building an image

Download and enter the SDK chroot which contains all of the compilers and
tooling.

```
./chromite/bin/cros_sdk
```

**WARNING:** If you ever need to delete the SDK chroot use
`./chromite/bin/cros_sdk --delete`. Otherwise, you will delete `/dev`
entries that are bind mounted into the chroot.

Set up the "core" user's password.

```
./set_shared_user_password.sh
```

Target amd64-generic for this image:

```
echo amd64-generic > .default_board
```

Setup a board root filesystem in /build/${BOARD}:

```
./setup_board
```

Build all of the target binary packages:

```
./build_packages
```

Build an image based on the built binary packages along with the developer
overlay:

```
./build_image --noenable_rootfs_verification dev
```

After this finishes up commands for converting the raw bin into
a bootable vm will be printed. Run the `image_to_vm.sh` command.

### Booting

Once you build an image you can launch it with KVM (instructions will
print out after `image_to_vm.sh` runs).

To demo the general direction we are starting in now the OS starts two
small daemons that you can access over an HTTP interface. The first,
systemd-rest, allows you to stop and start units via HTTP. The other is a
small server that you can play with shutting off and on called
motd-http. You can try these daemons with:

{'fraction_non_alphanumeric': 0.08672676406589991, 'fraction_numerical': 0.0024867889337892445, 'mean_word_length': 4.039154267815192, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5644158', 'n_tokens_mistral': 2009, 'n_tokens_neox': 1888, 'n_words': 908}