'how to config u-boot for imx6?

When I am trying to make u-boot for apalis-aimx6-quad board, and below list is shows the details of my configuration:

  1. CROSS_COMPILER = aarch64-unknown-linux-gnu 1.1 it already exported to path 1.2 menuconfig of the cross compiler remains as before.
  2. Host Linux version = 5.4.0-109-generic #123~18.04.1-Ubuntu
  3. version of the cross compiler : crosstool-ng-1.25-rc2

according to the mentioned software and hardware properties, I faced with the following error when i try to make the boot-loader for my board using u-boot:

cc1: error: bad value (‘generic-armv7-a’) for ‘-mtune=’ switch
cc1: note: valid arguments to ‘-mtune=’ switch are: nocona core2 nehalem corei7
westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell 
skylake skylake-avx512 bonnell atom silvermont slm knl intel x86-64 eden-x2
nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron 
opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3
bdver4 znver1 btver1 btver2 generic
scripts/Makefile.build:147: recipe for target 'lib/asm-offsets.s' failed
make[1]: *** [lib/asm-offsets.s] Error 1
Makefile:1965: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

what can be the error solution?

and the Second question is: in the ./ct-ng list-samples what type of samples are suitable for my board?

CPU-NAME = NXP® i.MX 6Quad CPU-TYPE : 4x Arm Cortex™-A9 CPU-CLOCK : 800MHz FLOATING-POINT-UNIT : VFPv3



Solution 1:[1]

  1. You are using the wrong compiler, i.e. the gcc from your Linux PC, this is why the error message is suggesting to use values such as corei7 for the -mtune option.

  2. This being said, because your apalis-aimx6-quad SoC is a Cortex-A9,its architecture is Armv7-a and you therefore cannot use a compiler targeting the Armv8-a architecture, such as the aarch64-unknown-linux-gnu-gcc you are using. You should rather use, say, arm-unknown-linux-gnu-gcc or arm-none-eabi-gcc.I would strongly suggest to use an official Arm toolchain, such as this one (available here), for building u-boot, and to avoid using the latest 11.2 version: I have been unable to build u-boot when using it because of an internal compiler error.

  3. You should use CROSS_COMPILE=, and not CROSS_COMPILER= in your build command,and this is the reason why you were using your system gcc instead of aarch64-unknown-linux-gnu-gcc for building u-boot.

Bottom line, your build command should be something like:

CROSS_COMPILE=arm-none-eabi- make mrproper  apalis_imx6_defconfig all

After completion of the build command, you should see the u-boot artefacts:

ll u-boot*
-rwxrwxr-x 1 user user 4988448 May 13 07:56 u-boot*
-rw-rw-r-- 1 user user  569504 May 13 07:56 u-boot-dtb.bin
-rw-rw-r-- 1 user user  569568 May 13 07:56 u-boot-dtb.img
-rwxrwxr-x 1 user user  512920 May 13 07:56 u-boot-nodtb.bin*
-rw-rw-r-- 1 user user  639200 May 13 07:56 u-boot-with-spl.imx
-rw-rw-r-- 1 user user  569504 May 13 07:56 u-boot.bin
-rw-rw-r-- 1 user user   18081 May 13 07:55 u-boot.cfg
-rw-rw-r-- 1 user user   10858 May 13 07:55 u-boot.cfg.configs
-rw-rw-r-- 1 user user   56584 May 13 07:56 u-boot.dtb
-rw-rw-r-- 1 user user  569568 May 13 07:56 u-boot.img
-rw-rw-r-- 1 user user    1719 May 13 07:56 u-boot.lds
-rw-rw-r-- 1 user user 1100407 May 13 07:56 u-boot.map
-rwxrwxr-x 1 user user 1538914 May 13 07:56 u-boot.srec*
-rw-rw-r-- 1 user user  195657 May 13 07:56 u-boot.sym

Solution 2:[2]

I also do the same thing for RPI 4 which the following command lines do:

wget https://dev.iopsys.eu/fork/uboot.git
tar -xf u-boot.tar.gz
ls ./configs 
ls ./configs|grep rpi
make rpi_4_defconfig
export PATH=/home/<your user name>/x-tools/aarch64-rpi4-linux-gnu/bin/:$PATH
type aarch an hit tab if system recognize the compiler continue else 
go back and export the compiler path. 
export CROSS_COMPILE=aarch64-rpi4-linux-gnu-
make menuconfig
make
------------------------------------------------------------------------

cd ..
mkdir sdcard 
sudo cp ../u-boot/u-boot.bin .
wget    

------------------------------------------------------------------------
PREPARE MEMORY FOR BOOT
connect your memory to pc.
lsblk --> to know what is the name of the memory (assume it is sdb)
sudo umount /dev/sdb1
sudo cfdisk /dev/sdb --> erase older partitions and clear on 100M partition
-- note : type of the partition have to be fat32
once the partition is created. 
sudo mkfs.vfat /dev/sdb1
sudo mount /dev/sdb1 /mnt 
wget https://github.com/raspberrypi/firmware/raw/master/boot/start4.elf
wget https://github.com/raspberrypi/firmware/raw/master/boot/bcm2711-rpi-4-b.dtb
gedit config.txt
--#######################
IN THE CONFIG
enable_uart=1
kernel=u-boot.bin
arm_64bit=1
--#######################
cat config.txt
sudo cp * /mnt 
sudo umount /mnt
unconnect the memory and connect it to the target machine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 M.Mahdi Sayadi