agama/live/config-cdroot/fix_bootconfig.ppc64le

123 lines
2.8 KiB
Bash
Executable file

#! /bin/bash
# This script takes an unpacked ppc64le Live iso image in the form KIWI-NG currently creates.
#
# It modifies the tree to match ppx64le expectations.
#
# Usage:
#
# fix_bootconfig.ppc64le DST_DIR
#
# iso layout before:
# .
# ├── LiveOS
# │   └── squashfs.img
# └── boot
# └── ppc64le
# └── loader
# ├── initrd
# ├── isolinux.cfg
# ├── isolinux.msg
# └── linux
#
# iso layout adjusted:
# .
# ├── LiveOS
# │   └── squashfs.img
# ├── boot
# │   ├── grub2
# │   │   ├── core.elf
# │   │   ├── grub.cfg
# │   │   └── powerpc-ieee1275
# │   │   └── *.mod
# │   └── ppc64le
# │ └── loader
# │ ├── initrd
# │ └── linux
# └── ppc
# └── bootinfo.txt
#
set -e
dst="$1"
if [ ! -d "$dst" ] ; then
echo "fix_bootconfig.ppc64le: image dir \"$dst\" not found"
exit 1
fi
# KIWI config which should normally be inherited
# from a parent process in our case xorriso
# but that's not the case.
test -f $dst/.profile && . $dst/.profile
# ----------------
# Note:
#
# KIWI-NG creates an iso with isolinux boot files in boot/ppc64le/loader.
#
# These files are not needed except for kernel and initrd (and kernel params from isolinux.cfg).
#
# This script removes the isolinux config and adds ppc64le related config
# files. It also moves kernel and initrd to the usual location (in boot/s390x).
#
boot_dir=$dst/boot/ppc64le/loader
grub_dir=$dst/boot/grub2
mkdir -p $boot_dir $grub_dir $dst/ppc
chmod 644 $boot_dir/{initrd,linux}
arch=`uname -m`
profile=$(echo "$kiwi_profiles" | tr "-" " ")
label="$profile ($arch)"
# Create grub.cfg.
#
cat >$dst/boot/grub2/grub.cfg <<XXX
# Agama generated grub2 config file
gfxmode=auto
set default=0
insmod gettext
if sleep --interruptible 0 ; then
timeout=60
fi
menuentry "Install $label" --class os --unrestricted {
echo 'Loading kernel...'
linux /boot/ppc64le/loader/linux splash=silent
echo 'Loading initrd...'
initrd /boot/ppc64le/loader/initrd
}
menuentry "Check Installation Medium" --class os --unrestricted {
echo 'Loading kernel...'
linux /boot/ppc64le/loader/linux mediacheck=1 plymouth.enable=0
echo 'Loading initrd...'
initrd /boot/ppc64le/loader/initrd
}
menuentry "Rescue System" --class os --unrestricted {
echo 'Loading kernel...'
linux /boot/ppc64le/loader/linux $RESCUE_SYSTEM_BOOT_SETTINGS
echo 'Loading initrd...'
initrd /boot/ppc64le/loader/initrd
}
XXX
# Create bootinfo.txt
#
cat >$dst/ppc/bootinfo.txt <<XXX
<chrp-boot>
<description>Install $label</description>
<os-name>$label</os-name>
<boot-script>boot &device;:1,\boot\grub2\grub.elf</boot-script>
</chrp-boot>
XXX