What's wrong with: sudo apt-get install gcc ?? sudo apt-get install kernel-source ???
Might need to edit /etc/apt/sources.list to gain access to stuff that can break your system.
Be aware that this will give you the ubuntu-patched sources for kernel 2.6.15-25.
SPARC support was stopped for a long time in kernel 2.6.16 and is now back in 2.6.17 and up (I think Gentoo actually have 2.6.16 kernels for SPARC). You might as well go for the latest "stable" kernel from http://www.kernel.org/.
I would build the ubuntu-patched version first to verify that the tools work (and figure out how they work).
PS:
If installing gcc hard, then I think that you will have real trouble building a kernel that actually work. The SPARC build appears to be *very* sensitive to the kernel konfiguration and the defaults do not work (on my box anyway). The easiest is to Google for a kernel config that works for your architecture!