用于自己记录
RomBOOT
hw_init_hook: OFF Lcd BackLight test
AT91Bootstrap 3.5.4 (Wed Aug 4 02:01:58 PDT 2021)
LOGO Image Info:filename[NULL], dest[0x73e00000], offset[0x100000], length[0x19000]
NAND: ONFI not supported
NAND: Manufacturer ID: 0x0x98 Chip ID: 0x0xd3
NAND: Disable On-Die ECC
NAND: Using Software ECC
NAND: Image: Copy 0x19000 bytes from 0x100000 to 0x73e00000
BMP Info: bpp = 0x18,width = 0x16d, height = 0x52, data_offset = 0x36.
DDR size is 64MB
-- 2 --x_start_pos = 0x89, y_start_pos = 0xc7.
* DMA Frame Configuration Register = 0x7025800
input clk=0x5f5e100
clk div val=0x3
Updated pix clock=0x17d7840
*FIFO Threshold= 0x1ed
*Disable all interrupts
*Set contrast
FPGA type is xilinx lx16
FPGA Image Info:filename[NULL], dest[0x70007fc0], offset[0xc00000], length[0x100000]
NAND: ONFI not supported
NAND: Manufacturer ID: 0x0x98 Chip ID: 0x0xd3
NAND: Disable On-Die ECC
NAND: Using Software ECC
NAND: Image: Copy 0x100000 bytes from 0xc00000 to 0x70007fc0
Done to load image len = 0x100000
Fpga config...
Done High
Done, REG:0xa956
Kernel Image Info:filename[NULL], dest[0x70007fc0], offset[0x1000000], length[0x300000]
NAND: ONFI not supported
NAND: Manufacturer ID: 0x0x98 Chip ID: 0x0xd3
NAND: Disable On-Die ECC
NAND: Using Software ECC
NAND: Image: Copy 0x300000 bytes from 0x1000000 to 0x70007fc0
Image magic: 0x27051956 is found
Starting linux kernel ..., machid: 0x8a4
Uncompressing Linux.................................................................................................................................................... done, booting the kernel.
Linux version 2.6.30-V1.0 (shanjuntao@ubuntu) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #11 PREEMPT Sat Jul 31 02:00:32 PDT 2021
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Atmel AT91SAM9G45-EKES
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 15748
Kernel command line: mem=62M console=ttyS0,115200 video=atmel_fb:0x73E00000,0x200000 root=/dev/mtdblock6 rootfstype=yaffs2 rw rootdelay=0
NR_IRQS:192
AT91: 160 gpio irqs in 5 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttyS0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 62MB = 62MB total
Memory: 57684KB available (4204K code, 680K data, 128K init, 0K highmem)
Calibrating delay loop... 198.14 BogoMIPS (lpj=99072)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 296 bytes
NET: Registered protocol family 16
liuliu at91_add_device_lcdc 916
AT91: Power Management
AT91: Starting after software reset
atmel_tcb: probe of atmel_tcb.0 failed with error -22
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
JFFS2 version 2.2. (NAND) (SUMMARY) ? 2001-2006 Red Hat, Inc.
yaffs Jul 17 2021 20:39:25 Installing.
msgmni has been set to 112
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
atmel_lcdfb atmel_lcdfb.0: 2048KiB frame buffer at 73e00000 (mapped at c4400000)
atmel_lcdfb atmel_lcdfb.0: fb0: Atmel LCDC at 0x00500000 (mapped at c406c000), irq 23
atmel_usart.0: ttyS0 at MMIO 0xfeffee00 (irq = 1) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfff90000 (irq = 8) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
ssc ssc.1: Atmel SSC device at 0xc4078000 (irq 17)
Driver 'sd' needs updating - please use bus_type methods
libertas_sdio: Libertas SDIO driver
libertas_sdio: Copyright Pierre Ossman
NAND device: Manufacturer ID: 0x98, Chip ID: 0xd3 (Toshiba NAND 1GiB 3,3V 8-bit)
AT91 NAND: 8-bit, Software ECC
Scanning device for bad blocks
Bad eraseblock 357 at 0x000005940000
Bad eraseblock 359 at 0x0000059c0000
Bad eraseblock 1536 at 0x000018000000
Bad eraseblock 1537 at 0x000018040000
Bad eraseblock 3516 at 0x000036f00000
Bad eraseblock 3574 at 0x000037d80000
Bad eraseblock 3584 at 0x000038000000
Bad eraseblock 3585 at 0x000038040000
Bad eraseblock 3614 at 0x000038780000
Bad eraseblock 3696 at 0x000039c00000
Bad eraseblock 3780 at 0x00003b100000
Bad eraseblock 3826 at 0x00003bc80000
Bad eraseblock 3850 at 0x00003c280000
Bad eraseblock 4006 at 0x00003e980000
Creating 12 MTD partitions on "atmel_nand":
0x000000000000-0x000000100000 : "Partition 1: BOOT"
0x000000100000-0x000000200000 : "Partition 2: Logo"
0x000000200000-0x000000c00000 : "Partition 3: Recovery"
0x000000c00000-0x000000e00000 : "Partition 4: FPGA1"
0x000000e00000-0x000001000000 : "Partition 5: FPGA2"
0x000001000000-0x000001400000 : "Partition 6: KERNEL"
0x000001400000-0x000003400000 : "Partition 7: ROOTFS"
0x000003400000-0x000007400000 : "Partition 8: Cache"
0x000007400000-0x000007800000 : "Partition 9: Reserved1"
0x000007800000-0x000007c00000 : "Partition 10: Reserved2"
0x000007c00000-0x000027c00000 : "Partition 11: USERFS"
0x000027c00000-0x000040000000 : "Partition 12: DATAFS"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffa4000 (irq 14)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
atmel-ehci atmel-ehci: Atmel EHCI UHP HS
atmel-ehci atmel-ehci: new USB bus registered, assigned bus number 1
atmel-ehci atmel-ehci: irq 22, io mem 0x00800000
atmel-ehci atmel-ehci: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Atmel EHCI UHP HS
usb usb1: Manufacturer: Linux 2.6.30-V1.0 ehci_hcd
usb usb1: SerialNumber: atmel-ehci
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 2
at91_ohci at91_ohci: irq 22, io mem 0x00700000
usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: AT91 OHCI
usb usb2: Manufacturer: Linux 2.6.30-V1.0 ohci_hcd
usb usb2: SerialNumber: at91
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 0 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbtest
mice: PS/2 mouse device common for all mice
liuliu_testtesttest222 f216l_key_init 163
liuliu f216l_key_init 170
liuliu f216l_key_init 190
input: F216L_KEY as /devices/virtual/input/input0
liuliu f216l_key_init 206
liuliu f216l_key_init 216
liuliu f216l_key_init 224
liuliu f216l_key_init 224
liuliu f216l_key_init 224
liuliu f216l_key_init 224
liuliu f216l_key_init 234
i2c /dev entries driver
i2c-gpio i2c-gpio.0: using pins 52 (SDA) and 53 (SCL)
at24 1-0050: 65536 byte 24c512 EEPROM (writable)
rtc-pcf8563 1-0051: chip found, driver version 0.4.3
rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0
i2c-gpio i2c-gpio.1: using pins 74 (SDA) and 75 (SCL)
p89lpc933 1-002e: registered with irq(128)
Linux video capture interface: v2.00
leds-gpio: probe of leds-gpio failed with error -16
at_hdmac at_hdmac: Atmel AHB DMA Controller ( cpy slave ), 8 channels
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
logger: created 64K log 'log_main'
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
Advanced Linux Sound Architecture Driver Version 1.0.20.
No device for DAI atmel-ssc0
No device for DAI atmel-ssc1
No device for DAI atmel-ssc2
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
lib80211: common routines for IEEE802.11 drivers
rtc-pcf8563 1-0051: low voltage detected, date/time is not reliable.
rtc-pcf8563 1-0051: retrieved date/time is not valid.
rtc-pcf8563 1-0051: hctosys: invalid date/time
usb 1-2: new high speed USB device using atmel-ehci and address 2
atmel_mci atmel_mci.0: Atmel MCI controller at 0xfff80000 irq 11, 1 slots
yaffs: dev is 32505862 name is "mtdblock6"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.6, "mtdblock6"
usb 1-2: New USB device found, idVendor=23a9, idProduct=ef18
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-2: Product: Mass Storage
usb 1-2: Manufacturer: AI210
usb 1-2: configuration #1 chosen from 1 choice
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new SDHC card at address 0001
mmcblk0: mmc0:0001 SD 3.69 GiB
mmcblk0:<7>usb-storage 1-2:1.0: usb_probe_interface
p1 p2
scsi0 : SCSI emulation for USB Mass Storage devices
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs2 filesystem) on device 31:6.
Freeing init memory: 128K
Warning: create dev/console failed
yaffs: dev is 32505866 name is "mtdblock10"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.10, "mtdblock10"
block 1041 is bad
block 1042 is bad
yaffs_read_super: isCheckpointed 0
yaffs: dev is 32505867 name is "mtdblock11"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.11, "mtdblock11"
yaffs: restored from checkpoint
yaffs_read_super: isCheckpointed 1
mv: can't rename '/sbin/listener.sh': No such file or directory
insmod: can't read '/mnt/sdcard/drv_optic.ko': No such file or directory
insmod: can't read '/mnt/sdcard/drv_powermeter.ko': No such file or directory
fpga installed
drv_keybpad installed!
scsi 0:0:0:0: Direct-Access AI Mass Storage PQ: 0 ANSI: 4
sd 0:0:0:0: [sda] 31490176 512-byte hardware sectors: (16.1 GB/15.0 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
module_base_addr = 0x0
module_part_size = 0x80
module_part_count = 0x4
module_index = 0x0
module_err = 0x0
syspara_base_addr = 0x800
syspara_part_size = 0x6c00
syspara_part_count = 0x2
syspara_valid_page_cnt = 0x1
syspara_index = 0x0
syspara_err = 0x0
crc_base_addr = 0xe000
crc_part_count = 0x4
crc_index = 0x0
crc_err = 0x0
buff_base_addr = 0xf000
buff_part_count = 0x10
buffer_id = 0x0
buff_err = 0x0
optic device installed, with major 247
optic_init used 496452 us.
alloc order 10
usbcore: registered new interface driver inno_f252
inno_f252: inno instrument f252 usb driver
RTL871X: module init start version:v4.1.8_9499.20131104
RTL871X: module init ret=0
Driver module for sub-board powermeter, build: May 20 2021 04:53:57
chown: unknown user root
/app/otdrStart.sh: line 14: /app/bin/vsftpd: Permission denied
/app/otdrStart.sh: line 19: /app/wndproc: not found
/app/otdrStart.sh: line 21: /sbin/listener.sh: not found
Please press Enter to activate this console.
内核对应
E:\code\drvice\linux-at91_2.6.30\arch\arm\kernel
setup.c
start_kernel()
|
1:setup_arch(&command_line)
|
1:unwind_init(); 从setup_arch调用以导入内核展开信息
2: setup_processor();在支持的处理器列表中找到处理器类型。链接器从arch/arm/mm/proc-*.S中的条目----cpu_name = list->cpu_name;
|
cacheid_init()
3:setup_machine(machine_arch_type);
|
lookup_machine_type(nr);
4:paging_init()
|
build_mem_type_table()
devicemaps_init
|
.map_io = ek_map_io,
|
at91sam9g45_initialize()
|
at91_clock_init()
----------
cpu_init();
----------
5:{init_arch_irq = mdesc->init_irq;
|
.init_irq = ek_init_irq()
|
at91sam9g45_init_interrupts()
|
at91_gpio_irq_setup()
system_timer = mdesc->timer;
init_machine = mdesc->init_machine;
}
2:build_all_zonelists()
__setup("console=", console_setup);
__early_param("mem=", early_mem);
3:early_irq_init()
4:pidhash_init()
con_init()
printk("Console: %s %s %dx%d",vc->vc_can_do_color ? "colour" : "mono",display_desc, vc->vc_cols, vc->vc_rows);
5:vfs_caches_init(num_physpages)
|
{
dcache_init();
inode_init();
|
alloc_large_system_hash()
printk(KERN_INFO "%s hash table entries: %d (order: %d, %lu bytes)\n"tablename,(1U << log2qty),ilog2(size) - PAGE_SHIFT,size);
mnt_init();
|
}
6:mem_init()
printk(KERN_NOTICE "Memory: %luKB available (%dK code, ""%dK data, %dK init, %luK highmem)\n",(unsigned long) nr_free_pages() << (PAGE_SHIFT-10),codesize >> 10, datasize >> 10, initsize >> 10,(unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
7:calibrate_delay()
8:check_bugs()
--------------------
pure_initcall(net_ns_init);
net_ns_init()
------------------
nr_family_ops
#define PF_NETROM AF_NETROM
#define AF_NETROM 6
module_init(nr_proto_init);
nr_proto_init()
|
sock_register(&nr_family_ops)
------------------------------------------------------------------------
arch_initcall(customize_machine);
|
.init_machine = ek_board_init,
|
at91_add_device_lcdc(&ek_lcdc_data);
--------------------------------------------------------------
arch_initcall(at91_pm_init);
|
at91_pm_init()
#define pr_info(fmt, ...) \
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
----------------------------------------------------------------
arch_initcall(at91_pm_init);
|
at91_pm_init()
|
show_reset_status()
pr_info("AT91: Starting after %s %s\n", reason, r2);
--------------------------------------------------------------
{
__device_attach()
__driver_attach()
}
|
driver_probe_device
|
really_probe(dev, drv)
|
drv->probe) {
ret = drv->probe(dev);
}
printk(KERN_WARNING
"%s: probe of %s failed with error %d\n",
drv->name, dev_name(dev), ret);
struct device_driver
tc_init()
|
platform_driver_probe(&tc_driver, tc_probe);
|
-------------------------------------------
subsys_initcall(init_bio);
init_bio()
|
bioset_create()
|
bio_find_or_create_slab()
printk("bio: create slab <%s> at %d\n", bslab->name, entry);
https:
https:
https:
----------------------------------------------------
subsys_initcall(init_scsi);
init_scsi()
Linux SCSI 子系统剖析
----------------------------------------
subsys_initcall(usb_init);
usb_init()
|
1:retval = usb_register(&usbfs_driver);
usb_register(struct usb_driver *driver)
usb_register_driver()
pr_info("%s: registered new interface driver %s\n",usbcore_name, new_driver->name);
2:usb_hub_init(void)
usb_register(&hub_driver)
3:usb_register_device_driver(&usb_generic_driver, THIS_MODULE);
------------------------------------------------
DECLARE_WORK主要用于不需要实例数据的静态工作项.您需要INIT_WORK.使用它初始化work_struct,该work_struct是另一个结构的成员(您选择的),然后在回调中使用container_of获取指向包含结构的指针.这种container_of模式在Linux内核中非常普遍,因此熟悉它是一个好主意!
static DECLARE_WORK(reg_work, reg_todo);
reg_todo(struct work_struct *work)
reg_process_pending_hints()
reg_process_hint()
__regulatory_hint()
call_crda(const char *alpha2)
printk(KERN_INFO "cfg80211: Calling CRDA to update world ""regulatory domain\n")
https:
https:
不想要在编译时就用DECLARE_WORK()创建并初始化工作结构体变量,也可以在程序运行时再用INIT_WORK()创建
------------------------------------------------
fs_initcall(inet_init);
inet_init()
1:ip_init()
ip_rt_init()
alloc_large_system_hash("IP route cache",...)/从 bootmem 分配一个大的系统哈希表
printk(KERN_INFO "%s hash table entries: %d (order: %d, %lu bytes)\n",tablename,(1U << log2qty), ilog2(size) - PAGE_SHIFT,size);
2:tcp_init(void)
alloc_large_system_hash("TCP established",...)
alloc_large_system_hash("TCP bind",...)
printk(KERN_INFO "TCP: Hash tables configured ""(established %d bind %d)\n", tcp_hashinfo.ehash_size, tcp_hashinfo.bhash_size);
tcp_register_congestion_control(&tcp_reno);
int tcp_register_congestion_control(struct tcp_congestion_ops *ca)
printk(KERN_INFO "TCP %s registered\n", ca->name);
-------------------------------------------
fs_initcall(af_unix_init);
af_unix_init()
sock_register(&unix_family_ops);
static struct net_proto_family unix_family_ops = {
sock_register(const struct net_proto_family *ops)
printk(KERN_INFO "NET: Registered protocol family %d\n", ops->family);
------------------------------------------------
module_init(fpe_init);
fpe_init()
printk(KERN_WARNING "NetWinder Floating Point Emulator V0.97 (" NWFPE_BITS " precision)\n");
fpe?????
---------------------------------------------
knfsd 的系统调用接口
module_init(init_nfsd)
init_nfsd()
printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
Linux Kernel 包含的kNFSd存在整数溢出,远程攻击者可以利用这个漏洞使kNFSd服务程序崩溃。
网络文件系统
---------------------------
module_init(init_jffs2_fs);
init_jffs2_fs()
printk(KERN_INFO "JFFS2 version 2.2."
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
" (NAND)"
#endif
#ifdef CONFIG_JFFS2_SUMMARY
" (SUMMARY) "
#endif
" ? 2001-2006 Red Hat, Inc.\n");
JFFS2文件系统
在Nor Flash上建立uClinux的JFFS2文件系统的一般步骤,从而为FLASH上的数据管理提供了理想的选择方式。
JFFS2的底层驱动主要完成文件系统对Flash芯片的访问控制,如读、写、擦除操作。在Linux中这部分功能是通过调用MTD(memory technology device内存技术设备)驱动实现的
块设备驱动程序
它主要向上提供两个接口:MTD字符设备和MTD块设备。通过这两个接口,就可以象读写普通文件一样对FLASH设备进行读写操
http:
---------------------------------
__initcall(ipc_init);
ipc_init()
|
msg_init();
printk(KERN_INFO "msgmni has been set to %d\n",init_ipc_ns.msg_ctlmni);
------------------------------
static struct crypto_alg rng_alg = {
.cra_name = "stdrng",
static struct crypto_alg krng_alg = {
.cra_name = "stdrng",
.notifier_call = cryptomgr_notify,
cryptomgr_schedule_test(data);
kthread_run(cryptomgr_test, param, "cryptomgr_test");
alg_test(param->driver, param->alg, type, CRYPTO_ALG_TESTED);
printk(KERN_INFO "alg: No test for %s (%s)\n", alg, driver);
应用层网关(Application Level Gateway)alg
MODULE_ALIAS("stdrng");
MODULE_DESCRIPTION(模块用途的简单描述);
MODULE_VERSION(模块的版本字符串);
MODULE_ALIAS(模块的别名);
http:
-----------------------------------------------
module_init(noop_init);
noop_init()
elv_register(&elevator_noop);
elv_register(struct elevator_type *e)
printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name,def);
Noop调度器算法 这个调度器基本上没做什么特殊的事情,就是把邻近bio进行了合并处理
https:
linux系统的elevator子系统???
----------------
static struct elevator_type iosched_as={
.elevator_name = "anticipatory",
}
module_init(as_init);
elv_register(&iosched_as);
printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name,def);
https:
-----------------------------------
================platform_device============
static struct platform_device at91_lcdc_device = {
.name = "atmel_lcdfb",
}
static struct platform_driver atmel_lcdfb_driver = {
.remove = __exit_p(atmel_lcdfb_remove),
.suspend = atmel_lcdfb_suspend,
.resume = atmel_lcdfb_resume,
.driver = {
.name = "atmel_lcdfb",
.owner = THIS_MODULE,
},
}
static struct platform_device at91_lcdc_device = {
.name = "atmel_lcdfb",
}
atmel_lcdfb_probe(struct platform_device *pdev)
ret = atmel_lcdfb_init_fbinfo(sinfo);
atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
dev_info(info->device, "%luKiB frame buffer at %08lx (mapped at %p)\n",。。。 )
dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %i\n",。。。)
-------------------------------------------
atmel_usart.0: ttyS0 at MMIO 0xfeffee00 (irq = 1) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfff90000 (irq = 8) is a ATMEL_SERIAL???????????
-----------------------------------------
module_init(brd_init);
brd_init()
loop_init()
loop: module loaded
https:
-------------------------------------
ssc_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Atmel SSC device at 0x%p (irq %d)\n",ssc->regs, ssc->irq);
ssc
系统启动流程:
BIOS 上电自检(POST)
引导装载程序 (GRUB2)
内核初始化
启动 systemd,其是所有进程之父。
---------------------------------------
driver_register(struct device_driver *drv)
printk(KERN_WARNING "Driver '%s' needs updating - please use ""bus_type methods\n", drv->name);
------------------------
module_init(if_sdio_init_module);
printk(KERN_INFO "libertas_sdio: Libertas SDIO driver\n");
printk(KERN_INFO "libertas_sdio: Copyright Pierre Ossman\n");
libertas wifi 驱动
1。就是将WIFI模块的GPIO初始化和反初始化加入到libertas里面去
2。我这边采用的是SDIO的WIFI,所以在libertas sdio的加载时要进行一下SDHC的强制检测
3。要在/lib/下创建一个firmware的文件夹,里面放上SDIO WIFI的firmware
------------------------------------------
nand_scan_ident()
nand_get_flash_type()
printk(KERN_INFO "NAND device: Manufacturer ID:" " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id,dev_id, nand_manuf_ids[maf_idx].name, mtd->name);
--------------------------------
module_init(atmel_nand_init);
atmel_nand_init(void)
static int __init atmel_nand_probe(struct platform_device *pdev)
printk(KERN_INFO "AT91 NAND: %i-bit, %s ECC\n",(nand_chip->options & NAND_BUSWIDTH_16) ? 16 : 8,ecc_modes[nand_chip->ecc.mode]
---------------------------------------
create_bbt - [GENERIC] Create a bad block table by scanning the device
static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd, int chip)
printk(KERN_INFO "Scanning device for bad blocks\n");
http:
MTD device structure
而且Linux平台的应用,能够将通讯功能集成于MID里面,更好的体现的MID的定义
printk(KERN_WARNING "Bad eraseblock %d at 0x%012llx\n", i >> 1, (unsigned long long)from);
https:
bbt是在内存中分配的一块内存(nand_scan_bbt中分配的,后面会说到),这块内存会存放BBT
MTD查找bbt的过程为:如果你在bbt_td和bbt_md的options 成员变量中定义了
NAND_BBT_LASTBLOCK,那么MTD就会从NAND芯片的最后一个block开始查找(在default情况下,MTD就是这么干的),否则就从第一个block开始查找。
https:
linux无论如何是需要在内存中建立坏块信息表
nand flash 坏块
https:
-----------------------------------
atmel_nand_probe(struct platform_device *pdev)
struct mtd_info *master
int add_mtd_partitions(struct mtd_info *master, const struct mtd_partition *parts,int nbparts)
printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
linux下MTD驱动
https:
MTD:memory technology device内存技术设备
还是调用了mount_pseudo();
当给磁盘分区,在分区上创建文件系统,运行文件系统检查程序,或装载一个分区时,块设备驱动程序会调用open函数
从本质上讲,一个request结构是作为一个bio结构的链表实现的,bio结构是在底层对部分块设备I/O请求的描述。
bio结构的核心是bi_io_vec的数组
在xxx_flash_probe()中主要还是对mtd_info结构体(MTD原始设备)的参数赋值,和回调函数的注册。在每次发送命令之前都需要进行写使能,然后发送命令的内容,最后再加上地址。最后调用mtd_device_register().如果没有分区的话就调用add_mtd_partition(),否则就调用add_mtd_partitions()
----------------------------
atmel_nand_probe(struct platform_device *pdev)
int add_mtd_partitions(struct mtd_info *master, const struct mtd_partition *parts,int nbparts)
add_one_partition(master, parts + i, i, cur_offset);
printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long long)slave->offset,(unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name);
static struct atmel_nand_data __initdata ek_nand_data ={
.partition_info = nand_partitions,
nand_partitions
return ek_nand_partition;
* NAND flash
*/
static struct mtd_partition __initdata ek_nand_partition[] = {
{
.name = "Partition 1: BOOT",
.offset = 0,
.size = SZ_1M,
},
...
}
-----------------------------------------
atmel_spi_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n",(unsigned long)regs->start, irq);
-------------------------------------------
module_init(ehci_hcd_init);
printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name);
#define DRIVER_DESC "USB 2.0 'Enhanced' Host Controller (EHCI) Driver"
https:
-------------------------------------------
ehci_atmel_drv_probe(struct platform_device *pdev)
usb_add_hcd(hcd, irq, IRQF_SHARED);
dev_info(hcd->self.controller, "%s\n", hcd->product_desc);
dev_info(hcd->self.controller, "irq %d, %s 0x%08llx\n", irqnum,(hcd->driver->flags & HCD_MEMORY) ?"io mem" : "io base",(unsigned long long)hcd->rsrc_start);
const struct hc_driver *driver = &ehci_atmel_hc_driver;
static const struct hc_driver ehci_atmel_hc_driver = {
.description = hcd_name,
.product_desc = "Atmel EHCI UHP HS",
--------------------------------------------------
subsys_initcall(usb_init);
static int __init usb_init(void)
int usb_hub_init(void)
khubd_task = kthread_run(hub_thread, NULL, "khubd");
static int hub_thread(void *__unused)
static void hub_events(void)
hub_port_connect_change()
* usb_new_device - perform initial device setup (usbcore-internal)
* @udev: newly addressed device (in ADDRESS state)
int usb_new_device(struct usb_device *udev)
announce_device(udev);
static void announce_device(struct usb_device *udev)
dev_info(&udev->dev, "New USB device found, idVendor=%04x, idProduct=%04x\n",le16_to_cpu(udev->descriptor.idVendor),le16_to_cpu(udev->descriptor.idProduct));
"New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
show_string(udev, "Product", udev->product);
show_string(udev, "Manufacturer", udev->manufacturer);
show_string(udev, "SerialNumber", udev->serial);
https:
USB设备驱动开发-USB Gadget Driver(一) http:
https:
Linux设备驱动之USB hub驱动 https:
-------------------------------------------------------------------
static struct usb_driver hub_driver = {
.name = "hub",
.probe = hub_probe,
static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
dev_info (&intf->dev, "USB hub found\n");
if (hub_configure(hub, endpoint) >= 0)
dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild,(hdev->maxchild == 1) ? "" : "s");
https:
----------------------------------------------------
static int __init usb_stor_init(void)
printk(KERN_INFO "Initializing USB Mass Storage driver...\n");
https:
设备驱动程序,只需要提交一个urb就可以了,剩下的事情usb core会去处理,有了结果它会通知我们.而提交urb,usb core为我们准备了一个函数,usb_submit_urb()不管我们使用什么传输方式,我们都只要调用这个函数即可,在此之前,我们需要做的只是准备好这么一个urb,把urb中各相关的成员填充好,然后就ok了.而这usb_stor_msg_common正是这样做的.而显然,不同的传输方式其填写urb的方式也不同。
-------------------------------------------------------
static struct usb_driver usbtest_driver = {
.name = "usbtest",
}
module_init (usbtest_init);
static int __init usbtest_init (void)
return usb_register (&usbtest_driver);
static inline int usb_register(struct usb_driver *driver)
int usb_register_driver(struct usb_driver *new_driver, struct module *owner,const char *mod_name)
pr_info("%s: registered new interface driver %s\n",usbcore_name, new_driver->name);
---------------------------------------------------------------
module_init(mousedev_init);
printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");
---------------------------------------------------------
按键liuliu_testtesttest222 f216l_key_init 163
static int __init f216l_key_init(void)
printk(KERN_ERR "liuliu_testtesttest222 %s %d\n",__func__,__LINE__);
???如何将驱动程序编译进内核?
https:
https:
------------------------------------------------------------
int input_register_device(struct input_dev *dev)
printk(KERN_INFO "input: %s as %s\n",dev->name ? dev->name : "Unspecified device", path ? path : "N/A");
--------------------------------------------------
static int __init i2c_dev_init(void)
{
int res;
printk(KERN_INFO "i2c /dev entries driver\n");
-----------------------------------------------
static int __devinit i2c_gpio_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
------------------------------------------------
static int pcf8563_probe(struct i2c_client *client,const struct i2c_device_id *id)
dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
---------------------------
struct rtc_device *rtc_device_register(const char *name, struct device *dev,const struct rtc_class_ops *ops,struct module *owner)
dev_info(dev, "rtc core: registered %s as %s\n",rtc->name, dev_name(&rtc->dev));
实时时钟驱动也有一个子系统,叫做RTC子系统
https:
----------------------------
module_init(videodev_init)
videodev_init()
printk(KERN_INFO "Linux video capture interface: v2.00\n");
------------------------------
static int __init at_dma_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Atmel AHB DMA Controller ( %s%s), %d channels\n",)
https:
Linux驱动修炼之道-DMA框架源码分析
--------------------------------
device_initcall(logger_init);
ret = init_log(&log_main);
ret = init_log(&log_events);
ret = init_log(&log_radio);
printk(KERN_INFO "logger: created %luK log '%s'\n", (unsigned long) log->size >> 10, log->misc.name);
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
----------------------------------------
module_init(alsa_sound_init)
static int __init alsa_sound_init(void)
printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n");
http:
----------------------------------------
snd_soc_register_dai - Register a DAI with the ASoC core
int snd_soc_register_dai(struct snd_soc_dai *dai)
printk(KERN_WARNING "No device for DAI %s\n", dai->name);
https:
cpu dai:在嵌入式系统里面通常指soc的i2s,pcm总线控制器,负责把音频数据从I2S tx FIFO搬运到codec(playback,capture则相反)。cpu_dai通过 snd_soc_register_dai()来注册。注:DAI是Digital Audio Interface的简称,分为cpu_dai和codec_dai,这两者通过i2s/pcm总线连接;AIF是Audio Interface母的简称,嵌入式系统中一般是I2S和PCM接口。
-----------------------------------------
https:
--------------------------------------------
sock_register - add a socket protocol handler
int sock_register(const struct net_proto_family *ops)
printk(KERN_INFO "NET: Registered protocol family %d\n", ops->family);
---------------------------------------------
int xprt_register_transport(struct xprt_class *transport)
printk(KERN_INFO "RPC: Registered %s transport module.\n",transport->name);
----------------------------------
https:
#define DRV_DESCRIPTION "common routines for IEEE802.11 drivers"
module_init(lib80211_init);
static int __init lib80211_init(void)
{
printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION "\n");
----------------------------------------
static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm)
https:
dev_info(&client->dev,"low voltage detected, date/time is not reliable.\n");
-----------------------------------------
atmel_mci atmel_mci.0: Atmel MCI controller at 0xfff80000 irq 11, 1 slots
Linux SD卡/SDIO驱动开发-dw_mci_probe
https:
Linux SD卡驱动开发(一) —— SD 相关基础概念
https:
-------------------------------------
yaffs: dev is 32505862 name is "mtdblock6"
https:
linux加载rootfs 根文件系统 kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
https:
Linux开发十七_yaffs文件系统
--------------------------------
https:
Linux系统中/dev/mtd与/dev/mtdblock的区别
而/dev/mtdblockN,是Nand Flash驱动中
-------------------------------
https:
mmc0: host does not support reading read-only switch. assuming write-enable
Linux中,将包括MMC、SD、SDIO统称为MMC子系统
------------------------
mmcblk0:<7>usb-storage 1-2:1.0: usb_probe_interface
linux 查看mmc分区 SD卡在Linux下/dev下的设备名叫mmcblk0p
----------------------
SCSI的英文全称为“Small Computer System Interface”,中文名“小型计算机系统接口”。它是一种外设接口,在服务器中则主要由硬盘采用
linux驱动子系统--SCSI
内核启动流程: 1:自解压内核:decompess(arch/arm/boot/compressed/head.s) 2:运行内核汇编部分head.s 入口start (arch/arm/kernel/head.s) 检测合法性(cpu类型 机器类型) 3:运行内核c部分 start_kernel (init/main.c) cpu 、机器参数的安装 setup_arch 中断 、定时器、终端、内存最基本的初始化 创建核进程kernel_init(重要的inital机制),启动多任务调度 多任务调度过程: (启动dio子系统 、平台子系统、scsi自此同、mmc子系统 等) (系统硬件探测及硬件驱动的初始化(比如SPI、蓝牙、以太网等等,所有的驱动都在里面)) 4:挂载rootfs 5:运行第一个应用程序init initrd ----> /sbin/init(linuxrc) <----> /etc/inittab。---->/etc/intr.d/rcs 运行shell
|