OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Script to build a bootable keyfob-based chromeos system image from within | 7 # Script to build a bootable keyfob-based chromeos system image from within |
8 # a chromiumos setup. This assumes that all needed packages have been built into | 8 # a chromiumos setup. This assumes that all needed packages have been built into |
9 # the given target's root with binary packages turned on. This script will | 9 # the given target's root with binary packages turned on. This script will |
10 # build the Chrome OS image using only pre-built binary packages. | 10 # build the Chrome OS image using only pre-built binary packages. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 STATEFUL_LOOP_DEV= | 255 STATEFUL_LOOP_DEV= |
256 ESP_LOOP_DEV= | 256 ESP_LOOP_DEV= |
257 | 257 |
258 # ${DEV_IMAGE_ROOT} specifies the location of where developer packages will | 258 # ${DEV_IMAGE_ROOT} specifies the location of where developer packages will |
259 # be installed on the stateful dir. On a Chromium OS system, this will | 259 # be installed on the stateful dir. On a Chromium OS system, this will |
260 # translate to /usr/local. | 260 # translate to /usr/local. |
261 DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image" | 261 DEV_IMAGE_ROOT="${STATEFUL_FS_DIR}/dev_image" |
262 | 262 |
263 # What cross-build are we targeting? | 263 # What cross-build are we targeting? |
264 . "${BOARD_ROOT}/etc/make.conf.board_setup" | 264 . "${BOARD_ROOT}/etc/make.conf.board_setup" |
265 LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r1"} | 265 LIBC_VERSION=${LIBC_VERSION:-"2.10.1-r2"} |
davidjames
2011/02/25 19:22:18
So it looks like LIBC_VERSION has been in ${BOARD_
| |
266 | 266 |
267 if [ ${FLAGS_jobs} -ne -1 ]; then | 267 if [ ${FLAGS_jobs} -ne -1 ]; then |
268 EMERGE_JOBS="--jobs=${FLAGS_jobs}" | 268 EMERGE_JOBS="--jobs=${FLAGS_jobs}" |
269 fi | 269 fi |
270 | 270 |
271 # Figure out ARCH from the given toolchain. | 271 # Figure out ARCH from the given toolchain. |
272 # TODO: Move to common.sh as a function after scripts are switched over. | 272 # TODO: Move to common.sh as a function after scripts are switched over. |
273 TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }') | 273 TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }') |
274 case "${TC_ARCH}" in | 274 case "${TC_ARCH}" in |
275 arm*) | 275 arm*) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 DISK_LABEL="C-STATE" | 594 DISK_LABEL="C-STATE" |
595 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}" | 595 sudo losetup "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_IMG}" |
596 sudo mkfs.ext3 "${STATEFUL_LOOP_DEV}" | 596 sudo mkfs.ext3 "${STATEFUL_LOOP_DEV}" |
597 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${STATEFUL_LOOP_DEV}" | 597 sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${STATEFUL_LOOP_DEV}" |
598 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}" | 598 sudo mount "${STATEFUL_LOOP_DEV}" "${STATEFUL_FS_DIR}" |
599 | 599 |
600 # -- Install packages into the root file system -- | 600 # -- Install packages into the root file system -- |
601 | 601 |
602 # We need to install libc manually from the cross toolchain. | 602 # We need to install libc manually from the cross toolchain. |
603 # TODO: Improve this? We only want libc and not the whole toolchain. | 603 # TODO: Improve this? We only want libc and not the whole toolchain. |
604 PKGDIR="/var/lib/portage/pkgs/cross/" | 604 # TODO(raymes): Remove this check after some time which ensures |
605 sudo tar jxvpf \ | 605 # backward compatibility with the crossdev location change |
davidjames
2011/02/25 19:22:18
Please add a trailing period.
| |
606 "${PKGDIR}/${CHOST}/cross-${CHOST}"/glibc-${LIBC_VERSION}.tbz2 \ | 606 PKGDIR="/var/lib/portage/pkgs" |
607 -C "${ROOT_FS_DIR}" --strip-components=3 \ | 607 LIBC_TAR="glibc-${LIBC_VERSION}.tbz2" |
608 NEW_LIBC_PATH="${PKGDIR}/cross-${CHOST}/${LIBC_TAR}" | |
609 OLD_LIBC_PATH="${PKGDIR}/cross/${CHOST}/cross-${CHOST}/${LIBC_TAR}" | |
610 if [ -e "${NEW_LIBC_PATH}" ] ; then | |
611 LIBC_PATH="${NEW_LIBC_PATH}" | |
612 else | |
613 LIBC_PATH="${OLD_LIBC_PATH}" | |
614 fi | |
615 | |
616 sudo tar jxvpf "${LIBC_PATH}" -C "${ROOT_FS_DIR}" --strip-components=3 \ | |
608 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o | 617 --exclude=usr/include --exclude=sys-include --exclude=*.a --exclude=*.o |
609 | 618 |
610 # We need to install libstdc++ manually from the cross toolchain. | 619 # We need to install libstdc++ manually from the cross toolchain. |
611 # TODO: Figure out a better way of doing this? | 620 # TODO: Figure out a better way of doing this? |
612 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib" | 621 sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib" |
613 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib" | 622 sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib" |
614 | 623 |
615 # Prepare stateful partition with some pre-created directories. | 624 # Prepare stateful partition with some pre-created directories. |
616 sudo mkdir -p "${DEV_IMAGE_ROOT}" | 625 sudo mkdir -p "${DEV_IMAGE_ROOT}" |
617 sudo mkdir -p "${STATEFUL_FS_DIR}/var" | 626 sudo mkdir -p "${STATEFUL_FS_DIR}/var" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
810 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 819 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
811 fi | 820 fi |
812 | 821 |
813 print_time_elapsed | 822 print_time_elapsed |
814 | 823 |
815 echo "To copy to USB keyfob, do something like:" | 824 echo "To copy to USB keyfob, do something like:" |
816 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 825 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
817 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 826 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
818 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 827 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
819 echo "from the scripts directory where you entered the chroot." | 828 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |