]>
git.wh0rd.org - home.git/blob - .bin/cros-board
2 .
/etc
/init.d
/functions.sh ||
exit 1
3 die
() { eerror
"$*"; exit 1; }
6 cd "${HOME}/trunk/src/scripts/"
8 : "${BOARD:="$(cat .default_board 2>/dev/null)"}"
9 if [[ -z ${BOARD} ]] ; then
12 IMAGES
="${HOME}/trunk/src/build/images/${BOARD}"
13 BUILD
="/build/${BOARD}"
17 Usage: cros-board [options]
19 Build for the board listed in \${BOARD} (current: ${BOARD}).
20 Normally only builds a dev image.
23 -t Build test packages & image
24 --autotest Build & install autotest packages.
25 --factory Build factory packages & image.
26 --nousepkg Force build from source.
30 -Y Write image to ${ARG_DEV} w/out prompting.
31 -y <dev> Write image to <dev> w/out prompting.
33 -p Pretend -- show commands that would be run.
34 -v Verbose -- send command output to stdout.
38 find_first_removable
() {
42 if [[ $
(cat "${d}/removable" 2>/dev
/null
) == "1" ]]; then
51 ARG_DEV
="$(find_first_removable)"
59 while [[ $# -ne 0 ]] ; do
61 --clean) ARG_CLEAN
=true
;;
62 -p) ARG_PRETEND
=true
;;
63 -Y) ARG_DEV_USER
=true
;;
64 -y) shift; ARG_DEV
=$1; ARG_DEV_USER
=true
;;
65 -v) ARG_VERBOSE
=true
;;
67 --nousepkg) ARG_NOPKG
=true
;;
68 --autotest) ARG_AUTOTEST
=true
;;
69 --factory) ARG_FACTORY
=true
;;
71 *) echo "unknown opt: $*"; exit 1;;
76 piperet
() { set -- ${PIPESTATUS[@]/0}; [[ $# -eq 0 ]]; }
79 if ! ${ARG_PRETEND} ; then
81 local log
="${IMAGES}"/log.
${1##*/}
82 if ${ARG_VERBOSE} ; then
95 tfe
() { ($1 && echo $2 ||
echo $3); }
98 rm -f "${IMAGES}"/log.
*
100 einfo
"Log root: ${IMAGES}/log."
102 run .
/update_chroot
--toolchain_boards=${BOARD}
104 if ${ARG_CLEAN} ||
[[ ! -d ${BUILD} ]] ; then
105 run sudo
rm -rf "${BUILD}"
106 run .
/setup_board
--board=${BOARD} --skip_chroot_upgrade
107 if [ $?
-ne 0 ] ; then
108 run sudo
rm -rf "${BUILD}"
113 run .
/build_packages \
117 --skip_chroot_upgrade \
118 $
(tfe
${ARG_AUTOTEST} --{,no
}withautotest
) \
119 $
(tfe
${ARG_FACTORY} --{,no
}withfactory
) \
120 $
(tfe
${ARG_NOPKG} --{no
,}usepkg
) \
121 $
(tfe
${ARG_TEST} --{,no
}withtest
)
122 BUILD_IMG
="./build_image --board=${BOARD} --noenable_rootfs_verification $(tfe ${ARG_TEST} test) dev"
125 IMG_TO_USB
="cros flash --yes usb://${ARG_DEV} xbuddy://local/${BOARD}/latest/dev"
126 if ${ARG_DEV_USER} ; then
132 rm -rf $
(ls -td1R `find -mindepth 1 -maxdepth 1 -type d` |
sed -e 1d
-e 2d
)
134 d
="~/trunk/src/scripts"
135 BUILD_IMG
="${d}/${BUILD_IMG#./}"
142 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest
143 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest --test_image
144 ~/chromiumos/chromite/bin/cros_vm --start --no-display --image-path=\${HOME}/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
145 #--kvm_cpu "max,vmx=on"
147 https://dev.chromium.org/chromium-os/testing/running-smoke-suite-on-a-vm-image
149 /usr/local/autotest/bin/autologin.py
151 export CROS_USER_ID_HASH=\$(ls /home/user/)
152 sudo -u chronos CROS_USER_ID_HASH="${CROS_USER_ID_HASH}" crosh
153 vmc start termina # might run twice
156 ${d}/mod_image_for_recovery.sh --board=${BOARD}
157 ${IMG_TO_USB%/dev}/recovery
160 ${BUILD_IMG} --factory_install
161 ${IMG_TO_USB} -i factory_install_shim.bin