Page 1 of 1

Setting up Gamecube Linux help

Posted: Wed Sep 28, 2011 1:37 am
by emu_kidid
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 :)

Re: Setting up Gamecube Linux help

Posted: Wed Sep 28, 2011 4:38 pm
by julius
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.

Re: Setting up Gamecube Linux help

Posted: Wed Sep 28, 2011 5:07 pm
by liquitt
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

Re: Setting up Gamecube Linux help

Posted: Mon Oct 03, 2011 9:45 pm
by arcticfox
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 :)

Re: Setting up Gamecube Linux help

Posted: Mon Oct 03, 2011 10:49 pm
by emu_kidid
swap on SD card is so slow because it's PIO and not DMA :(

Re: Setting up Gamecube Linux help

Posted: Tue Oct 04, 2011 11:25 am
by liquitt
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. ?

Re: Setting up Gamecube Linux help

Posted: Tue Oct 04, 2011 6:43 pm
by arcticfox
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.

Re: Setting up Gamecube Linux help

Posted: Tue Oct 04, 2011 10:11 pm
by emu_kidid
A ready to go package would be nice :)

Re: Setting up Gamecube Linux help

Posted: Tue Oct 04, 2011 11:19 pm
by liquitt
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

Re: Setting up Gamecube Linux help

Posted: Wed Oct 05, 2011 10:39 am
by arcticfox
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!

Re: Setting up Gamecube Linux help

Posted: Wed Oct 05, 2011 11:48 am
by liquitt
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/ ;)

Re: Setting up Gamecube Linux help

Posted: Wed Oct 05, 2011 4:44 pm
by arcticfox
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 :)

Re: Setting up Gamecube Linux help

Posted: Thu Oct 06, 2011 7:02 pm
by infact
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.

Re: Setting up Gamecube Linux help

Posted: Tue Oct 18, 2011 12:49 pm
by steffen
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

Re: Setting up Gamecube Linux help

Posted: Tue Oct 18, 2011 2:48 pm
by liquitt
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

Re: Setting up Gamecube Linux help

Posted: Mon Oct 31, 2011 6:55 pm
by Kalifornia Jani
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 ;)

Re: Setting up Gamecube Linux help

Posted: Mon Oct 31, 2011 7:44 pm
by liquitt
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 :)

Re: Setting up Gamecube Linux help

Posted: Mon Oct 31, 2011 7:59 pm
by Kalifornia Jani
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

Re: Setting up Gamecube Linux help

Posted: Tue Nov 01, 2011 9:20 pm
by Kalifornia Jani
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

Re: Setting up Gamecube Linux help

Posted: Wed Nov 02, 2011 5:10 pm
by julius
Have you succeeded using this method to load gc-linux? http://www.elotrolado.net/wiki/Ejecutar ... tarjeta_SD