task中出现的错误及解决方法记录

本文介绍了如何在QEMU的ARM架构Linux系统中传输文件,包括创建rootfs、挂载和复制文件。同时详细讲述了遇到内核模块编译错误时的解决方案,如清理编译信息、设置编译变量和生成.config文件。
摘要由CSDN通过智能技术生成

1、从主机向qemu中的arm架构的linux系统传输文件

(1)创建rootfs文件夹,将其与rootfs.img放在同一文件夹下。

(2)挂载rootfs于rootfs.img:

sudo mount rootfs.img rootfs

  (3)创建driver文件夹:

sudo mkdir rootfs/driver

  (4) 复制目标文件:

sudo cp /home/h34/consolve_driver/consolve_driver.ko rootfs/driver

  (5)停止挂载:

sudo umount rootfs

  (6)进入虚拟机,模块在driver文件夹下,如果是内核模块:

insmod console_driver.ko

2、编写内核模块后make报错

(1)错误:

    make[1]: 进入目录“/home/h34/linux-6.2”
    warning: the compiler differs from the one used to build the kernel
    The kernel was built by: aarch64-linux-gnu-gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0
    You are using: gcc (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0
    CC [M] /home/h34/my_device/my_device_app.o
    gcc: error: unrecognized argument in option ‘-mstack-protector-guard=sysreg’
    gcc: note: valid arguments to ‘-mstack-protector-guard=’ are: global tls
    gcc: error: unrecognized command-line option ‘-mlittle-endian’
    gcc: error: unrecognized command-line option ‘-mbranch-protection=pac-ret+leaf’
    make[2]: *** [scripts/Makefile.build:252:/home/h34/my_device/my_device_app.o] 错误 1
    make[1]: *** [Makefile:2021:/home/h34/my_device] 错误 2
    make[1]: 离开目录“/home/h34/linux-6.2”
    make: *** [Makefile:7:all] 错误 2

(2)解决办法:

        a、进入linux-6.2内核文件,清理过往编译信息:

make clean //只清理编译所有产生的文件
make mrproper //清理编译所有产生的文件与config配置文件
make distclean //清理编译所有产生的文件与config配置文件,并且编辑过的补丁文件

        b、设置编译变量

export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64

        c、生成.config文件和make

make defconfig
make

        d、回到内核模块,清理过往编译信息,重新make

make clean
make

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值