HOWTO Compile on another computer
From Gentoo Linux Wiki
There are so many methods for achieving this,so we will first use the most convenient:the one which works with portage
Others methods are reserved to others situation who the main problem is not(only) the processor power and so the compilation time(for example to port Gentoo to a system that can't boot on cd,network...) there are interesting too because theses devices could also need compiling from another computer once the system is functional
- distributed compiling
- Resolving the problem of the diferent architectures
It is possible to compile gentoo for old x86 system (pentium pro 200MHz with very little ram) using a x86_64 pc running gentoo. It is not possible other way - to build a 64bit system on 32bit box. It's because you try to use just compiled 64bit binaries which the 32bit box isn't able to run.
I managed to build the system in chroot. I just went through the handbook using 64bit-gentoo in place of live-cd system.
You need to set up CHOST and CFLAGS for your target platform (don't change CHOST when you use stage2 or 3, still - get stages for target platform). For me it was:
# CHOST="i686-pc-linux-gnu" # CFLAGS="-march=pentiumpro -Os -momit-frame-pointer -pipe" # CXXFLAGS="$CFLAGS"
You still need to partition disks and make filesystems on the old machine with a live-cd or other linux system.
I don't know why, but I couldn't force
make menuconfig
to allow me set x86 arch. I configured and build the kernel on standard x86 system.
FIX: to compile kernel for i386 on x86_64 just append ARCH=i386 when you configure and compile your kernel:
make menuconfig ARCH=i386 make clean dep modules modules_install bzImage ARCH=i386 cp arch/i386/boot/bzImage /boot/vmlinuz
I coppied the ready system to the old pc with:
# cd /your/new/gentoo # echo "/sys/*" >> tar_exclusions # echo "/var/run/*" >> tar_exclusions # echo "/tmp/*" >> tar_exclusions # echo "/proc/*" >> tar_exclusions # # tar -C /your/new/gentoo -X tar_exclusions --preserve -cf ../gentoo.tar . ## you can add -v for verbose or -j / -z for compression # scp [-P ssh_port] ../gentoo.tar user@dest_pc:
and on the destination pc: prepare the disks and untar the system
# tar -C /your/new/system --preserve -xf ~user/gentoo.tar
Now you can chroot. Get the kernel and its sources from the machine where you build it, install modules. Configure bootloader and reboot. You are now working on your brand new Gentoo.
The system should be working now, but I noticed a problem - I couldn't compile anything. It seemed that C preprocessor nor gcc works (usually configure said that /lib/cpp fails sanity check). I don't know why, but copying (chroot_dir)/usr/include from the box where all compilation took place to the old box helped.
Good luck.
This article is still a Stub. You can help Gentoo-Wiki by expanding it.
