Skip to contentSkip to conversation

ELF tool chain builds hello world!!!

parisc-linux Paul Bame 2 participants 6 messages May 12, 2000

lore
Share & tools
lore

Paul Bame

author
#0 lore raw

Just thought I'd offer a binary tarball of a tool chain which can cross-compile hello world!!!!! (seems to work on the kernel too) There are quite a few little icky things I did to build this which I'll clean up and post, along with build recipes, over the next day or so.

User space is not far off!!!!!

-Paul Bame

The following tarball should be unpacked in / and it populates /opt/palinux (not to be confused with /opt/puffin). It is built for i586 (I have an AMD K6 box at home!) on the Debian 'potato' release.

ftp://puffin.external.hp.com/pub/parisc/binaries/tgz/elf32x86.tar.gz

author
#1 lore raw

To build the limping tool chain, grab the latest CVS bits for binutils, gcc, and glibc, and follow a recipe somewhat like this (it's not exact unfortunately, but should contain all the tricks):

PREFIX=$HOME/xc

cvs co binutils glibc gcc
cd gcc
ln -s ../binutils gcc/binutils

mkdir build-gcc
cd build-gcc

../gcc/configure \
	--disable-nls \
	--disable-shared \
	--target=hppa1.1-linux \
	--host=i586-pc-linux-gnu \
	--prefix=$PREFIX \
	--with-headers=/opt/puffin/include \
	--with-libs=$PREFIX/lib \
	--with-libc

make # need libiberty.a

# build until binutils is complete
cd binutils; make install

PATH=$PREFIX/bin:$PATH

cd ../..; mkdir build-glibc; cd build-glibc

../glibc/configure \
	--disable-nls \
	--without-nls \
	--disable-shared \
	--disable-profile \
	--enable-static-nss \
	--build=i586-linux \
	--host=hppa1.1-linux \
	--disable-sanity-checks \
	--with-headers=/opt/puffin/include \
	--prefix=$PREFIX

make # fails pretty soon

cp ../glibc/csu/crt?.S csu/
make # gets pretty far then fails looking for crtbegin.o

cd ../build-gcc
## Remove $PREFIX/bin from your $PATH!!!
## Repeat GCC configure from above then...
make install # This installs the rest of gcc just in case...

cd ../build-glibc; make
make install MAKEINFO=

cd $(dirname $(find $PREFIX -name crtbegin.o))
ln -s $PREFIX/lib/* .

# Now you should be able to compile hello world

# The problem is that not all the headers seem to be available, in

# two categories: 1) some headers for example glibc/string/memory.h
# which ought to be installed as ...../include/string/memory.h, aren't
# and 2) things in <sys> like <sys/mount.h>
author
#2 lore raw

Gaak! so many errors in my recipe!

First, I'm pre-supposing you have /opt/puffin populated with the current tool chain and the "includes" tarball in /opt/puffin/include.

= To build the limping tool chain, grab the latest CVS bits for = binutils, gcc, and glibc, and follow a recipe somewhat like this = (it's not exact unfortunately, but should contain all the tricks):
=
=
= PREFIX=$HOME/xc
=
= cvs co binutils glibc gcc
Do Not = cd gcc
= ln -s ../binutils gcc/binutils
=
= mkdir build-gcc
= cd build-gcc
= ../gcc/configure \
= --disable-nls \
= --disable-shared \
= --target=hppa1.1-linux \
= --host=i586-pc-linux-gnu \
= --prefix=$PREFIX \
= --with-headers=/opt/puffin/include \
= --with-libs=$PREFIX/lib \
= --with-libc
=
= make # need libiberty.a
= # build until binutils is complete

It's probably OK to let gcc build to completion and install that, if it works

= cd binutils; make install
=
= PATH=$PREFIX/bin:$PATH
=
= cd ../..; mkdir build-glibc; cd build-glibc
=
= ../glibc/configure \
= --disable-nls \
= --without-nls \
= --disable-shared \
= --disable-profile \
= --enable-static-nss \
= --build=i586-linux \
= --host=hppa1.1-linux \
= --disable-sanity-checks \
= --with-headers=/opt/puffin/include \
= --prefix=$PREFIX
=
= make # fails pretty soon
=
= cp ../glibc/csu/crt?.S csu/
= make # gets pretty far then fails looking for crtbegin.o =
= cd ../build-gcc

Do Not = ## Remove $PREFIX/bin from your $PATH!!! Do Not = ## Repeat GCC configure from above then...

= make install # This installs the rest of gcc just in case... =
= cd ../build-glibc; make
= make install MAKEINFO=
=
= cd $(dirname $(find $PREFIX -name crtbegin.o))
= ln -s $PREFIX/lib/* .

You may get warnings here from 'ln' -- ignore them

= # Now you should be able to compile hello world
=
= # The problem is that not all the headers seem to be available, in = # two categories: 1) some headers for example glibc/string/memory.h = # which ought to be installed as ...../include/string/memory.h, aren't = # and 2) things in <sys> like <sys/mount.h>
=
= --------------------------------------------------------------------------- = To unsubscribe: send e-mail to [email protected] with = `unsubscribe' as the subject.
=
=
=

author
#3 lore raw

This recipe is a little better. Remember it assumes /opt/puffin contains the current cross compiler and /opt/puffin/include contains the include.tar.gz tarball.

#!/bin/sh

set -e
set -x

# Where to put the built results
PREFIX=$HOME/xc

# Where your checked-out CVS sources live
SRC=$HOME/palinux

# Where your build sub-dirs go
BUILD=$HOME/xc-build

# Clean out and/or create some things
rm -fr $PREFIX/* $BUILD/build-gcc $BUILD/build-glibc mkdir -p $PREFIX $BUILD/build-gcc -p $BUILD/build-glibc

PATH=$PREFIX/bin:/opt/puffin/bin:$PATH

# Allow the GCC configure step to auto-configure binutils cd $SRC && rm -f gcc/binutils &&
ln -s ../binutils gcc/binutils

# This'll mainly build binutils for now
cd $BUILD/build-gcc

$SRC/gcc/configure \
	--disable-nls \
	--disable-shared \
	--target=hppa1.1-linux \
	--host=i586-pc-linux-gnu \
	--prefix=$PREFIX \
	--with-headers=/opt/puffin/include \
	--with-libs=$PREFIX/lib \
	--with-libc

make || true

# build will fail inside gcc somewhere, don't stop the script for this

# Install binutils anyway
cd binutils; make install

# no need to re-make this again
rm $SRC/gcc/binutils

# Get ready to re-config gcc -- should build this time cd $BUILD/build-gcc && rm -r *

$SRC/gcc/configure \
	--disable-nls \
	--disable-shared \
	--target=hppa1.1-linux \
	--host=i586-pc-linux-gnu \
	--prefix=$PREFIX \
	--with-headers=/opt/puffin/include \
	--with-libs=$PREFIX/lib \
	--with-libc

make
make install

cd $BUILD/build-glibc

$SRC/glibc/configure \
	--disable-nls \
	--without-nls \
	--disable-shared \
	--disable-profile \
	--enable-static-nss \
	--build=i586-linux \
	--host=hppa1.1-linux \
	--disable-sanity-checks \
	--with-headers=/opt/puffin/include \
	--prefix=$PREFIX

cd $BUILD/build-glibc
make || true # fails pretty soon

cp $SRC/glibc/csu/crt?.S csu/ || true

cd $(dirname $(find $PREFIX -name crtbegin.o))
ln -s $PREFIX/lib/* .

# Now you should be able to compile hello world

# The problem is that not all the headers seem to be available, in

# two categories: 1) some headers for example glibc/string/memory.h
# which ought to be installed as ...../include/string/memory.h, aren't
# and 2) things in <sys> like <sys/mount.h>
author
#4 lore raw

Tired of these yet?

#!/bin/sh

set -e
set -x

# Where to put the built results
PREFIX=$HOME/xc

# Where your checked-out CVS sources live
SRC=$HOME/palinux

# Where your build sub-dirs go
BUILD=$HOME/xc-build

# Clean out and/or create some things
rm -fr $PREFIX/* $BUILD/build-gcc $BUILD/build-glibc mkdir -p $PREFIX $BUILD/build-gcc -p $BUILD/build-glibc

PATH=$PREFIX/bin:/opt/puffin/bin:$PATH

# Allow the GCC configure step to auto-configure binutils cd $SRC && rm -f gcc/binutils &&
ln -s ../binutils gcc/binutils

# This'll mainly build binutils for now
cd $BUILD/build-gcc

$SRC/gcc/configure \
	--disable-nls \
	--disable-shared \
	--target=hppa1.1-linux \
	--host=i586-pc-linux-gnu \
	--prefix=$PREFIX \
	--with-headers=/opt/puffin/include \
	--with-libs=$PREFIX/lib \
	--with-libc

make || true

# build will fail inside gcc somewhere, don't stop the script for this

# Install binutils anyway
cd binutils; make install

# no need to re-make this again
rm $SRC/gcc/binutils

# Get ready to re-config gcc -- should build this time cd $BUILD/build-gcc && rm -r *

$SRC/gcc/configure \
	--disable-nls \
	--disable-shared \
	--target=hppa1.1-linux \
	--host=i586-pc-linux-gnu \
	--prefix=$PREFIX \
	--with-headers=/opt/puffin/include \
	--with-libs=$PREFIX/lib \
	--with-libc

make
make install

cd $BUILD/build-glibc

$SRC/glibc/configure \
	--disable-nls \
	--without-nls \
	--disable-shared \
	--disable-profile \
	--enable-static-nss \
	--build=i586-linux \
	--host=hppa1.1-linux \
	--disable-sanity-checks \
	--with-headers=/opt/puffin/include \
	--prefix=$PREFIX

cd $BUILD/build-glibc
make || true # fails pretty soon

cp $SRC/glibc/csu/crt?.S csu/ || true
make
make install MAKEINFO=

cd $(dirname $(find $PREFIX -name crtbegin.o))
ln -s $PREFIX/lib/* .

# Now you should be able to compile hello world

# The problem is that not all the headers seem to be available, in

# two categories: 1) some headers for example glibc/string/memory.h
# which ought to be installed as ...../include/string/memory.h, aren't
# and 2) things in <sys> like <sys/mount.h>
#5 lore raw
In reply to Paul Bame
Quoted 3 lines · Paul Bame

User space is not far off!!!!!

COOL!!!!
I got a 715/75 with 64meg ram just waiting for an OS.
Also Has anyone thought about tweaking gcc so that it produces better
binaries for pa-risc, Like Alpha Linux gcc compiles with registers basically with enough registers for an x86 and so speed is lost.
Just my .02 worth.
Terry