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
if [ -f "/tmp/grub/install" ] ; then
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
install-packages grub-ieee1275
install-packages -m bootloader grub-ppc64
else
install-packages -m bootloader grub-pc
fi
@ -117,12 +120,11 @@ function install_grub2 {
fi
if [[ "$ARCH" =~ "ppc" ]] ; then
# For PPC, we use the "boot" partition as the one to point
# grub-install to, not the loopback device. ppc has a
# dedicated PReP boot partition. This seems to only work on
# /dev/mapper/... nodes due to matching rules in grub
# XXX : this may not be true. It seems to work,
# but requires some more investigation.
# For PPC (64-Bit regardless of Endian-ness), we use the "boot"
# partition as the one to point grub-install to, not the loopback
# device. ppc has a dedicated PReP boot partition.
# For grub2 < 2.02~beta3 this needs to be a /dev/mapper/... node after
# that a dev/loopXpN node will work fine.
$GRUBNAME --modules="part_msdos" $GRUB_OPTS ${DEVICES[boot]} --no-nvram
else
$GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV

View File

@ -12,12 +12,14 @@
},
"redhat": {
"extlinux": "syslinux-extlinux",
"grub-pc": "grub2-tools grub2"
"grub-pc": "grub2-tools grub2",
"grub-ppc64": "grub2-tools grub2"
}
},
"default": {
"dkms_package": "dkms",
"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
the directory containing the ``5/6/7`` directories.
: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
ARCH="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
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
fi

View File

@ -11,8 +11,11 @@ set -o pipefail
if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
ARCH="x86_64"
elif [[ "ppc64le" =~ "$ARCH" ]]; then
# We don't need to do anything here other than avoid the else clause
:
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
fi

View File

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

View File

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