环境搭建和编译-kernel

文章目录

  • 一、下载Kernel
  • 二、下载完代码后配置环境变量
  • 三、编译内核
  • 四、编译uboot
  • 五、编译中的错误

这里主要记录下kernel的代码下载和编译

一、下载Kernel

git clone https://gerrit.googlesource.com/git-repo  (谷歌官方源)
git clone https://mirrors.tuna.tsinghua.edu.cn/git/git-repo (国内清华源)
git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo (国内中科大源)
// 配置REPO_URL
// 在到构建和谐社会的前提下,需要修改REPO_URL,可参考以下修改:
vim repo
## REPO_URL = 'https://gerrit-googlesource.proxy.ustclug.org/git-repo'
REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

// 配置好的repo(二选一)

git clone  https://gitee.com/oschina/repo.git
git clone https://e.coding.net/codebug8/repo.git
// 100ask_imx6ull_pro开发板

book@100ask:~$ git clone https://e.coding.net/codebug8/repo.git
book@100ask:~$ mkdir -p 100ask_imx6ull-sdk && cd 100ask_imx6ull-sdk
book@100ask:~/100ask_imx6ull-sdk$ ../repo/repo init -u  https://gitee.com/weidongshan/manifests.git -b linux-sdk -m imx6ull/100ask_imx6ull_linux4.9.88_release.xml  --no-repo-verify
book@100ask:~/100ask_imx6ull-sdk$  ../repo/repo sync -j4

// 100ask_imx6ull_pro开发板linux kernel5.4版本

book@100ask:~$ git clone https://e.coding.net/codebug8/repo.git
book@100ask:~$ mkdir -p 100ask_imx6ull_pro-sdk && cd 100ask_imx6ull_pro-sdk
book@100ask:~/100ask_imx6ull_pro-sdk$ ../repo/repo init -u  https://gitee.com/weidongshan/manifests.git -b linux-sdk -m imx6ull/100ask_imx6ull_linux5.4.24_release.xml  --no-repo-verify
book@100ask:~/100ask_imx6ull_pro-sdk$  ../repo/repo sync -j4

二、下载完代码后配置环境变量

vi ~/.bashrc
export ARCH=arm
export CROSS_COMPILE=arm-buildroot-linux-gnueabihf- 
export PATH=$PATH:/home/tony/100ask_ix6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin
// 注意这里的路径 

相关验证


tony@lc:~/study/Linux-4.9.88$ source ~/.bashrc
tony@lc:~/study/Linux-4.9.88$ arm-buildroot-linux-gnueabihf-gcc -v
使用内建 specs。
COLLECT_GCC=/home/tony/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/arm-buildroot-linux-gnueabihf-gcc.br_real
COLLECT_LTO_WRAPPER=/home/tony/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin/../libexec/gcc/arm-buildroot-linux-gnueabihf/7.5.0/lto-wrapper
目标:arm-buildroot-linux-gnueabihf
配置为:./configure --prefix=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host --sysconfdir=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host/etc --enable-static --target=arm-buildroot-linux-gnueabihf --with-sysroot=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host/arm-buildroot-linux-gnueabihf/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --with-gmp=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host --with-mpc=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host --with-mpfr=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host --with-pkgversion='Buildroot 2020.02-gee85cab' --with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath --enable-tls --enable-plugins --enable-lto --enable-threads --with-isl=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host --with-abi=aapcs-linux --with-cpu=cortex-a7 --with-fpu=neon-vfpv4 --with-float=hard --with-mode=arm --enable-languages=c,c++,fortran --with-build-time-tools=/home/book/100ask_imx6ull-sdk/Buildroot_2020.02.x/output/host/arm-buildroot-linux-gnueabihf/bin --enable-shared --enable-libgomp
线程模型:posix
gcc 版本 7.5.0 (Buildroot 2020.02-gee85cab)

这样就ok了
然后就可以编译了

三、编译内核

tony@lc:~/sdcard/imx6ull-pro/Linux-4.9.88$ make mrproper

tony@lc:~/sdcard/imx6ull-pro/Linux-4.9.88$ make 100ask_imx6ull_defconfig 
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

tony@lc:~/sdcard/imx6ull-pro/Linux-4.9.88$ make zImage -j4

tony@lc:~/sdcard/imx6ull-pro/Linux-4.9.88$ make dtbs

四、编译uboot

tony@lc:~/sdcard/imx6ull-pro/Uboot-2017.03$ make disclean

tony@lc:~/sdcard/imx6ull-pro/Uboot-2017.03$ make mx6ull_14x14_evk_defconfig

tony@lc:~/sdcard/imx6ull-pro/Uboot-2017.03$ make 

五、编译中的错误

  LZO     arch/arm/boot/compressed/piggy_data
/bin/sh: 1: lzop: not found
arch/arm/boot/compressed/Makefile:186: recipe for target 'arch/arm/boot/compressed/piggy_data' failed
make[2]: *** [arch/arm/boot/compressed/piggy_data] Error 1
make[2]: *** 正在等待未完成的任务....
make[2]: *** wait: 没有子进程。 停止。
arch/arm/boot/Makefile:53: recipe for target 'arch/arm/boot/compressed/vmlinux' failed
make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2
arch/arm/Makefile:329: recipe for target 'zImage' failed
make: *** [zImage] Error 2

安装 lzop

tony@lc:~/sdcard/imx6ull-pro/Linux-4.9.88$  sudo apt install lzop

你可能感兴趣的:(韦东山老师imx6ull,驱动学习,大数据,c语言,嵌入式硬件)