[lfs-support] Cross-compiling in Ch6

Paul Rogers paulgrogers at fastmail.fm
Sat Sep 2 23:09:15 PDT 2017


> On 09/01/2017 11:04 AM, Paul Rogers wrote:
> > Being able to use my (now old) i7 to build (B)LFS has made this much
> > faster, but seems to have tripped me up.  I was trying to build an i686
> > LFS, and thought it was enough to use an older i686-made OS and
> > toolchain.  Works on Conroe targets, but when I actually tried a
> > Pentium-3 the kernel panicked, and when trying to rebuild the kernel
> > with a chroot from a real i686 OS and toolchain, make kept segfaulting.
> >
> > In spite of my package management wrappers, I always have followed the
> > book closely, but the book presumes one will run on the same system, not
> > a lower-grade member of the family.  I'm guessing I'll need to use
> > --host=i686-pc-linux-gnu throughout Ch6, and perhaps even a similar
> > --target for binutils, GMP, MPFR, MPC, & gcc?  Is that right?
> 
> Used to be able to do various uname hacks to get around it. If kernel is 
> a real i686 kernel, something really simple like this:
> 
> mv /bin/uname /bin/uname.orig
> cat > /bin/uname << "EOF"
> #!/bin/bash
> # Begin /bin/uname
> /bin/uname.orig $@ | sed 's at x86_64@i686 at g'
> # End /bin/uname
> EOF
> chmod 755 /bin/uname
> 
> But with that said, I've no idea whether it will actually work. It used 
> to. Also would probably want to use march and mtune flags and probably 
> need to use config.fsf for gmp or explicitly set the target for that one.
> 
> --DJ
> 

OK, to clarify the above, I was _trying_ to make the "POD-6.1"/LFS-7.7
on the i7 for i686 by using a real i686 host "POD-4.1"/LFS-7.2.  uname
-a says I have an i686 kernel.  The "triplet" is i686-pc-linux-gnu.  But
as I was following the book too closely, without --host & --target, [GMP
let] some i7 instructions apparently crept into binutils and gcc, and
the triplet isn't quite true.  I guess what I got from Ch5 then was an
i686 to i7 cross-compiler?  The system *seems* to work.

> 
> 
> 
> 
> clfs.org
> 
> 
> 
> akh
> 

Ahh, I see, I think.  I need to make the i686 compiler in Ch5.  And go
back to hosting on POD-4.1/LFS-7.2 where --host is really what it
claims.  But I'm still trying to avoid doing all the work of the whole
CLFS cross-build.  AIUI I'll have i686 host and target, but just have to
tell binutils and gcc, "No, you can't use everything you can see!" in
Ch5.

(Reminding me a bit of when I needed to run second-level VMs on IBM's
VM/SP4 in the mid 80's.  (On a dual-processor 14.7MHz 8MB 4381.  How
times have changed!)  Confusing for a while, but finally it
"clicked-in".  I'm still in the confused stage now.)

-- 
Paul Rogers
paulgrogers at fastmail.fm
Rogers' Second Law: "Everything you do communicates."
(I do not personally endorse any additions after this line. TANSTAAFL
:-)


More information about the lfs-support mailing list