feat(coreos): add required packages for board setup

This commit is contained in:
Brandon Philips 2013-02-06 16:46:56 -08:00
parent f5f9ed6fcc
commit 8787d218bf
32 changed files with 1896 additions and 0 deletions

View File

@ -0,0 +1,37 @@
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
CROS_WORKON_COMMIT="f91b983c430f2e7ce125fda8704d094616d24a0c"
CROS_WORKON_TREE="e18118e277349f02968917bc3eddb4dc39722e05"
CROS_WORKON_PROJECT="chromiumos/platform/chromiumos-assets"
inherit cros-workon toolchain-funcs
DESCRIPTION="Chromium OS-specific assets"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE=""
PDEPEND=">chromeos-base/chromeos-assets-0.0.1-r47"
DEPEND=""
RDEPEND=""
CROS_WORKON_LOCALNAME="chromiumos-assets"
src_install() {
insinto /usr/share/chromeos-assets/images
doins -r "${S}"/images/*
insinto /usr/share/chromeos-assets/images_100_percent
doins -r "${S}"/images_100_percent/*
insinto /usr/share/chromeos-assets/images_200_percent
doins -r "${S}"/images_200_percent/*
insinto /usr/share/chromeos-assets/screensavers
doins -r "${S}"/screensavers/*
}

View File

@ -0,0 +1,35 @@
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
CROS_WORKON_PROJECT="chromiumos/platform/chromiumos-assets"
inherit cros-workon toolchain-funcs
DESCRIPTION="Chromium OS-specific assets"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE=""
PDEPEND=">chromeos-base/chromeos-assets-0.0.1-r47"
DEPEND=""
RDEPEND=""
CROS_WORKON_LOCALNAME="chromiumos-assets"
src_install() {
insinto /usr/share/chromeos-assets/images
doins -r "${S}"/images/*
insinto /usr/share/chromeos-assets/images_100_percent
doins -r "${S}"/images_100_percent/*
insinto /usr/share/chromeos-assets/images_200_percent
doins -r "${S}"/images_200_percent/*
insinto /usr/share/chromeos-assets/screensavers
doins -r "${S}"/screensavers/*
}

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=2
CROS_WORKON_COMMIT="366c9e7ff1c99364be8eea8e1accc5bcb301773b"
CROS_WORKON_TREE="d003ce8d1ed1a8f362a169685fae11e7aedc0afe"
CROS_WORKON_PROJECT="chromiumos/platform/assets"
inherit cros-workon toolchain-funcs
DESCRIPTION="Chrome OS assets (images, sounds, etc.)"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE="alex lumpy lumpy64 mario tegra2-ldk"
DEPEND="media-fonts/croscorefonts
media-fonts/droidfonts-cros
x11-apps/xcursorgen"
RDEPEND=""
REAL_CURSOR_NAMES="
fleur
hand2
left_ptr
sb_h_double_arrow
sb_v_double_arrow
top_left_corner
top_right_corner
xterm"
# These are cursors for which there is no file, but we want to use
# one of the existing files. So we link them. The first one is an
# X holdover from some mozilla bug, and without it, we will use the
# default left_ptr_watch bitmap.
LINK_CURSORS="
08e8e1c95fe2fc01f976f1e063a24ccd:left_ptr_watch
X_cursor:left_ptr
arrow:left_ptr
based_arrow_down:sb_v_double_arrow
based_arrow_up:sb_v_double_arrow
boat:left_ptr
bogosity:left_ptr
bottom_left_corner:top_right_corner
bottom_right_corner:top_left_corner
bottom_side:sb_v_double_arrow
bottom_tee:sb_v_double_arrow
box_spiral:left_ptr
center_ptr:left_ptr
circle:left_ptr
clock:left_ptr
coffee_mug:left_ptr
diamond_cross:left_ptr
dot:left_ptr
dotbox:left_ptr
double_arrow:sb_v_double_arrow
draft_large:left_ptr
draft_small:left_ptr
draped_box:left_ptr
exchange:left_ptr
gobbler:left_ptr
gumby:left_ptr
hand1:hand2
heart:left_ptr
icon:left_ptr
iron_cross:left_ptr
left_ptr_watch:left_ptr
left_side:sb_h_double_arrow
left_tee:sb_h_double_arrow
leftbutton:left_ptr
ll_angle:top_right_corner
lr_angle:top_left_corner
man:left_ptr
middlebutton:left_ptr
mouse:left_ptr
pencil:left_ptr
pirate:left_ptr
plus:left_ptr
right_ptr:left_ptr
right_side:sb_h_double_arrow
right_tee:sb_h_double_arrow
rightbutton:left_ptr
rtl_logo:left_ptr
sailboat:left_ptr
sb_down_arrow:sb_v_double_arrow
sb_left_arrow:sb_h_double_arrow
sb_right_arrow:sb_h_double_arrow
sb_up_arrow:sb_v_double_arrow
shuttle:left_ptr
sizing:top_left_corner
spider:left_ptr
spraycan:left_ptr
star:left_ptr
target:left_ptr
tcross:left_ptr
top_left_arrow:left_ptr
top_side:sb_v_double_arrow
top_tee:sb_v_double_arrow
trek:left_ptr
ul_angle:top_left_corner
umbrella:left_ptr
ur_angle:top_right_corner
watch:left_ptr"
CROS_WORKON_LOCALNAME="assets"
src_install() {
insinto /usr/share/chromeos-assets/images
doins -r "${S}"/images/*
insinto /usr/share/chromeos-assets/images_100_percent
doins -r "${S}"/images_100_percent/*
insinto /usr/share/chromeos-assets/images_200_percent
doins -r "${S}"/images_200_percent/*
insinto /usr/share/chromeos-assets/text
doins -r "${S}"/text/boot_messages
dosbin "${S}"/text/display_boot_message
insinto /usr/share/chromeos-assets/gaia_auth
doins -r "${S}"/gaia_auth/*
insinto /usr/share/chromeos-assets/input_methods
doins "${S}"/input_methods/*
unzip "${S}"/accessibility/extensions/access_chromevox.zip
insinto /usr/share/chromeos-assets/accessibility/extensions/access_chromevox
doins -r "${S}"/chromevox_deploy/*
insinto /usr/share/chromeos-assets/crosh_builtin/
unzip -d crosh_builtin_deploy/ "${S}"/chromeapps/crosh_builtin/crosh_builtin.zip
doins -r "${S}"/crosh_builtin_deploy/*
insinto /usr/share/fonts/chrome-droid
doins "${S}"/fonts/ChromeDroid*.ttf
insinto /usr/share/color/bin
if use mario; then
newins "${S}"/color_profiles/mario.bin internal_display.bin
elif use alex; then
newins "${S}"/color_profiles/alex.bin internal_display.bin
elif use lumpy; then
newins "${S}"/color_profiles/lumpy.bin internal_display.bin
fi
# Don't install cursors when building for Tegra, since the
# current ARGB cursor implementation is performing badly,
# and the fallback to 2-bit hardware cursor works better.
# TODO: Remove this when the display driver has been fixed to
# remove the performance bottlenecks.
if ! use tegra2-ldk; then
local CURSOR_DIR="${D}"/usr/share/cursors/xorg-x11/chromeos/cursors
mkdir -p "${CURSOR_DIR}"
for i in ${REAL_CURSOR_NAMES}; do
xcursorgen -p "${S}"/cursors "${S}"/cursors/$i.cfg >"${CURSOR_DIR}/$i"
done
for i in ${LINK_CURSORS}; do
ln -s ${i#*:} "${CURSOR_DIR}/${i%:*}"
done
fi
mkdir -p "${D}"/usr/share/cursors/xorg-x11/default
echo Inherits=chromeos \
>"${D}"/usr/share/cursors/xorg-x11/default/index.theme
#
# Speech synthesis
#
insinto /usr/share/chromeos-assets/speech_synthesis/patts
# Speech synthesis component extension code
doins "${S}"/speech_synthesis/patts/manifest.json
doins "${S}"/speech_synthesis/patts/tts_main.js
doins "${S}"/speech_synthesis/patts/tts_service.nmf
# Speech synthesis voice data
doins "${S}"/speech_synthesis/patts/voice_data_hmm_en-US.js
unzip "${S}"/speech_synthesis/patts/voice_data_hmm_en-US.zip
doins -r "${S}"/voice_data_hmm_en-US
# Speech synthesis engine (platform-specific native client module)
if use arm ; then
unzip "${S}"/speech_synthesis/patts/tts_service_pexe_arm.nexe.zip
doins "${S}"/tts_service_pexe_arm.nexe
elif use x86 ; then
unzip "${S}"/speech_synthesis/patts/tts_service_x86-32.nexe.zip
doins "${S}"/tts_service_x86-32.nexe
elif use amd64 ; then
unzip "${S}"/speech_synthesis/patts/tts_service_x86-64.nexe.zip
doins "${S}"/tts_service_x86-64.nexe
fi
}

View File

@ -0,0 +1,197 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
CROS_WORKON_PROJECT="chromiumos/platform/assets"
inherit cros-workon toolchain-funcs
DESCRIPTION="Chrome OS assets (images, sounds, etc.)"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="alex lumpy lumpy64 mario tegra2-ldk"
DEPEND="media-fonts/croscorefonts
media-fonts/droidfonts-cros
x11-apps/xcursorgen"
RDEPEND=""
REAL_CURSOR_NAMES="
fleur
hand2
left_ptr
sb_h_double_arrow
sb_v_double_arrow
top_left_corner
top_right_corner
xterm"
# These are cursors for which there is no file, but we want to use
# one of the existing files. So we link them. The first one is an
# X holdover from some mozilla bug, and without it, we will use the
# default left_ptr_watch bitmap.
LINK_CURSORS="
08e8e1c95fe2fc01f976f1e063a24ccd:left_ptr_watch
X_cursor:left_ptr
arrow:left_ptr
based_arrow_down:sb_v_double_arrow
based_arrow_up:sb_v_double_arrow
boat:left_ptr
bogosity:left_ptr
bottom_left_corner:top_right_corner
bottom_right_corner:top_left_corner
bottom_side:sb_v_double_arrow
bottom_tee:sb_v_double_arrow
box_spiral:left_ptr
center_ptr:left_ptr
circle:left_ptr
clock:left_ptr
coffee_mug:left_ptr
diamond_cross:left_ptr
dot:left_ptr
dotbox:left_ptr
double_arrow:sb_v_double_arrow
draft_large:left_ptr
draft_small:left_ptr
draped_box:left_ptr
exchange:left_ptr
gobbler:left_ptr
gumby:left_ptr
hand1:hand2
heart:left_ptr
icon:left_ptr
iron_cross:left_ptr
left_ptr_watch:left_ptr
left_side:sb_h_double_arrow
left_tee:sb_h_double_arrow
leftbutton:left_ptr
ll_angle:top_right_corner
lr_angle:top_left_corner
man:left_ptr
middlebutton:left_ptr
mouse:left_ptr
pencil:left_ptr
pirate:left_ptr
plus:left_ptr
right_ptr:left_ptr
right_side:sb_h_double_arrow
right_tee:sb_h_double_arrow
rightbutton:left_ptr
rtl_logo:left_ptr
sailboat:left_ptr
sb_down_arrow:sb_v_double_arrow
sb_left_arrow:sb_h_double_arrow
sb_right_arrow:sb_h_double_arrow
sb_up_arrow:sb_v_double_arrow
shuttle:left_ptr
sizing:top_left_corner
spider:left_ptr
spraycan:left_ptr
star:left_ptr
target:left_ptr
tcross:left_ptr
top_left_arrow:left_ptr
top_side:sb_v_double_arrow
top_tee:sb_v_double_arrow
trek:left_ptr
ul_angle:top_left_corner
umbrella:left_ptr
ur_angle:top_right_corner
watch:left_ptr"
CROS_WORKON_LOCALNAME="assets"
src_install() {
insinto /usr/share/chromeos-assets/images
doins -r "${S}"/images/*
insinto /usr/share/chromeos-assets/images_100_percent
doins -r "${S}"/images_100_percent/*
insinto /usr/share/chromeos-assets/images_200_percent
doins -r "${S}"/images_200_percent/*
insinto /usr/share/chromeos-assets/text
doins -r "${S}"/text/boot_messages
dosbin "${S}"/text/display_boot_message
insinto /usr/share/chromeos-assets/gaia_auth
doins -r "${S}"/gaia_auth/*
insinto /usr/share/chromeos-assets/input_methods
doins "${S}"/input_methods/*
unzip "${S}"/accessibility/extensions/access_chromevox.zip
insinto /usr/share/chromeos-assets/accessibility/extensions/access_chromevox
doins -r "${S}"/chromevox_deploy/*
insinto /usr/share/chromeos-assets/crosh_builtin/
unzip -d crosh_builtin_deploy/ "${S}"/chromeapps/crosh_builtin/crosh_builtin.zip
doins -r "${S}"/crosh_builtin_deploy/*
insinto /usr/share/fonts/chrome-droid
doins "${S}"/fonts/ChromeDroid*.ttf
insinto /usr/share/color/bin
if use mario; then
newins "${S}"/color_profiles/mario.bin internal_display.bin
elif use alex; then
newins "${S}"/color_profiles/alex.bin internal_display.bin
elif use lumpy; then
newins "${S}"/color_profiles/lumpy.bin internal_display.bin
fi
# Don't install cursors when building for Tegra, since the
# current ARGB cursor implementation is performing badly,
# and the fallback to 2-bit hardware cursor works better.
# TODO: Remove this when the display driver has been fixed to
# remove the performance bottlenecks.
if ! use tegra2-ldk; then
local CURSOR_DIR="${D}"/usr/share/cursors/xorg-x11/chromeos/cursors
mkdir -p "${CURSOR_DIR}"
for i in ${REAL_CURSOR_NAMES}; do
xcursorgen -p "${S}"/cursors "${S}"/cursors/$i.cfg >"${CURSOR_DIR}/$i"
done
for i in ${LINK_CURSORS}; do
ln -s ${i#*:} "${CURSOR_DIR}/${i%:*}"
done
fi
mkdir -p "${D}"/usr/share/cursors/xorg-x11/default
echo Inherits=chromeos \
>"${D}"/usr/share/cursors/xorg-x11/default/index.theme
#
# Speech synthesis
#
insinto /usr/share/chromeos-assets/speech_synthesis/patts
# Speech synthesis component extension code
doins "${S}"/speech_synthesis/patts/manifest.json
doins "${S}"/speech_synthesis/patts/tts_main.js
doins "${S}"/speech_synthesis/patts/tts_service.nmf
# Speech synthesis voice data
doins "${S}"/speech_synthesis/patts/voice_data_hmm_en-US.js
unzip "${S}"/speech_synthesis/patts/voice_data_hmm_en-US.zip
doins -r "${S}"/voice_data_hmm_en-US
# Speech synthesis engine (platform-specific native client module)
if use arm ; then
unzip "${S}"/speech_synthesis/patts/tts_service_pexe_arm.nexe.zip
doins "${S}"/tts_service_pexe_arm.nexe
elif use x86 ; then
unzip "${S}"/speech_synthesis/patts/tts_service_x86-32.nexe.zip
doins "${S}"/tts_service_x86-32.nexe
elif use amd64 ; then
unzip "${S}"/speech_synthesis/patts/tts_service_x86-64.nexe.zip
doins "${S}"/tts_service_x86-64.nexe
fi
}

View File

@ -0,0 +1,53 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
DESCRIPTION="ChromiumOS-specific configuration files for pambase"
HOMEPAGE="http://www.chromium.org"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm x86"
RDEPEND="
>=sys-auth/pambase-20090620.1-r7
chromeos-base/vboot_reference"
DEPEND="${RDEPEND}"
src_install() {
# Chrome OS: sudo and vt2 are important for system debugging both in
# developer mode and during development. These two stanzas allow sudo and
# login auth as user chronos under the following conditions:
#
# 1. password-less access:
# - system in developer mode
# - there is no passwd.devmode file
# - there is no system-wide password set above.
# 2. System-wide (/etc/shadow) password access:
# - image has a baked in password above
# 3. Developer mode password access
# - user creates a passwd.devmode file with "chronos:CRYPTED_PASSWORD"
# 4. System-wide (/etc/shadow) password access set by modifying /etc/shadow:
# - Cases #1 and #2 will apply but failure will fall through to the
# inserted password.
insinto /etc/pam.d
doins "${FILESDIR}/chromeos-auth" || die
dosbin "${FILESDIR}/is_developer_end_user" || die
}
pkg_postinst() {
# If there's a shared user password or if the build target is the host,
# reset chromeos-auth to an empty file. We don't transition from empty to
# populated because binary packages lose FILESDIR.
local crypted_password='*'
if [ "${ROOT}" = "/" ]; then
crypted_password='host'
elif [ -r "${SHARED_USER_PASSWD_FILE}" ]; then
crypted_password=$(cat "${SHARED_USER_PASSWD_FILE}")
fi
if [ "${crypted_password}" != '*' ]; then
echo -n '' > "${ROOT}/etc/pam.d/chromeos-auth" || die
fi
}

View File

@ -0,0 +1,16 @@
# If we're not in dev-mode, skip to the system password stack.
auth [success=ignore default=3] pam_exec.so \
quiet /usr/bin/crossystem cros_debug?1
# Check if a custom devmode password file exists and prefer it.
auth [success=ignore default=1] pam_exec.so \
quiet /usr/bin/test -f /mnt/stateful_partition/etc/devmode.passwd
# If we get to pwdfile, use it or bypass the password-less login.
auth [success=done default=1] pam_pwdfile.so \
pwdfile /mnt/stateful_partition/etc/devmode.passwd
# If we get here, allow password-less access
auth sufficient pam_exec.so quiet /usr/bin/crossystem cros_debug?1
# Fallback to a system password if one was stamped in after initial build.

View File

@ -0,0 +1,13 @@
#!/bin/sh
# 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.
# Exit status is 0 if this is a "developer system", non-zero if not.
# We define "developer system" as any of
# - a release image on a system with the developer hardware switch set on,
# - a developer or test image running on hardware or a VM, or
# - a system with a shared user password set (meaning it's possible to log in
# on a VT console).
crossystem "cros_debug?1" || grep -q '^chronos:[^*]' /etc/shadow

View File

@ -0,0 +1 @@
./chromeos-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-chromeos-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,63 @@
# 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="f6a78c3976f71190d7aa4d310f245410627e77d2"
CROS_WORKON_TREE="acf7bf198dadec0295a36c07a3f28615bd53af35"
CROS_WORKON_PROJECT="chromiumos/platform/debugd"
CROS_WORKON_LOCALNAME=$(basename ${CROS_WORKON_PROJECT})
inherit cros-debug cros-workon toolchain-funcs
DESCRIPTION="Chrome OS debugging service"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE=""
LIBCHROME_VERS="125070"
RDEPEND="chromeos-base/chromeos-minijail
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
chromeos-base/libchromeos
dev-libs/dbus-c++
dev-libs/glib:2
dev-libs/libpcre"
DEPEND="${RDEPEND}
chromeos-base/shill
sys-apps/dbus
virtual/modemmanager"
src_compile() {
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG OBJCOPY
cros-debug-add-NDEBUG
emake BASE_VER=${LIBCHROME_VERS}
}
src_test() {
emake tests BASE_VER=${LIBCHROME_VERS}
}
src_install() {
cd build-opt
into /
dosbin debugd
dodir /debugd
exeinto /usr/libexec/debugd/helpers
doexe helpers/icmp
doexe helpers/netif
doexe helpers/modem_status
doexe "${S}"/src/helpers/minijail-setuid-hack.sh
doexe "${S}"/src/helpers/systrace.sh
doexe helpers/network_status
insinto /etc/dbus-1/system.d
doins "${FILESDIR}/org.chromium.debugd.conf"
insinto /etc/init
doins "${FILESDIR}/debugd.conf"
doins "${FILESDIR}/trace_marker-test.conf"
}

View File

@ -0,0 +1,61 @@
# 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/debugd"
CROS_WORKON_LOCALNAME=$(basename ${CROS_WORKON_PROJECT})
inherit cros-debug cros-workon toolchain-funcs
DESCRIPTION="Chrome OS debugging service"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE=""
LIBCHROME_VERS="125070"
RDEPEND="chromeos-base/chromeos-minijail
chromeos-base/libchrome:${LIBCHROME_VERS}[cros-debug=]
chromeos-base/libchromeos
dev-libs/dbus-c++
dev-libs/glib:2
dev-libs/libpcre"
DEPEND="${RDEPEND}
chromeos-base/shill
sys-apps/dbus
virtual/modemmanager"
src_compile() {
tc-export CC CXX AR RANLIB LD NM PKG_CONFIG OBJCOPY
cros-debug-add-NDEBUG
emake BASE_VER=${LIBCHROME_VERS}
}
src_test() {
emake tests BASE_VER=${LIBCHROME_VERS}
}
src_install() {
cd build-opt
into /
dosbin debugd
dodir /debugd
exeinto /usr/libexec/debugd/helpers
doexe helpers/icmp
doexe helpers/netif
doexe helpers/modem_status
doexe "${S}"/src/helpers/minijail-setuid-hack.sh
doexe "${S}"/src/helpers/systrace.sh
doexe helpers/network_status
insinto /etc/dbus-1/system.d
doins "${FILESDIR}/org.chromium.debugd.conf"
insinto /etc/init
doins "${FILESDIR}/debugd.conf"
doins "${FILESDIR}/trace_marker-test.conf"
}

View File

@ -0,0 +1,30 @@
# 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.
description "Chromium OS debug daemon"
author "chromium-os-dev@chromium.org"
start on started ui
stop on stopping ui or starting halt or starting reboot
respawn
pre-start script
TRACING=/sys/kernel/debug/tracing
# NB: check for tracing dir in case the kernel config changes
if [ -d "${TRACING}" ]; then
# enable debugd write access for systrace helper
for file in buffer_size_kb set_event trace trace_clock trace_marker \
tracing_on; do
chgrp debugd ${TRACING}/${file} && chmod g+w ${TRACING}/${file}
done
fi
# NB: only on exynos5
MALI_HWC_ENABLE=/sys/devices/platform/mali.0/hwc_enable
if [ -f "${MALI_HWC_ENABLE}" ]; then
chgrp debugd ${MALI_HWC_ENABLE} && chmod g+w ${MALI_HWC_ENABLE}
fi
end script
exec /sbin/debugd

View File

@ -0,0 +1,19 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy context="default">
<allow send_destination="org.chromium.debugd"/>
</policy>
<policy user="debugd">
<allow own="org.chromium.debugd"/>
</policy>
<policy user="root">
<allow own="org.chromium.debugd"/>
</policy>
<limit name="max_replies_per_connection">512</limit>
</busconfig>

View File

@ -0,0 +1,20 @@
# 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.
description "Chromium OS debug daemon trace_marker helper"
author "chromium-os-dev@chromium.org"
# This lets us log trace events to the kernel trace buffer on test images
# where non-Chrome libraries can do logging to the trace_marker file.
# We need this to integrate third-party tracing into combined Chrome
# and system traces.
#for_test start on starting debugd
stop on stopping ui or starting halt or starting reboot
respawn
pre-start script
chmod a+w /sys/kernel/debug/tracing/trace_marker
end script

View File

@ -0,0 +1,77 @@
# 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.makefile file.
EAPI="4"
CROS_WORKON_COMMIT="6e29f8091d9da763cd39b7ea61eefb5c35b94606"
CROS_WORKON_TREE="7312bc4c61477f0041b02dbca07a3029707e9d46"
CROS_WORKON_PROJECT="chromiumos/platform/ec"
CROS_WORKON_LOCALNAME="ec"
inherit toolchain-funcs cros-board cros-workon
DESCRIPTION="Embedded Controller firmware code"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="arm amd64 x86"
IUSE="test bds snow spring"
# We don't want binchecks since we're cross-compiling firmware images using
# non-standard layout.
RESTRICT="binchecks"
set_build_env() {
# The firmware is running on ARMv7-m (Cortex-M4)
export CROSS_COMPILE=arm-none-eabi-
tc-export CC BUILD_CC
export HOSTCC=${CC}
export BUILDCC=${BUILD_CC}
# Allow building for boards that don't have an EC
# (so we can compile test on bots for testing).
export EC_BOARD=$(usev bds || get_current_board_with_variant)
if [[ ! -d board/${EC_BOARD} ]] ; then
ewarn "Sorry, ${EC_BOARD} not supported; doing build-test with BOARD=bds"
EC_BOARD=bds
fi
# FIXME: hack to separate BOARD= used by EC Makefile and Portage,
# crosbug.com/p/10377
if use snow; then
EC_BOARD=snow
fi
# If building for spring hack in spring, must happen after snow due
# to hirearchy of current overlays.
if use spring; then
ewarn "USE=spring detected; overriding EC_BOARD=spring"
EC_BOARD=spring
fi
}
src_compile() {
set_build_env
BOARD=${EC_BOARD} emake all
EXTRA_ARGS="out=build/${EC_BOARD}_shifted "
EXTRA_ARGS+="EXTRA_CFLAGS=\"-DSHIFT_CODE_FOR_TEST\""
BOARD=${EC_BOARD} emake all ${EXTRA_ARGS}
}
src_install() {
set_build_env
# EC firmware binaries
insinto /firmware
doins build/${EC_BOARD}/ec.bin
doins build/${EC_BOARD}/ec.RW.bin
newins build/${EC_BOARD}/ec.RO.flat ec.RO.bin
newins build/${EC_BOARD}_shifted/ec.bin ec_autest_image.bin
# Intermediate files for debugging
doins build/${EC_BOARD}/ec.*.elf
# Utilities
exeinto /usr/bin
doexe build/${EC_BOARD}/util/ectool
}

View File

@ -0,0 +1,75 @@
# 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.makefile file.
EAPI="4"
CROS_WORKON_PROJECT="chromiumos/platform/ec"
CROS_WORKON_LOCALNAME="ec"
inherit toolchain-funcs cros-board cros-workon
DESCRIPTION="Embedded Controller firmware code"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~arm ~amd64 ~x86"
IUSE="test bds snow spring"
# We don't want binchecks since we're cross-compiling firmware images using
# non-standard layout.
RESTRICT="binchecks"
set_build_env() {
# The firmware is running on ARMv7-m (Cortex-M4)
export CROSS_COMPILE=arm-none-eabi-
tc-export CC BUILD_CC
export HOSTCC=${CC}
export BUILDCC=${BUILD_CC}
# Allow building for boards that don't have an EC
# (so we can compile test on bots for testing).
export EC_BOARD=$(usev bds || get_current_board_with_variant)
if [[ ! -d board/${EC_BOARD} ]] ; then
ewarn "Sorry, ${EC_BOARD} not supported; doing build-test with BOARD=bds"
EC_BOARD=bds
fi
# FIXME: hack to separate BOARD= used by EC Makefile and Portage,
# crosbug.com/p/10377
if use snow; then
EC_BOARD=snow
fi
# If building for spring hack in spring, must happen after snow due
# to hirearchy of current overlays.
if use spring; then
ewarn "USE=spring detected; overriding EC_BOARD=spring"
EC_BOARD=spring
fi
}
src_compile() {
set_build_env
BOARD=${EC_BOARD} emake all
EXTRA_ARGS="out=build/${EC_BOARD}_shifted "
EXTRA_ARGS+="EXTRA_CFLAGS=\"-DSHIFT_CODE_FOR_TEST\""
BOARD=${EC_BOARD} emake all ${EXTRA_ARGS}
}
src_install() {
set_build_env
# EC firmware binaries
insinto /firmware
doins build/${EC_BOARD}/ec.bin
doins build/${EC_BOARD}/ec.RW.bin
newins build/${EC_BOARD}/ec.RO.flat ec.RO.bin
newins build/${EC_BOARD}_shifted/ec.bin ec_autest_image.bin
# Intermediate files for debugging
doins build/${EC_BOARD}/ec.*.elf
# Utilities
exeinto /usr/bin
doexe build/${EC_BOARD}/util/ectool
}

View File

@ -0,0 +1,73 @@
# 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="ea3cd573f8d47f15f7e4808a838f0066777bed16"
CROS_WORKON_TREE="849f1bf8c2dd07edda676636f278674b93c49414"
CROS_WORKON_PROJECT="chromiumos/platform/init"
CROS_WORKON_LOCALNAME="init"
inherit cros-workon
DESCRIPTION="Upstart init scripts for Chromium OS"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE="nfs"
DEPEND=""
# vpd for vpd-log.conf of upstart
# vboot_reference for crossystem
RDEPEND="chromeos-base/chromeos-disableecho
!<chromeos-base/shill-0.0.1-r805
chromeos-base/vboot_reference
chromeos-base/vpd
net-firewall/iptables[ipv6]
sys-apps/chvt
sys-apps/smartmontools
sys-apps/upstart"
src_install() {
into / # We want /sbin, not /usr/sbin, etc.
# Install Upstart configuration files.
insinto /etc/init
doins *.conf
insinto /etc
doins issue rsyslog.chromeos
# Install various utility files
dosbin killers
dosbin date-proxy-watcher
# Install startup/shutdown scripts.
dosbin chromeos_startup chromeos_shutdown
dosbin chromeos-boot-alert
dosbin clobber-state
dosbin clobber-log
dosbin display_low_battery_alert
# Install log cleaning script and run it daily.
into /usr
dosbin chromeos-cleanup-logs
# Install lightup_screen
dosbin lightup_screen
# Some daemons and utilities access the mounts through /etc/mtab.
dosym /proc/mounts /etc/mtab || die
if use nfs; then
# With USE=nfs we remove the iptables rules to allow mounting
# of the root device.
rm "${D}/etc/init/iptables.conf" || die
rm "${D}/etc/init/ip6tables.conf" || die
# If nfs mounted use a tmpfs stateful partition like factory
sed -i 's/ext4/tmpfs/; s/,commit=600//' \
"${D}/sbin/chromeos_startup" || die
fi
}

View File

@ -0,0 +1,71 @@
# 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/init"
CROS_WORKON_LOCALNAME="init"
inherit cros-workon
DESCRIPTION="Upstart init scripts for Chromium OS"
HOMEPAGE="http://www.chromium.org/"
SRC_URI=""
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="nfs"
DEPEND=""
# vpd for vpd-log.conf of upstart
# vboot_reference for crossystem
RDEPEND="chromeos-base/chromeos-disableecho
!<chromeos-base/shill-0.0.1-r805
chromeos-base/vboot_reference
chromeos-base/vpd
net-firewall/iptables[ipv6]
sys-apps/chvt
sys-apps/smartmontools
sys-apps/upstart"
src_install() {
into / # We want /sbin, not /usr/sbin, etc.
# Install Upstart configuration files.
insinto /etc/init
doins *.conf
insinto /etc
doins issue rsyslog.chromeos
# Install various utility files
dosbin killers
dosbin date-proxy-watcher
# Install startup/shutdown scripts.
dosbin chromeos_startup chromeos_shutdown
dosbin chromeos-boot-alert
dosbin clobber-state
dosbin clobber-log
dosbin display_low_battery_alert
# Install log cleaning script and run it daily.
into /usr
dosbin chromeos-cleanup-logs
# Install lightup_screen
dosbin lightup_screen
# Some daemons and utilities access the mounts through /etc/mtab.
dosym /proc/mounts /etc/mtab || die
if use nfs; then
# With USE=nfs we remove the iptables rules to allow mounting
# of the root device.
rm "${D}/etc/init/iptables.conf" || die
rm "${D}/etc/init/ip6tables.conf" || die
# If nfs mounted use a tmpfs stateful partition like factory
sed -i 's/ext4/tmpfs/; s/,commit=600//' \
"${D}/sbin/chromeos_startup" || die
fi
}

View File

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

View File

@ -0,0 +1,219 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=2
DESCRIPTION="Chrome OS (meta package)"
HOMEPAGE="http://src.chromium.org"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm x86"
IUSE="bluetooth bootimage coreboot cros_ec gdmwimax X bootchart opengles"
################################################################################
#
# READ THIS BEFORE ADDING PACKAGES TO THIS EBUILD!
#
################################################################################
#
# Every chromeos dependency (along with its dependencies) is included in the
# release image -- more packages contribute to longer build times, a larger
# image, slower and bigger auto-updates, increased security risks, etc. Consider
# the following before adding a new package:
#
# 1. Does the package really need to be part of the release image?
#
# Some packages can be included only in the developer or test images, i.e., the
# chromeos-dev or chromeos-test ebuilds. If the package will eventually be used
# in the release but it's still under development, consider adding it to
# chromeos-dev initially until it's ready for production.
#
# 2. Why is the package a direct dependency of the chromeos ebuild?
#
# It makes sense for some packages to be included as a direct dependency of the
# chromeos ebuild but for most it doesn't. The package should be added as a
# direct dependency of the ebuilds for all packages that actually use it -- in
# time, this ensures correct builds and allows easier cleanup of obsolete
# packages. For example, if a utility will be invoked by the session manager,
# its package should be added as a dependency in the chromeos-login ebuild. Or
# if the package adds a daemon that will be started through an upstart job, it
# should be added as a dependency in the chromeos-init ebuild. If the package
# really needs to be a direct dependency of the chromeos ebuild, consider adding
# a comment why the package is needed and how it's used.
#
# 3. Are all default package features and dependent packages needed?
#
# The release image should include only packages and features that are needed in
# the production system. Often packages pull in features and additional packages
# that are never used. Review these and consider pruning them (e.g., through USE
# flags).
#
# 4. What is the impact on the image size?
#
# Before adding a package, evaluate the impact on the image size. If the package
# and its dependencies increase the image size significantly, consider
# alternative packages or approaches.
#
# 5. Is the package needed on all targets?
#
# If the package is needed only on some target boards, consider making it
# conditional through USE flags in the board overlays.
#
################################################################################
X86_DEPEND="
sys-boot/syslinux
"
RDEPEND="${RDEPEND} x86? ( ${X86_DEPEND} )"
RDEPEND="${RDEPEND} amd64? ( ${X86_DEPEND} )"
RDEPEND="${RDEPEND}
arm? (
chromeos-base/u-boot-scripts
)
"
RDEPEND="${RDEPEND}
virtual/linux-sources
"
# Specifically include the editor we want to appear in chromeos images, so that
# it is deterministic which editor is chosen by 'virtual/editor' dependencies
# (such as in the 'sudo' package). See crosbug.com/5777.
RDEPEND="${RDEPEND}
app-editors/vim
"
# TODO(micahc): Remove board-devices from RDEPEND in lieu of
# virtual/chromeos-bsp
# Note that o3d works with opengl on x86 and opengles on ARM, but not ARM
# opengl.
# We depend on dash for the /bin/sh shell for runtime speeds, but we also
# depend on bash to make the dev mode experience better. We do not enable
# things like line editing in dash, so its interactive mode is very bare.
# TODO
# chromeos-base/update_engine
RDEPEND="${RDEPEND}
app-admin/rsyslog
app-arch/sharutils
app-arch/tar
bootchart? (
app-benchmarks/bootchart
)
app-crypt/trousers
app-i18n/ibus-english-m
app-i18n/ibus-m17n
app-i18n/ibus-mozc
app-i18n/ibus-mozc-chewing
app-i18n/ibus-mozc-hangul
app-i18n/ibus-mozc-pinyin
app-laptop/laptop-mode-tools
app-shells/bash
app-shells/dash
coreos-base/audioconfig
coreos-base/board-devices
coreos-base/bootstat
coreos-base/chromeos-assets
coreos-base/chromeos-assets-split
coreos-base/chromeos-auth-config
coreos-base/chromeos-base
coreos-base/chromeos-debugd
coreos-base/chromeos-init
coreos-base/crash-reporter
coreos-base/cromo
coreos-base/cros-disks
coreos-base/cros_boot_mode
coreos-base/crosh
coreos-base/dev-install
coreos-base/internal
coreos-base/metrics
coreos-base/root-certificates
coreos-base/shill
coreos-base/userfeedback
media-gfx/ply-image
media-plugins/alsa-plugins
!arm? ( media-plugins/o3d )
arm? (
opengles? ( media-plugins/o3d )
)
media-sound/alsa-utils
media-sound/adhd
net-firewall/iptables
net-misc/tlsdate
net-wireless/ath3k
net-wireless/ath6k
net-wireless/crda
gdmwimax? (
net-wireless/gdmwimax
)
net-wireless/marvell_sd8787
bluetooth? (
net-wireless/bluez
)
>=sys-apps/baselayout-2.0.0
sys-apps/bootcache
sys-apps/coreutils
sys-apps/dbus
sys-apps/eject
sys-apps/flashrom
sys-apps/grep
sys-apps/mawk
sys-apps/module-init-tools
sys-apps/mosys
sys-apps/net-tools
sys-apps/pv
sys-apps/rootdev
sys-apps/sed
sys-apps/shadow
sys-apps/upstart
sys-apps/ureadahead
sys-apps/util-linux
sys-auth/pam_pwdfile
sys-fs/e2fsprogs
sys-fs/udev
sys-libs/timezone-data
sys-process/lsof
sys-process/procps
virtual/modemmanager
"
# TODO(dianders):
# In gentoo, the 'which' command is part of 'system'. That means that packages
# assume that it's there and don't list it as an explicit dependency. At the
# moment, we don't emerge 'system', but we really should at least emerge the
# embedded profile system. Until then, we'll list it as a dependency here.
#
# Note that even gentoo's 'embedded' profile effectively has 'which' in its
# implicit dependencies, since it depepends on busybox and the default busybox
# config from gentoo provides which.
#
# See http://crosbug.com/8144
RDEPEND="${RDEPEND}
coreboot? ( virtual/chromeos-coreboot )
sys-apps/which
"
# In addition to RDEPEND components, DEPEND in certain cases includes packages
# which do not need to be installed on the target, but need to be included for
# testing/compilation sanity check purposes.
DEPEND="${RDEPEND}
bootimage? ( sys-boot/chromeos-bootimage )
cros_ec? ( coreos-base/chromeos-ec )
"
# Add dev-util/quipper to the image. This is needed to do
# profiling on ChromiumOS on live systems.
RDEPEND="${RDEPEND}
dev-util/quipper
"
# USB / WiFi Firmware
RDEPEND="${RDEPEND}
net-wireless/realtek-rt2800-firmware
"

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>chromium</herd>
<maintainer>
<email>chromium-os-dev@chromium.org</email>
<description>Maintained by The Chromium OS Authors.</description>
</maintainer>
<longdescription>The Chromium OS base package pulls in dependencies to build a Chromium OS system.</longdescription>
<use>
<flag name='X'>Enables dependencies on X.</flag>
<flag name='bluetooth'>Enables bluetooth dependencies.</flag>
<flag name='bootimage'>Enables firmware bootimage dependencies.</flag>
<flag name='coreboot'>Enables coreboot.</flag>
<flag name='cros_ec'>Enables CrOS Embedded Controller.</flag>
<flag name='gdmwimax'>Enables WiMax dependencies.</flag>
<flag name='bootchart'>Enables bootchart.</flag>
<flag name='opengles'>Enables OpenGL ES.</flag>
</use>
</pkgmetadata>

View File

@ -0,0 +1 @@
chromeos-bootimage-0.0.2.ebuild

View File

@ -0,0 +1,189 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=4
inherit cros-debug
DESCRIPTION="ChromeOS firmware image builder"
HOMEPAGE="http://www.chromium.org"
LICENSE=""
SLOT="0"
KEYWORDS="amd64 arm x86"
# TODO(sjg@chromium.org): Remove when x86 can build all boards
BOARDS="alex butterfly emeraldlake2 haswell link lumpy lumpy64 mario parrot stout stumpy"
IUSE="${BOARDS} exynos factory-mode memtest tegra cros_ec depthcharge spring"
REQUIRED_USE="^^ ( ${BOARDS} arm )"
X86_DEPEND="
virtual/chromeos-coreboot
sys-apps/coreboot-utils
sys-boot/chromeos-seabios
"
DEPEND="
exynos? ( sys-boot/exynos-pre-boot )
tegra? ( virtual/tegra-bct )
x86? ( ${X86_DEPEND} )
amd64? ( ${X86_DEPEND} )
virtual/u-boot
cros_ec? ( chromeos-base/chromeos-ec )
chromeos-base/vboot_reference
sys-boot/chromeos-bmpblk
memtest? ( sys-boot/chromeos-memtest )
depthcharge? ( sys-boot/depthcharge )
"
S=${WORKDIR}
# Directory where the generated files are looked for and placed.
CROS_FIRMWARE_IMAGE_DIR="/firmware"
CROS_FIRMWARE_ROOT="${ROOT%/}${CROS_FIRMWARE_IMAGE_DIR}"
netboot_required() {
! use memtest && ( use factory-mode || use link || use spring)
}
# Build vboot and non-vboot images for the given device tree file
# A vboot image performs a full verified boot, and this is the normal case.
# A non-vboot image doesn't do a check for updated firmware, and just boots
# the kernel without verity enabled.
# Args:
# $1: fdt_file - full name of device tree file
# $2: uboot_file - full name of U-Boot binary
# $3: ec_file - full name of the EC read/write binary
# $4: common_flags - flags to use for all images
# $5: verified_flags - extra flags to use for verified image
# $6: nv_flags - extra flags to pass for non-verified image
build_image() {
local nv_uboot_file
local fdt_file="$1"
local uboot_file="$2"
local ec_file="$3"
local common_flags="$4"
local verified_flags="$5"
local nv_flags="$6"
local board
local base
local ec_file_flag
if use cros_ec; then
ec_file_flag="--ec ${ec_file}"
else
ec_file_flag=""
fi
einfo "Building images for ${fdt_file}"
# Bash stuff to turn '/path/to/exynos-5250-snow.dts' into 'snow'
base=$(basename ${fdt_file})
board=${base%%.dts}
board=${board##*-}
cmdline="${common_flags} \
--dt ${fdt_file} \
--uboot ${uboot_file} \
${ec_file_flag} \
--bootcmd vboot_twostop \
--bootsecure \
${verified_flags}"
# Build an RO-normal image, and an RW (twostop) image. This assumes
# that the fdt has the flags set to 1 by default.
cros_bundle_firmware ${cmdline} \
--outdir "out-${board}.ro" \
--output "image-${board}.bin" ||
die "failed to build image."
cros_bundle_firmware ${cmdline} --force-rw \
--outdir "out-${board}.rw" \
--output "image-${board}.rw.bin" ||
die "failed to build image."
# Make non-vboot image
nv_uboot_file="${uboot_file}"
if netboot_required; then
nv_uboot_file="${CROS_FIRMWARE_ROOT}/u-boot_netboot.bin"
fi
cros_bundle_firmware \
${common_flags} \
--dt ${fdt_file} \
--uboot ${nv_uboot_file} \
${ec_file_flag} \
--add-config-int load_env 1 \
--add-node-enable console 1 \
${nv_flags} \
--outdir "nvout-${board}" \
--output "nv_image-${board}.bin" ||
die "failed to build legacy image."
}
src_compile() {
local verified_flags=''
local common_flags=''
local bct_file
local fdt_file
local uboot_file
local devkeys_file
local dd_params
# Location of the board-specific bct file
bct_file="${ROOT%/}${CROS_FIRMWARE_IMAGE_DIR}/bct/board.bct"
if use memtest; then
uboot_file="${CROS_FIRMWARE_ROOT}/x86-memtest"
elif use depthcharge; then
uboot_file="${CROS_FIRMWARE_ROOT}/depthcharge/depthcharge.bin"
U_BOOT_FDT_USE="${U_BOOT_FDT_USE}_dc"
else
# We only have a single U-Boot, and it is called u-boot.bin
uboot_file="${CROS_FIRMWARE_ROOT}/u-boot.bin"
fi
# Location of the EC RW image
ec_file="${CROS_FIRMWARE_ROOT}/ec.RW.bin"
# Location of the devkeys
devkeys_file="${ROOT%/}/usr/share/vboot/devkeys"
if ! use x86 && ! use amd64 && ! use cros-debug; then
verified_flags+=' --add-config-int silent_console 1'
fi
if use x86 || use amd64; then
# Add a SeaBIOS payload
common_flags+=" --seabios ${CROS_FIRMWARE_ROOT}/seabios.cbfs"
common_flags+=" --coreboot \
${CROS_FIRMWARE_ROOT}/coreboot.rom"
if use depthcharge; then
common_flags+=" --coreboot-elf=${CROS_FIRMWARE_ROOT}"
common_flags+="/depthcharge/depthcharge.elf"
fi
fi
common_flags+=" --board ${BOARD_USE} --bct ${bct_file}"
common_flags+=" --key ${devkeys_file}"
common_flags+=" --bmpblk ${CROS_FIRMWARE_ROOT}/bmpblk.bin"
# TODO(sjg@chromium.org): For x86 we can't build all the images
# yet, since we need to use a different skeleton file for each.
if use x86 || use amd64; then
einfo "x86: Only building for board ${U_BOOT_FDT_USE}"
# Location of the U-Boot flat device tree source file
fdt_file="${CROS_FIRMWARE_ROOT}/dts/${U_BOOT_FDT_USE}.dts"
build_image "${fdt_file}" "${uboot_file}" "${ec_file}" \
"${common_flags}" "${verified_flags}" ""
else
einfo "Building all images"
for fdt_file in ${CROS_FIRMWARE_ROOT}/dts/*.dts; do
build_image "${fdt_file}" "${uboot_file}" \
"${ec_file}" "${common_flags}" \
"${verified_flags}" ""
done
fi
}
src_install() {
insinto "${CROS_FIRMWARE_IMAGE_DIR}"
doins *image*.bin
}