-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Masanori Mitsugi
committed
Jul 28, 2015
1 parent
8576b41
commit 5d4af51
Showing
9 changed files
with
259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
REQUIRED_PROGS=( | ||
"${REQUIRED_PROGS[@]}" | ||
parted | ||
sfdisk | ||
) | ||
|
||
PROGS=( | ||
"${PROGS[@]}" | ||
partprobe | ||
fdisk | ||
cfdisk | ||
bootlist | ||
pseries_platform | ||
nvram | ||
ofpathname | ||
bc | ||
agetty | ||
) | ||
|
||
COPY_AS_IS_EXCLUDE=( ${COPY_AS_IS_EXCLUDE[@]} /lib*/firmware ) | ||
|
||
KERNEL_CMDLINE="LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us console=hvc0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This script is an improvement over the default grub-install '(hd0)' | ||
# | ||
# However the following issues still exist: | ||
# | ||
# * We don't know what the first disk will be, so we cannot be sure the MBR | ||
# is written to the correct disk(s). That's why we make all disks bootable. | ||
# | ||
# * There is no guarantee that GRUB was the boot loader used originally. One | ||
# solution is to save and restore the MBR for each disk, but this does not | ||
# guarantee a correct boot-order, or even a working boot-lader config (eg. | ||
# GRUB stage2 might not be at the exact same location) | ||
|
||
# skip if another bootloader was installed | ||
if [[ -z "$NOBOOTLOADER" ]] ; then | ||
return | ||
fi | ||
|
||
# Only for GRUB2 - GRUB Legacy will be handled by its own script | ||
[[ $(type -p grub-probe) || $(type -p grub2-probe) ]] || return | ||
|
||
LogPrint "Installing GRUB2 boot loader" | ||
mount -t proc none /mnt/local/proc | ||
|
||
if [[ -r "$LAYOUT_FILE" ]]; then | ||
|
||
# Check if we find GRUB where we expect it | ||
[[ -d "/mnt/local/boot" ]] | ||
StopIfError "Could not find directory /boot" | ||
|
||
# grub2 can be in /boot/grub or /boot/grub2 | ||
grub_name="grub2" | ||
if [[ ! -d "/mnt/local/boot/$grub_name" ]] ; then | ||
grub_name="grub" | ||
[[ -d "/mnt/local/boot/$grub_name" ]] | ||
StopIfError "Could not find directory /boot/$grub_name" | ||
fi | ||
[[ -r "/mnt/local/boot/$grub_name/grub.cfg" ]] | ||
LogIfError "Unable to find /boot/$grub_name/grub.cfg." | ||
|
||
# Find PPC PReP Boot partition | ||
part=`awk -F ' ' '/^part / {if ($6 ~ /prep/) {print $7}}' $LAYOUT_FILE` | ||
|
||
if [ -n "$part" ]; then | ||
LogPrint "Boot partition found: $part" | ||
chroot /mnt/local /bin/bash --login -c "$grub_name-install $part" | ||
# Run bootlist only in PowerVM environment | ||
if ! grep -q "PowerNV" /proc/cpuinfo && ! grep -q "emulated by qemu" /proc/cpuinfo ; then | ||
bootdev=`echo $part | sed -e 's/[0-9]*$//'` | ||
LogPrint "Boot device is $bootdev." | ||
bootlist -m normal $bootdev | ||
fi | ||
NOBOOTLOADER= | ||
fi | ||
fi | ||
|
||
if [[ "NOBOOTLOADER" ]]; then | ||
LogIfError "No bootloader configuration found. Install boot partition manually" | ||
fi | ||
|
||
#for i in /dev /dev/pts /proc /sys; do umount /mnt/local${i} ; done | ||
umount /mnt/local/proc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
usr/share/rear/output/ISO/Linux-ppc64le/30_create_grub2.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# #30_create_grub2.sh | ||
# | ||
# create grub.cfg for Relax-and-Recover | ||
# | ||
# Relax-and-Recover is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
|
||
# Relax-and-Recover is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with Relax-and-Recover; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
# | ||
# | ||
|
||
# create grub directory structure | ||
mkdir -p $v $TMP_DIR/ppc >&2 | ||
cat >"$TMP_DIR/ppc/bootinfo.txt" <<EOF | ||
<chrp-boot> | ||
<description>Relax-and-Recover</description> | ||
<os-name>Linux</os-name> | ||
<boot-script>boot &device;:\boot\grub\powerpc.elf</boot-script> | ||
</chrp-boot> | ||
EOF | ||
|
||
mkdir -p $v $TMP_DIR/boot/grub >&2 | ||
cat >"$TMP_DIR/boot/grub/grub.cfg" <<EOF | ||
set timeout=100 | ||
menuentry "Relax-and-Recover" { | ||
linux /kernel root=/dev/ram0 $KERNEL_CMDLINE | ||
initrd /initrd.cgz | ||
} | ||
EOF | ||
|
||
grub_name=grub2 | ||
$grub_name-mkimage --version >&8 | ||
if [ $? -ne 0 ]; then | ||
grub_name=grub | ||
fi | ||
|
||
$grub_name-mkimage -O powerpc-ieee1275 -p '()/boot/grub' -o $TMP_DIR/boot/grub/powerpc.elf linux normal iso9660 | ||
|
||
ISO_FILES=( "${ISO_FILES[@]}" boot=boot ppc=ppc ) |
44 changes: 44 additions & 0 deletions
44
usr/share/rear/output/ISO/Linux-ppc64le/80_create_isofs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# #80_create_isofs.sh | ||
# | ||
# create initramfs for Relax-and-Recover | ||
# | ||
# Relax-and-Recover is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
|
||
# Relax-and-Recover is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with Relax-and-Recover; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
# | ||
# | ||
|
||
# check that we have mkisofs | ||
[ -x "$ISO_MKISOFS_BIN" ] | ||
StopIfError "ISO_MKISOFS_BIN [$ISO_MKISOFS_BIN] not an executable !" | ||
|
||
Log "Copying kernel" | ||
cp -pL $v $KERNEL_FILE $TMP_DIR/kernel >&2 | ||
|
||
ISO_FILES=( ${ISO_FILES[@]} $TMP_DIR/kernel initrd.cgz ) | ||
Log "Starting '$ISO_MKISOFS_BIN'" | ||
LogPrint "Making ISO image" | ||
|
||
mkdir -p $v "$ISO_DIR" >&2 | ||
StopIfError "Could not create ISO ouput directory ($ISO_DIR)" | ||
|
||
pushd $TMP_DIR >&8 # so that relative paths will work | ||
$ISO_MKISOFS_BIN $v -o "$ISO_DIR/$ISO_PREFIX.iso" -U -chrp-boot \ | ||
-R -J -volid "$ISO_VOLID" -v -graft-points "${ISO_FILES[@]}" >&8 | ||
StopIfError "Could not create ISO image" | ||
ISO_IMAGES=( "${ISO_IMAGES[@]}" "$ISO_DIR/$ISO_PREFIX.iso" ) | ||
popd >&8 | ||
Print "Wrote ISO Image $ISO_DIR/$ISO_PREFIX.iso ($(du -h "$ISO_DIR/$ISO_PREFIX.iso"| tr -s " \t" " " | cut -d " " -f 1))" | ||
|
||
# Add ISO image to result files | ||
RESULT_FILES=( "${RESULT_FILES[@]}" "$ISO_DIR/$ISO_PREFIX.iso" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# 30_copy_kernel.sh | ||
# | ||
# copy kernel for Relax-and-Recover | ||
# | ||
# Relax-and-Recover is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
|
||
# Relax-and-Recover is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with Relax-and-Recover; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
# | ||
# | ||
|
||
# find and copy kernel | ||
# we only try to find the currently running kernel | ||
# Using another kernel is a TODO for now | ||
|
||
if [ ! -s "$KERNEL_FILE" ]; then | ||
if [ -r "/boot/vmlinuz-$KERNEL_VERSION" ]; then | ||
KERNEL_FILE="/boot/vmlinuz-$KERNEL_VERSION" | ||
elif has_binary get_kernel_version; then | ||
for src in /boot/* ; do | ||
if VER=$(get_kernel_version "$src") && test "$VER" == "$KERNEL_VERSION" ; then | ||
KERNEL_FILE="$src" | ||
break | ||
fi | ||
done | ||
elif [ -f /etc/redhat-release ]; then | ||
# GD - kernel not found under /boot - 19/May/2008 | ||
# check under /boot/efi/efi/redhat (for Red Hat) | ||
[ -f "/boot/efi/efi/redhat/vmlinuz-$KERNEL_VERSION" ] | ||
StopIfError "Could not find a matching kernel in /boot/efi/efi/redhat !" | ||
KERNEL_FILE="/boot/efi/efi/redhat/vmlinuz-$KERNEL_VERSION" | ||
elif [ -f /etc/debian_version ]; then | ||
[ -f "/boot/vmlinux-$KERNEL_VERSION" ] | ||
StopIfError "Could not find a matching kernel in /boot (debian) !" | ||
KERNEL_FILE="/boot/vmlinux-$KERNEL_VERSION" | ||
else | ||
Error "Could not find a matching kernel in /boot !" | ||
fi | ||
fi | ||
|
||
[ -s "$KERNEL_FILE" ] | ||
StopIfError "Could not find a suitable kernel. Maybe you have to set KERNEL_FILE [$KERNEL_FILE] ?" | ||
|
||
if [ -L $KERNEL_FILE ]; then | ||
KERNEL_FILE=$(readlink -f $KERNEL_FILE) | ||
fi | ||
|
||
Log "Found kernel $KERNEL_FILE" | ||
#cp -aL $v "$KERNEL_FILE" "$TMP_DIR/kernel" >&2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# if this system has a hvc console then start a getty on it | ||
|
||
if [ -c /dev/hvc0 ] ; then | ||
pushd $ROOTFS_DIR/usr/lib/systemd/system/getty.target.wants >&8 | ||
ln -s ../getty\@.service getty\@hvc0.service | ||
popd >&8 | ||
Log "hvc console support enabled" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
usr/share/rear/skel/default/usr/lib/systemd/system/sysinit.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[Unit] | ||
Description=Initialize Rescue System | ||
After=systemd-udevd.service | ||
|
||
[Service] | ||
Type=oneshot | ||
|