If you have powerfull desktop/server box, you can run n8x0 stage on it. Main reasons to do so are CPU speed (and quantity) and RAM amount (several packages cannot be built on N8X0 due to insufficient RAM). We'll use QEMU user emulation + binfmt_misc. Due to the need to pass additional args to QEMU (cpu model), we'll create wrapper script that'll call QEMU with it.
/usr/armv6j-unknown-linux-gnueabi/./configure --target-list=arm-linux-user --static && make
arm-linux-user/qemu-arm to / and /usr/armv6j-unknown-linux-gnueabi/qemu-wrapper.c: #include <unistd.h> #include <string.h> int main(int argc, char *argv[], char *envp[]) { char *newargv[argc + 3]; newargv[0] = argv[0]; newargv[1] = "-cpu"; newargv[2] = "arm1136"; memcpy(&newargv[3], &argv[1], sizeof(*argv) * (argc - 1)); newargv[argc + 2] = NULL; return execve("/qemu-arm", newargv, envp); }
and compile it:
gcc -static qemu-wrapper.c -o qemu-wrapper
qemu-wrapper to / and /usr/armv6j-unknown-linux-gnueabi/#!/bin/bash CHOST="armv6j-unknown-linux-gnueabi" QEMU="/qemu-wrapper" modprobe binfmt_misc && mount -t binfmt_misc none /proc/sys/fs/binfmt_misc [ -e /proc/sys/fs/binfmt_misc/arm ] || echo ":arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:${QEMU}:" > /proc/sys/fs/binfmt_misc/register mount --bind /usr/portage/ "/usr/${CHOST}/usr/portage/" mount --bind /sys/ "/usr/${CHOST}/sys/" mount -t proc proc "/usr/${CHOST}/proc/" mount -o rbind /dev/ "/usr/${CHOST}/dev/"
chroot /usr/armv6j-unknown-linux-gnueabi/
Same approach can be used for any QEMU-supported machine. For binfmt ELF magic see qemu-binfmt-conf.sh from QEMU tarball.