OpenWrt Forum Archive

Topic: Building a custom U-Boot image on a Mac under OS X 10.11.4

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm fairly new to OpenWRT so please be gentle! I'm trying to build a U-Boot image for a BT Homehub 5 from a repository that seems to work fine for everyone else. I suspect my issue is the Mac, but the others I've spoke to aren't using a Mac its difficult to get help. So I figured I would ask on the main OpenWRT forum for help, hence here I am!

The hub 5 discussion is here ...  http://openwrt.ebilan.co.uk/viewforum.php?f=7.

I can build OpenWRT images just fine on my Mac after jumping through some hoops with MacPorts and some other bits. But the u-boot build always fails with an obscure error. The process I am following is this:

git clone https://github.com/xdarklight/u-boot-lantiq.git
cd u-boot-lantiq
wget https://github.com/openwrt/openwrt/raw/master/package/boot/uboot-lantiq/patches/0047-add-gcc5-support.patch
wget https://github.com/openwrt/openwrt/raw/de9b443207c2428c91d0ad75494e8e6941d762ac/package/boot/uboot-lantiq/patches/0045-no_extern_inline.patch
wget https://github.com/openwrt/openwrt/raw/de9b443207c2428c91d0ad75494e8e6941d762ac/package/boot/uboot-lantiq/patches/0046-no_weak_alias.patch

patch -p1 < 0045-no_extern_inline.patch
patch -p1 < 0046-no_weak_alias.patch
patch -p1 < 0047-add-gcc5-support.patch

export STAGING_DIR=/Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/bin/
export PATH=$STAGING_DIR:$PATH
make bthomehubv5a_ram_config CROSS_COMPILE=mips-openwrt-linux-
make CROSS_COMPILE=mips-openwrt-linux-

On running those commands this is what is output:

Plasmas-MBP:u-boot-lantiq plasma$ make bthomehubv5a_ram_config CROSS_COMPILE=mips-openwrt-linux-
Generating include/autoconf.mk
Generating include/autoconf.mk.dep
Configuring for bthomehubv5a_ram - Board: bthomehubv5a, Options: SYS_BOOT_RAM
Plasmas-MBP:u-boot-lantiq plasma$ make CROSS_COMPILE=mips-openwrt-linux-
Generating include/autoconf.mk
Generating include/autoconf.mk.dep
Generating include/spl-autoconf.mk
Generating include/tpl-autoconf.mk
mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
      -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
      -o lib/asm-offsets.s lib/asm-offsets.c -c -S
Generating include/generated/generic-asm-offsets.h
tools/scripts/make-asm-offsets lib/asm-offsets.s include/generated/generic-asm-offsets.h
if [ -f arch/mips/cpu/mips32/vrx200/asm-offsets.c ];then \
      mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
      -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
         -o arch/mips/cpu/mips32/vrx200/asm-offsets.s arch/mips/cpu/mips32/vrx200/asm-offsets.c -c -S; \
   else \
      touch arch/mips/cpu/mips32/vrx200/asm-offsets.s; \
   fi
Generating include/generated/asm-offsets.h
tools/scripts/make-asm-offsets arch/mips/cpu/mips32/vrx200/asm-offsets.s include/generated/asm-offsets.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tools all
cat /dev/null  >.depend
In file included from /Volumes/OpenWRT/u-boot-lantiq/common/image.c:53:
In file included from /Volumes/OpenWRT/u-boot-lantiq/include/image.h:20:
/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include/asm/byteorder.h:72:4: error: "MIPS, but
      neither __MIPSEB__, nor __MIPSEL__???"
#  error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
   ^
1 error generated.
In file included from /Volumes/OpenWRT/u-boot-lantiq/common/image-sig.c:15:
In file included from /Volumes/OpenWRT/u-boot-lantiq/include/image.h:20:
/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include/asm/byteorder.h:72:4: error: "MIPS, but
      neither __MIPSEB__, nor __MIPSEL__???"
#  error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
   ^
1 error generated.
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include /Volumes/OpenWRT/u-boot-lantiq/include/libfdt_env.h -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -I /Volumes/OpenWRT/u-boot-lantiq/lib/libfdt -I /Volumes/OpenWRT/u-boot-lantiq/tools -DCONFIG_SYS_TEXT_BASE=0xA0100000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE   -o aisimage.o aisimage.c -c
In file included from aisimage.c:10:
In file included from /Volumes/OpenWRT/u-boot-lantiq/include/image.h:20:
/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include/asm/byteorder.h:72:4: error: "MIPS, but
      neither __MIPSEB__, nor __MIPSEL__???"
#  error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
   ^
1 error generated.
make[1]: *** [aisimage.o] Error 1
make: *** [tools] Error 2
Plasmas-MBP:u-boot-lantiq plasma$

When I Google for the error error: "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" it really doesn't turn up anything of help. Has anyone successfully built u-boot on a Mac or can point me in the right direction.

Many Thanks in advance.

Plasma

First of all, please use the "hh5a-v2014.01-gcc5-20160116" branch (git checkout hh5a-v2014.01-gcc5-20160116). It has the gcc patches as well as a fix for the hh5a ram boot already applied.

Would you please check the output of:

/Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/bin/mips-openwrt-linux-gcc -dM -E - < /dev/null | grep -i mips

If the output neither contain __MIPSEB__ nor __MIPSEL__. You will get the error message as soon as the preprocessor defines are used as it is in byteorder.h.

I guess something is wrong with the compiler that compiles mips-openwrt-linux-gcc.

(Last edited by mkresin on 3 May 2016, 17:30)

mkresin wrote:

If the output neither contain __MIPSEB__ nor __MIPSEL__. You will get the error message as soon as the preprocessor defines are used as it is in byteorder.h.

I guess something is wrong with the compiler that compiles mips-openwrt-linux-gcc.

The output is:

Plasmas-MBP:bin plasma$ ./mips-openwrt-linux-gcc -dM -E - < /dev/null | grep -i mips
#define _MIPS_ISA _MIPS_ISA_MIPS1
#define _MIPS_TUNE "mips1"
#define __mips_abicalls 1
#define __mips_fpr 32
#define __mips__ 1
#define MIPSEB 1
#define mips 1
#define _MIPS_ARCH_MIPS1 1
#define __MIPSEB__ 1
#define _MIPSEB 1
#define _MIPS_ARCH "mips1"
#define _MIPS_SPFPSET 16
#define _MIPS_TUNE_MIPS1 1
#define _MIPS_SZPTR 32
#define _mips 1
#define _MIPS_SZINT 32
#define __MIPSEB 1
#define _MIPS_SIM _ABIO32
#define _MIPS_FPSET 16
#define __mips_soft_float 1
#define __mips 1
#define _MIPS_SZLONG 32
Plasmas-MBP:bin plasma$ 

I will look at checking out the version you mention, I guess I'll need to find the full URL for git? I'm very new to OpenWRT so have not entirely got to grips with all the different setups yet.

Plasma

I switched to the branch you suggested and the error is the same:

Plasmas-MBP:u-boot-lantiq plasma$ git checkout hh5a-v2014.01-gcc5-20160116
Branch hh5a-v2014.01-gcc5-20160116 set up to track remote branch hh5a-v2014.01-gcc5-20160116 from origin.
Switched to a new branch 'hh5a-v2014.01-gcc5-20160116'
Plasmas-MBP:u-boot-lantiq plasma$ 
Plasmas-MBP:u-boot-lantiq plasma$ 
Plasmas-MBP:u-boot-lantiq plasma$ export STAGING_DIR=/Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/bin/
Plasmas-MBP:u-boot-lantiq plasma$ export PATH=$STAGING_DIR:$PATH
Plasmas-MBP:u-boot-lantiq plasma$ make bthomehubv5a_ram_config CROSS_COMPILE=mips-openwrt-linux-
Generating include/autoconf.mk
Configuring for bthomehubv5a_ram - Board: bthomehubv5a, Options: SYS_BOOT_RAM
Plasmas-MBP:u-boot-lantiq plasma$ make CROSS_COMPILE=mips-openwrt-linux-
Generating include/autoconf.mk
Generating include/autoconf.mk.dep
Generating include/spl-autoconf.mk
Generating include/tpl-autoconf.mk
mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
        -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
        -o lib/asm-offsets.s lib/asm-offsets.c -c -S
Generating include/generated/generic-asm-offsets.h
tools/scripts/make-asm-offsets lib/asm-offsets.s include/generated/generic-asm-offsets.h
if [ -f arch/mips/cpu/mips32/vrx200/asm-offsets.c ];then \
        mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
        -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
            -o arch/mips/cpu/mips32/vrx200/asm-offsets.s arch/mips/cpu/mips32/vrx200/asm-offsets.c -c -S; \
    else \
        touch arch/mips/cpu/mips32/vrx200/asm-offsets.s; \
    fi
Generating include/generated/asm-offsets.h
tools/scripts/make-asm-offsets arch/mips/cpu/mips32/vrx200/asm-offsets.s include/generated/asm-offsets.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tools all
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include /Volumes/OpenWRT/u-boot-lantiq/include/libfdt_env.h -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -I /Volumes/OpenWRT/u-boot-lantiq/lib/libfdt -I /Volumes/OpenWRT/u-boot-lantiq/tools -DCONFIG_SYS_TEXT_BASE=0xA0100000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE   -o aisimage.o aisimage.c -c
In file included from aisimage.c:10:
In file included from /Volumes/OpenWRT/u-boot-lantiq/include/image.h:20:
/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include/asm/byteorder.h:72:4: error: 
      "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
#  error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
   ^
1 error generated.
make[1]: *** [aisimage.o] Error 1
make: *** [tools] Error 2
Plasmas-MBP:u-boot-lantiq plasma$

Thanks

Plasma

The output of your cross compiler (mips-openwrt-linux-gcc) looks fine.

But after having a second look at the output you have posted, it seams to me that your system gcc is used instead of your crosscompiler:

Plasma wrote:
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include /Volumes/OpenWRT/u-boot-lantiq/include/libfdt_env.h -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -I /Volumes/OpenWRT/u-boot-lantiq/lib/libfdt -I /Volumes/OpenWRT/u-boot-lantiq/tools -DCONFIG_SYS_TEXT_BASE=0xA0100000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE   -o aisimage.o aisimage.c -c
In file included from aisimage.c:10:
In file included from /Volumes/OpenWRT/u-boot-lantiq/include/image.h:20:
/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include/asm/byteorder.h:72:4: error: "MIPS, but
      neither __MIPSEB__, nor __MIPSEL__???"
#  error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"

I bet your system gcc isn't setup to cross compile to mips.

According to my notes, you need to specify the ARCH environment variable as well:

make bthomehubv5a_ram_config ARCH=mips CROSS_COMPILE=mips-openwrt-linux-
make ARCH=mips CROSS_COMPILE=mips-openwrt-linux-

(Last edited by mkresin on 3 May 2016, 19:48)

mkresin wrote:

make bthomehubv5a_ram_config ARCH=mips CROSS_COMPILE=mips-openwrt-linux-
make ARCH=mips CROSS_COMPILE=mips-openwrt-linux-

Unfortunately that didn't make any difference (that my untrained eye can see):

Plasmas-MBP:u-boot-lantiq plasma$ make bthomehubv5a_ram_config ARCH=mips CROSS_COMPILE=mips-openwrt-linux-
Configuring for bthomehubv5a_ram - Board: bthomehubv5a, Options: SYS_BOOT_RAM
Plasmas-MBP:u-boot-lantiq plasma$ make ARCH=mips CROSS_COMPILE=mips-openwrt-linux-
Generating include/autoconf.mk
Generating include/autoconf.mk.dep
Generating include/spl-autoconf.mk
Generating include/tpl-autoconf.mk
mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
        -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
        -o lib/asm-offsets.s lib/asm-offsets.c -c -S
Generating include/generated/generic-asm-offsets.h
tools/scripts/make-asm-offsets lib/asm-offsets.s include/generated/generic-asm-offsets.h
if [ -f arch/mips/cpu/mips32/vrx200/asm-offsets.c ];then \
        mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
        -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
            -o arch/mips/cpu/mips32/vrx200/asm-offsets.s arch/mips/cpu/mips32/vrx200/asm-offsets.c -c -S; \
    else \
        touch arch/mips/cpu/mips32/vrx200/asm-offsets.s; \
    fi
Generating include/generated/asm-offsets.h
tools/scripts/make-asm-offsets arch/mips/cpu/mips32/vrx200/asm-offsets.s include/generated/asm-offsets.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tools all
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include /Volumes/OpenWRT/u-boot-lantiq/include/libfdt_env.h -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -I /Volumes/OpenWRT/u-boot-lantiq/lib/libfdt -I /Volumes/OpenWRT/u-boot-lantiq/tools -DCONFIG_SYS_TEXT_BASE=0xA0100000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE   -o aisimage.o aisimage.c -c
In file included from aisimage.c:10:
In file included from /Volumes/OpenWRT/u-boot-lantiq/include/image.h:20:
/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include/asm/byteorder.h:72:4: error: 
      "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
#  error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
   ^
1 error generated.
make[1]: *** [aisimage.o] Error 1
make: *** [tools] Error 2
Plasmas-MBP:u-boot-lantiq plasma$ 

Thanks

Plasma

My last idea on this is to export the ARCH and CROSS_COMPILE variables instead of passing them with the make command. Maybe they get lost somewhere:

export STAGING_DIR=/Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/bin/
export PATH=$STAGING_DIR:$PATH
export ARCH=mips
export CROSS_COMPILE=mips-openwrt-linux-
make bthomehubv5a_ram_config
make
mkresin wrote:

My last idea on this is to export the ARCH and CROSS_COMPILE variables instead of passing them with the make command. Maybe they get lost somewhere:

export STAGING_DIR=/Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/bin/
export PATH=$STAGING_DIR:$PATH
export ARCH=mips
export CROSS_COMPILE=mips-openwrt-linux-
make bthomehubv5a_ram_config
make

Thanks very much for the suggestions, unfortunately its the same:

Plasmas-MBP:u-boot-lantiq plasma$ export STAGING_DIR=/Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/bin/
Plasmas-MBP:u-boot-lantiq plasma$ export PATH=$STAGING_DIR:$PATH
Plasmas-MBP:u-boot-lantiq plasma$ export ARCH=mips
Plasmas-MBP:u-boot-lantiq plasma$ export CROSS_COMPILE=mips-openwrt-linux-
Plasmas-MBP:u-boot-lantiq plasma$ make bthomehubv5a_ram_config
Configuring for bthomehubv5a_ram - Board: bthomehubv5a, Options: SYS_BOOT_RAM
Plasmas-MBP:u-boot-lantiq plasma$ make
Generating include/autoconf.mk
Generating include/autoconf.mk.dep
Generating include/spl-autoconf.mk
Generating include/tpl-autoconf.mk
mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
        -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
        -o lib/asm-offsets.s lib/asm-offsets.c -c -S
Generating include/generated/generic-asm-offsets.h
tools/scripts/make-asm-offsets lib/asm-offsets.s include/generated/generic-asm-offsets.h
if [ -f arch/mips/cpu/mips32/vrx200/asm-offsets.c ];then \
        mips-openwrt-linux-gcc -DDO_DEPS_ONLY \
        -g  -Os   -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xA0100000  -I/Volumes/OpenWRT/u-boot-lantiq/include  -I/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -fno-builtin -ffreestanding -nostdinc -isystem /Volumes/OpenWRT/openwrt-trunk/staging_dir/toolchain-mips_34kc+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mips-openwrt-linux-musl/5.3.0/include -pipe  -DCONFIG_MIPS -D__MIPS__ -G 0 -mabicalls -fpic -EB -msoft-float -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mtune=34kc -I/Volumes/OpenWRT/u-boot-lantiq/board/bt/bthomehubv5a -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fstack-usage   \
            -o arch/mips/cpu/mips32/vrx200/asm-offsets.s arch/mips/cpu/mips32/vrx200/asm-offsets.c -c -S; \
    else \
        touch arch/mips/cpu/mips32/vrx200/asm-offsets.s; \
    fi
Generating include/generated/asm-offsets.h
tools/scripts/make-asm-offsets arch/mips/cpu/mips32/vrx200/asm-offsets.s include/generated/asm-offsets.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tools all
gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include /Volumes/OpenWRT/u-boot-lantiq/include/libfdt_env.h -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/arch/mips/include -idirafter /Volumes/OpenWRT/u-boot-lantiq/include -I /Volumes/OpenWRT/u-boot-lantiq/lib/libfdt -I /Volumes/OpenWRT/u-boot-lantiq/tools -DCONFIG_SYS_TEXT_BASE=0xA0100000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE   -o aisimage.o aisimage.c -c
In file included from aisimage.c:10:
In file included from /Volumes/OpenWRT/u-boot-lantiq/include/image.h:20:
/Volumes/OpenWRT/u-boot-lantiq/arch/mips/include/asm/byteorder.h:72:4: error: 
      "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
#  error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
   ^
1 error generated.
make[1]: *** [aisimage.o] Error 1
make: *** [tools] Error 2
Plasmas-MBP:u-boot-lantiq plasma$ 

Almost at the point of running up a linux virtual machine to build it in.

Plasma

What I wrote earlier is rubbish.

It's correct that your host gcc is picked up, since you're building tools that should run on your Apple machine at this time.

I guess what is missing is some special handling if u-boot is compiled on OS X. Maybe some header files look different or they're missing on OS X.

It looks to me that compiling u-boot on OS X isn't supported and was never tested. Since the u-boot version we are using is slightly old, it's could be already fixed upstream.

It might be a good idea to report the bug to the u-boot guys and use a linux virtual machine to build u-boot in the meantime.

(Last edited by mkresin on 5 May 2016, 15:46)

The discussion might have continued from here.