GameCube autoboot into Swiss

From Modding Fridays
Revision as of 00:51, 27 January 2019 by Ultrageranium (talk | contribs) (Dollz3)
Jump to: navigation, search

The GameCube's Main Menu, known as the GameCube BIOS, is the Initial Program Loader (IPL). Modchips allows the use of alternative IPL, featuring limited extra capabilities. In contrast Swiss, the "all-in-one homebrew utility for the Nintendo GameCube", gives plethora of useful and handy features. Usually running Swiss requires several trivial steps, but recently a minimal alternative IPL, iplboot, has been developed that allows to run any application from a SD card at boot time. So combined with a modchip like the Qoob Pro, which firmware can be replaced, and a prepared SD card, it's possible to boot directly into Swiss.

Tools needed

GQoobPro

GQoobPro is collection of GPL and LGPL tools to Nintendo Gamecube Qoob Pro mod chip.

  • Clone repos
git clone https://github.com/jvaltane/gqoobpro.git
  • build and install libqoob (this is based on a Debian install, adapt if needed, also check GQoobPro on FreeBSD if needed)
cd gqoobpro/libqoob
./autogen.sh
sudo apt install libusb-dev
./configure
sudo make install
  • Make sure the Qoob Pro is not incorrectly claimed (Debian instructions, adapt if needed, FreeBSD does not need any of this)
sudo cp data/86-qoobpro.rules /etc/udev/rules.d/
sudo cp data/qoobpro.conf /etc/modprobe.d
sudo service udev restart
sudo rmmod usbhid && sudo modprobe usbhid
  • build and install qoob-flasher
cd gqoobpro/qoob-flasher
./autogen.sh
./configure
make
sudo make install

devkitPPC

Part of devkitPro, a collection of homebrew toolchains for wii, gamecube, ds, gba, gp32 and psp. We need it to compile the IDL firmware.

Option 1: get the binaries

  • use automated install script
wget https://raw.githubusercontent.com/devkitPro/installer/master/perl/devkitPPCupdate.pl
chmod +x devkitPPCupdate.pl
./devkitPPCupdate.pl
  • Adjust your shell rc with the following environment variables:
# devkitPro
export DEVKITPRO=/opt/devkitpro
export DEVKITPPC=$DEVKITPRO/devkitPPC

Option 2: compile yourself

tar xvf buildscripts-20XXXXXX.tar.bz2
cd buildscripts
./build-devkit.sh
  • Choose to compile devkitPPC and point the installer to /opt/devkitpro
  • Watch some animu (depending how fast is your super mainframe computer)
  • Adjust your shell rc with the following environment variables:
# devkitPro
export DEVKITPRO=/opt/devkitpro
export DEVKITPPC=$DEVKITPRO/devkitPPC

Dollz3

d0lLZ 3.0 is a GameCube Executable compressor. It creates compressed dols for the GameCube which can in turn be run as a normal DOL. It is required during the creation of the IPL.

wget http://wiibrew.org/w/images/e/ef/Dollz3.zip
unzip Dollz3.zip
chmod dollz3/dollz3
sudo mv dollz3/dollz3 /usr/local/bin
git clone https://github.com/FIX94/dolxz.git
cd dolxz
chmod +x bin2h/bin2h
cd loader/cube
PATH=${PATH}:/opt/devkitpro/devkitPPC/bin make
cd ../wii
PATH=${PATH}:/opt/devkitpro/devkitPPC/bin make
cd ..
PATH=${PATH}:/opt/devkitpro/devkitPPC/bin make -f Makefile.cube
PATH=${PATH}:/opt/devkitpro/devkitPPC/bin make -f Makefile.cube high=1
PATH=${PATH}:/opt/devkitpro/devkitPPC/bin make -f Makefile.wii
PATH=${PATH}:/opt/devkitpro/devkitPPC/bin make -f Makefile.wii high=1
cd ..

  • Change main.c slightly:
diff --git a/bin2h/bin2h b/bin2h/bin2h
old mode 100644
new mode 100755
diff --git a/main.c b/main.c
index 5108d1b..875a3b9 100644
--- a/main.c
+++ b/main.c
@@ -8,6 +8,7 @@
 #include <malloc.h>
 #include <lzma.h>
 #include <stdbool.h>
+#include <errno.h>
 
 #include "loader/loader_cube.h"
 #include "loader/loader_cube_high.h"
  • Resume compiling
gcc -Wall -static -O2 -s main.c -llzma -o dolxz
chmod +x dolxz
sudo cp dolxz /usr/local/bin

iplboot

FINALLY, we build iplboot, the alternative minimal GC IPL.

  • Clone repos
git clone https://github.com/Streetwalrus/iplboot.git
  • Modify the Makefile in such way (assuming the current devkitPPC is based on gcc 6.3.0:
diff --git a/Makefile b/Makefile
index 210fd07..4e19b04 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ endif
 
 include $(DEVKITPPC)/gamecube_rules

-export CC := powerpc-eabi-clang
+export CC := powerpc-eabi-gcc-6.3.0
 MACHDEP =  -DGEKKO -mcpu=750 \
           -D__gamecube__ -DHW_DOL -ffunction-sections -fdata-sections

@@ -74,10 +74,10 @@ BINFILES    :=      $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
 #---------------------------------------------------------------------------------
 ifeq ($(strip $(CPPFILES)),)
        export LD       :=      $(CC) -Wl,--gc-sections -nostartfiles \
-               $(DEVKITPPC)/lib/gcc/powerpc-eabi/*/crtend.o \
-               $(DEVKITPPC)/lib/gcc/powerpc-eabi/*/ecrtn.o \
-               $(DEVKITPPC)/lib/gcc/powerpc-eabi/*/ecrti.o \
-               $(DEVKITPPC)/lib/gcc/powerpc-eabi/*/crtbegin.o \
+               $(DEVKITPPC)/lib/gcc/powerpc-eabi/6.3.0/crtend.o \
+               $(DEVKITPPC)/lib/gcc/powerpc-eabi/6.3.0/ecrtn.o \
+               $(DEVKITPPC)/lib/gcc/powerpc-eabi/6.3.0/ecrti.o \
+               $(DEVKITPPC)/lib/gcc/powerpc-eabi/6.3.0/crtbegin.o \
                $(DEVKITPPC)/powerpc-eabi/lib/crtmain.o
 else
        export LD       :=      $(CXX)
  • Find an original GC IPL image that matches your console region (EU, US, JP) (hint)
  • make sure you rename the original IPL image to ipl.rom and place it in the iplboot folder
  • build iplboot
make
  • if all goes well you should now have an iplboot.gcm file in the iplboot directory.

Swiss

  • Get Swiss source code:
git clone https://github.com/emukidid/swiss-gc.git
  • Compile Swiss:
cd swiss-gc
make dev   # we just need swiss.dol
  • If all goes well swiss is compiled as cube/swiss/swiss.dol


Install iplboot + Swiss

Flash iplboot on Qoob Pro

  • backup original Qoob Pro IPL
qoob-flasher -r0 qoob-bios.gcb
  • erase Qoob Pro IPL and flash iplboot
qoob-flasher -e0
qoob-flasher -q -w0 iplboot.gcb

Prepare SD card

  • Buy/find one these GC sdcard adapter, or build your own
  • copy Swiss as ipl.dol
cd swiss-gc
sudo mount /dev/sdX /media/sd
sudo cp cube/swiss/swiss.dol /media/sd/ipl.dol
sudo umount /media/sd

Test

If everything went well, next time you boot your GC you will be welcome with Swiss!