环境搭建和编译-kernel

这里主要记录下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
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

永不秃头的程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值