Skip to content

Instantly share code, notes, and snippets.

@timw4mail
Created February 28, 2020 21:03
Show Gist options
  • Save timw4mail/9f2b55cf6b703690a5ebc12d43822d17 to your computer and use it in GitHub Desktop.
Save timw4mail/9f2b55cf6b703690a5ebc12d43822d17 to your computer and use it in GitHub Desktop.
Gentoo Grub2 on OpenFirmware (PowerPC) New Kernel Update Script
#!/bin/bash
set -euo pipefail
# Adapted from: https://wiki.gentoo.org/wiki/GRUB_on_Open_Firmware_(PowerPC)
# Re-generate grub.cfg
grub-mkconfig -o /boot/grub/grub.cfg
# Make new OF grub img
grub-mkimage --prefix=/boot/grub --format=powerpc-ieee1275 --config=/boot/NWBB/grub-initial.cfg --output=/boot/NWBB/grub.img `cat /boot/NWBB/grub_mod-minimal.list`
# Mount the hfs bootblock
hmount /dev/sdb2
# Copy boot files
hcopy -r /boot/NWBB/grub-initial.cfg :grub:grub.cfg
hcopy -r /boot/NWBB/grub.img :grub:grub.img
hcopy -r /boot/NWBB/ofboot.b :grub:ofboot.b
# Set boot attributes
hattrib -c UNIX -t tbxi :grub:ofboot.b
hattrib -b :grub
# Unmount bootblock
humount
# Set as default boot device
# This os is on the second drive "sd1", and the Open Firmware partion is partition 2
nvram --update-config boot-device='sd1:2,\\:tbxi'
echo "Bootloader updated"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment