make install;

some notes to myself



Building Copperhead OS for the Pixel XL

Written on January 20, 2018

Notes for building Copperhead OS for the Pixel XL. (gist here: This was done on Ubuntu 14.04.5 LTS, using GNU Make 3.81 (3.81-8.2ubuntu3) and Python 2.7.6 (2.7.6-8ubuntu0.2), as recommended on All below instructions are specific to the Pixel XL (marlin) and come from

Install build dependencies

sudo apt-get update 
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

sudo apt-get install fuseext2 # It is not advised to use this for down below (see comments on, but I wasn't sure what to do, as debugfs wasn't working.
sudo apt-get install liblz4-tool

Set up

build_tag='OPM1.171019.012.2018.01.03.02' # this is the value in the Version column on
device='marlin' # Pixel XL
build_id='OPM1.171019.012' #

Download source

mkdir copperheados-${build_tag}
cd copperheados-${build_tag}
repo init -u -b refs/tags/${build_tag}

gpg --recv-keys 65EEFE022108E2B708CBFCF7F9E712E59AF5F22A
gpg --recv-keys 4340D13570EF945E83810964E8AD3F819AB10E78
cd .repo/manifests
git verify-tag --raw $(git describe)
cd ../..

repo sync -j10

repo forall -c 'git verify-tag --raw $(git describe)'

Setting up the build environment

source script/
choosecombo release aosp_${device} user

# Edit vendor/android-prepare-vendor/ to use fuse instead of debugfs
vendor/android-prepare-vendor/ -d marlin -b ${build_id} -o vendor/android-prepare-vendor
mkdir -p vendor/google_devices
rm -rf vendor/google_devices/${device}

lower_build_id=$(echo $build_id | tr '[:upper:]' '[:lower:]')
mv vendor/android-prepare-vendor/marlin/${lower_build_id}/vendor/google_devices/marlin vendor/google_devices

Generating release signing keys

mkdir -p keys/${device}
cd keys/${device}
../../development/tools/make_key releasekey '/C=CA/ST=Ontario/L=Toronto/O=CopperheadOS/OU=CopperheadOS/CN=CopperheadOS/'
../../development/tools/make_key platform '/C=CA/ST=Ontario/L=Toronto/O=CopperheadOS/OU=CopperheadOS/CN=CopperheadOS/'
../../development/tools/make_key shared '/C=CA/ST=Ontario/L=Toronto/O=CopperheadOS/OU=CopperheadOS/CN=CopperheadOS/'
../../development/tools/make_key media '/C=CA/ST=Ontario/L=Toronto/O=CopperheadOS/OU=CopperheadOS/CN=CopperheadOS/'
../../development/tools/make_key verity '/C=CA/ST=Ontario/L=Toronto/O=CopperheadOS/OU=CopperheadOS/CN=CopperheadOS/'
cd ../..

make -j10 generate_verity_key
out/host/linux-x86/bin/generate_verity_key -convert keys/${device}/verity.x509.pem keys/${device}/verity_key

openssl x509 -outform der -in keys/${device}/verity.x509.pem -out kernel/google/${device}/verity_user.der.x509

Put the platform and releasekey into so that apps from F-Droid can be installed (

release_fingerprint=$(cat keys/marlin/releasekey.x509.pem | openssl x509  -fingerprint -sha256 -noout | tr -d ":" | sed 's/.*=//')
platform_fingerprint=$(cat keys/marlin/platform.x509.pem | openssl x509  -fingerprint -sha256 -noout | tr -d ":" | sed 's/.*=//')

# Replace existing marlin fingerprints
sed -i "s/6425C9DE6219056CCE62F73E7AD9F92C940B83BAC1D5516ABEBCE1D38F85E4CF/${release_fingerprint}/g" $client_whitelist
sed -i "s/CC1E06EAD3E9CA2C4E46073172E92BAD4AFB02D4D21EDDC3F4D9A50C2FBD639D/${platform_fingerprint}/g" $client_whitelist


rm -r out
make target-files-package -j10

#Generating signed factory images and full update packages
make -j10 brillo_update_payload
script/ marlin


rm -r * # Delete everything but the .repo dir
# set the necessary variables in *Set up* and restart