Updated: 2007-04-18
Useful links
Install using chroot and rsync
Fun with chroot
HOWTO Build a 64-bit kernel
Filed bugs
Bug #9580: glibc fails to compile on sparc
Instructions
Built using the Gentoo 1.1a Sparc installer (fun install...)
Insert the Gentoo CD and boot
boot: ramdisk
# mount -t iso9660 -o ro /dev/cdroms/cdrom0 /mnt
# chroot /mnt/root-`uname -m` bin/bash
# source /etc/profile
# mount -n /dev/hda3 /mnt gentoo
# cd /mnt/gentoo
# dhcpcd eth0
# wget http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/1.4_rc4/sparc/sparc32/stage1-sparc64-1.4_rc4.tbz2
# bunzip2 -c stage1-sparc64-1.4_rc4.tbz2 | tar xvpf -
# nano etc/resolve.conf
# rm etc/make.profile
# mount -o bind /proc /mnt/gentoo/proc
# chroot /mnt/gentoo bin/bash
# source /etc/profile
# emerge sync
# ln -s /usr/portage/profiles/default-sparc64-1.4 /etc/make.profile
# /usr/portage/scripts/bootstrap.sh
# export CONFIG_PROTECT=""
# emerge system
# ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime
# emerge sys-kernel/sparc-sources
# cd /usr/src/linux
# make menuconfig
# make dep && make clean && make vmlinux && make modules && make modules_install
# cp vmlinux /boot/vmlinux
# cd /boot
# gzip -9 vmlinux
# mv vmlinux.gz vmlinuz
# nano /etc/silo.conf
# silo
# exit
# umount /mnt/gentoo/proc
# umount /mnt/gentoo
# exit
# reboot
After the reboot, I do the following:
# emerge nfs-utils
# /etc/init.d/nfslock start
# mount <server>://var/spool/sorcery /usr/portage/distfiles
# emerge -U world
# wget http://download.sourcemage.org/sorcery/sorcery-stable.tar.bz2
# tar xjf sorcery-stable.tar.bz2
# sorcery/install
# mount --bind /var/spool/sorcery /usr/portage/distfiles
# sorcery
Configure your optimizations for the SPARC you have (I chose combreloc, tiny, and strip)
Turn on CROSS_INSTALL in Options->Features
# scribe update (this will also copy the needed Sorcery files to /opt/cross-install/sparc<blah>-unknown-linux-gnu
# cast basesystem (glibc and module-init-tools will fail)
glibc error:
checking installed Linux kernel header files... TOO OLD!
configure: error: GNU libc requires kernel header files from
Linux 2.0.10 or later to be installed before configuring.
The kernel header files are found usually in /usr/include/asm and
/usr/include/linux; make sure these directories use files from
Linux 2.0.10 or later. This check uses <linux/version.h>, so
make sure that file was built correctly when installing the kernel header
files. To use kernel headers not from /usr/include/linux, use the
configure option --with-headers.
# cat /usr/include/linux/version.h
#define UTS_RELEASE "2.4.21"
#define LINUX_VERSION_CODE 132117
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
# cat /opt/cross-install/sparc-unknown-linux-gnu/usr/include/linux/version.h
#define UTS_RELEASE "2.4.24"
#define LINUX_VERSION_CODE 132120
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
Just found this in glibc/BUILD:
--with-headers="${INSTALL_ROOT}/usr/src/linux/include/"
I haven't built a kernel for SMGL yet. ;) For now I'll just copy the Gentoo one from /usr/src/linux...
Well, now I'm past that problem, but back to my old problem:
gcc ../sysdeps/sparc/sparc32/setjmp.S -c -I../include -I. -I/opt/cross-install/sparc-unknown-linux-gnu/usr/src/glibc-2.3.2
.bld/setjmp -I.. -I../libio -I/opt/cross-install/sparc-unknown-linux-gnu/usr/src/glibc-2.3.2.bld -I../sysdeps/sparc/sparc3
2/elf -I../linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32 -I../linuxthreads/sysdeps/unix/sysv/linux/sparc -I../linuxthr
eads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthread -I../sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv -I.
./linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/sparc/sparc32 -I../linuxthreads/sysdeps/sparc -I../sysdeps/unix/sysv/
linux/sparc/sparc32 -I../sysdeps/unix/sysv/linux/sparc -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/comm
on -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/sparc -I../sysdeps/unix -I../sysd
eps/posix -I../sysdeps/sparc/sparc32/fpu -I../sysdeps/sparc/sparc32 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I
../sysdeps/ieee754/dbl-64 -I../sysdeps/sparc/sparc32/soft-fp -I../sysdeps/sparc/fpu -I../sysdeps/sparc -I../sysdeps/ieee754
-I../sysdeps/generic/elf -I../sysdeps/generic -nostdinc -isystem /usr/lib/gcc-lib/sparc-unknown-linux-gnu/3.2.3/include -
isystem /opt/cross-install/sparc-unknown-linux-gnu/usr/src/linux/include/ -D_LIBC_REENTRANT -include ../include/libc-symbol
s.h -DASSEMBLER -D__ASSEMBLY__ -o /opt/cross-install/sparc-unknown-linux-gnu/usr/src/glibc-2.3.2.bld/setjmp/setjmp.o
In file included from ../sysdeps/sparc/sparc32/setjmp.S:20:
../sysdeps/unix/sysv/linux/sparc/sys/trap.h:5:23: asm/traps.h: No such file or directory
make[3]: *** [/opt/cross-install/sparc-unknown-linux-gnu/usr/src/glibc-2.3.2.bld/setjmp/setjmp.o] Error 1
make[3]: Leaving directory `/opt/cross-install/sparc-unknown-linux-gnu/usr/src/glibc-2.3.2/setjmp'
make[2]: *** [setjmp/subdir_lib] Error 2
If I try to chroot to finish the updates, I get:
# chroot /opt/cross-install/sparc-unknown-linux-gnu
chroot: /bin/bash: No such file or directory
Compiling bash statically ("static" option in Sorcery), it works, but the rest of the packages suffer the same problem (linking against Gentoo's /lib/libc.so.6 and /lib/ld-linux.so.2).
module-init-tools error:
make[1]: Leaving directory `/opt/cross-install/sparc-unknown-linux-gnu/usr/src/modutils-2.4.26'
make[1]: Entering directory `/opt/cross-install/sparc-unknown-linux-gnu/usr/src/module-init-tools-3.0'
if [ "`echo /opt/cross-install/sparc-unknown-linux-gnu//sbin | tr -s / /`" = /sbin ]; then :; \
else \
echo moveold usually only makes sense when installing into /sbin; \
exit 1; \
fi
moveold usually only makes sense when installing into /sbin
make[1]: *** [check-for-sbin] Error 1
OLD INFO:
# cast basesystem (glibc will fail)
Turn on "static" compile optimization
# cast -c bash
Turn off "static" compile optimization
# cp /usr/include/asm/traps.h /opt/cross-install/<blah>-unknown-linux-gnu/usr/include/asm
# cast -c glibc
# cp /lib/libc.so.6 /opt/cross-install/<blah>-unknown-linux-gnu/lib
# cp /lib/ld-linux.so.2 /opt/cross-install/<blah>-unknown-linux-gnu/lib
# chroot /opt/cross-install/<blah>-unknown-linux-gnu
# mount /proc