coreos-base: initial commit

This commit is contained in:
Brandon Philips 2013-02-05 11:47:38 -08:00
parent 81921ecf6c
commit 0f9184b51b
29 changed files with 1907 additions and 0 deletions

View File

@ -0,0 +1 @@
coreos-base-0.ebuild

View File

@ -0,0 +1,284 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
inherit useradd pam
DESCRIPTION="ChromeOS specific system setup"
HOMEPAGE="http://src.chromium.org/"
SRC_URI=""
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE="cros_host pam"
# We need to make sure timezone-data is merged before us.
# See pkg_setup below as well as http://crosbug.com/27413
# and friends.
DEPEND=">=sys-apps/baselayout-2
!<sys-apps/baselayout-2.0.1-r227
!<sys-libs/timezone-data-2011d
!<=app-admin/sudo-1.8.2
!<sys-apps/mawk-1.3.4
!<app-shells/bash-4.1
!<app-shells/dash-0.5.5
!<net-misc/openssh-5.2_p1-r8
!cros_host? (
!app-misc/editor-wrapper
sys-libs/timezone-data
)"
RDEPEND="${DEPEND}"
# Remove entry from /etc/group
#
# $1 - Group name
remove_group() {
[ -e "${ROOT}/etc/group" ] && sed -i -e /^${1}:.\*$/d "${ROOT}/etc/group"
}
# Adds a "daemon"-type user with no login or shell.
copy_or_add_daemon_user() {
local username="$1"
local uid="$2"
if user_exists "${username}"; then
elog "Removing existing user '$1' for copy_or_add_daemon_user"
remove_user "${username}"
fi
copy_or_add_user "${username}" "*" $uid $uid "" /dev/null /bin/false
if group_exists "${username}"; then
elog "Removing existing group '$1' for copy_or_add_daemon_user"
elog "Any existing group memberships will be lost"
remove_group "${username}"
fi
copy_or_add_group "${username}" $uid
}
# Removes all users from a group in /etc/group.
# No changes if the group does not exist.
remove_all_users_from_group() {
local group="$1"
sed -i "/^${group}:/s/:[^:]*$/:/" "${ROOT}/etc/group"
}
# Removes a list of users from a group in /etc/group.
# No changes if the group does not exist or the user is not in the group.
remove_users_from_group() {
local group="$1"; shift
local username
for username in "$@"; do
sed -i -r "/^${group}:/{s/([,:])${username}(,|$)/\1/; s/,$//}" \
"${ROOT}/etc/group"
done
}
# Adds a list of users to a group in /etc/group.
# No changes if the group does not exist.
add_users_to_group() {
local group="$1"; shift
local username
remove_users_from_group "${group}" "$@"
for username in "$@"; do
sed -i "/^${group}:/{ s/$/,${username}/ ; s/:,/:/ }" "${ROOT}/etc/group"
done
}
pkg_setup() {
if ! use cros_host ; then
# The sys-libs/timezone-data package installs a default /etc/localtime
# file automatically, so scrub that if it's a regular file.
local etc_tz="${ROOT}etc/localtime"
[[ -L ${etc_tz} ]] || rm -f "${etc_tz}"
fi
}
src_install() {
insinto /etc
doins "${FILESDIR}"/sysctl.conf || die
insinto /etc/profile.d
doins "${FILESDIR}"/xauthority.sh || die
insinto /lib/udev/rules.d
doins "${FILESDIR}"/udev-rules/*.rules || die
# target-specific fun
if ! use cros_host ; then
dodir /bin /usr/bin
# Symlink /etc/localtime to something on the stateful partition, which we
# can then change around at runtime.
dosym /var/lib/timezone/localtime /etc/localtime || die
# We use mawk in the target boards, not gawk.
dosym mawk /usr/bin/awk || die
# We want dash as our main shell.
dosym dash /bin/sh
# Avoid the wrapper and just link to the only editor we have.
dodir /usr/libexec
dosym /usr/bin/vim /usr/libexec/editor || die
dosym /bin/more /usr/libexec/pager || die
# Install our custom ssh config settings.
insinto /etc/ssh
doins "${FILESDIR}"/ssh{,d}_config
fperms 600 /etc/ssh/sshd_config
# Custom login shell snippets.
insinto /etc/profile.d
doins "${FILESDIR}"/cursor.sh
fi
# Add our little bit of sudo glue.
newpamd "${FILESDIR}"/include-coreos-auth sudo
# This one line comes from the sudo ebuild.
pamd_mimic system-auth sudo auth account session
if [[ -n ${SHARED_USER_NAME} ]] ; then
insinto /etc/sudoers.d
echo "${SHARED_USER_NAME} ALL=(ALL) ALL" > 95_cros_base
insopts -m 440
doins 95_cros_base || die
fi
}
pkg_postinst() {
local x
# We explicitly add all of the users needed in the system here. The
# build of Chromium OS uses a single build chroot environment to build
# for various targets with distinct ${ROOT}. This causes two problems:
# 1. The target rootfs needs to have the same UIDs as the build
# chroot so that chmod operations work.
# 2. The portage tools to add a new user in an ebuild don't work when
# $ROOT != /
# We solve this by having baselayout install in both the build and
# target and pre-create all needed users. In order to support existing
# build roots we copy over the user entries if they already exist.
local system_user="chronos"
local system_id="1000"
local system_home="/home/${system_user}/user"
# Add a chronos-access group to provide non-chronos users,
# mostly system daemons running as a non-chronos user, group permissions
# to access files/directories owned by chronos.
local system_access_user="chronos-access"
local system_access_id="1001"
local crypted_password='*'
[ -r "${SHARED_USER_PASSWD_FILE}" ] &&
crypted_password=$(cat "${SHARED_USER_PASSWD_FILE}")
remove_user "${system_user}"
add_user "${system_user}" "x" "${system_id}" \
"${system_id}" "system_user" "${system_home}" /bin/sh
remove_shadow "${system_user}"
add_shadow "${system_user}" "${crypted_password}"
copy_or_add_group "${system_user}" "${system_id}"
copy_or_add_daemon_user "${system_access_user}" "${system_access_id}"
copy_or_add_daemon_user "messagebus" 201 # For dbus
copy_or_add_daemon_user "syslog" 202 # For rsyslog
copy_or_add_daemon_user "ntp" 203
copy_or_add_daemon_user "sshd" 204
copy_or_add_daemon_user "polkituser" 206 # For policykit
copy_or_add_daemon_user "tss" 207 # For trousers (TSS/TPM)
copy_or_add_daemon_user "pkcs11" 208 # For pkcs11 clients
copy_or_add_daemon_user "qdlservice" 209 # for QDLService
copy_or_add_daemon_user "cromo" 210 # For cromo (modem manager)
# copy_or_add_daemon_user "cashew" 211 # Deprecated, do not reuse
copy_or_add_daemon_user "ipsec" 212 # For strongswan/ipsec VPN
copy_or_add_daemon_user "cros-disks" 213 # For cros-disks
copy_or_add_daemon_user "tor" 214 # For tor (anonymity service)
copy_or_add_daemon_user "tcpdump" 215 # For tcpdump --with-user
copy_or_add_daemon_user "debugd" 216 # For debugd
copy_or_add_daemon_user "openvpn" 217 # For openvpn
copy_or_add_daemon_user "bluetooth" 218 # For bluez
copy_or_add_daemon_user "wpa" 219 # For wpa_supplicant
copy_or_add_daemon_user "cras" 220 # For cras (audio)
# copy_or_add_daemon_user "gavd" 221 # For gavd (audio) (deprecated)
copy_or_add_daemon_user "input" 222 # For /dev/input/event access
copy_or_add_daemon_user "chaps" 223 # For chaps (pkcs11)
copy_or_add_daemon_user "dhcp" 224 # For dhcpcd (DHCP client)
copy_or_add_daemon_user "tpmd" 225 # For tpmd
copy_or_add_daemon_user "mtp" 226 # For libmtp
copy_or_add_daemon_user "proxystate" 227 # For proxy monitoring
copy_or_add_daemon_user "power" 228 # For powerd
copy_or_add_daemon_user "watchdog" 229 # For daisydog
copy_or_add_daemon_user "devbroker" 230 # For permission_broker
copy_or_add_daemon_user "xorg" 231 # For Xorg
# Reserve some UIDs/GIDs between 300 and 349 for sandboxing FUSE-based
# filesystem daemons.
copy_or_add_daemon_user "ntfs-3g" 300 # For ntfs-3g prcoess
copy_or_add_daemon_user "avfs" 301 # For avfs process
copy_or_add_daemon_user "fuse-exfat" 302 # For exfat-fuse prcoess
# Group that are allowed to create directories under /home/<hash>/root
copy_or_add_group "daemon-store" 400
# All audio interfacing will go through the audio server.
add_users_to_group audio "cras"
add_users_to_group input "cras" # For /dev/input/event* access
# The system user is part of the audio server group to play sounds. The
# power manager user needs to check whether audio is playing.
add_users_to_group cras "${system_user}" power
# The system_user needs to be part of the audio and video groups.
add_users_to_group audio "${system_user}"
add_users_to_group video "${system_user}"
# The Xorg user needs to be part of the input and video groups.
add_users_to_group input "xorg"
add_users_to_group video "xorg"
# Users which require access to PKCS #11 cryptographic services must be
# in the pkcs11 group.
remove_all_users_from_group pkcs11
add_users_to_group pkcs11 root ipsec "${system_user}" chaps wpa
# All users accessing opencryptoki database files and all users for
# sandboxing FUSE-based filesystem daemons need to be in the
# ${system_access_user} group.
remove_all_users_from_group "${system_access_user}"
add_users_to_group "${system_access_user}" root ipsec "${system_user}" \
ntfs-3g avfs fuse-exfat chaps
# Dedicated group for owning access to serial devices.
copy_or_add_group "serial" 402
add_users_to_group "serial" "${system_user}"
add_users_to_group "serial" "uucp"
# The root user must be in the wpa group for wpa_cli.
add_users_to_group wpa root
# Restrict tcsd access to root and chaps.
add_users_to_group tss root chaps
# Add mtp user to usb group for USB device access.
add_users_to_group usb mtp
# Create a group for device access via permission_broker
copy_or_add_group "devbroker-access" 403
add_users_to_group devbroker-access "${system_user}"
# Give the power manager access to I2C devices so it can adjust external
# displays' brightness via DDC.
copy_or_add_group i2c 404
add_users_to_group i2c power
# Give the power manager access to /dev/tty* so it can disable VT switching
# before suspending the system.
add_users_to_group tty power
# The power manager needs to read from /dev/input/event* to observe power
# button and lid events.
add_users_to_group input power
# Some default directories. These are created here rather than at
# install because some of them may already exist and have mounts.
for x in /dev /home /media \
/mnt/stateful_partition /proc /root /sys /var/lock; do
[ -d "${ROOT}/$x" ] && continue
install -d --mode=0755 --owner=root --group=root "${ROOT}/$x"
done
}

View File

@ -0,0 +1,7 @@
# We disable vt cursors by default on the kernel command line
# (so that it doesn't flash when doing boot splash and such).
#
# Re-enable it when launching a login shell. This should only
# happen when logging in via vt or crosh or ssh and those are
# all fine. Login shells shouldn't get launched normally.
setterm -cursor on

View File

@ -0,0 +1 @@
auth include chromeos-auth

View File

@ -0,0 +1,2 @@
Host *
UserKnownHostsFile /home/chronos/user/.ssh/known_hosts

View File

@ -0,0 +1,13 @@
# Force protocol v2 only
Protocol 2
# /etc is read-only. Fetch keys from stateful partition
# Not using v1, so no v1 key
HostKey /mnt/stateful_partition/etc/ssh/ssh_host_rsa_key
HostKey /mnt/stateful_partition/etc/ssh/ssh_host_dsa_key
PasswordAuthentication no
UsePAM yes
PrintMotd no
PrintLastLog no
Subsystem sftp internal-sftp

View File

@ -0,0 +1,96 @@
# /etc/sysctl.conf
#
# For more information on how this file works, please see
# the manpages sysctl(8) and sysctl.conf(5).
#
# In order for this file to work properly, you must first
# enable 'Sysctl support' in the kernel.
#
# Look in /proc/sys/ for all the things you can setup.
#
#
# Original Gentoo settings:
#
# Disables packet forwarding
net.ipv4.ip_forward = 0
# Disables IP dynaddr
#net.ipv4.ip_dynaddr = 0
# Disable ECN
#net.ipv4.tcp_ecn = 0
# Enables source route verification
net.ipv4.conf.default.rp_filter = 1
# Enable reverse path
net.ipv4.conf.all.rp_filter = 1
# Enable SYN cookies (yum!)
# http://cr.yp.to/syncookies.html
#net.ipv4.tcp_syncookies = 1
# Disable source route
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv4.conf.default.accept_source_route = 0
# Disable redirects
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv4.conf.default.accept_redirects = 0
# Disable secure redirects
#net.ipv4.conf.all.secure_redirects = 0
#net.ipv4.conf.default.secure_redirects = 0
# Ignore ICMP broadcasts
#net.ipv4.icmp_echo_ignore_broadcasts = 1
# Perform PLPMTUD only after detecting a "blackhole" in old-style PMTUD
net.ipv4.tcp_mtu_probing = 1
# Disables the magic-sysrq key
#kernel.sysrq = 0
# When the kernel panics, automatically reboot in 3 seconds
#kernel.panic = 3
# Allow for more PIDs (cool factor!); may break some programs
#kernel.pid_max = 999999
# You should compile nfsd into the kernel or add it
# to modules.autoload for this to work properly
# TCP Port for lock manager
#fs.nfs.nlm_tcpport = 0
# UDP Port for lock manager
#fs.nfs.nlm_udpport = 0
#
# ChromeOS specific settings:
#
# Set watchdog_thresh
kernel.watchdog_thresh = 5
# When the kernel panics, automatically reboot to preserve dump in ram
kernel.panic = -1
# Reboot on oops as well
kernel.panic_on_oops = 1
# Disable shrinking the cwnd when connection is idle
net.ipv4.tcp_slow_start_after_idle = 0
# Protect working set in order to avoid thrashing.
# See http://crosbug.com/7561 for details.
vm.min_filelist_kbytes = 50000
# Allow full memory overcommit as we rather close or kill tabs than
# refuse memory to arbitrary core processes.
vm.overcommit_memory = 1
# Use laptop mode settings always
vm.dirty_background_ratio = 1
vm.dirty_expire_centisecs = 60000
vm.dirty_ratio = 60
vm.dirty_writeback_centisecs = 60000
vm.laptop_mode = 0
# Disable kernel address visibility to non-root users.
kernel.kptr_restrict = 1
# Increase shared memory segment limit for plugins rendering large areas
kernel.shmmax = 134217728

View File

@ -0,0 +1,9 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
KERNEL=="tty[A-Z]*[0-9]", GROUP="serial"
# Don't allow access to serial interfaces on Gobi modems.
KERNEL=="tty[A-Z]*[0-9]", ID_USB_DRIVER=="qcserial", GROUP="root"
# Don't allow access to serial interfaces on Novatel modems.
KERNEL=="tty[A-Z]*[0-9]", ID_USB_DRIVER=="option", GROUP="root"

View File

@ -0,0 +1,5 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
KERNEL=="i2c-[0-9]", GROUP="i2c"

View File

@ -0,0 +1,8 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="07", ATTRS{idProduct}=="*", \
PROGRAM="/usr/bin/dbus-send --system --type=method_call --dest=org.chromium.LibCrosService \
/org/chromium/LibCrosService org.chromium.LibCrosServiceInterface.PrinterAdded \
string:$attr{idVendor} string:$attr{idProduct}"

View File

@ -0,0 +1 @@
export XAUTHORITY="/home/chronos/.Xauthority"

View File

@ -0,0 +1,141 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_COMMIT="9a6f64de2cda21ad3f173c13298a53dcb5525cc3"
CROS_WORKON_TREE="a0a8dc61fac2ae0179f836e42406c569c2e2ca84"
CROS_WORKON_PROJECT="chromiumos/platform/dev-util"
CROS_WORKON_LOCALNAME="dev"
inherit cros-workon multilib python
DESCRIPTION="Development utilities for ChromiumOS"
HOMEPAGE="http://www.chromium.org/"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE="cros_host test"
RDEPEND="cros_host? ( app-emulation/qemu-kvm )
app-portage/gentoolkit
cros_host? ( app-shells/bash )
!cros_host? ( !chromeos-base/gmerge )
dev-lang/python
dev-util/shflags
cros_host? ( dev-util/crosutils )
"
# These are all either bash / python scripts. No actual builds DEPS.
DEPEND=""
src_install() {
# Run the devserver Makefile.
emake install DESTDIR="$D"
dosym /build /var/lib/devserver/static/pkgroot
dosym /var/lib/devserver/static /usr/lib/devserver/static
if ! use cros_host; then
dobin gmerge stateful_update
else
local host_tools
host_tools=(
cros_bundle_firmware
cros_choose_profile
cros_chrome_make
cros_fetch_image
cros_sign_bootstub
cros_start_vm
cros_stop_vm
cros_workon
cros_workon_make
cros_write_firmware
dump_i2c
dump_tpm
gdb_remote
gdb_x86_local
gmergefs
image_to_live.sh
strip_package
ssh_no_update
willis
)
dobin "${host_tools[@]/#/host/}"
# Payload generation scripts.
dobin host/cros_generate_update_payload
dobin host/cros_generate_stateful_update_payload
# Repo and git bash completion.
insinto /usr/share/bash-completion
newins host/repo_bash_completion repo
dosym /usr/share/bash-completion/git /etc/bash_completion.d/git
dosym /usr/share/bash-completion/repo /etc/bash_completion.d/repo
insinto "$(python_get_sitedir)"
doins host/lib/*.py
insinto "/usr/lib/crosutils"
doins host/lib/cros_archive.sh
fi
}
src_test() {
cd "${S}" # Let's just run unit tests from ${S} rather than install and run.
# Run bundle_firmware tests
pushd host/lib >/dev/null
local libfile
for libfile in *.py; do
einfo Running tests in ${libfile}
python ${libfile} --test || \
die "Unit tests failed at ${libfile}!"
done
popd >/dev/null
pushd host/tests >/dev/null
for ut_file in *.py; do
echo Running tests in ${ut_file}
PYTHONPATH=../lib python ${ut_file} ||
die "Unit tests failed at ${ut_file}!"
done
popd >/dev/null
local TESTS=()
if ! use cros_host; then
TESTS+=( gmerge_test.py )
# FIXME(zbehan): import gmerge in gmerge_test.py won't work if we won't
# have the .py.
ln -sf gmerge gmerge.py
else
TESTS+=( autoupdate_unittest.py )
TESTS+=( builder_test.py )
TESTS+=( devserver_test.py )
TESTS+=( common_util_unittest.py )
TESTS+=( host/lib/cros_archive_unittest.sh )
#FIXME(zbehan): update_test.py doesn't seem to work right now.
fi
local test
for test in ${TESTS[@]} ; do
einfo "Running ${test}"
./${test} || die "Failed in ${test}"
done
}
pkg_preinst() {
# Handle pre-existing possibly problematic configurations of static
use cros_host || return 0
if [[ -e ${ROOT}/usr/bin/static && ! -L ${ROOT}/usr/bin/static ]] ; then
einfo "/usr/bin/static detected, and is not a symlink, performing cleanup"
# Well, I don't know what else should be done about it. Moving the
# files has several issues: handling of all kinds of links, special
# files, permissions, etc. Autoremval is not a good idea, what if
# this ended up with accidental destruction of the system?
local newname="static-old-${RANDOM}" # In case this happens more than once.
mv "${ROOT}"/usr/bin/static "${ROOT}"/usr/bin/${newname}
ewarn "/usr/bin/${newname} has the previous contents of static."
ewarn "It can be safely deleted (or kept around forever)."
fi
}

View File

@ -0,0 +1,139 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_PROJECT="chromiumos/platform/dev-util"
CROS_WORKON_LOCALNAME="dev"
inherit cros-workon multilib python
DESCRIPTION="Development utilities for ChromiumOS"
HOMEPAGE="http://www.chromium.org/"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="cros_host test"
RDEPEND="cros_host? ( app-emulation/qemu-kvm )
app-portage/gentoolkit
cros_host? ( app-shells/bash )
!cros_host? ( !chromeos-base/gmerge )
dev-lang/python
dev-util/shflags
cros_host? ( dev-util/crosutils )
"
# These are all either bash / python scripts. No actual builds DEPS.
DEPEND=""
src_install() {
# Run the devserver Makefile.
emake install DESTDIR="$D"
dosym /build /var/lib/devserver/static/pkgroot
dosym /var/lib/devserver/static /usr/lib/devserver/static
if ! use cros_host; then
dobin gmerge stateful_update
else
local host_tools
host_tools=(
cros_bundle_firmware
cros_choose_profile
cros_chrome_make
cros_fetch_image
cros_sign_bootstub
cros_start_vm
cros_stop_vm
cros_workon
cros_workon_make
cros_write_firmware
dump_i2c
dump_tpm
gdb_remote
gdb_x86_local
gmergefs
image_to_live.sh
strip_package
ssh_no_update
willis
)
dobin "${host_tools[@]/#/host/}"
# Payload generation scripts.
dobin host/cros_generate_update_payload
dobin host/cros_generate_stateful_update_payload
# Repo and git bash completion.
insinto /usr/share/bash-completion
newins host/repo_bash_completion repo
dosym /usr/share/bash-completion/git /etc/bash_completion.d/git
dosym /usr/share/bash-completion/repo /etc/bash_completion.d/repo
insinto "$(python_get_sitedir)"
doins host/lib/*.py
insinto "/usr/lib/crosutils"
doins host/lib/cros_archive.sh
fi
}
src_test() {
cd "${S}" # Let's just run unit tests from ${S} rather than install and run.
# Run bundle_firmware tests
pushd host/lib >/dev/null
local libfile
for libfile in *.py; do
einfo Running tests in ${libfile}
python ${libfile} --test || \
die "Unit tests failed at ${libfile}!"
done
popd >/dev/null
pushd host/tests >/dev/null
for ut_file in *.py; do
echo Running tests in ${ut_file}
PYTHONPATH=../lib python ${ut_file} ||
die "Unit tests failed at ${ut_file}!"
done
popd >/dev/null
local TESTS=()
if ! use cros_host; then
TESTS+=( gmerge_test.py )
# FIXME(zbehan): import gmerge in gmerge_test.py won't work if we won't
# have the .py.
ln -sf gmerge gmerge.py
else
TESTS+=( autoupdate_unittest.py )
TESTS+=( builder_test.py )
TESTS+=( devserver_test.py )
TESTS+=( common_util_unittest.py )
TESTS+=( host/lib/cros_archive_unittest.sh )
#FIXME(zbehan): update_test.py doesn't seem to work right now.
fi
local test
for test in ${TESTS[@]} ; do
einfo "Running ${test}"
./${test} || die "Failed in ${test}"
done
}
pkg_preinst() {
# Handle pre-existing possibly problematic configurations of static
use cros_host || return 0
if [[ -e ${ROOT}/usr/bin/static && ! -L ${ROOT}/usr/bin/static ]] ; then
einfo "/usr/bin/static detected, and is not a symlink, performing cleanup"
# Well, I don't know what else should be done about it. Moving the
# files has several issues: handling of all kinds of links, special
# files, permissions, etc. Autoremval is not a good idea, what if
# this ended up with accidental destruction of the system?
local newname="static-old-${RANDOM}" # In case this happens more than once.
mv "${ROOT}"/usr/bin/static "${ROOT}"/usr/bin/${newname}
ewarn "/usr/bin/${newname} has the previous contents of static."
ewarn "It can be safely deleted (or kept around forever)."
fi
}

View File

@ -0,0 +1,31 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_COMMIT="1bf718b912cf8ea5dcbf25f04a9ef9a9204f83d1"
CROS_WORKON_TREE="7b1191682d8df182503e2c2ee948c0ecb48c5461"
CROS_WORKON_PROJECT="chromiumos/platform/crostestutils"
inherit cros-workon
DESCRIPTION="Host test utilities for ChromiumOS"
HOMEPAGE="http://www.chromium.org/"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm x86"
CROS_WORKON_LOCALNAME="crostestutils"
RDEPEND="app-emulation/qemu-kvm
app-portage/gentoolkit
app-shells/bash
chromeos-base/cros-devutils
dev-util/crosutils
"
# These are all either bash / python scripts. No actual builds DEPS.
DEPEND=""
# Use default src_compile and src_install which use Makefile.

View File

@ -0,0 +1,29 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_PROJECT="chromiumos/platform/crostestutils"
inherit cros-workon
DESCRIPTION="Host test utilities for ChromiumOS"
HOMEPAGE="http://www.chromium.org/"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
CROS_WORKON_LOCALNAME="crostestutils"
RDEPEND="app-emulation/qemu-kvm
app-portage/gentoolkit
app-shells/bash
chromeos-base/cros-devutils
dev-util/crosutils
"
# These are all either bash / python scripts. No actual builds DEPS.
DEPEND=""
# Use default src_compile and src_install which use Makefile.

View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This script is given one argument: the base of the source directory of
# the package, and it prints a string on stdout with the numerical version
# number for said repo.
"$1"/configure --version | awk '{print $NF; exit}'

View File

@ -0,0 +1,93 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=4
CROS_WORKON_COMMIT="232fb3ad52342305e55b3a1d51632a9bd52d18cc"
CROS_WORKON_TREE="cc72c3a2e2d1746bb31faf70937fc427ad6a57aa"
CROS_WORKON_PROJECT="chromiumos/platform/google-breakpad"
inherit autotools cros-debug cros-workon toolchain-funcs
DESCRIPTION="Google crash reporting"
HOMEPAGE="http://code.google.com/p/google-breakpad"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 x86 arm"
IUSE=""
RDEPEND="net-misc/curl"
DEPEND="${RDEPEND}"
src_prepare() {
eautoreconf
if ! tc-is-cross-compiler; then
einfo "Creating a separate 32b src directory"
mkdir ../work32
cp -a . ../work32
mv ../work32 .
fi
}
src_configure() {
#TODO(raymes): Uprev breakpad so this isn't necessary. See
# (crosbug.com/14275).
[ "$ARCH" = "arm" ] && append-cflags "-marm" && append-cxxflags "-marm"
# We purposefully disable optimizations due to optimizations causing
# src/processor code to crash (minidump_stackwalk) as well as tests
# to fail. See
# http://code.google.com/p/google-breakpad/issues/detail?id=400.
append-flags "-O0"
tc-export CC CXX LD PKG_CONFIG
econf
if ! tc-is-cross-compiler; then
einfo "Running 32b configuration"
cd work32 || die "chdir failed"
append-flags "-m32"
econf
filter-flags "-m32"
fi
}
src_compile() {
tc-export CC CXX PKG_CONFIG
emake
if ! tc-is-cross-compiler; then
cd work32 || die "chdir failed"
einfo "Building dump_syms and minidump-2-core with -m32"
emake src/tools/linux/dump_syms/dump_syms \
src/tools/linux/md2core/minidump-2-core
fi
}
src_test() {
emake check
}
src_install() {
tc-export CXX PKG_CONFIG
emake DESTDIR="${D}" install
insinto /usr/include/google-breakpad/client/linux/handler
doins src/client/linux/handler/*.h
insinto /usr/include/google-breakpad/client/linux/crash_generation
doins src/client/linux/crash_generation/*.h
insinto /usr/include/google-breakpad/common/linux
doins src/common/linux/*.h
insinto /usr/include/google-breakpad/processor
doins src/processor/*.h
dobin src/tools/linux/core2md/core2md \
src/tools/linux/md2core/minidump-2-core \
src/tools/linux/dump_syms/dump_syms \
src/tools/linux/symupload/sym_upload \
src/tools/linux/symupload/minidump_upload
if ! tc-is-cross-compiler; then
newbin work32/src/tools/linux/dump_syms/dump_syms dump_syms.32
newbin work32/src/tools/linux/md2core/minidump-2-core \
minidump-2-core.32
fi
}

View File

@ -0,0 +1,91 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=4
CROS_WORKON_PROJECT="chromiumos/platform/google-breakpad"
inherit autotools cros-debug cros-workon toolchain-funcs
DESCRIPTION="Google crash reporting"
HOMEPAGE="http://code.google.com/p/google-breakpad"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~arm"
IUSE=""
RDEPEND="net-misc/curl"
DEPEND="${RDEPEND}"
src_prepare() {
eautoreconf
if ! tc-is-cross-compiler; then
einfo "Creating a separate 32b src directory"
mkdir ../work32
cp -a . ../work32
mv ../work32 .
fi
}
src_configure() {
#TODO(raymes): Uprev breakpad so this isn't necessary. See
# (crosbug.com/14275).
[ "$ARCH" = "arm" ] && append-cflags "-marm" && append-cxxflags "-marm"
# We purposefully disable optimizations due to optimizations causing
# src/processor code to crash (minidump_stackwalk) as well as tests
# to fail. See
# http://code.google.com/p/google-breakpad/issues/detail?id=400.
append-flags "-O0"
tc-export CC CXX LD PKG_CONFIG
econf
if ! tc-is-cross-compiler; then
einfo "Running 32b configuration"
cd work32 || die "chdir failed"
append-flags "-m32"
econf
filter-flags "-m32"
fi
}
src_compile() {
tc-export CC CXX PKG_CONFIG
emake
if ! tc-is-cross-compiler; then
cd work32 || die "chdir failed"
einfo "Building dump_syms and minidump-2-core with -m32"
emake src/tools/linux/dump_syms/dump_syms \
src/tools/linux/md2core/minidump-2-core
fi
}
src_test() {
emake check
}
src_install() {
tc-export CXX PKG_CONFIG
emake DESTDIR="${D}" install
insinto /usr/include/google-breakpad/client/linux/handler
doins src/client/linux/handler/*.h
insinto /usr/include/google-breakpad/client/linux/crash_generation
doins src/client/linux/crash_generation/*.h
insinto /usr/include/google-breakpad/common/linux
doins src/common/linux/*.h
insinto /usr/include/google-breakpad/processor
doins src/processor/*.h
dobin src/tools/linux/core2md/core2md \
src/tools/linux/md2core/minidump-2-core \
src/tools/linux/dump_syms/dump_syms \
src/tools/linux/symupload/sym_upload \
src/tools/linux/symupload/minidump_upload
if ! tc-is-cross-compiler; then
newbin work32/src/tools/linux/dump_syms/dump_syms dump_syms.32
newbin work32/src/tools/linux/md2core/minidump-2-core \
minidump-2-core.32
fi
}

View File

@ -0,0 +1 @@
hard-host-depends-0.0.1.ebuild

View File

@ -0,0 +1,205 @@
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
DESCRIPTION="List of packages that are needed on the buildhost (meta package)"
HOMEPAGE="http://src.chromium.org"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
# Pull in any site-specific or private-overlay-specific packages needed on the
# host.
RDEPEND="${RDEPEND}
virtual/hard-host-depends-bsp
"
# Needed to run setup crossdev, run build scripts, and make a bootable image.
RDEPEND="${RDEPEND}
app-arch/lzop
app-arch/pigz
app-admin/sudo
dev-embedded/cbootimage
dev-embedded/tegrarcm
dev-embedded/u-boot-tools
dev-util/ccache
dev-util/crosutils
>=sys-apps/dtc-1.3.0-r5
sys-boot/bootstub
sys-boot/grub
sys-boot/syslinux
sys-devel/crossdev
sys-fs/dosfstools
"
# Host dependencies for building cross-compiled packages.
# TODO: chromeos-base/chromeos-installer
RDEPEND="${RDEPEND}
app-admin/eselect-opengl
app-admin/eselect-mesa
app-arch/cabextract
>=app-arch/pbzip2-1.1.1-r1
app-arch/rpm2targz
app-arch/sharutils
app-arch/unzip
app-crypt/nss
app-emulation/qemu-kvm
!app-emulation/qemu-user
app-i18n/ibus
app-text/texi2html
coreos-base/google-breakpad
coreos-base/coreos-base
coreos-base/cros-devutils[cros_host]
coreos-base/cros-factoryutils
coreos-base/cros-testutils
dev-lang/python
dev-db/m17n-contrib
dev-db/m17n-db
dev-lang/closure-compiler-bin
dev-lang/nasm
dev-lang/swig
dev-lang/yasm
dev-libs/dbus-c++
dev-libs/dbus-glib
>=dev-libs/glib-2.26.1
dev-libs/libgcrypt
dev-libs/libxslt
dev-libs/libyaml
dev-libs/m17n-lib
dev-libs/protobuf
dev-python/cherrypy
dev-python/ctypesgen
dev-python/dbus-python
dev-python/imaging
dev-python/m2crypto
dev-python/mako
dev-python/netifaces
dev-python/pygobject
dev-python/pygtk
dev-python/pyinotify
dev-python/pyopenssl
dev-python/python-daemon
dev-python/pyudev
dev-python/pyusb
dev-python/setproctitle
dev-python/ws4py
dev-util/cmake
dev-util/gob
dev-util/gdbus-codegen
dev-util/gperf
dev-util/gtk-doc
dev-util/hdctools
>=dev-util/gtk-doc-am-1.13
>=dev-util/intltool-0.30
dev-util/scons
>=dev-vcs/git-1.7.2
dev-vcs/subversion[-dso]
>=media-libs/freetype-2.2.1
media-libs/mesa
net-misc/gsutil
sys-apps/usbutils
!sys-apps/nih-dbus-tool
=sys-devel/automake-1.10*
sys-devel/clang
sys-fs/sshfs-fuse
sys-fs/udev
sys-libs/libnih
sys-power/iasl
"
# Host dependencies that create usernames/groups we need to pull over to target.
RDEPEND="${RDEPEND}
sys-apps/dbus
"
# Host dependencies that are needed by mod_image_for_test.
RDEPEND="${RDEPEND}
sys-process/lsof
"
# Useful utilities for developers.
RDEPEND="${RDEPEND}
app-arch/zip
app-portage/eclass-manpages
app-portage/gentoolkit
app-portage/portage-utils
app-editors/qemacs
app-editors/vim
dev-util/perf
sys-apps/pv
app-shells/bash-completion
sys-devel/smatch
"
# Host dependencies that are needed for autotests.
RDEPEND="${RDEPEND}
dev-util/dejagnu
"
# Host dependencies that are needed to create and sign images
RDEPEND="${RDEPEND}
>=coreos-base/vboot_reference-1.0-r174
coreos-base/verity
sys-apps/mosys
sys-fs/libfat
"
# Host dependency used by the chromeos-base/root-certificates ebuild
RDEPEND="${RDEPEND}
>=app-misc/ca-certificates-20090709-r6
"
# Host dependencies that are needed for delta_generator.
RDEPEND="${RDEPEND}
chromeos-base/update_engine
"
# Host dependencies to run unit tests within the chroot
RDEPEND="${RDEPEND}
dev-cpp/gflags
dev-python/mock
dev-python/mox
dev-python/unittest2
"
# Host dependencies for running pylint within the chroot
RDEPEND="${RDEPEND}
dev-python/pylint
"
# Host dependencies to scp binaries from the binary component server
# TODO: chromeos-base/ssh-known-hosts
# chromeos-base/ssh-root-dot-dir
RDEPEND="${RDEPEND}
net-misc/openssh
net-misc/wget
"
# Host dependencies that are needed for chromite/bin/upload_package_status
RDEPEND="${RDEPEND}
dev-python/gdata
"
# Host dependencies for taking to dev boards
RDEPEND="${RDEPEND}
dev-embedded/smdk-dltool
"
# Host dependencies for HWID processing
RDEPEND="${RDEPEND}
dev-python/pyyaml
"
# Tools for working with compiler generated profile information
# (such as coverage analysis in common.mk)
RDEPEND="${RDEPEND}
dev-util/lcov
"
# Uninstall these packages.
RDEPEND="${RDEPEND}
!net-misc/dhcpcd
"

View File

@ -0,0 +1,4 @@
[git.chromium.org]:6222 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnpMqy+POoe0kuCL00MFMEI3dJuoGU971N9LxJv9glnXPaXgV1scRjDJ2dAxIN8xi7+L4iymt0m7Ibg7eQUfWK90csub2xo8mltQg2XQCdV7QqUGcdidZsC7oZk8wIq7whS9rwC0F9yXmjLHyAp4nHAE2eqbVk8FOGsHkZdHI9wAo8T305Nh9cbmo2PlUAyJXGFo4eY4ZYo5lRlGMYMf3dTEyZ8XUrSQQVbjjkmexm/T7KZMBmt4BfGjauy2b9pmjmCpZIDlt4nLSAcpmXPAe8Uv3zTsZOXYhS2UgjB0QbLOZzRoOqPkl3lqXumUSiYWwOfu7vj82Y5MwT8v5KBxBOQ==
[gerrit.chromium.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCfRn+J+e9mU0c4bxFD8v2rhhd3O9WPk435xEtG9FD8a8fOnIubJcpObvQJhfSgYkxVUQOKk97V8b2eGjf72AGBhDQVJMiaLQc8ZGomeNlK/7cWjkJFDoIKQHilHQidz/pgZc/Pu+7Tl2emVGd6425QRK1h47CYtT9IUPt3Jtdv4w==
[gerrit-int.chromium.org]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCfdDDvb5HD7hDOtSZPJRg2NkBVnVWRVX4UB+QTDT37rha7rw0k/ZY8GOyT2AlaTiZcufszvFHdPwgCBhSSJscGNizrm1Ne48EpPm+GK4gHQAidKS4+nw1xleZki8qt7D99v/WwOaphuBbWUaupS1Mq36UXikSWdyqPJRVbw7VCpQ==
[gerrit-int.chromium.org]:29419 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCfdDDvb5HD7hDOtSZPJRg2NkBVnVWRVX4UB+QTDT37rha7rw0k/ZY8GOyT2AlaTiZcufszvFHdPwgCBhSSJscGNizrm1Ne48EpPm+GK4gHQAidKS4+nw1xleZki8qt7D99v/WwOaphuBbWUaupS1Mq36UXikSWdyqPJRVbw7VCpQ==

View File

@ -0,0 +1 @@
ssh-known-hosts-0.0.1.ebuild

View File

@ -0,0 +1,20 @@
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
DESCRIPTION="SSH known_hosts file"
HOMEPAGE="http://src.chromium.org"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""
DEPEND=""
RDEPEND="net-misc/openssh"
src_install() {
insinto /etc/ssh
doins ${FILESDIR}/ssh_known_hosts || die
}

View File

@ -0,0 +1,97 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_COMMIT="50c6063bf22ea1776579fda55402ce34b4c21daa"
CROS_WORKON_TREE="bb8510cb7d96ac37c6e2407ce9b4b3006a11b0f4"
CROS_WORKON_PROJECT="chromiumos/platform/update_engine"
inherit toolchain-funcs cros-debug cros-workon scons-utils
DESCRIPTION="Chrome OS Update Engine"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE="cros_host -delta_generator"
LIBCHROME_VERS="125070"
RDEPEND="app-arch/bzip2
chromeos-base/chromeos-ca-certificates
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
chromeos-base/libchromeos
chromeos-base/metrics
chromeos-base/vboot_reference
chromeos-base/verity
dev-cpp/gflags
dev-libs/glib
dev-libs/libpcre
dev-libs/libxml2
dev-libs/openssl
dev-libs/protobuf
dev-util/bsdiff
net-misc/curl
sys-apps/rootdev
sys-fs/e2fsprogs
sys-libs/e2fsprogs-libs"
DEPEND="chromeos-base/system_api
dev-cpp/gmock
dev-cpp/gtest
dev-libs/dbus-glib
cros_host? ( dev-util/scons )
sys-fs/udev
${RDEPEND}"
src_compile() {
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG
cros-debug-add-NDEBUG
export CCFLAGS="$CFLAGS"
export BASE_VER=${LIBCHROME_VERS}
escons
}
src_test() {
UNITTESTS_BINARY=update_engine_unittests
TARGETS="${UNITTESTS_BINARY} test_http_server delta_generator"
escons ${TARGETS}
if ! use x86 && ! use amd64 ; then
einfo "Skipping tests on non-x86 platform..."
else
# We need to set PATH so that the `openssl` in the target
# sysroot gets executed instead of the host one (which is
# compiled differently). http://crosbug.com/27683
PATH="$SYSROOT/usr/bin:$PATH" \
"./${UNITTESTS_BINARY}" --gtest_filter='-*.RunAsRoot*' \
&& einfo "./${UNITTESTS_BINARY} (unprivileged) succeeded" \
|| die "./${UNITTESTS_BINARY} (unprivileged) failed, retval=$?"
sudo LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" PATH="$SYSROOT/usr/bin:$PATH" \
"./${UNITTESTS_BINARY}" --gtest_filter='*.RunAsRoot*' \
&& einfo "./${UNITTESTS_BINARY} (root) succeeded" \
|| die "./${UNITTESTS_BINARY} (root) failed, retval=$?"
fi
}
src_install() {
dosbin update_engine
dobin update_engine_client
use delta_generator && dobin delta_generator
insinto /usr/share/dbus-1/services
doins org.chromium.UpdateEngine.service
insinto /etc/dbus-1/system.d
doins UpdateEngine.conf
insinto /lib/udev/rules.d
doins 99-gpio-dutflag.rules
insinto /usr/include/chromeos/update_engine
doins update_engine.dbusserver.h
doins update_engine.dbusclient.h
}

View File

@ -0,0 +1,95 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_PROJECT="chromiumos/platform/update_engine"
inherit toolchain-funcs cros-debug cros-workon scons-utils
DESCRIPTION="Chrome OS Update Engine"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="cros_host -delta_generator"
LIBCHROME_VERS="125070"
RDEPEND="app-arch/bzip2
chromeos-base/chromeos-ca-certificates
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
chromeos-base/libchromeos
chromeos-base/metrics
chromeos-base/vboot_reference
chromeos-base/verity
dev-cpp/gflags
dev-libs/glib
dev-libs/libpcre
dev-libs/libxml2
dev-libs/openssl
dev-libs/protobuf
dev-util/bsdiff
net-misc/curl
sys-apps/rootdev
sys-fs/e2fsprogs
sys-libs/e2fsprogs-libs"
DEPEND="chromeos-base/system_api
dev-cpp/gmock
dev-cpp/gtest
dev-libs/dbus-glib
cros_host? ( dev-util/scons )
sys-fs/udev
${RDEPEND}"
src_compile() {
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG
cros-debug-add-NDEBUG
export CCFLAGS="$CFLAGS"
export BASE_VER=${LIBCHROME_VERS}
escons
}
src_test() {
UNITTESTS_BINARY=update_engine_unittests
TARGETS="${UNITTESTS_BINARY} test_http_server delta_generator"
escons ${TARGETS}
if ! use x86 && ! use amd64 ; then
einfo "Skipping tests on non-x86 platform..."
else
# We need to set PATH so that the `openssl` in the target
# sysroot gets executed instead of the host one (which is
# compiled differently). http://crosbug.com/27683
PATH="$SYSROOT/usr/bin:$PATH" \
"./${UNITTESTS_BINARY}" --gtest_filter='-*.RunAsRoot*' \
&& einfo "./${UNITTESTS_BINARY} (unprivileged) succeeded" \
|| die "./${UNITTESTS_BINARY} (unprivileged) failed, retval=$?"
sudo LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" PATH="$SYSROOT/usr/bin:$PATH" \
"./${UNITTESTS_BINARY}" --gtest_filter='*.RunAsRoot*' \
&& einfo "./${UNITTESTS_BINARY} (root) succeeded" \
|| die "./${UNITTESTS_BINARY} (root) failed, retval=$?"
fi
}
src_install() {
dosbin update_engine
dobin update_engine_client
use delta_generator && dobin delta_generator
insinto /usr/share/dbus-1/services
doins org.chromium.UpdateEngine.service
insinto /etc/dbus-1/system.d
doins UpdateEngine.conf
insinto /lib/udev/rules.d
doins 99-gpio-dutflag.rules
insinto /usr/include/chromeos/update_engine
doins update_engine.dbusserver.h
doins update_engine.dbusclient.h
}

View File

@ -0,0 +1,201 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_COMMIT="3e9cf90442632bed695ac0552a76ca0d1154f799"
CROS_WORKON_TREE="8b768b506c41afc82139df72f689917b51d7cbb2"
CROS_WORKON_PROJECT="chromiumos/platform/vboot_reference"
inherit cros-debug cros-workon cros-au
DESCRIPTION="Chrome OS verified boot tools"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE="32bit_au minimal rbtest tpmtests cros_host"
LIBCHROME_VERS="125070"
RDEPEND="app-crypt/trousers
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
!minimal? ( dev-libs/libyaml )
dev-libs/glib
dev-libs/openssl
sys-apps/util-linux"
DEPEND="${RDEPEND}
dev-cpp/gflags
dev-cpp/gtest"
# We need the config in place before we run, but don't need to rebuild this
# package every time.
RDEPEND="${RDEPEND}
!cros_host? ( chromeos-base/vboot_reference-config )"
_src_compile_main() {
mkdir "${S}"/build-main
tc-export CC AR CXX PKG_CONFIG
cros-debug-add-NDEBUG
export BASE_VER=${LIBCHROME_VERS}
# Vboot reference knows the flags to use
unset CFLAGS
emake BUILD="${S}"/build-main \
ARCH=$(tc-arch) \
MINIMAL=$(usev minimal) all
unset CC AR CXX
}
_src_compile_au() {
mkdir "${S}"/build-au
if use 32bit_au ; then
AU_TARGETS="libcgpt_cc libdump_kernel_config"
einfo "Building 32-bit AU_TARGETS: ${AU_TARGETS}"
board_setup_32bit_au_env
else
AU_TARGETS="libcgpt_cc libdump_kernel_config cgptmanager_tests"
einfo "Building native AU_TARGETS: ${AU_TARGETS}"
fi
tc-export CC AR CXX PKG_CONFIG
emake BUILD="${S}"/build-au/ \
CC="${CC}" \
CXX="${CXX}" \
ARCH=$(tc-arch) MINIMAL=$(usev minimal) \
${AU_TARGETS}
use 32bit_au && board_teardown_32bit_au_env
}
src_compile() {
_src_compile_main
_src_compile_au
}
src_test() {
emake BUILD="${S}"/build-main \
ARCH=$(tc-arch) \
MINIMAL=$(usev minimal) runtests
}
src_install() {
local dst_dir
if use minimal ; then
# Installing on the target. Cherry pick programs generated
# by src_compile in the source tree build-main/ subdirectory
einfo "Installing target programs"
local progs='utility/dump_kernel_config'
progs+=' utility/crossystem'
progs+=' utility/dev_sign_file'
progs+=' utility/dumpRSAPublicKey'
progs+=' utility/tpm_init_temp_fix'
progs+=' utility/tpmc'
progs+=' utility/vbutil_key'
progs+=' utility/vbutil_keyblock'
progs+=' utility/vbutil_kernel'
progs+=' utility/vbutil_firmware'
progs+=' utility/vbutil_what_keys'
progs+=' utility/gbb_utility'
progs+=' utility/dump_fmap'
progs+=' utility/dev_debug_vboot'
progs+=' utility/enable_dev_usb_boot'
progs+=' cgpt/cgpt'
into /usr
for prog in ${progs}; do
dobin build-main/"${prog}"
done
einfo "Installing TPM tools"
exeinto /usr/sbin
doexe "utility/tpm-nvsize"
doexe "utility/chromeos-tpm-recovery"
einfo "Installing boot tools"
exeinto /sbin
doexe build-main/utility/mount-encrypted
einfo "Installing dev tools"
dst_dir='/usr/share/vboot/bin'
local src_dir='scripts/image_signing'
dodir "${dst_dir}"
exeinto "${dst_dir}"
doexe "${src_dir}/common_minimal.sh"
doexe "${src_dir}/resign_firmwarefd.sh"
doexe "${src_dir}/make_dev_firmware.sh"
doexe "${src_dir}/make_dev_ssd.sh"
doexe "${src_dir}/set_gbb_flags.sh"
# TODO(hungte) Since we now install all keyset into
# /usr/share/vboot/devkeys, maybe SAFT does not need to install
# its own keys anymore.
einfo "Installing keys for SAFT"
local keys_to_install='recovery_kernel_data_key.vbprivk'
keys_to_install+=' firmware.keyblock '
keys_to_install+=' firmware_data_key.vbprivk'
keys_to_install+=' kernel_subkey.vbpubk'
keys_to_install+=' kernel_data_key.vbprivk'
dst_dir='/usr/sbin/firmware/saft'
dodir "${dst_dir}"
insinto "${dst_dir}"
for key in ${keys_to_install}; do
doins "tests/devkeys/${key}"
done
else
# Installing on host.
emake BUILD="${S}"/build-main \
DESTDIR="${D}/usr/bin" install
# EC firmware needs to compile directly from source
dodir /usr/src/vboot
insinto /usr/src/vboot
doins -r firmware/include firmware/lib
fi
if use rbtest; then
emake BUILD="${S}"/build-main DESTDIR="${D}/usr/bin" -C tests \
install-rbtest
fi
if use tpmtests; then
into /usr
# copy files starting with tpmtest, but skip .d files.
dobin "${S}"/build-main/tests/tpm_lite/tpmtest*[^.]?
dobin "${S}"/build-main/utility/tpm_set_readsrkpub
fi
# Install devkeys to /usr/share/vboot/devkeys
# (shared by host and target)
einfo "Installing devkeys"
dst_dir='/usr/share/vboot/devkeys'
dodir "${dst_dir}"
insinto "${dst_dir}"
doins tests/devkeys/*
einfo "Installing header files and libraries"
# Install firmware/include to /build/${BOARD}/usr/include/vboot
local dst_dir='/usr/include/vboot'
dodir "${dst_dir}"
insinto "${dst_dir}"
doins -r firmware/include/*
for arch in $(ls firmware/arch/); do
insinto "${dst_dir}"/arch/"${arch}"
doins firmware/arch/"${arch}"/include/biosincludes.h
done
insinto /usr/include/vboot/
doins "utility/include/kernel_blob.h"
doins "utility/include/dump_kernel_config.h"
doins "cgpt/CgptManager.h"
doins "firmware/lib/cgptlib/include/gpt.h"
# Install static library needed by install programs.
# we need board_setup_32bit_au_env again so dolib.a installs to the
# correct location
use 32bit_au && board_setup_32bit_au_env
einfo "Installing dump_kernel_config library"
dolib.a build-au/libdump_kernel_config.a
einfo "Installing C++ version of cgpt static library:libcgpt-cc.a"
dolib.a build-au/cgpt/libcgpt-cc.a
use 32bit_au && board_teardown_32bit_au_env
}

View File

@ -0,0 +1,199 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_PROJECT="chromiumos/platform/vboot_reference"
inherit cros-debug cros-workon cros-au
DESCRIPTION="Chrome OS verified boot tools"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="32bit_au minimal rbtest tpmtests cros_host"
LIBCHROME_VERS="125070"
RDEPEND="app-crypt/trousers
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
!minimal? ( dev-libs/libyaml )
dev-libs/glib
dev-libs/openssl
sys-apps/util-linux"
DEPEND="${RDEPEND}
dev-cpp/gflags
dev-cpp/gtest"
# We need the config in place before we run, but don't need to rebuild this
# package every time.
RDEPEND="${RDEPEND}
!cros_host? ( chromeos-base/vboot_reference-config )"
_src_compile_main() {
mkdir "${S}"/build-main
tc-export CC AR CXX PKG_CONFIG
cros-debug-add-NDEBUG
export BASE_VER=${LIBCHROME_VERS}
# Vboot reference knows the flags to use
unset CFLAGS
emake BUILD="${S}"/build-main \
ARCH=$(tc-arch) \
MINIMAL=$(usev minimal) all
unset CC AR CXX
}
_src_compile_au() {
mkdir "${S}"/build-au
if use 32bit_au ; then
AU_TARGETS="libcgpt_cc libdump_kernel_config"
einfo "Building 32-bit AU_TARGETS: ${AU_TARGETS}"
board_setup_32bit_au_env
else
AU_TARGETS="libcgpt_cc libdump_kernel_config cgptmanager_tests"
einfo "Building native AU_TARGETS: ${AU_TARGETS}"
fi
tc-export CC AR CXX PKG_CONFIG
emake BUILD="${S}"/build-au/ \
CC="${CC}" \
CXX="${CXX}" \
ARCH=$(tc-arch) MINIMAL=$(usev minimal) \
${AU_TARGETS}
use 32bit_au && board_teardown_32bit_au_env
}
src_compile() {
_src_compile_main
_src_compile_au
}
src_test() {
emake BUILD="${S}"/build-main \
ARCH=$(tc-arch) \
MINIMAL=$(usev minimal) runtests
}
src_install() {
local dst_dir
if use minimal ; then
# Installing on the target. Cherry pick programs generated
# by src_compile in the source tree build-main/ subdirectory
einfo "Installing target programs"
local progs='utility/dump_kernel_config'
progs+=' utility/crossystem'
progs+=' utility/dev_sign_file'
progs+=' utility/dumpRSAPublicKey'
progs+=' utility/tpm_init_temp_fix'
progs+=' utility/tpmc'
progs+=' utility/vbutil_key'
progs+=' utility/vbutil_keyblock'
progs+=' utility/vbutil_kernel'
progs+=' utility/vbutil_firmware'
progs+=' utility/vbutil_what_keys'
progs+=' utility/gbb_utility'
progs+=' utility/dump_fmap'
progs+=' utility/dev_debug_vboot'
progs+=' utility/enable_dev_usb_boot'
progs+=' cgpt/cgpt'
into /usr
for prog in ${progs}; do
dobin build-main/"${prog}"
done
einfo "Installing TPM tools"
exeinto /usr/sbin
doexe "utility/tpm-nvsize"
doexe "utility/chromeos-tpm-recovery"
einfo "Installing boot tools"
exeinto /sbin
doexe build-main/utility/mount-encrypted
einfo "Installing dev tools"
dst_dir='/usr/share/vboot/bin'
local src_dir='scripts/image_signing'
dodir "${dst_dir}"
exeinto "${dst_dir}"
doexe "${src_dir}/common_minimal.sh"
doexe "${src_dir}/resign_firmwarefd.sh"
doexe "${src_dir}/make_dev_firmware.sh"
doexe "${src_dir}/make_dev_ssd.sh"
doexe "${src_dir}/set_gbb_flags.sh"
# TODO(hungte) Since we now install all keyset into
# /usr/share/vboot/devkeys, maybe SAFT does not need to install
# its own keys anymore.
einfo "Installing keys for SAFT"
local keys_to_install='recovery_kernel_data_key.vbprivk'
keys_to_install+=' firmware.keyblock '
keys_to_install+=' firmware_data_key.vbprivk'
keys_to_install+=' kernel_subkey.vbpubk'
keys_to_install+=' kernel_data_key.vbprivk'
dst_dir='/usr/sbin/firmware/saft'
dodir "${dst_dir}"
insinto "${dst_dir}"
for key in ${keys_to_install}; do
doins "tests/devkeys/${key}"
done
else
# Installing on host.
emake BUILD="${S}"/build-main \
DESTDIR="${D}/usr/bin" install
# EC firmware needs to compile directly from source
dodir /usr/src/vboot
insinto /usr/src/vboot
doins -r firmware/include firmware/lib
fi
if use rbtest; then
emake BUILD="${S}"/build-main DESTDIR="${D}/usr/bin" -C tests \
install-rbtest
fi
if use tpmtests; then
into /usr
# copy files starting with tpmtest, but skip .d files.
dobin "${S}"/build-main/tests/tpm_lite/tpmtest*[^.]?
dobin "${S}"/build-main/utility/tpm_set_readsrkpub
fi
# Install devkeys to /usr/share/vboot/devkeys
# (shared by host and target)
einfo "Installing devkeys"
dst_dir='/usr/share/vboot/devkeys'
dodir "${dst_dir}"
insinto "${dst_dir}"
doins tests/devkeys/*
einfo "Installing header files and libraries"
# Install firmware/include to /build/${BOARD}/usr/include/vboot
local dst_dir='/usr/include/vboot'
dodir "${dst_dir}"
insinto "${dst_dir}"
doins -r firmware/include/*
for arch in $(ls firmware/arch/); do
insinto "${dst_dir}"/arch/"${arch}"
doins firmware/arch/"${arch}"/include/biosincludes.h
done
insinto /usr/include/vboot/
doins "utility/include/kernel_blob.h"
doins "utility/include/dump_kernel_config.h"
doins "cgpt/CgptManager.h"
doins "firmware/lib/cgptlib/include/gpt.h"
# Install static library needed by install programs.
# we need board_setup_32bit_au_env again so dolib.a installs to the
# correct location
use 32bit_au && board_setup_32bit_au_env
einfo "Installing dump_kernel_config library"
dolib.a build-au/libdump_kernel_config.a
einfo "Installing C++ version of cgpt static library:libcgpt-cc.a"
dolib.a build-au/cgpt/libcgpt-cc.a
use 32bit_au && board_teardown_32bit_au_env
}

View File

@ -0,0 +1,62 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_COMMIT="e5627e7a2506fdd93f3b6edf48c76b68bfe75326"
CROS_WORKON_TREE="8f459ef16b87c47cb26400078c2ae353cb41455b"
CROS_WORKON_PROJECT="chromiumos/platform/dm-verity"
CROS_WORKON_OUTOFTREE_BUILD=1
inherit cros-workon cros-au
DESCRIPTION="File system integrity image generator for Chromium OS"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 x86 arm"
IUSE="32bit_au test valgrind splitdebug"
RDEPEND=""
# qemu use isn't reflected as it is copied into the target
# from the build host environment.
DEPEND="${RDEPEND}
dev-cpp/gtest
dev-cpp/gmock
32bit_au? (
dev-cpp/gtest32
dev-cpp/gmock32
)
valgrind? ( dev-util/valgrind )"
src_prepare() {
cros-workon_src_prepare
}
src_configure() {
use 32bit_au && board_setup_32bit_au_env
cros-workon_src_configure
}
src_compile() {
cros-workon_src_compile
}
src_test() {
cros-workon_src_test
}
src_install() {
dolib.a "${OUT}"/libdm-bht.a
insinto /usr/include/verity
doins dm-bht.h dm-bht-userspace.h
insinto /usr/include/verity
cd include
doins -r linux asm asm-generic crypto
cd ..
into /
dobin "${OUT}"/verity-static
dosym verity-static bin/verity
}

View File

@ -0,0 +1,60 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI="4"
CROS_WORKON_PROJECT="chromiumos/platform/dm-verity"
CROS_WORKON_OUTOFTREE_BUILD=1
inherit cros-workon cros-au
DESCRIPTION="File system integrity image generator for Chromium OS"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~arm"
IUSE="32bit_au test valgrind splitdebug"
RDEPEND=""
# qemu use isn't reflected as it is copied into the target
# from the build host environment.
DEPEND="${RDEPEND}
dev-cpp/gtest
dev-cpp/gmock
32bit_au? (
dev-cpp/gtest32
dev-cpp/gmock32
)
valgrind? ( dev-util/valgrind )"
src_prepare() {
cros-workon_src_prepare
}
src_configure() {
use 32bit_au && board_setup_32bit_au_env
cros-workon_src_configure
}
src_compile() {
cros-workon_src_compile
}
src_test() {
cros-workon_src_test
}
src_install() {
dolib.a "${OUT}"/libdm-bht.a
insinto /usr/include/verity
doins dm-bht.h dm-bht-userspace.h
insinto /usr/include/verity
cd include
doins -r linux asm asm-generic crypto
cd ..
into /
dobin "${OUT}"/verity-static
dosym verity-static bin/verity
}