Setting up Gamecube Linux help

Discussion for GC-Linux on Gamecube & Wii
Post Reply
User avatar
emu_kidid
Site Admin
Posts: 4535
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Setting up Gamecube Linux help

Post by emu_kidid » Wed Sep 28, 2011 1:37 am

Just wondering if anyone has recently setup GC-Linux to run from an SDGecko w/ ARAM as Swap (Basically without the need for sharing storage over the BBA).

I haven't been following gc-linux since 2006 or so, so I was wondering if someone here had done it recently and could post a short guide.

Any help is much appreciated :)
Image
julius
Posts: 201
Joined: Thu Nov 04, 2010 5:11 pm

Re: Setting up Gamecube Linux help

Post by julius » Wed Sep 28, 2011 4:38 pm

There´s a way to run it from sd, but you have to make fat partition with an aditional ext partition with a file system, you know, all of those complicated things. That´s why I´m excited with neogeo cd update that infact is doing, because we can only run advance mame from gc linux and I could not install it.
User avatar
liquitt
Posts: 1761
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: Setting up Gamecube Linux help

Post by liquitt » Wed Sep 28, 2011 5:07 pm

the latest patch that the team released is for the 2.6.32 kernel. i'll try to build it once i have everything set up correctly
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm
arcticfox
Posts: 6
Joined: Mon Oct 03, 2011 8:53 pm

Re: Setting up Gamecube Linux help

Post by arcticfox » Mon Oct 03, 2011 9:45 pm

Hi.
I played with gc-linux about half a year ago. I have bba, so i build kernel (2.6.32 with mikep5 gc patch, newer kernels have gc support already) with nfs root support. I tried whiite-linux (debian-lenny adopted for Wii), debootstraped debian6.0 (you may debootstrap it on gc itself, or use qemu-linux-ppc-static trick on your x86 linux-box) and also tried buildroot-uclibc rootfs. All 3 worked ok. ARAM swap worked too. It was nice to see blackbox with x11 mpd client running on gc :) Also HoMM3 linux-ppc works too (somesort of, because cube xorg driver is 640x480, but homm3 uses 800x600, and cube driver dont support virtual display and xrandr scaling), but need additional swap on sd. And its very slow.
Some things, that may need attention - you need to compile cube xorg driver, if you want to use xorg on gc. And if you want to use gamepad as ponter device in xorg, you may be need to recompile joystick_drv. I aslo tried distcc compilation on gc-linux (on other side was x86-linux powerpc-gcc) - and it works, too.
Also, tried to set swap on sd card (in addition to ARAM) - but it was very slow (maybe bad sd?).

So, if you have any specific questions - i will glad to help :) But, remember, i played with it half a year ago, so, i may forget some details :)
User avatar
emu_kidid
Site Admin
Posts: 4535
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: Setting up Gamecube Linux help

Post by emu_kidid » Mon Oct 03, 2011 10:49 pm

swap on SD card is so slow because it's PIO and not DMA :(
Image
User avatar
liquitt
Posts: 1761
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: Setting up Gamecube Linux help

Post by liquitt » Tue Oct 04, 2011 11:25 am

arcticfox wrote:(2.6.32 with mikep5 gc patch, newer kernels have gc support already)
you don't have to patch them anymore? wow!
what crosscompiler are you using btw. ?
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm
arcticfox
Posts: 6
Joined: Mon Oct 03, 2011 8:53 pm

Re: Setting up Gamecube Linux help

Post by arcticfox » Tue Oct 04, 2011 6:43 pm

liquitt wrote:
arcticfox wrote:(2.6.32 with mikep5 gc patch, newer kernels have gc support already)
you don't have to patch them anymore? wow!
Right now, i take a look at vanilla 2.6.38 source (just have it on local storage) - yes, its true, seems that it have all you need to build it for gc.
liquitt wrote:what crosscompiler are you using btw. ?
For building a kernel, i used this cross toolchain http://downloads.sourceforge.net/gc-lin ... pc.tar.bz2

When i compiled on gc-linux itself, to make this process much faster, i builded distcc crosstoolchain on my x86 linux-box. You need to build same versions of binutils/gcc that you have on your gc-linux. When building, you must point "--with-sysroot=" to your gc-linux rootfs / then it will work without any problem. With usage of distcc, i recompiled entire Xorg subsystem (experimented with KDrive) It takes less than a hour, if i remember correctly.
User avatar
emu_kidid
Site Admin
Posts: 4535
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: Setting up Gamecube Linux help

Post by emu_kidid » Tue Oct 04, 2011 10:11 pm

A ready to go package would be nice :)
Image
User avatar
liquitt
Posts: 1761
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: Setting up Gamecube Linux help

Post by liquitt » Tue Oct 04, 2011 11:19 pm

emu_kidid wrote:A ready to go package would be nice :)
i second that

i can't get that buildcross to run ffs so i might try the other one as well
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm
arcticfox
Posts: 6
Joined: Mon Oct 03, 2011 8:53 pm

Re: Setting up Gamecube Linux help

Post by arcticfox » Wed Oct 05, 2011 10:39 am

Not really a package, but... I tried right now to build gc-linux kernel from scratch, and it was successfull - right now i see gc-linux kernel panic on my gc, because it cant find root (it's ok, because there is no any rootfs as of now) :)
Btw, i compiled 2.6.32 kernel with mikep5 patch and not the newer kernel (like 2.6.38), because i want to be sure that cross building works. I know that 2.6.32 builds ok, and i never tried to build newer kernels. I will try to build newer kernel later today, or you may do it yourself, and report your results :)

So, i write this quick tutorial on cross building gc-linux kernel. Please, report your results and any questions if you have :)

How to build gc-linux kernel from scratch v0.1 :D

Prerequisites: any working linux system with current general devtools (make, gcc, binutils, etc.)

0) I would recommend to do all work in your home subdir or in tmp subdir, so, you cant mess with your working system.

1) Create working subdir and get all needed sources there (for example, i will do everything in /home/arcticfox/gclinux/):

Code: Select all

$ mkdir ~/gclinux && cd ~/gclinux
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.bz2
$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.3.2/gcc-core-4.3.2.tar.bz2
$ wget http://slackware.sukkology.net/packages/devkitpro-gc/doltool.0.3.2.linux-TenOfTen.tgz
$ wget http://mirror.transact.net.au/sourceforge/g/project/gc/gc-linux/kernel/2.6.32/mikep5-patch-2.6.32-gc.bz2
$ wget http://ftp.halifax.rwth-aachen.de/kernel/linux/kernel/v2.6/linux-2.6.32.tar.bz2
2) Build stage1 crosstoolchain, sufficient only for building kernel.

Code: Select all

$ tar xjf binutils-2.18.tar.bz2
$ tar xjf gcc-core-4.3.2.tar.bz2
$ mkdir build-binutils && mkdir build-gcc && mkdir gccross && cd build-binutils
$ export PREFIX=/home/arcticfox/gclinux/gccross
$ export TARGET=powerpc-linux-gnu
$ sed -i "s/\[4-9\]|\[5-9\]/([4-9]|[1-9][0-9])|[5-9]/" ../binutils-2.18/configure
$ ../binutils-2.18/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-werror=no
$ make all
$ make install
$ export PATH=$PATH:/home/arcticfox/gclinux/gccross/bin
$ cd .. && cd build-gcc
$ ../gcc-4.3.2/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c --disable-nls --without-headers
$ make all-gcc
$ make install-gcc
3) We have stage1 crosscompiler ready. Now we may build the kernel. We will patch it with mikep5 patch, and then will use default gamecube config:

Code: Select all

$ cd /home/arcticfox/gclinux/
$ tar xjf linux-2.6.32.tar.bz2
$ cd linux-2.6.32
$ bzip2 -cd <../mikep5-patch-2.6.32-gc.bz2 | patch -p1
$ cd ..
$ cp linux-2.6.32/arch/powerpc/configs/gamecube_defconfig linux-2.6.32/.config
If you want to make a changes in default config:

Code: Select all

$ make -C linux-2.6.32 ARCH=powerpc CROSS32_COMPILE=powerpc-linux-gnu- CROSS_COMPILE=powerpc-linux-gnu- menuconfig
also, if you want to modify kernel command line, edit this file (search for bootargs) linux-2.6.32/arch/powerpc/boot/dts/gamecube.dts

Now building the kenrel itself!

Code: Select all

$ make -C linux-2.6.32 ARCH=powerpc CROSS32_COMPILE=powerpc-linux-gnu- CROSS_COMPILE=powerpc-linux-gnu- zImage
4) If you get to this step without errors, you already have freshly builded kernel in linux-2.6.32/arch/powerpc/boot/zImage But you may want to "convert" it to dol file:

Code: Select all

$ cd /home/arcticfox/gclinux
$ tar xzf doltool.0.3.2.linux-TenOfTen.tgz
$ cd doltool.0.3.2.linux-TenOfTen
$ g++ -o doltool *cpp
$ cp doltool /home/arcticfox/gclinux/gccross/bin/
$ cd ..
$ touch build-dol.sh
(Now paste following code in build-dol.sh with your favorite file editor):

Code: Select all

 #!/bin/bash
 
 target=${1:-zImage}
 ofile=zImage1
 
 [ -r ${KSRC}/arch/powerpc/boot/${target} ] || {
   echo "Can't find target image ${KSRC}/arch/powerpc/boot/${target}"
   exit 1
 }
 
 cp ${KSRC}/arch/powerpc/boot/${target} ${ofile}
 
 CROSS=powerpc-linux-gnu-
 
 echo "+ building DOL"
 load=$(${CROSS}readelf -l "$ofile" | \
 	perl -lane'printf"%08x\n",hex($F[3])+0x80000000 if /LOAD/;')
 echo "  LOAD: $load"
 entry=$(${CROSS}readelf -l "$ofile" | \
 	perl -lane'printf"%08x\n",hex($F[2])+0x80000000 if /Entry point/;')
 echo "  EP  : $entry"
 
 ${CROSS}objcopy -O binary \
 	-R .comment -R .shstrtab -R .symtab -R .strtab \
 	-R .gnu.attributes \
 	${ofile} ${ofile}.bin
 doltool -c ${ofile}.bin $load $entry
 doltool -i ${ofile}.dol
 echo ""
then continue:

Code: Select all

$ chmod u+x build-dol.sh
$ KSRC=linux-2.6.32/ ./build-dol.sh
You will have then zImage.dol file in current dir!

I tried all of this, right now - and it works. And thanks to all gc-linux team, becuase this guide is mostly based on their works.

Please, if you have any questions - i will glad to help!
Last edited by arcticfox on Wed Oct 05, 2011 4:45 pm, edited 1 time in total.
User avatar
liquitt
Posts: 1761
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: Setting up Gamecube Linux help

Post by liquitt » Wed Oct 05, 2011 11:48 am

tar xjf binutils-2.18.tar.bz2
tar xjf gcc-core-4.3.2.tar.bz2
mkdir build-binutils && mkdir build-gcc && mkdir gccross && cd build-binutils
export PREFIX=/home/gclinux/gccross
export TARGET=powerpc-linux-gnu
sed -i "s/\[4-9\]|\[5-9\]/([4-9]|[1-9][0-9])|[5-9]/" configure
if you do it like that, sed will tell you, that there is no such file ("configure") because you're entering an empty directory ("build-binutils")
of course you meant the just tarred directory binutils-2.18/ ;)
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm
arcticfox
Posts: 6
Joined: Mon Oct 03, 2011 8:53 pm

Re: Setting up Gamecube Linux help

Post by arcticfox » Wed Oct 05, 2011 4:44 pm

liquitt wrote:
sed -i "s/\[4-9\]|\[5-9\]/([4-9]|[1-9][0-9])|[5-9]/" configure
if you do it like that, sed will tell you, that there is no such file ("configure") because you're entering an empty directory ("build-binutils")
of course you meant the just tarred directory binutils-2.18/ ;)
sure, will fix my post :)
User avatar
infact
Posts: 347
Joined: Tue Mar 29, 2011 4:35 am
Location: Germany

Re: Setting up Gamecube Linux help

Post by infact » Thu Oct 06, 2011 7:02 pm

Just wanted to let you guys know, that it also worked with updated versions of the tools.
I used binutils-2.21.1 and gcc-4.4.6. The sed line was not necessary.
infact
Image Image
User avatar
steffen
Posts: 41
Joined: Mon Jan 31, 2011 1:32 pm

Re: Setting up Gamecube Linux help

Post by steffen » Tue Oct 18, 2011 12:49 pm

arcticfox wrote: You will have then zImage.dol file in current dir!

I tried all of this, right now - and it works. And thanks to all gc-linux team, becuase this guide is mostly based on their works.

Please, if you have any questions - i will glad to help!
I have a question - can you share your zImage.dol? I'm sure a lot of people don't have time/don't want to setup a cross-compiler, so it would be awesome if you supported our laziness. :D
User avatar
liquitt
Posts: 1761
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: Setting up Gamecube Linux help

Post by liquitt » Tue Oct 18, 2011 2:48 pm

damn i just wanted to upload one for you but when i tried to compile linux told me to update my binutils, wtf - this worked before
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm
User avatar
Kalifornia Jani
Posts: 8
Joined: Sun Sep 05, 2010 5:20 pm
Location: Finland

Re: Setting up Gamecube Linux help

Post by Kalifornia Jani » Mon Oct 31, 2011 6:55 pm

I used GNU bintutils 2.19.1 on that toolchain tutorial, so now I can upload some linux kernels in dol-format !!! First up is NFS-kernel and then NBD(I need to know what specific command parameters you have to use in 2.6.32-NBD Kernel bootargs) Then Also one that could boot base-systems (rootfs) from SD card just tell me if you need some simple modifications on the kernel like squashfs or something ;)
Image
User avatar
liquitt
Posts: 1761
Joined: Thu Apr 01, 2010 5:43 am
Location: neverland
Contact:

Re: Setting up Gamecube Linux help

Post by liquitt » Mon Oct 31, 2011 7:44 pm

hey cool that you're joining in ;)
tomorrow i'm testing my VM again. dunno whats wrong but i wasn't able to compile a kernel lately.
the default one was NFS iirc....i wanted to try one that has its FS on the SDcard too

if you like you can upload one of them :)
please search before you ask - a lot has been discussed already!
(or use google with "site:gc-forever.com *term*")
http://is.gd/MDmZcr

we also have a wiki filled with knowledge
http://is.gd/dX58Rm
User avatar
Kalifornia Jani
Posts: 8
Joined: Sun Sep 05, 2010 5:20 pm
Location: Finland

Re: Setting up Gamecube Linux help

Post by Kalifornia Jani » Mon Oct 31, 2011 7:59 pm

Well you have to export the toolchain everytime when you want to use it so, if you dont do it at the beginning when starting the compiling process it fails and says that you need newer binutils, but im sure you know guys know this stuff already :D

Here is my NFS-version of the kernel, remember to hex-edit the right IP address on it!! I dont know if you can use other than NFS-with this when I had ticked the *rootfs on NFS -option
Attachments
zImage1.dol.zip
NFS
(1.94 MiB) Downloaded 264 times
Image
User avatar
Kalifornia Jani
Posts: 8
Joined: Sun Sep 05, 2010 5:20 pm
Location: Finland

Re: Setting up Gamecube Linux help

Post by Kalifornia Jani » Tue Nov 01, 2011 9:20 pm

bump. Here is the one made for loading from sd card!! BUT I dunno if I have to do other partition on the sd card to get rootfs to boot up!! It mounted my sd card vfat as a read only and then it fails, and says try to pass init= option to the kernel!! Well I did that init=/bin/bash or init=/linuxrc just incase and it didnt help :(. I guess fat-filesystems arent supported to read/write, someone enlighten me! Or give me better mini debian-base system :D....I share this one anyways
Attachments
zImage1SD.zip
(1.78 MiB) Downloaded 267 times
Image
julius
Posts: 201
Joined: Thu Nov 04, 2010 5:11 pm

Re: Setting up Gamecube Linux help

Post by julius » Wed Nov 02, 2011 5:10 pm

Have you succeeded using this method to load gc-linux? http://www.elotrolado.net/wiki/Ejecutar ... tarjeta_SD
Post Reply