Building The Source Code

Before you can start building ChromiumOS from source, you will need to to select the target device that you will be using to actually run the distribution you are creating. If you are creating a distribution for a device that shipped with ChromeOS pre-installed, you will need to get the "Board Name" from our ChromeOS Board Overlays Database. If you are building ChromiumOS that you plan to install on a desktop or laptop, you should use "amd64-generic" as your target board. If you are building ChromiumOS for a custom device or porting it to a single board computer, you will need to specify the name of the device overlay that you created (omit the "overlay-" prefix).

Enter the ChromiumOS SDK

cd ~/Workspace/ChromiumOS/
cros_sdk --enter

All of the commands following will need to be done in the cros_sdk.

If you plan on implementing over the air updates on your distribution, you will need the IP address to your build server. If you are using a NAT, you will need to use the IP address of the hypervisor or router and setup port forwarding to ensure that port 5555 is routed to port 5555 on the build server or virtual machine that you are using to build your distribution. This guide will assume you are using port 5555 for updates however you may change this to any port you wish. Omit the following 3 lines if you do not wish to support over the air upgrades.

export CHROMEOS_VERSION_DEVSERVER="http://YourIPAddress:8555"
export CHROMEOS_VERSION_AUSERVER="http://YourIPAddress:8555/update"
export CHROMEOS_RELEASE_TRACK="stable-channel"

Start the build process by issuing the following commands, this example will build ChromiumOS for the "amd64-generic" board, please change this value to match the board or overlay you are intending to use to run your final build.

./build_packages --board=amd64-generic
./build_image --board=amd64-generic --noenable_rootfs_verification dev base test

This process will take several hours depending on the hardware of your build machine and will create 3 raw disk images that can be used to test and deploy your build. The images will be placed in src/build/images/amd64-generic/latest/ if building for the amd64-generic board.

The command will generate 3 images-

  • chromiumos_image.bin - This is the image you will want to flash on hardware, it contains your build of ChromiumOS in a raw disk image that is setup in developer mode.
  • chromiumos_base_image.bin - This image is used for flashing on production hardware if you are a OEM. You will need a ChromiumOS shim to install to hardware as this image does not give access to the shell needed to perform the installation.
  • chromiumos_test_image.bin - This image is used for automated testing and should never be ran on production hardware as it is by design, very insecure. The output directory also includes a set of private/public ssh keys to connect to devices as root.
  • The "test" flag in the build image is only needed if you plan to run the ChromiumOS automated testing suite on the build and may be omitted if you plan to only test on physical hardware.