如何为 imx6 配置 u-boot?
how to config u-boot for imx6?
当我尝试为 apalis-aimx6-quad 板制作 u-boot 时,下面的列表显示了我的配置的详细信息:
- CROSS_COMPILER = aarch64-unknown-linux-gnu
1.1 它已经导出到路径
1.2交叉编译器的menuconfig保持原样
- 主机Linux版本=5.4.0-109-通用#123~18.04.1-Ubuntu
- 交叉编译器版本:crosstool-ng-1.25-rc2
根据上述软件和硬件特性,当我尝试使用 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
错误解决方法是什么?
第二个问题是:
在 ./ct-ng list-samples 中什么类型的样本适合我的板子?
CPU-NAME = NXP® i.MX 6Quad
CPU-类型:4x Arm Cortex™-A9
CPU-时钟:800MHz
浮点单位:VFPv3
您使用了错误的编译器,即来自您 Linux PC 的 gcc,这就是为什么错误消息建议使用 corei7
等值的原因 -mtune
选项。
这就是说,因为您的 apalis-aimx6-quad SoC 是 Cortex-A9
,它的架构是 Armv7-a
,因此您不能使用针对 [=16] 的编译器=] 体系结构,例如您正在使用的 aarch64-unknown-linux-gnu-gcc
。您应该使用 arm-unknown-linux-gnu-gcc
或 arm-none-eabi-gcc
。我强烈建议使用官方 Arm 工具链,例如 this one (available here),用于构建 u-boot,并避免使用最新的11.2版本:由于内部编译器错误,我在使用它时无法构建u-boot。
您应该在构建命令中使用 CROSS_COMPILE=
,而不是 CROSS_COMPILER=
,这就是您使用系统 gcc 而不是 aarch64-[=43 的原因=] 建设 u-boot.
最重要的是,您的构建命令应该类似于:
CROSS_COMPILE=arm-none-eabi- make mrproper apalis_imx6_defconfig all
构建命令完成后,您应该会看到 u-boot 工件:
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
我也为 RPI 4 做同样的事情,下面的命令行做:
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.
当我尝试为 apalis-aimx6-quad 板制作 u-boot 时,下面的列表显示了我的配置的详细信息:
- CROSS_COMPILER = aarch64-unknown-linux-gnu 1.1 它已经导出到路径 1.2交叉编译器的menuconfig保持原样
- 主机Linux版本=5.4.0-109-通用#123~18.04.1-Ubuntu
- 交叉编译器版本:crosstool-ng-1.25-rc2
根据上述软件和硬件特性,当我尝试使用 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
错误解决方法是什么?
第二个问题是: 在 ./ct-ng list-samples 中什么类型的样本适合我的板子?
CPU-NAME = NXP® i.MX 6Quad CPU-类型:4x Arm Cortex™-A9 CPU-时钟:800MHz 浮点单位:VFPv3
您使用了错误的编译器,即来自您 Linux PC 的 gcc,这就是为什么错误消息建议使用
corei7
等值的原因-mtune
选项。这就是说,因为您的 apalis-aimx6-quad SoC 是
Cortex-A9
,它的架构是Armv7-a
,因此您不能使用针对 [=16] 的编译器=] 体系结构,例如您正在使用的aarch64-unknown-linux-gnu-gcc
。您应该使用arm-unknown-linux-gnu-gcc
或arm-none-eabi-gcc
。我强烈建议使用官方 Arm 工具链,例如 this one (available here),用于构建 u-boot,并避免使用最新的11.2版本:由于内部编译器错误,我在使用它时无法构建u-boot。您应该在构建命令中使用
CROSS_COMPILE=
,而不是CROSS_COMPILER=
,这就是您使用系统 gcc 而不是 aarch64-[=43 的原因=] 建设 u-boot.
最重要的是,您的构建命令应该类似于:
CROSS_COMPILE=arm-none-eabi- make mrproper apalis_imx6_defconfig all
构建命令完成后,您应该会看到 u-boot 工件:
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
我也为 RPI 4 做同样的事情,下面的命令行做:
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.