Tag Archives: Mac

Cross Building Linux With ELLCC: Part 4 – Building Linux on the Mac

In a previous post I described cross compiling the Linux kernel and userland for the Raspberry Pi using ELLCC. In this post, I’ll do the same thing on Mac OS X.
I’d like to thank Emmanuel Blot for making this possible. He sent the necessary patches. Thanks Emmanuel!

First we need to make a case insensitive file system:

[~] Richards-Mac-mini% hdiutil create -size 10g -type SPARSEBUNDLE -nospotlight -volname ellcc -fs "Case-sensitive Journaled HFS+" -attach ./ellcc.dmg
/dev/disk1              GUID_partition_scheme           /dev/disk1s1           EFI
/dev/disk1s2            Apple_HFS                       /Volumes/ellcc
created: /Users/rich/ellcc.dmg.sparsebundle

Then get the the latest binary release of ELLCC:

[~] Richards-Mac-mini% cd /Volumes/ellcc/
[/Volumes/ellcc] Richards-Mac-mini% wget http://ellcc.org/releases/ellcc-Mac_OS_X_10.11.2-0.1.25.tgz
--2016-01-06 17:58:38--  http://ellcc.org/releases/ellcc-Mac_OS_X_10.11.2-0.1.25.tgz
Resolving ellcc.org... 174.102.201.124
Connecting to ellcc.org|174.102.201.124|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 417609504 (398M) [application/x-gzip]
Saving to: 'ellcc-Mac_OS_X_10.11.2-0.1.25.tgz'
ellcc-Mac_OS_X_10.11 100%[===================>] 398.26M  11.2MB/s    in 40s
2016-01-06 17:59:18 (10.0 MB/s) - 'ellcc-Mac_OS_X_10.11.2-0.1.25.tgz' saved [417609504/417609504]
[/Volumes/ellcc] Richards-Mac-mini% tar xvfp ellcc-Mac_OS_X_10.11.2-0.1.25.tgz
...

Now we can build. Check for supported boards and choose the one you want:

[/Volumes/ellcc] Richards-Mac-mini% cd ellcc/libecc/ecclinux/
[/Volumes/ellcc/ellcc/libecc/ecclinux] Richards-Mac-mini% ./build 
usage: ./build [options] target
  options:
    -nokernel           Don't build the Linux kernel
    -clean              Clean up a previous build
  targets:
    help                This message
    bcmrpi              Raspberry Pi    (ARMv6)
    bcm2709             Raspberry Pi 2  (ARMv7)
[/Volumes/ellcc/ellcc/libecc/ecclinux] Richards-Mac-mini% ./build bcm2709
...
Generating configuration file for e2fsprogs version 1.42.13
Release date is May, 2015
checking build system type... x86_64-apple-darwin15.2.0
checking host system type... x86_64-apple-darwin15.2.0
checking for gcc... /Volumes/ellcc/ellcc/bin/ecc -target arm-linux-engeabihf
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/Volumes/ellcc/ellcc/libecc/ecclinux/arm-linux-engeabihf/e2fsprogs':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
[/Volumes/ellcc/ellcc/libecc/ecclinux] Richards-Mac-mini%

Looks like I have a problem with the userland build, but the kernel built. I’ll look at that tomorrow. It’s late. Nice!