linuxarmchroottoolchainlinux-from-scratch

chroot into other arch's environment


Following the Linux from Scratch book I have managed to build a toolchain for an ARM on an ARM. This is till chapter 6 of the book, and on the ARM board itself I could go on further with no problems. My question is if I can use the prepared environment to continue building the soft from chapter 6 on my x86_64 Fedora 16 laptop? I thought that while I have all the binaries set up I could just copy them to laptop, chroot inside and feel myself as on the ARM board, but using the command from the book gives no result:

 `# chroot "$LFS" /tools/bin/env -i  HOME=/root TERM="$TERM" PS1='\u:\w\$ 
  PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h
      chroot: failed to run command `/tools/bin/env': No such file or directory`

The binary is there, but it doesn't belong to this system:

 `# ldd /tools/bin/env 
      not a dynamic executable`

The binary is compiled as per the book: # readelf -l /tools/bin/env | grep interpreter [Requesting program interpreter: /tools/lib/ld-linux.so.3]

So I wonder if there is a way, like using proper environment variables for CC LD READELF, to continue building for ARM using these tools on x86_64 host.

Thank you.


Solution

  • Nope. You can't run ARM binaries on x86, so you can't enter its chroot. No amount of environment variables will change that.

    You might be able to continue the process by creating a filesystem image for the target and running it under an emulator (e.g, qemu-system-arm), but that's quite a different thing.