Some changes to be able to build an armel-based rootfs.

Review URL: http://codereview.chromium.org/554056
This commit is contained in:
tedbo 2010-01-22 16:39:36 -08:00
parent cb68f29229
commit 3700cd8c0c
3 changed files with 40 additions and 15 deletions

View File

@ -142,15 +142,16 @@ fi
# -- Turn root file system into bootable image -- # -- Turn root file system into bootable image --
# Setup extlinux configuration. if [ "$FLAGS_arch" = "x86" ]; then
# TODO: For some reason the /dev/disk/by-uuid is not being generated by udev # Setup extlinux configuration.
# in the initramfs. When we figure that out, switch to root=UUID=$UUID. # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev
cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf # in the initramfs. When we figure that out, switch to root=UUID=$UUID.
cat <<EOF | sudo dd of="$ROOT_FS_DIR"/boot/extlinux.conf
DEFAULT chromeos-usb DEFAULT chromeos-usb
PROMPT 0 PROMPT 0
TIMEOUT 0 TIMEOUT 0
label chromeos-usb label chromeos-usb
menu label chromeos-usb menu label chromeos-usb
kernel vmlinuz kernel vmlinuz
append quiet console=tty2 initrd=initrd.img init=/sbin/init boot=local rootwait root=LABEL=$DISK_LABEL ro noresume noswap i915.modeset=1 loglevel=1 append quiet console=tty2 initrd=initrd.img init=/sbin/init boot=local rootwait root=LABEL=$DISK_LABEL ro noresume noswap i915.modeset=1 loglevel=1
@ -164,22 +165,28 @@ EOF
# Make partition bootable and label it. # Make partition bootable and label it.
sudo "$SCRIPTS_DIR/extlinux.sh" -z --install "${ROOT_FS_DIR}/boot" sudo "$SCRIPTS_DIR/extlinux.sh" -z --install "${ROOT_FS_DIR}/boot"
fi # --arch=x86
cleanup_rootfs_loop cleanup_rootfs_loop
if [ "$FLAGS_arch" = "x86" ]; then
# Create a master boot record. # Create a master boot record.
# Start with the syslinux master boot record. We need to zero-pad to # Start with the syslinux master boot record. We need to zero-pad to
# fill out a 512-byte sector size. # fill out a 512-byte sector size.
SYSLINUX_MBR="/usr/lib/syslinux/mbr.bin" SYSLINUX_MBR="/usr/lib/syslinux/mbr.bin"
dd if="$SYSLINUX_MBR" of="$MBR_IMG" bs=512 count=1 conv=sync dd if="$SYSLINUX_MBR" of="$MBR_IMG" bs=512 count=1 conv=sync
# Create a partition table in the MBR. # Create a partition table in the MBR.
NUM_SECTORS=$((`stat --format="%s" "$ROOT_FS_IMG"` / 512)) NUM_SECTORS=$((`stat --format="%s" "$ROOT_FS_IMG"` / 512))
sudo sfdisk -H64 -S32 -uS -f "$MBR_IMG" <<EOF sudo sfdisk -H64 -S32 -uS -f "$MBR_IMG" <<EOF
,$NUM_SECTORS,L,-, ,$NUM_SECTORS,L,-,
,$NUM_SECTORS,S,-, ,$NUM_SECTORS,S,-,
,$NUM_SECTORS,L,*, ,$NUM_SECTORS,L,*,
; ;
EOF EOF
fi # --arch=x86
OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}" OUTSIDE_OUTPUT_DIR="${EXTERNAL_TRUNK_PATH}/src/build/images/${IMAGE_SUBDIR}"
echo "Done. Image created in ${OUTPUT_DIR}" echo "Done. Image created in ${OUTPUT_DIR}"
echo "To copy to USB keyfob, outside the chroot, do something like:" echo "To copy to USB keyfob, outside the chroot, do something like:"

View File

@ -17,7 +17,7 @@
assert_inside_chroot assert_inside_chroot
# Flags # Flags
DEFINE_string target "x86" \ DEFINE_string arch "x86" \
"The target architecture to build for. One of { x86, arm }." "The target architecture to build for. One of { x86, arm }."
DEFINE_string root "" \ DEFINE_string root "" \
"The root file system to customize." "The root file system to customize."
@ -144,7 +144,7 @@ sudo chmod 0755 "$ROOT_FS_DIR"/mnt/stateful_partition
# installed all of the packages. # installed all of the packages.
TMP_STATIC=$(mktemp -d) TMP_STATIC=$(mktemp -d)
sudo cp -r "${SRC_ROOT}/rootfs_static_data/common/." "$TMP_STATIC" sudo cp -r "${SRC_ROOT}/rootfs_static_data/common/." "$TMP_STATIC"
# TODO: Copy additional target-platform-specific subdirectories. # TODO: Copy additional arch-platform-specific subdirectories.
sudo chmod -R a+rX "$TMP_STATIC/." sudo chmod -R a+rX "$TMP_STATIC/."
sudo cp -r "$TMP_STATIC/." "$ROOT_FS_DIR" sudo cp -r "$TMP_STATIC/." "$ROOT_FS_DIR"
sudo rm -rf "$TMP_STATIC" sudo rm -rf "$TMP_STATIC"

View File

@ -257,11 +257,17 @@ PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g')
PKG_LIST_ARCH="$FLAGS_arch" PKG_LIST_ARCH="$FLAGS_arch"
if [ "$PKG_LIST_ARCH" = "x86" ]; then if [ "$PKG_LIST_ARCH" = "x86" ]; then
PKG_LIST_ARCH="i386" PKG_LIST_ARCH="i386"
FORCE_NO_SCRIPTS=""
else
# For armel we forcefully disable all maintainer scripts.
# TODO: Remove this when everything is whitelisted for all build variants.
FORCE_NO_SCRIPTS="-o=DPkg::options::=--nodpkg_fallback"
fi fi
for p in $PACKAGE_LISTS; do for p in $PACKAGE_LISTS; do
COMPONENTS=$(filter_pkgs "$p" "$PKG_LIST_ARCH") COMPONENTS=$(filter_pkgs "$p" "$PKG_LIST_ARCH")
sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \
ARCH="$FLAGS_arch" apt-get --force-yes install $COMPONENTS ARCH="$FLAGS_arch" \
apt-get $FORCE_NO_SCRIPTS --force-yes install $COMPONENTS
done done
# Create kernel installation configuration to suppress warnings, # Create kernel installation configuration to suppress warnings,
@ -278,8 +284,20 @@ warn_initrd = no
EOF EOF
# Install the kernel. # Install the kernel.
sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive ARCH="$FLAGS_arch"\ # TODO: Support for armel kernels.
apt-get --force-yes install "linux-image-${KERNEL_VERSION}" if [ "$FLAGS_arch" = "x86" ]; then
sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive ARCH="$FLAGS_arch"\
apt-get --force-yes install "linux-image-${KERNEL_VERSION}"
fi
# Install optionally present rootfs static data. This can be used to blast
# custom firmware, kernel modules, etc. onto the image.
# TODO: Remove this hack at some point.
LOCAL_ASSETS="${FLAGS_build_root}/${FLAGS_arch}/local_assets"
OPTIONAL_ROOTFS_DATA="${LOCAL_ASSETS}/rootfs_data.tgz"
if [ -f "${OPTIONAL_ROOTFS_DATA}" ]; then
sudo tar -zxvf "${OPTIONAL_ROOTFS_DATA}" -C "${ROOT_FS_DIR}"
fi
# List all packages installed so far, since these are what the local # List all packages installed so far, since these are what the local
# repository needs to contain. # repository needs to contain.