Linux 学习调试记录

1、学习资料

1.1 官网

     内核

1.1 论坛         

     鸟哥官网          酷论坛     

1.2 博客

        磁盘,分区,文件系统 

 

2、基础知识

2.1 bash

  • 指令格式
command [-option] parameter1 parameter2 ...

//指令 选项 参数

 

3、思考的问题

3.1 文件权限问题

为什么通过 chmod 将文件夹的其他人属性改成不可读,在其他人的终端用ls 指令还是能查到文件夹的存在,有什么办法将文件夹设置成ls不可查?

思:这是由于此目录的父目录还是权限没变

 

3.2 /bin /sbin /usr/bin /usr/sbin 区别

/bin : 系统必备指令执行档
/sbin : 超级用户系统管理指令执行档
/usr/bin : 后期安装软件产生的指令执行档
/usr/sbin : 后期安装软件产生的系统管理指令执行档

 

3.3 目录的可执行问题

目录的执行权限不仅意味着查看目录下文件名还允许查看文件的其它信息如文件大小、修改时间
只有执行权限只能进入目录

 3.4 SUID/SGID/SBIT

SUID: 执行者具有拥有者的权限
SGID: 执行者具有群组者的权限
SBIT: 只能对自己建立的文件 删除/更名/移动 等操作

3、调试记录

3.1 编译问题

最近买了itop-4412 的板子 准被从内核移植  驱动编写  应用编程重新走一遍,刚开始很多问题没有搞懂,导致下面一些问题,后面会整理从0编译的文档

 

 

Makefile:506: arch//Makefile: No such file or directory

make: *** No rule to make target 'arch//Makefile'.  Stop.

ARCH?= $(SUBARCH) 这里不能修改成 ARCH?= $(arm)

Makefile中 $是递归展开 如果arm在之前没有定义 则ARCH展开为空

应该改为ARCH?= arm

gcc: error: unrecognized argument in option ‘-mabi=aapcs-linux’

gcc: note: valid arguments to ‘-mabi=’ are: ms sysv

gcc: error: unrecognized command line option ‘-mlittle-endian’

gcc: error: unrecognized command line option ‘-mno-thumb-interwork’

gcc: error: unrecognized command line option ‘-mfpu=vfp’

Kbuild:21: recipe for target 'kernel/bounds.s' failed

make[1]: *** [kernel/bounds.s] Error 1

Makefile:1097: recipe for target 'prepare0' failed

make: *** [prepare0] Error 2

CROSS_COMPLIE?= /home/cjx/Linux/Linux/LinuxTool/CompileTool/arm-2009q3/bin/arm-none-linux-

gnueabi-

 

这个问题是猜测是由于编译器OABI  ,而我下载最新的内核是只支持EABI的编译器 所以没法通过,所以我又下载

了3.1的版本来编译,去掉内核中的Kernel Features->Use the ARM EABIto compile the kernel选项

 

cc1: error: unrecognized command line option "-fstack-protector-strong"

Kbuild:35: recipe for target 'kernel/bounds.s' failed

make[1]: *** [kernel/bounds.s] Error 1

Makefile:980: recipe for target 'prepare0' failed

make: *** [prepare0] Error 2

这是由于编译器太老的原因 换个编译器 重新修改下Makefile编译器路径

 

fixdep: error opening depfile: kernel/.bounds.s.d: No such file or directory

Kbuild:35: recipe for target 'kernel/bounds.s' failed

make[1]: *** [kernel/bounds.s] Error 2

Makefile:980: recipe for target 'prepare0' failed

make: *** [prepare0] Error 2

有人说还是编译器不兼容内核的原因 可以查Documentation/Changes 看内核需要最低版本的编译器

Gnu C                  3.2                     # gcc --version

换了4.4.3的版本还是不行

bounds.c里面是个跳跃函数

这里看问题的描述是在Kbuild的35行,Kbuild是内核的配置文件,这里看出bounds.s 是由bounds.c生成的,

但是为什么生成不了呢,最后想想还是编译器不行,又把下载了3.3.2的版本,编译又出现下面的问题

 

error: unrecognized command line option '-fstack-protector-strong

解决办法:

在kernel目录下:

make menuconfig   

在 General setup——

Optimize very unlikely/likely branches   把该项在编译该项中去掉。如下图:

或者把子选项Stack Protector buffer overflow detection 设置为None

接着编译

Assembler messages:

Error: unknown architecture `armv7-a'

 

scripts/Makefile.build:257: recipe for target 'scripts/mod/empty.o' failed

make[2]: *** [scripts/mod/empty.o] Error 1

scripts/Makefile.build:402: recipe for target 'scripts/mod' failed

make[1]: *** [scripts/mod] Error 2

Makefile:555: recipe for target 'scripts' failed

make: *** [scripts] Error 2

这应该是menuconfig没有配置好的原因,

在System Type中选择Samsung S3C24XX SoCs

/home/cjx/usr/local/arm/3.3.2/bin/../lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/as: unrecognized option '-gdwarf-2'

scripts/Makefile.build:293: recipe for target 'usr/initramfs_data.o' failed

make[1]: *** [usr/initramfs_data.o] Error 1

Makefile:937: recipe for target 'usr' failed

make: *** [usr] Error 2

这里看还是gcc有问题 没有 gdwarf-2 的选项

最终又换了编译器通过,后续要分析下编译器与内核的关系

 

  CHK     include/config/kernel.release
Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
Makefile:1090: recipe for target 'prepare-compiler-check' failed
make: *** [prepare-compiler-check] Error 1


说明编译器不支持更强的堆栈保护,
在 >General setup->Stack Protector buffer overflow detection (Regular)  --->
改成Regular
这个变量在arch/Kconfig里面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值