GP2X Debian Cross-compiler Packages


judge0

Member
Joined
Oct 3, 2005
Messages
172
Location
Sault Ste Marie, Ontario, Canada
Website
Visit site
Here is a web page that has some packages for Debian (possibly Ubuntu/Kubuntu as well, let me know if they are compatible). They are available for Woody, Sarge and Sid.

binutils-arm

gcc-4.0-arm

g++-4.0-arm

glibc-cross-arm

gobjc-4.0-arm

They are available in lower versions as well. I installed these and tested in KDevelop, they appear to work. You have to give output executable the *.gpe extension AFAIK

Unless you plan on distributing libraries with your work, it's best to link statically against libs.

There are FAQs that discuss how to set up KDevelop for cross-compiling (Search for "setting up KDevelop to cross-compile")

Hope this helps someone out . . . :blink:

I'd be interested in any other resources available :D

Edit: Added reference to static linking of libs . . .brain-dead :blink:
 
Would you be able to package these as a tar or some other from of compression where I could just do something like "tar -xf <package name>" to install it?
 
If you use slackware, I believe it has a binary deb2tgz that will do what you want.

Otherwise, save the following script . . .

Code:
#!/usr/bin/perl -w
# $Id: deb2targz,v 1.1 2002/12/17 11:57:54 mike Exp $

# deb2targz - convert a Debian Linux .deb file to a .tar.gz
#
# This is a hack based only on my eyeball inspection of a single .deb
# file (scottfree_1.14-5_i386.deb) and not on a deep understanding of
# the format.  However, so far as I can tell, here's how it works:
#
# First line -- file header: "!<arch>" or similar
# Multiple blocks -- each one, a header line followed by data
#	Header line -- <filename> <num1> <num2> <num3> <mode> <len>
#	Data -- <len> bytes of data
# We want the block called "data.tar.gz"
#
# This naive algorithm seems to work on the other .deb files that I've
# tested it on, so I'm happy enough with it:
#	libapache-reload-perl_0.07-1_all.deb
#	libogg0_1.0.0-1_i386.deb
#	abiword_1.0.2+cvs.2002.06.05-1_i386.deb

use strict;
use IO::File;

$0 =~ s@.*/@@;
if (@ARGV == 0) {
    print STDERR "Usage: $0 <deb-file> [<deb-file> ...]\n";
    exit(1);
}

FILE: foreach my $filename (@ARGV) {
    if ($filename !~ /\.deb$/) {
	print "$0: ignoring '$filename' (not a .deb)\n";
	next;
    }

    print "$0: converting '$filename' ...\n";
    my $fh = new IO::File("<$filename")
	or die "$0: can't read '$filename': $!";

    <$fh>;  	# discard file-header line
    my $data = join(', <$fh>);
    $fh->close();

    while ($data) {
	my $header;
	($header, $data) = ($data =~ /(.*?)\n(.*)/s);
	my($name, $num1, $num2, $num3, $num4, $len) = split /\s+/, $header;
	#print "header='$header'\n\tname='$name', len=$len\n";
	if ($name eq "data.tar.gz") {
     # Found it
     $data = substr($data, 0, $len);
     $filename =~ s/\.deb$/.tar.gz/;
     my $fh = new IO::File(">$filename")
  or die "can't write '$filename': $!";
     print $fh $data;
     $fh->close();
     print "$0: wrote '$filename'\n";
     next FILE;
	}

	print "$0: skipping section '$name'\n";
	if (substr($data, $len, 1) eq "\n") {
     $len++;
	}
	$data = substr($data, $len);
    }
}

as deb2targx, script is written by a Mike Taylor atThis site

Let me know how it goes :blink:
 
Last edited by a moderator:
Im downloading the DEB files now and will be trying it out in a few minutes. I should have a PKGBUILD posted for Arch Linux posted in a short while, depnding how things go. Thanks

EDIT: The Deb2tgz script works perfectly
 
PKGBUILD for Arch Linux:
Code:
pkgname=gp2xtools
pkgver=1
pkgrel=1
pkgdesc="A set of tools that allow you to compile things for the GP2X"
url="http://debian.speedblue.org/packages/"
depends=('perl')
source=(${url}binutils-arm_2.15-3_i386.deb \
${url}g++-4.0-arm_4.0.0-1_i386.deb \
${url}glibc-cross-arm_2.3.2-4_i386.deb \
${url}gcc-4.0-arm_4.0.0-1_i386.deb \
${url}gobjc-4.0-arm_4.0.0-1_i386.deb)
md5sums=('0c4a5a3c6ce236b42b9ea37c4c66d6f4' '20464e00842649e37cb23642e38033ea'\
         'd6aaa501923efb54adb0da1531b2dfa7' 'a724099c34361faf2554f225a92cf8b7'\
         'c42d160241fe5cb8f6107d297e8c40d4')

build() {
  chmod +x $startdir/deb2tgz
  perl $startdir/deb2tgz g*
  perl $startdir/deb2tgz b*
  rm *.deb
  cd $startdir/src
  echo "Extracting sources, I know, this is a crap PKGBUILD"
  tar -xvzf $startdir/binutils-arm_2.15-3_i386.tar.gz
  tar -xzvf $startdir/g++-4.0-arm_4.0.0-1_i386.tar.gz
  tar -xzvf $startdir/gcc-4.0-arm_4.0.0-1_i386.tar.gz
  tar -xzvf $startdir/glibc-cross-arm_2.3.2-4_i386.tar.gz
  tar -xzvf $startdir/gobjc-4.0-arm_4.0.0-1_i386.tar.gz
  cd $startdir/src
  cp -R usr $startdir/pkg  
}
You will also need a file called deb2tgz in the same folder. Here is the code for said file:
Code:
#!/usr/bin/perl -w
# $Id: deb2targz,v 1.1 2002/12/17 11:57:54 mike Exp $

# deb2targz - convert a Debian Linux .deb file to a .tar.gz
#
# This is a hack based only on my eyeball inspection of a single .deb
# file (scottfree_1.14-5_i386.deb) and not on a deep understanding of
# the format.  However, so far as I can tell, here's how it works:
#
# First line -- file header: "!<arch>" or similar
# Multiple blocks -- each one, a header line followed by data
# Header line -- <filename> <num1> <num2> <num3> <mode> <len>
# Data -- <len> bytes of data
# We want the block called "data.tar.gz"
#
# This naive algorithm seems to work on the other .deb files that I've
# tested it on, so I'm happy enough with it:
# libapache-reload-perl_0.07-1_all.deb
# libogg0_1.0.0-1_i386.deb
# abiword_1.0.2+cvs.2002.06.05-1_i386.deb

use strict;
use IO::File;

$0 =~ s@.*/@@;
if (@ARGV == 0) {
   print STDERR "Usage: $0 <deb-file> [<deb-file> ...]\n";
   exit(1);
}

FILE: foreach my $filename (@ARGV) {
   if ($filename !~ /\.deb$/) {
print "$0: ignoring '$filename' (not a .deb)\n";
next;
   }

   print "$0: converting '$filename' ...\n";
   my $fh = new IO::File("<$filename")
or die "$0: can't read '$filename': $!";

   <$fh>;   # discard file-header line
   my $data = join(', <$fh>);
   $fh->close();

   while ($data) {
my $header;
($header, $data) = ($data =~ /(.*?)\n(.*)/s);
my($name, $num1, $num2, $num3, $num4, $len) = split /\s+/, $header;
#print "header='$header'\n\tname='$name', len=$len\n";
if ($name eq "data.tar.gz") {
    # Found it
    $data = substr($data, 0, $len);
    $filename =~ s/\.deb$/.tar.gz/;
    my $fh = new IO::File(">$filename")
 or die "can't write '$filename': $!";
    print $fh $data;
    $fh->close();
    print "$0: wrote '$filename'\n";
    next FILE;
}

print "$0: skipping section '$name'\n";
if (substr($data, $len, 1) eq "\n") {
    $len++;
}
$data = substr($data, $len);
   }
}
 
Last edited by a moderator:
mmmmm... about the gcc version used.....

I've tested GCC 4.0 on my Gentoo System, and benkmarched it. The results: very slow executables.

It's know that GCC 4.0 has some regresions, and as the optimization framework has been rewritten, it outputs executables that are slower than GCC 3.4 ones.

Why not using GCC 3.4 instead of 4.0? We all want the most speed from ours GP2X, don't we?
 
Last edited by a moderator:
Back
Top