yocto环境学习--工具链和单独编译uboot,kernel

1.Restarting a build environment

source setup-environment <build_dir>


2.gcc工具链

bitbake meta-toolchain
./tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-cortexa7hf-vfp-neon-toolchain-1.8.sh

3.QT工具链
bitbake meta-toolchain-qt5

4.编译uboot
source /opt/poky/1.8/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi
make mx6ul_14x14_evk_defconfig
make

5.编译kernel
export ARCH=arm
export CROSS_COMPILE=$TARGET_PREFIX
unset LDFLAGS
make imx_v7_defconfig
make uImage LOADADDR=0x10008000

make命令会生成Linux的dtb文件


6.单独编译C文件

yangzhiwen@yzw-kingsee:~$ cd /home/work/Elmo/test/test/
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$ ls
main.c  test
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$ rm test
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$ cat main.c
#include "stdlib.h"
#include "stdio.h"

void main(void)
{
        printf("Hello world\n");
}
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$ source /opt/poky/1.8/environment-setup-cortexa7hf-vfp-neon-poky-linux-gnueabi
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$ echo $CC
arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/opt/poky/1.8/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$ $CC main.c -o test
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$ file test
test: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=ad28e302b106823c7cbcd038f9cb4940c14b5f57, not stripped
yangzhiwen@yzw-kingsee:/home/work/Elmo/test/test$

阅读更多

没有更多推荐了,返回首页