]>
git.wh0rd.org - home.git/blob - .bin/cros-board
e9ff570a99cff7e5f2a794a8ffaf40f0f02e3f7a
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.
47 while [[ $# -ne 0 ]] ; do
49 --clean) ARG_CLEAN
=true
;;
50 -p) ARG_PRETEND
=true
;;
51 -Y) ARG_DEV_USER
=true
;;
52 -y) shift; ARG_DEV
=$1; ARG_DEV_USER
=true
;;
53 -v) ARG_VERBOSE
=true
;;
55 --nousepkg) ARG_NOPKG
=true
;;
56 --autotest) ARG_AUTOTEST
=true
;;
57 --factory) ARG_FACTORY
=true
;;
59 *) echo "unknown opt: $*"; exit 1;;
64 piperet
() { set -- ${PIPESTATUS[@]/0}; [[ $# -eq 0 ]]; }
67 if ! ${ARG_PRETEND} ; then
69 local log
="${IMAGES}"/log.
${1##*/}
70 if ${ARG_VERBOSE} ; then
83 tfe
() { ($1 && echo $2 ||
echo $3); }
86 rm -f "${IMAGES}"/log.
*
88 einfo
"Log root: ${IMAGES}/log."
90 run .
/update_chroot
--toolchain_boards=${BOARD}
92 if ${ARG_CLEAN} ||
[[ ! -d ${BUILD} ]] ; then
93 run sudo
rm -rf "${BUILD}"
94 run .
/setup_board
--board=${BOARD} --skip_chroot_upgrade
95 if [ $?
-ne 0 ] ; then
96 run sudo
rm -rf "${BUILD}"
101 run .
/build_packages \
105 --skip_chroot_upgrade \
106 $
(tfe
${ARG_AUTOTEST} --{,no
}withautotest
) \
107 $
(tfe
${ARG_FACTORY} --{,no
}withfactory
) \
108 $
(tfe
${ARG_NOPKG} --{no
,}usepkg
) \
109 $
(tfe
${ARG_TEST} --{,no
}withtest
)
110 BUILD_IMG
="./build_image --board=${BOARD} --noenable_rootfs_verification $(tfe ${ARG_TEST} test) dev"
113 IMG_TO_USB
="cros flash --yes usb://${ARG_DEV} xbuddy://local/${BOARD}/latest/dev"
114 if ${ARG_DEV_USER} ; then
120 rm -rf $
(ls -td1R `find -mindepth 1 -maxdepth 1 -type d` |
sed -e 1d
-e 2d
)
122 d
="~/trunk/src/scripts"
123 BUILD_IMG
="${d}/${BUILD_IMG#./}"
130 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest
131 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest --test_image
132 ~/chromiumos/src/scripts/bin/cros_start_vm --no_graphics --image_path=\${HOME}/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
133 qemu-system-x86_64 -enable-kvm -m 1024 -vga std -net nic,model=virtio -net user,hostfwd=tcp::9222-:22 -hda ~/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
134 http://dev.chromium.org/chromium-os/testing/running-smoke-suite-on-a-vm-image
137 ${d}/mod_image_for_recovery.sh --board=${BOARD}
138 ${IMG_TO_USB%/dev}/recovery
141 ${BUILD_IMG} --factory_install
142 ${IMG_TO_USB} -i factory_install_shim.bin