Search code examples
raspberry-pi3u-boot

u boot porting on rpi-3: getting error as "cc1: error: bad value (‘armv8-a’) for ‘-march=’ switch".


I am using link :https://elinux.org/RPi_U-Boot. This is my snapshot:

$ export CROSS_COMPILE=/scratch/rpi-tools/arm-bcm2708/arm 
bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-
pranav@abc:/scratch/u-boot$ export USE_PRIVATE_LIBGCC=yes
pranav@abc:/scratch/u-boot$ sudo make rpi_3_defconfig

upto this compiled successfully.Next stage gives error

pranav@abc:/scratch/u-boot$ sudo make -j3
scripts/kconfig/conf  --silentoldconfig Kconfig
GEN     include/autoconf.mk.dep
cc1: warning: unknown register name: x18
cc1: warning: unknown register name: x18  
warning: unable to access '/home/pranav/.config/git/attributes': 
Permission denied
cc1: warning: unknown register name: x18
cc1: warning: unknown register name: x18
cc1: error: bad value (‘armv8-a’) for ‘-march=’ switch
cc1: error: bad value (‘armv8-a’) for ‘-march=’ switch
cc1: note: valid arguments to ‘-march=’ switch are: nocona core2 

make[1]: *** [lib/asm-offsets.s] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [arch/arm/lib/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

After this I used:

$ export CROSS_COMPILE=aarch64-linux-gnu-

But then also giving some error.


Solution

  • CROSS_COMPILE=/scratch/rpi-tools/arm-bcm2708/arm bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi- relates to a 32bit compiler.

    The defconfig you are using is for 64-bit. So you have to install a 64-bit toolchain and then to specify CROSS_COMPILE to match the cross-building tools that you have installed.

    On Debian, Ubuntu, or Mint you would use

    sudo apt-get install gcc-aarch64-linux-gnu
    export CROSS_COMPILE aarch64-linux-gnu-