Created
September 1, 2014 09:17
-
-
Save grepwood/feb200d1623efedb62d6 to your computer and use it in GitHub Desktop.
This script will convert the latest stable Debian PowerPC netinstall image to one that will work with PS3s running OtherOS++
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
#!/bin/bash | |
# This script depends on another script that compiles a patched Linux kernel | |
# If in doubt, just | |
# mkdir -p /home/ftp/ps3 | |
# curl https://sucs.org/~grepwood/ps3/linux/kernels/tycho-3.15.10.tar.xz > /home/ftp/ps3/tycho-latest.tar.xz | |
JOB_PID=$$ | |
curl https://www.debian.org/CD/netinst/ > index.html.$JOB_PID | |
ISO_URL=`grep powerpc index.html.$JOB_PID | grep -v torrent | sed 's/\">powerpc.*//' | sed 's/.*href=\"//'` | |
rm -f index.html.$JOB_PID | |
ISO_FILE=`echo $ISO_URL | sed 's/.*\/iso-cd\///'` | |
ISO_URL=`echo $ISO_URL | sed 's/\/iso-cd.*/\/iso-cd/'` | |
if [ ! -f "$ISO_FILE" ]; then | |
echo "$ISO_URL/$ISO_FILE" | |
wget $ISO_URL/$ISO_FILE | |
fi | |
curl -O $ISO_URL/MD5SUMS | |
MD5_1=`grep netinst MD5SUMS | awk '{print $1}'` | |
rm -f MD5SUMS | |
MD5_2=`md5sum $ISO_FILE | awk '{print $1}'` | |
if [ "$MD5_1" != "$MD5_2" ]; then | |
echo "Error occured!" | |
fi | |
losetup /dev/loop1 ./$ISO_FILE | |
mount -o ro /dev/loop1 /mnt/iso0 | |
mkdir iso | |
cp -r /mnt/iso0/* iso | |
umount /dev/loop1 | |
losetup -D /dev/loop1 | |
mkdir kernel | |
cd kernel | |
tar -xf /home/ftp/ps3/tycho-latest.tar.xz | |
cd .. | |
mv kernel/boot/vmlinux* iso/install/powerpc64 | |
cat iso/install/powerpc64/initrd.gz | gunzip > initrd.cpio | |
mkdir initrd | |
cd initrd | |
cpio -i -d -H newc --no-absolute-filenames < ../initrd.cpio | |
rm -rf lib/modules/* | |
KERNEL_VERSION=`ls ../kernel/lib/modules` | |
cp -r ../kernel/lib/modules/* lib/modules/ | |
depmod -b `pwd` $KERNEL_VERSION | |
find . | cpio -H newc -o > ../initrd.cpio | |
cd .. | |
rm -rf kernel initrd | |
cat initrd.cpio | gzip > iso/install/powerpc64/initrd.gz | |
rm -f initrd.cpio | |
PS3_ISO=`echo $ISO_FILE | sed 's/powerpc/ps3/'` | |
mkisofs -V "Debian 7.6.0 ps3 1" -o /home/ftp/ps3/$PS3_ISO -posix-P -r iso | |
rm -rf iso | |
echo "Complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment