Enable vm element to create PowerPC image
Patch adds support to create PowerPC image with vm element. It creates 2 partitions, one for PReP boot and other for root and installs grub-ieee1275. Change-Id: I4675ef2b82aa69b63e63a1cc7db01b0c0e6f9fff Closes-Bug: 1418739
This commit is contained in:
parent
807e89f063
commit
631cae1fee
@ -5,14 +5,23 @@ set -o pipefail
|
|||||||
source $_LIB/die
|
source $_LIB/die
|
||||||
[ -n "$IMAGE_BLOCK_DEVICE" ] || die "Image block device not set"
|
[ -n "$IMAGE_BLOCK_DEVICE" ] || die "Image block device not set"
|
||||||
|
|
||||||
|
# Create 2 partitions for PPC, one for PReP boot and other for root
|
||||||
|
if [[ "$ARCH" =~ "ppc" ]] ; then
|
||||||
|
sudo sfdisk --force $IMAGE_BLOCK_DEVICE << EOF
|
||||||
|
0,8,41 *
|
||||||
|
,,L
|
||||||
|
;
|
||||||
|
EOF
|
||||||
|
else
|
||||||
# Create 1 partition far enough up the disk to permit grub to be installed on
|
# Create 1 partition far enough up the disk to permit grub to be installed on
|
||||||
# the MBR.
|
# the MBR.
|
||||||
sudo sfdisk $IMAGE_BLOCK_DEVICE << EOF
|
sudo sfdisk $IMAGE_BLOCK_DEVICE << EOF
|
||||||
1 - - *
|
1 - - *
|
||||||
0 0;
|
0 0;
|
||||||
0 0;
|
0 0;
|
||||||
0 0;
|
0 0;
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
sudo partprobe $IMAGE_BLOCK_DEVICE
|
sudo partprobe $IMAGE_BLOCK_DEVICE
|
||||||
|
|
||||||
@ -31,10 +40,15 @@ if [ ! -e "${IMAGE_BLOCK_DEVICE}p1" ]; then
|
|||||||
else
|
else
|
||||||
sudo kpartx -asv $TMP_IMAGE_PATH
|
sudo kpartx -asv $TMP_IMAGE_PATH
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$ARCH" =~ "ppc" ]]; then
|
||||||
|
sudo kpartx -asv $TMP_IMAGE_PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$DM" ]; then
|
if [ -n "$DM" ]; then
|
||||||
echo "IMAGE_BLOCK_DEVICE=${DM}p1"
|
echo "IMAGE_BLOCK_DEVICE=${DM}p1"
|
||||||
|
elif [[ "$ARCH" =~ "ppc" ]]; then
|
||||||
|
DM=${IMAGE_BLOCK_DEVICE/#\/dev/\/dev\/mapper}
|
||||||
|
echo "IMAGE_BLOCK_DEVICE=${DM}p2"
|
||||||
else
|
else
|
||||||
echo "IMAGE_BLOCK_DEVICE=${IMAGE_BLOCK_DEVICE}p1"
|
echo "IMAGE_BLOCK_DEVICE=${IMAGE_BLOCK_DEVICE}p1"
|
||||||
fi
|
fi
|
||||||
|
@ -9,7 +9,11 @@ set -o pipefail
|
|||||||
# FIXME:
|
# FIXME:
|
||||||
[ -n "$IMAGE_BLOCK_DEVICE" ]
|
[ -n "$IMAGE_BLOCK_DEVICE" ]
|
||||||
PART_DEV=$IMAGE_BLOCK_DEVICE
|
PART_DEV=$IMAGE_BLOCK_DEVICE
|
||||||
BOOT_DEV=$(echo $IMAGE_BLOCK_DEVICE | sed -e 's#p1##' | sed -e 's#mapper/##')
|
if [[ "$ARCH" =~ "ppc" ]]; then
|
||||||
|
BOOT_DEV=$(echo $IMAGE_BLOCK_DEVICE | sed -e 's#p2##')'p1'
|
||||||
|
else
|
||||||
|
BOOT_DEV=$(echo $IMAGE_BLOCK_DEVICE | sed -e 's#p1##' | sed -e 's#mapper/##')
|
||||||
|
fi
|
||||||
|
|
||||||
function install_extlinux {
|
function install_extlinux {
|
||||||
install-packages extlinux
|
install-packages extlinux
|
||||||
@ -51,6 +55,8 @@ 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
|
||||||
|
elif [[ "$ARCH" =~ "ppc" ]]; then
|
||||||
|
install-packages grub-ieee1275
|
||||||
else
|
else
|
||||||
install-packages grub-pc
|
install-packages grub-pc
|
||||||
fi
|
fi
|
||||||
@ -108,7 +114,11 @@ function install_grub2 {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV
|
if [[ "$ARCH" =~ "ppc" ]] ; then
|
||||||
|
$GRUBNAME --modules="part_msdos" $GRUB_OPTS $BOOT_DEV --no-nvram
|
||||||
|
else
|
||||||
|
$GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $BOOT_DEV
|
||||||
|
fi
|
||||||
|
|
||||||
# This might be better factored out into a per-distro 'install-bootblock'
|
# This might be better factored out into a per-distro 'install-bootblock'
|
||||||
# helper.
|
# helper.
|
||||||
|
Loading…
Reference in New Issue
Block a user