编译内核出错,请老师指点!!!

book@Ubuntu22:~$ echo $ARCH
arm
book@Ubuntu22:~$ echo $CROSS_COMPILE
arm-buildroot-linux-gnueabihf-
book@Ubuntu22:~$ arm-buildroot-linux-gnueabihf-gcc --version
arm-buildroot-linux-gnueabihf-gcc.br_real (Buildroot 2020.02-gee85cab) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

book@Ubuntu22:~$ bear --version
bear 3.0.18
book@Ubuntu22:~$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
book@Ubuntu22:~$ cd 100ask_imx6ull-sdk/Linux-4.9.88/
book@Ubuntu22:~/100ask_imx6ull-sdk/Linux-4.9.88$ bear make zImage -j4
Unrecognized parameter: “make”
Usage: bear [–output ] [–verbose] – …
book@Ubuntu22:~/100ask_imx6ull-sdk/Linux-4.9.88$

ubuntu 22.04 版本单独编译内核方法如下:

1. 配置交叉编译器,按自己的路径来;
export ARCH=arm 
export CROSS_COMPILE=arm-buildroot-linux-gnueabihf- 
export PATH=$PATH:/opt/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin 

2. 验证交叉编译器
arm-buildroot-linux-gnueabihf-gcc -v

3. 下载 gcc-9
sudo apt install gcc-9

4. 将 gcc 版本都切换为 9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100

5. 查看当前 gcc 版本,确定为 gcc-9 版本
gcc --version

6. 清除上次生成的编译环境
make distclean

7. 配置单板,该配置为 imx6ull_pro 的
make 100ask_imx6ull_defconfig

8. 编译内核
make zImage

9. 如果报错如下,那么执行第十步,然后继续编译内核
/bin/sh: 1: lzop: not found
  CC      arch/arm/boot/compressed/decompress.o
make[2]: *** [arch/arm/boot/compressed/Makefile:186: arch/arm/boot/compressed/piggy_data] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [arch/arm/boot/Makefile:53: arch/arm/boot/compressed/vmlinux] Error 2
make: *** [arch/arm/Makefile:329: zImage] Error 2

10. 安装 lzop
sudo apt-get install lzop

参考博客1
参考博客2

谢谢老师指导!编译内核成功!!!
Ubuntu22 安装 gcc-9,需要先完成一下步骤:

  1. 要导入 PPA
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y

  2. 运行更新和升级
    sudo apt update && sudo apt upgrade

  3. 已安装 build-essential 软件包
    sudo apt install build-essential -y

  4. 下载 gcc-9
    sudo apt install gcc-9 g+±9

参考链接1

1 个赞