易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : linux

linux驱动之makefile详解

# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
    obj-m := hello.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
    KERNELDIR ?= /lib/modules/$(shell uname -r)/build
    PWD := $(shell pwd)
default:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
当我们敲下make时,我们进入了这个权威的makefile二次。第一次进入makefile,发现KERNELRELEASE没有被设置时,于是她根据build这个符号链接定位内核源代码目录,然后进入default,开始第二个make,-C选项进入内核源代码目录,找到顶层的makefile,然后-M返回当前目录执行makefile文件,这就是第二次进入这个makefile,在这次,由于KERNELRELEASE变量已经定义,因此不需要进入else语言,在这里,obj-m:=hello.o这个语句和我们以前不是驱动程序中的makefile不同,在这里内核会帮你处理一切,这句话是告诉内核,需要从hello.o创建一个驱动模型(module)。
参考文献 ......

Linux GCC make文件的写法3

 包含3个文件夹
目录组织结构如下:
inc/hello.h
main/main.c, Makefile
src/hello.c
文件内容如下:
hello.h:
void hello(char name[]);
main.c:
#include <stdio.h>
#include "../inc/hello.h"
// The second hello.h should in ""
int main()
{
hello("GCC");
printf("Haha Linux Ubuntu!\n");
return 0;
}
其中,第二个包含文件,hello.h,必须要用"",如果用<>则gcc只会到系统目录下去搜索,不会到本当前目录下搜索
就是""在用户目录下,<>在系统目录下,这个在windows上不严格, 在linux里似乎很严格
Makefile版本1:
# String declaration
objects = main.o hello.o
# Command
app : $(objects)
cc -o app $(objects)
main.o : main.c hello.h
cc -c main.c
hello.o : hello.c stdio.h
cc -c ../src/hello.c
# Search paths
vpath %.h /usr/include ../inc
vpath %.c ../src
# Clean the intermediate files
.PHONY : clean
clean :
rm app $(objects)
貌似vpath只对 %.o : 后面的有影响,下面的cc -c没有作用
**************************
确实是这样的,
%.o : %.c %.h,这句话是ma ......

Linux下锁用户与解锁问题

Linux下锁用户与解锁问题 [原创 2010-02-03 21:44:35]   
字号:大 中 小
一:登录失败次回超过限制
1)锁用户的设定
/etc/pam.d/下包含各种认证程序或服务的配置文件。编辑这些可限制认证失败次数,当失败次数超过指定值时用户会被锁住。
在此,以run level为3的时候,多次登录登录失败即锁用户为例:
在/etc/pam.d/login文件中追加如下两行:
auth required /lib/security/pam_tally.so onerr=fail no_magic_root
account required /lib/security/pam_tally.so deny=3 no_magic_root reset
deny=3 设置登录失败3次就将用户锁住,该值可任意设定。
如下为全文见设定例:
auth      required pam_securetty.so
auth      required pam_stack.so service=system-auth
auth      required pam_nologin.so
auth      required pam_tally.so onerr=fail no_magic_root
account   required pam_stack.so service=system-auth
account   required pam_tally.so deny=3 no_magic_root reset ......

Linux GCC make文件的写法4 清晰版

包含3个文件夹,和一个文件Makefile
目录组织结构如下:
Makefile
inc/hello.h
main/main.c
src/hello.c
Makefile文件在外面,这样生成的.o和可执行文件都在外面,clean之后会很干净,结构清晰
文件内容如下:
Makefile(之所以用大写,因为make可以识别Makefile和makefile,用大写可以鲜明一些)::
# String declaration
objects = main.o hello.o
# Command
app : $(objects)
cc -o app $(objects)
main.o : main/main.c hello.h
cc -c main/main.c
hello.o : src/hello.c stdio.h
cc -c src/hello.c
# Search paths
vpath %.h /usr/include inc
# Clean the intermediate files
.PHONY : clean
clean :
rm app $(objects)

hello.h:
void hello(char name[]);
main.c:
#include <stdio.h>
#include "../inc/hello.h"
// The second hello.h should in ""
int main()
{
hello("GCC");
printf("Haha Linux Ubuntu!\n");
return 0;
}
其中,第二个包含文件,hello.h,必须要用"",如果用<>则gcc只会到系统目录下去搜索,不会到本当前目录下搜索
就是""在用户目录下,<>在系统目录下,这个在windows ......

LINUX FREEBSD 文件系统结构


Linux
/ Linux文件系统的入口,也是处于最高一级的目录;
/bin 基础系统所需要的那些命令位于此目录,也是最小系统所需要的命令;比如 ls、cp、mkdir等命令;功能和/usr/bin类似,这个目录中的文件都是可执行的,普通用户都可以使用的命令。做为基础系统所需要的最基础的命令就是放在这里。
/boot Linux的内核及引导系统程序所需要的文件,比如 vmlinuz initrd.img 文件都位于这个目录中。在一般情况下,GRUB或LILO系统引导管理器也位于这个目录;
/dev 设备文件存储目录,比如声卡、磁盘...
/etc 系统配置文件的所在地,一些服务器的配置文件也在这里;比如用户帐号及密码配置文件;
/home 普通用户家目录默认存放目录;
/lib 库文件存放目录
/lost+found 在ext2或ext3文件系统中,当系统意外崩溃或机器意外关机,而产生一些文件碎片放在这里。当系统启动的过程中fsck工具会检查这里,并修复已经损坏的文件系统。 有时系统发生问题,有很多的文件被移到这个目录中,可能会用手工的方式来修复,或移到文件到原来的位置上。
/media 即插即用型存储设备的挂载点自动在这个目录下创建,比如USB盘系统自动挂载后,会在这个目录下产生一个目录;CDROM/DVD自动挂载后,也 ......

Linux系统下修改MySQL的root密码

第一种方法:
root用户登录系统
usr/local/mysql/bin/mysqladmin -u root -p password 新密码
enter password 旧密码
第二种方法:
root用户登录mysql数据库
mysql> update mysql.user set password=password("新密码")where User="root";
mysql> flush privileges;
mysql> quit ;
mysql忘记root密码如何处理?
如果 MySQL 正在运行,首先结束mysql进程: killall mysqld
启动 MySQL (非正常方式起动):/usr/local/mysql/bin/mysqld_safe –skip-grant-tables &
这样就可以不需要密码进入 MySQL :/usr/local/mysql/bin/mysql -u root -p (要求输入密码时直接回车即可)
mysql> update user mysql.set password=password("新密码") where user="root";
mysql> flush privileges;
mysql> quit;
重新结束进程:killall mysqld
用正常方式启动 MySQL :/usr/local/mysql/bin/mysqld_safe -user=mysql &
注:
update语句里的password=password("新密码")只有新密码三个字在操作时替换成我们要设置的密码,其它原样照写,之前我做失败
的原因就在于把括号及前面的password给略掉造成的.它们的作用是使密码以加密的形式存储 ......

Linux系统下修改MySQL的root密码

第一种方法:
root用户登录系统
usr/local/mysql/bin/mysqladmin -u root -p password 新密码
enter password 旧密码
第二种方法:
root用户登录mysql数据库
mysql> update mysql.user set password=password("新密码")where User="root";
mysql> flush privileges;
mysql> quit ;
mysql忘记root密码如何处理?
如果 MySQL 正在运行,首先结束mysql进程: killall mysqld
启动 MySQL (非正常方式起动):/usr/local/mysql/bin/mysqld_safe –skip-grant-tables &
这样就可以不需要密码进入 MySQL :/usr/local/mysql/bin/mysql -u root -p (要求输入密码时直接回车即可)
mysql> update user mysql.set password=password("新密码") where user="root";
mysql> flush privileges;
mysql> quit;
重新结束进程:killall mysqld
用正常方式启动 MySQL :/usr/local/mysql/bin/mysqld_safe -user=mysql &
注:
update语句里的password=password("新密码")只有新密码三个字在操作时替换成我们要设置的密码,其它原样照写,之前我做失败
的原因就在于把括号及前面的password给略掉造成的.它们的作用是使密码以加密的形式存储 ......
总记录数:5772; 总页数:962; 每页6 条; 首页 上一页 [288] [289] [290] [291] 292 [293] [294] [295] [296] [297]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号