Support for Cloud Images on ppc64le for rhel7 and centos7

In order to support {CentOS,RHEL}7 for building cloud images we need to
handle the differences in grub packaging from Ubuntu.  We also need to
populate the defualt location for cloud images for CentOS builds.

Change-Id: Ie0d82ff21a42b08c4cb94b7a5635f80bfabf684e
This commit is contained in:
Chhavi Agarwal 2017-04-12 01:26:27 -04:00 committed by Tony Breeds
parent f8106b2ec0
commit 6d69d7909d
7 changed files with 31 additions and 18 deletions

View File

@ -55,8 +55,11 @@ function install_grub2 {
# Check for offline installation of grub # Check for offline installation of grub
if [ -f "/tmp/grub/install" ] ; then if [ -f "/tmp/grub/install" ] ; then
source /tmp/grub/install source /tmp/grub/install
# Right now we can't use pkg-map to branch by arch, so tag an architecture
# specific virtual package so we can install the rigth thing based on
# distribution.
elif [[ "$ARCH" =~ "ppc" ]]; then elif [[ "$ARCH" =~ "ppc" ]]; then
install-packages grub-ieee1275 install-packages -m bootloader grub-ppc64
else else
install-packages -m bootloader grub-pc install-packages -m bootloader grub-pc
fi fi
@ -117,12 +120,11 @@ function install_grub2 {
fi fi
if [[ "$ARCH" =~ "ppc" ]] ; then if [[ "$ARCH" =~ "ppc" ]] ; then
# For PPC, we use the "boot" partition as the one to point # For PPC (64-Bit regardless of Endian-ness), we use the "boot"
# grub-install to, not the loopback device. ppc has a # partition as the one to point grub-install to, not the loopback
# dedicated PReP boot partition. This seems to only work on # device. ppc has a dedicated PReP boot partition.
# /dev/mapper/... nodes due to matching rules in grub # For grub2 < 2.02~beta3 this needs to be a /dev/mapper/... node after
# XXX : this may not be true. It seems to work, # that a dev/loopXpN node will work fine.
# but requires some more investigation.
$GRUBNAME --modules="part_msdos" $GRUB_OPTS ${DEVICES[boot]} --no-nvram $GRUBNAME --modules="part_msdos" $GRUB_OPTS ${DEVICES[boot]} --no-nvram
else else
$GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV $GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV

View File

@ -12,12 +12,14 @@
}, },
"redhat": { "redhat": {
"extlinux": "syslinux-extlinux", "extlinux": "syslinux-extlinux",
"grub-pc": "grub2-tools grub2" "grub-pc": "grub2-tools grub2",
"grub-ppc64": "grub2-tools grub2"
} }
}, },
"default": { "default": {
"dkms_package": "dkms", "dkms_package": "dkms",
"extlinux": "extlinux", "extlinux": "extlinux",
"grub-pc": "grub-pc" "grub-pc": "grub-pc",
"grub-ppc64": "grub-ieee1275"
} }
} }

View File

@ -12,3 +12,10 @@ DIB_DISTRIBUTION_MIRROR:
before running bin/disk-image-create. This URL should point to before running bin/disk-image-create. This URL should point to
the directory containing the ``5/6/7`` directories. the directory containing the ``5/6/7`` directories.
:Example: ``DIB_DISTRIBUTION_MIRROR=http://amirror.com/centos`` :Example: ``DIB_DISTRIBUTION_MIRROR=http://amirror.com/centos``
DIB_CLOUD_IMAGES
:Required: No
:Description: Set the desired URL to fetch the images from. ppc64le:
Currently the CentOS community is working on providing the
ppc64le images until then you'll need to set this to a local
image file.

View File

@ -15,8 +15,10 @@ if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then
ARCH="aarch64" ARCH="aarch64"
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/7/images/aarch64} DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/7/images/aarch64}
elif [[ "ppc64le" =~ "$ARCH" ]]; then
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/7/images/ppc64le}
else else
echo 'centos7 root element only support the x86_64 and aarch64 $ARCH value.' echo 'centos7 root element only support the x86_64, aarch64 and ppc64le values for $ARCH'
exit 1 exit 1
fi fi

View File

@ -11,8 +11,11 @@ set -o pipefail
if [[ "amd64 x86_64" =~ "$ARCH" ]]; then if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
ARCH="x86_64" ARCH="x86_64"
elif [[ "ppc64le" =~ "$ARCH" ]]; then
# We don't need to do anything here other than avoid the else clause
:
else else
echo 'rhel7 root element only support the x86_64 $ARCH value.' echo 'rhel7 root element only supports x86_64 and ppc64le values for $ARCH'
exit 1 exit 1
fi fi

View File

@ -15,9 +15,9 @@ elif [[ "amd64 x86_64" =~ "$ARCH" ]]; then
elif [[ "$ARCH" = "ppc64" ]]; then elif [[ "$ARCH" = "ppc64" ]]; then
basearch=ppc64 basearch=ppc64
arch=ppc64 arch=ppc64
elif [[ "$ARCH" = "ppc64el" ]]; then elif [[ "$ARCH" = "ppc64le" ]]; then
basearch=ppc64el basearch=ppc64le
arch=ppc64el arch=ppc64le
elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then
basearch=aarch64 basearch=aarch64
arch=aarch64 arch=aarch64

View File

@ -14,11 +14,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# options for create-baremetal-image.sh
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
_ARCH=$(dpkg --print-architecture) _ARCH=$(dpkg --print-architecture)
else else
_ARCH=$(uname -m) _ARCH=$(uname -m)
# Standardise Architecture names
case $_ARCH in case $_ARCH in
"x86_64") "x86_64")
_ARCH="amd64" _ARCH="amd64"
@ -29,9 +29,6 @@ else
"aarch64") "aarch64")
_ARCH="arm64" _ARCH="arm64"
;; ;;
*)
echo "WARNING: Unknown architecture: $_ARCH"
;;
esac esac
fi fi
ARCH=${ARCH:-$_ARCH} ARCH=${ARCH:-$_ARCH}