Various image build improvements for ARM

Add an --arch option to build_image.sh, passed to install_packages.sh.
Use it to set APT::Architecture.

Add --mirror2/--suite2 options to build_image.sh, and --server2/--suite2
options to install_packages.sh (differing option names to match options
that were there already).  This allows some of the packages to be pulled
from ports.ubuntu.com rather than from local_packages, like this:

  ./build_image.sh --arch armel --mirror2 http://ports.ubuntu.com/ubuntu-ports --suite2 karmic

Copy only .debs from local_packages, not whatever other junk might be
lying around there.

Use copy: rather than file: for local_packages, so that the files will
be copied into the apt cache directory for the benefit of
dpkg_no_scripts.sh.

Review URL: http://codereview.chromium.org/554031
This commit is contained in:
Colin Watson 2010-01-22 17:57:28 +00:00
parent 1bd60cdedf
commit aaedee7f36
2 changed files with 24 additions and 3 deletions

View File

@ -33,8 +33,12 @@ DEFINE_boolean replace $FLAGS_FALSE "Overwrite existing output, if any."
DEFINE_boolean increment $FLAGS_FALSE \ DEFINE_boolean increment $FLAGS_FALSE \
"Picks the latest build and increments the minor version by one." "Picks the latest build and increments the minor version by one."
DEFINE_string arch "x86" \
"The target architecture to build for. One of { x86, armel }."
DEFINE_string mirror "$DEFAULT_IMG_MIRROR" "Repository mirror to use." DEFINE_string mirror "$DEFAULT_IMG_MIRROR" "Repository mirror to use."
DEFINE_string suite "$DEFAULT_IMG_SUITE" "Repository suite to base image on." DEFINE_string suite "$DEFAULT_IMG_SUITE" "Repository suite to base image on."
DEFINE_string mirror2 "" "Additional repository mirror to use (URL only)."
DEFINE_string suite2 "" "Repository suite for additional mirror."
DEFINE_string pkglist "$DEFAULT_PKGLIST" \ DEFINE_string pkglist "$DEFAULT_PKGLIST" \
"Name of file listing packages to install from repository." "Name of file listing packages to install from repository."
DEFINE_boolean with_dev_pkgs $FLAGS_TRUE \ DEFINE_boolean with_dev_pkgs $FLAGS_TRUE \
@ -128,8 +132,11 @@ fi
--root="$ROOT_FS_DIR" \ --root="$ROOT_FS_DIR" \
--output_dir="${OUTPUT_DIR}" \ --output_dir="${OUTPUT_DIR}" \
--package_list="$PKGLIST" \ --package_list="$PKGLIST" \
--arch="$FLAGS_arch" \
--mirror="$FLAGS_mirror" \ --mirror="$FLAGS_mirror" \
--suite="$FLAGS_suite" --suite="$FLAGS_suite" \
--mirror2="$FLAGS_mirror2" \
--suite2="$FLAGS_suite2"
"${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}" "${SCRIPTS_DIR}/customize_rootfs.sh" --root="${ROOT_FS_DIR}"

View File

@ -34,6 +34,8 @@ DEFINE_string mirror "$DEFAULT_IMG_MIRROR" \
"The upstream package mirror to use." "The upstream package mirror to use."
DEFINE_string suite "$DEFAULT_IMG_SUITE" \ DEFINE_string suite "$DEFAULT_IMG_SUITE" \
"The upstream package suite to use." "The upstream package suite to use."
DEFINE_string mirror2 "" "Additional package mirror to use (URL only)."
DEFINE_string suite2 "" "Package suite for additional mirror."
# Parse command line # Parse command line
FLAGS "$@" || exit 1 FLAGS "$@" || exit 1
@ -81,7 +83,7 @@ cleanup_rootfs_mounts() {
# Set up repository for locally built packages; these take highest precedence. # Set up repository for locally built packages; these take highest precedence.
mkdir -p "${SETUP_DIR}/local_packages" mkdir -p "${SETUP_DIR}/local_packages"
cp "${FLAGS_build_root}/${FLAGS_arch}/local_packages"/* \ cp "${FLAGS_build_root}/${FLAGS_arch}/local_packages"/*.deb \
"${SETUP_DIR}/local_packages" "${SETUP_DIR}/local_packages"
cd "$SETUP_DIR" cd "$SETUP_DIR"
dpkg-scanpackages local_packages/ /dev/null | \ dpkg-scanpackages local_packages/ /dev/null | \
@ -91,15 +93,26 @@ cd -
# Create the temporary apt source.list used to install packages. # Create the temporary apt source.list used to install packages.
APT_SOURCE="${OUTPUT_DIR}/sources.list" APT_SOURCE="${OUTPUT_DIR}/sources.list"
cat <<EOF > "$APT_SOURCE" cat <<EOF > "$APT_SOURCE"
deb file:"$SETUP_DIR" local_packages/ deb copy:"$SETUP_DIR" local_packages/
deb $FLAGS_mirror $FLAGS_suite main restricted multiverse universe deb $FLAGS_mirror $FLAGS_suite main restricted multiverse universe
EOF EOF
if [ -n "$FLAGS_mirror2" ] && [ -n "$FLAGS_suite2" ]; then
cat <<EOF >> "$APT_SOURCE"
deb $FLAGS_mirror2 $FLAGS_suite2 main restricted multiverse universe
EOF
fi
# Cache directory for APT to use. This cache is re-used across builds. We # Cache directory for APT to use. This cache is re-used across builds. We
# rely on the cache to reduce traffic to the hosted repositories. # rely on the cache to reduce traffic to the hosted repositories.
APT_CACHE_DIR="${FLAGS_build_root}/apt_cache-${FLAGS_arch}/" APT_CACHE_DIR="${FLAGS_build_root}/apt_cache-${FLAGS_arch}/"
mkdir -p "${APT_CACHE_DIR}/archives/partial" mkdir -p "${APT_CACHE_DIR}/archives/partial"
if [ "${FLAGS_arch}" = x86 ]; then
APT_ARCH=i386
else
APT_ARCH="${FLAGS_arch}"
fi
# Create the apt configuration file. See "man apt.conf" # Create the apt configuration file. See "man apt.conf"
APT_PARTS="${OUTPUT_DIR}/apt.conf.d" APT_PARTS="${OUTPUT_DIR}/apt.conf.d"
mkdir -p "$APT_PARTS" # An empty apt.conf.d to avoid other configs. mkdir -p "$APT_PARTS" # An empty apt.conf.d to avoid other configs.
@ -114,6 +127,7 @@ APT
Assume-Yes "1"; Assume-Yes "1";
AllowUnauthenticated "1"; AllowUnauthenticated "1";
}; };
Architecture "${APT_ARCH}";
}; };
Dir Dir
{ {