linux txt
来源:互联网 发布:日进斗金软件 编辑:程序博客网 时间:2024/05/02 02:04
1.Ubuntu-10.04(LTS) :Vmware vmare player
2.minicom : serial terminal target shell
3.tftp server: target board(bootloader)HW
copy the kernel image(in host-pc) to RAM, and boot the kernel(down load to tftp server)
4.nfs server: target board (Linux)HW
mount HOST file system by network(执行类似本地文件)
(USB RDNIS)
adb push driver file directory
5.cross compiler : ARM GCC ,kernel source compile, driver source compile(SW)
[ way to test hello module:minicom (in minicom)
#cd /mnt/nfs/el2440-driver/sample-src/hello module
#insmod hello_module.ko
#lsmod
#rmmod hello_module
step in studying device driver
1. character driver : major number device file(oplication ?)
2. LDM (Linux Driver Model) : bus/device/driver (it is the key and very important)
3. LDM : class (every device must be belong to a class) USB FB MDP
1.open VMware player -> file -> open a virtual file(add ubuntu)-> ex
alt + ctrl + enter
google use 10.04 for android(newly is 13.04)
2.virtual machine for setting(ctrl + D) : option + shared folders -> always enable
=> add => next => browse => select el2440-lab2 => rename "Shared"
then select Places => Floppy Drive ,we can see Shared
then run Terminal,enter minicom,then press "reset key" in the board
terminal-> enter "minicom" -> set com1 -> connect
root => cd / => etc
//
AUTO.txt
[Target-BD:minicom]
tftp 30c00000 zImage
tftp 30800000 ramdisk.gz
go linux
mount -t nfs 192.168.100.2:/tftpboot /mnt/nfs
mount -t jffs2 /dev/mtdblock3 /mnt/mtd3
[Host-PC:ubuntu]
ifconfig eth1 192.168.100.2 up
/etc/init.d/xinetd restart second,then "ifconfig"
/etc/init.d/nfs-kernel-server restart
another command:
1. first : ifconfig eth1 192.168.100.2 up
2. second: /etc/init.d/xinetd restart input "ifconfig"
quit command
minicom => tftp 30c00000 zImage
//
PM1:
target board PA map
[1] ROM : 0x0
[2] RAM : 0x30000000 ~ 0x33FFFFFF[64MB]
[3] SFR : 0x40000000 [AHB] map for momery
0x50000000 [APB]
*linux 使用虚拟空间 linux va map : 32 bit [4GB] linux space
linux kernel[1G](0xFFFFFFFF ~ 0XC0000000 start(this can be lower but can not be above as 0xBF000000 in ARM)) shared memory
linux user [3G](0xBFFFFFFF ~ 0X0) not a shared memory
momery.h TASK_SIZE
lsmod can find hello_module 1088 0 - Live 0xbf000000(start point addr)
in file linux-2.6.24-el2440-v2.0,we can see system.map (by search initcall)
init.h main.c(do_initcall)int /init/
makefile in hello_module
# EL-2440 kernel 2.6 driver Makefile
obj-m := hello_module.o
KDIR := /usr/src/elayer/linux-2.6.24-el2440-v2.0
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean :
rm -rf *.ko
rm -rf *.mod.*
rm -rf .*.cmd
rm -rf *.o
PM2:
[way to test mydrv : minicom]
1.#cd /mnt/nfs/el2440-driver/sample-src/mydrv
#mkbod /dev/mydrv c 240 0 (creat node )
#insmod mydrv.ko
#lsmod
#cat /proc/devices
commad:
cat /proc/cpuinfo/
ls /proc/
cat /proc/devices
unsmod?
*File System ~/include/linux/fs.h struct file_operations{}函数指针fp
[1]struct inode (very important)
has the infomation of a file in the disk
dev_t i_rdev : [(high 12bit)12bit(major number) | 20bit (minor number)]
mknod /dev/mydrv c 240 0 (it is device file,can not use like a real file,is a fake file)
(if the num is not in the rang,the driver fun will not be called,as we set 243)
insmod mydrv.ko ==> register file_operations(many function) to 240 in driver table,other driver can not use this number
unistd.h (can not change the num,just can use the system call num)
<application> : can access to H/W with standard and abstraction way.
int fd = open("/dev/mydrv",O_RDWR); (open virtual function) (int fd = open("hello.txt",O_RDWR);use in normal function)
int fd = open("/dev/video0",O_RDWR);//operation call , open camera device
//but the name is not important,open("/dev/video0",O_RDWR) can use "/dev/aaa" ?(first we should change mknod /dev/aaa c 240 0 )
//"swi 5"-->(sytem call,only way to change into kernel)-->kernel mode -->sys_open():get major number,(has two nums)
create file objecter ,get 240 file_operations,save it to file object-->mydrv_open() in mydry.c
//MAJOR(inode->i_rdev);和file *file 的区别是?
read(fd,buf_in,MAX_BUFFER);
//"swi 3"-->kernel_mode--sytem_read()-->mydrv_read()will be call
write(fd,buf_out,)
//"swi 4"-->kernel_mode--sytem_write()-->mydrv_write()will be call(unsitd.h)
close(fd) locate below framework(dinamic),like JNI,NDK(C,C++) HAL is a lib(***.so),in HAL use ioctl, deliver command to device driver
//"swi 6"-->kernel_mode--sytem_close()-->mydrv_release()-->sys_close:delete file object
camera device(video0) can not write, just read
[2]struct file : dinamic
created when calling open()
removed when calling close()
created in memory,can be created many times
one device must be belong to a class
command:
strace
strace xterm(root@elayer will go sleep)
<linux/time.h> compile I can not use the function of localtime()
- linux txt
- linux网络命令.txt
- linux分区.txt
- linux安装mysql.txt
- linux安装mysql.txt
- linux/fs/proc.txt
- linux/Documentation/java.txt
- Linux/Documentation/io_ordering.txt
- Linux Makefile.txt 分析
- linux中文乱码txt
- linux CMakeLists.txt 语法
- [Linux DMA]DMA-mapping.txt
- [Linux DMA]DMA-API.txt
- linux网络服务器上.txt
- linux监控和管理.txt
- linux下TXT显示乱码
- linux-2.6.30 devices.txt
- Linux mannual page to txt
- C#中TreeView组件使用方法初步
- Java基础复习:线程练习1
- Java中"=="与equals()方法的区别
- sql表查询某一字段为空的记录的问题
- Ext使用form布局时 使用hide()方法或者setVisible()隐藏textfile 等组件 filedLable不隐藏问题
- linux txt
- 在windows下调试linux内核
- 平台调用:C# 使用非托管dll函数
- ReSharper使用手册:配置语法高亮字体和颜色
- java的八大基本类型
- 初识bat文件
- MapReduce框架编程体会
- Andriod编译内核模块*.ko
- 三层架构实战篇—系统登录实例