之前尝试过编译banana-pi提供的BSP,能编译通过,根据官方的方法把u-boot烧写到SD卡中无法启动,串口也没有输出。香蕉派对于软件方面提供的支持很少,而且BSP也应该是在odroid-c4的基础上修改而来的。odroid-c4和BPI-M5的cpu都是相同的,硬件上的差异不太大,而odroid-c4官方提供了丰富的软件支持,GPU加速之类的,所以决定先参照odroid-c4的资料开始折腾,本博客记录u-boot的编译过程。PS:以后买开发板一定要看社区活跃程度和官方提供的技术支持是否完整。
1 安装toolchain
toolchain的版本是6.3,下载链接:
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
https://releases.linaro.org/archive/14.04/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz
执行以下命令安装toolchain:
sudo mkdir -p /opt/toolchains
sudo tar xvf gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz -C /opt/toolchains/
sudo tar xvf gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz -C /opt/toolchains/
将toolchain路径添加到环境变量:
sudo vim ~/.bashrc
在文件最末尾添加以下内容:
export ARCH=arm64
export CROSS_COMPILE=aarch64-none-elf-
export PATH=/opt/toolchains/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:/opt/toolchains/gcc-linaro-arm-none-eabi-4.8-2014.04_linux/bin:$PATH
执行命令,使环境变量改变立即生效:
source ~/.bashrc
执行以下命令,测试是否安装成功:
aarch64-none-elf-gcc -v
如果有类似输出则代表安装成功:
zhy@zhy-ThinkPad-E480:~$ aarch64-none-elf-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-none-elf-gcc
COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin/../libexec/gcc/aarch64-none-elf/4.8.3/lto-wrapper
Target: aarch64-none-elf
...
Thread model: single
gcc version 4.8.3 20131111 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.11 - Linaro GCC 2013.10)
2 编译u-boot
拉取u-boot代码:
git clone https://github.com/hardkernel/u-boot.git -b odroidg12-v2015.01
配置
cd u-boot
make odroidc4_defconfig
编译
make
编译后会在/u-boot/sd_fuse/目录生成u-boot.bin
3 烧写u-boot到SD卡
执行以下命令将u-boot.bin 烧写到SD卡
cd sd_fuse
./sd_fusing.sh /dev/mmcblk0
参考文章
https://wiki.odroid.com/odroid-c4/software/building_u-boot
|