嵌入式Linux基础教程(第2版):英文版
编辑推荐
嵌入式Linux权威著作
Amazon全五星评价
全面剖析嵌入式Linux开发,揭示大量技术内幕
基本信息
http://product.china-pub.com/194677
内容简介
《嵌入式linux基础教程》是嵌入式linux 的经典教程,介绍了引导装入程序、系统初始化、文件系统、闪存和内核、应用程序调试技巧等,还讲述了构建linux 系统的工作原理,用于驱动不同体系结构的配置,linux内核源码树的特性,如何根据需求配制内核运行时的行为,如何扩展系统功能,用于构建完整嵌入式linux 发行版的常用构建系统,usb 子系统和系统配置工具udev 等内容。更重要的是,《嵌入式linux基础教程》阐述了如何修改系统使之满足读者自己的需求,使读者能从中学习一些嵌入式工程中非常有用的提示和技巧。
《嵌入式linux基础教程》适合linux 程序员阅读,也可作为高等院校相关专业师生的参考读物。
目录
《嵌入式linux基础教程》
edition xxxiii
acknowledgments for the second edition xxxv
about the author xxxvi
chapter 1 introduction 1
1.1 why linux? 2
1.2 embedded linux today 3
1.3 open source and the gpl 3
1.3.1 free versus freedom 4
1.4 standards and relevant bodies 5
1.4.1 linux standard base 5
1.4.2 linux foundation 6
1.4.3 carrier-grade linux 6
1.4.4 mobile linux initiative: moblin 7
1.4.5 service availability forum 7
1.5 summary 8
1.5.1 suggestions for additional reading 8
chapter 2 the big picture 9
2.1 embedded or not? 10
2.1.1 bios versus bootloader 11
.2.2 anatomy of an embedded system 12
2.2.1 typical embedded linux setup 13
2.2.2 starting the target board 14
2.2.3 booting the kernel 16
2.2.4 kernel initialization: overview 18
2.2.5 first user space process: init 19
2.3 storage considerations 20
2.3.1 flash memory 20
2.3.2 nand flash 22
2.1.1 bios versus bootloader 11
2.2 anatomy of an embedded system 12
2.2.1 typical embedded linux setup 13
2.2.2 starting the target board 14
2.2.3 booting the kernel 16
2.2.4 kernel initialization: overview 18
2.2.5 first user space process: init 19
2.3 storage considerations 20
2.3.1 flash memory 20
2.3.2 nand flash 22
2.3.3 flash usage 23
2.3.4 flash file systems 24
2.3.5 memory space 25
2.3.6 execution contexts 26
2.3.7 process virtual memory 28
2.3.8 cross-development environment 30
2.4 embedded linux distributions 32
2.4.1 commercial linux distributions 33
2.4.2 do-it-yourself linux distributions 33
2.5 summary 34
2.5.1 suggestions for additional reading 35
chapter 3 processor basics 37
3.1 stand-alone processors 38
3.1.1 ibm 970fx 39
3.1.2 intel pentium m 39
3.1.3 intel atom? 40
3.1.4 freescale mpc7448 40
3.1.5 companion chipsets 41
3.2 integrated processors: systems on chip 43
3.2.1 power architecture 44
3.2.2 freescale power architecture 44
3.2.3 freescale powerquicc i 45
3.2.4 freescale powerquicc ii 46
3.2.5 powerquicc ii pro 47
3.2.6 freescale powerquicc iii 48
3.2.7 freescale qoriq? 48
3.1.4 freescale mpc7448 40
3.1.5 companion chipsets 41
3.2 integrated processors: systems on chip 43
3.2.1 power architecture 44
3.2.2 freescale power architecture 44
3.2.3 freescale powerquicc i 45
3.2.4 freescale powerquicc ii 46
3.2.5 powerquicc ii pro 47
3.2.6 freescale powerquicc iii 48
3.2.7 freescale qoriq? 48
3.2.8 amcc power architecture 50
3.2.9 mips 53
3.2.10 broadcom mips 54
3.2.11 other mips 55
3.2.12 arm 55
3.2.13 ti arm 56
3.2.14 freescale arm 58
3.2.15 other arm processors 59
3.3 other architectures 59
3.4 hardware platforms 60
3.4.1 compactpci 60
3.4.2 atca 60
3.5 summary 61
3.5.1 suggestions for additional reading 62
chapter 4 the linux kernel: a different perspective 63
4.1 background 64
4.1.1 kernel versions 65
4.1.2 kernel source repositories 67
4.1.3 using git to download a kernel 68
4.2 linux kernel construction 68
4.2.1 top-level source directory 69
4.2.2 compiling the kernel 69
4.2.3 the kernel proper: vmlinux 72
4.2.4 kernel image components 73
4.2.5 subdirectory layout 77
4.3 kernel build system 78
4.1.1 kernel versions 65
4.1.2 kernel source repositories 67
4.1.3 using git to download a kernel 68
4.2 linux kernel construction 68
4.2.1 top-level source directory 69
4.2.2 compiling the kernel 69
4.2.3 the kernel proper: vmlinux 72
4.2.4 kernel image components 73
4.2.5 subdirectory layout 77
4.3 kernel build system 78
4.3.1 the dot-config 78
4.3.2 configuration editor(s) 80
4.3.3 makefile targets 83
4.4 kernel configuration 89
4.4.1 custom configuration options 91
4.4.2 kernel makefiles 95
4.5 kernel documentation 96
4.6 obtaining a custom linux kernel 96
4.6.1 what else do i need? 97
4.7 summary 97
4.7.1 suggestions for additional reading 98
chapter 5 kernel initialization 99
5.1 composite kernel image: piggy and friends 100
5.1.1 the image object 103
5.1.2 architecture objects 104
5.1.3 bootstrap loader 105
5.1.4 boot messages 106
5.2 initialization flow of control 109
5.2.1 kernel entry point: head.o 111
5.2.2 kernel startup: main.c 113
5.2.3 architecture setup 114
5.3 kernel command-line processing 115
5.3.1 the __setup macro 116
5.4 subsystem initialization 122
5.4.1 the *__initcall macros 122
5.5 the init thread 125
5.2 initialization flow of control 109
5.2.1 kernel entry point: head.o 111
5.2.2 kernel startup: main.c 113
5.2.3 architecture setup 114
5.3 kernel command-line processing 115
5.3.1 the __setup macro 116
5.4 subsystem initialization 122
5.4.1 the *__initcall macros 122
5.5 the init thread 125
5.5.1 initialization via initcalls 126
5.5.2 initcall_debug 127
5.5.3 final boot steps 127
5.6 summary 129
5.6.1 suggestions for additional reading 130
chapter 6 user space initialization 131
6.1 root file system 132
6.1.1 fhs: file system hierarchy standard 133
6.1.2 file system layout 133
6.1.3 minimal file system 134
6.1.4 the embedded root fs challenge 136
6.1.5 trial-and-error method 137
6.1.6 automated file system build tools 137
6.2 kernel’s last boot steps 137
6.2.1 first user space program 139
6.2.2 resolving dependencies 139
6.2.3 customized initial process 140
6.3 the init process 140
6.3.1 inittab 143
6.3.2 sample web server startup script 145
6.4 initial ram disk 146
6.4.1 booting with initrd 147
6.4.2 bootloader support for initrd 148
6.4.3 initrd magic: linuxrc 150
6.4.4 the initrd plumbing 151
6.4.5 building an initrd image 152
6.5 using initramfs 153
6.5.1 customizing 154
6.3.1 inittab 143
6.3.2 sample web server startup script 145
6.4 initial ram disk 146
6.4.1 booting with initrd 147
6.4.2 bootloader support for initrd 148
6.4.3 initrd magic: linuxrc 150
6.4.4 the initrd plumbing 151
6.4.5 building an initrd image 152
6.5 using initramfs 153
6.5.1 customizing initramfs 154
6.6 shutdown 156
6.7 summary 156
6.7.1 suggestions for additional reading 157
chapter 7 bootloaders 159
7.1 role of a bootloader 160
7.2 bootloader challenges 161
7.2.1 dram controller 161
7.2.2 flash versus ram 162
7.2.3 image complexity 162
7.2.4 execution context 165
7.3 a universal bootloader: das u-boot 166
7.3.1 obtaining u-boot 166
7.3.2 configuring u-boot 167
7.3.3 u-boot monitor commands 169
7.3.4 network operations 170
7.3.5 storage subsystems 173
7.3.6 booting from disk 174
7.4 porting u-boot 174
7.4.1 ep405 u-boot port 175
7.4.2 u-boot makefile configuration target 176
7.4.3 ep405 first build 177
7.4.4 ep405 processor initialization 178
7.4.5 board-specific initialization 181
7.4.6 porting summary 184
7.4.7 u-boot image format 185
7.5 device tree blob (flat device tree) 187
7.3.6 booting from disk 174
7.4 porting u-boot 174
7.4.1 ep405 u-boot port 175
7.4.2 u-boot makefile configuration target 176
7.4.3 ep405 first build 177
7.4.4 ep405 processor initialization 178
7.4.5 board-specific initialization 181
7.4.6 porting summary 184
7.4.7 u-boot image format 185
7.5 device tree blob (flat device tree) 187
7.5.1 device tree source 189
7.5.2 device tree compiler 192
7.5.3 alternative kernel images using dtb 193
7.6 other bootloaders 194
7.6.1 lilo 194
7.6.2 grub 195
7.6.3 still more bootloaders 197
7.7 summary 197
7.7.1 suggestions for additional reading 198
chapter 8 device driver basics 201
8.1 device driver concepts 202
8.1.1 loadable modules 203
8.1.2 device driver architecture 204
8.1.3 minimal device driver example 204
8.1.4 module build infrastructure 205
8.1.5 installing a device driver 209
8.1.6 loading a module 210
8.1.7 module parameters 211
8.2 module utilities 212
8.2.1 insmod 212
8.2.2 lsmod 213
8.2.3 modprobe 213
8.2.4 depmod 214
8.2.5 rmmod 215
8.2.6 modinfo 216
8.3 driver methods 217
8.1.5 installing a device driver 209
8.1.6 loading a module 210
8.1.7 module parameters 211
8.2 module utilities 212
8.2.1 insmod 212
8.2.2 lsmod 213
8.2.3 modprobe 213
8.2.4 depmod 214
8.2.5 rmmod 215
8.2.6 modinfo 216
8.3 driver methods 217
8.3.1 driver file system operations 217
8.3.2 allocation of device numbers 220
8.3.3 device nodes and mknod 220
8.4 bringing it all together 222
8.5 building out-of-tree drivers 223
8.6 device drivers and the gpl 224
8.7 summary 225
8.7.1 suggestions for additional reading 226
chapter 9 file systems 227
9.1 linux file system concepts 228
9.1.1 partitions 229
9.2 ext2 230
9.2.1 mounting a file system 232
9.2.2 checking file system integrity 233
9.3 ext3 235
9.4 ext4 237
9.5 reiserfs 238
9.6 jffs2 239
9.6.1 building a jffs2 image 240
9.7 cramfs 242
9.8 network file system 244
9.8.1 root file system on nfs 246
9.9 pseudo file systems 248
9.9.1 /proc file system 249
9.9.2 sysfs 252
9.4 ext4 237
9.5 reiserfs 238
9.6 jffs2 239
9.6.1 building a jffs2 image 240
9.7 cramfs 242
9.8 network file system 244
9.8.1 root file system on nfs 246
9.9 pseudo file systems 248
9.9.1 /proc file system 249
9.9.2 sysfs 252
9.10 other file systems 255
9.11 building a simple file system 256
9.12 summary 258
9.12.1 suggestions for additional reading 259
chapter 10 mtd subsystem 261
10.1 mtd overview 262
10.1.1 enabling mtd services 263
10.1.2 mtd basics 265
10.1.3 configuring mtd on your target 267
10.2 mtd partitions 267
10.2.1 redboot partition table partitioning 269
10.2.2 kernel command-line partitioning 273
10.2.3 mapping driver 274
10.2.4 flash chip drivers 276
10.2.5 board-specific initialization 276
10.3 mtd utilities 279
10.3.1 jffs2 root file system 281
10.4 ubi file system 284
10.4.1 configuring for ubifs 284
10.4.2 building a ubifs image 284
10.4.3 using ubifs as the root file system 287
10.5 summary 287
10.5.1 suggestions for additional reading 288
chapter 11 busybox 289
11.1 introduction to busybox 290
11.1.1 busybox is easy 291
11.2 busybox configuration 291
11.2.1 cross-compiling busybox 293
11.3 busybox operation 293
11.3.1 busybox init 297
11.3.2 sample rcs initialization script 299
11.3.3 busybox target installation 300
11.3.4 busybox applets 302
11.4 summary 303
11.4.1 suggestions for additional reading 304
chapter 12 embedded development environment 305
12.1 cross-development environment 306
12.1.1 “hello world” embedded 307
12.2 host system requirements 311
12.2.1 hardware debug probe 311
12.3 hosting target boards 312
12.3.1 tftp server 312
12.3.2 bootp/dhcp server 313
12.3.3 nfs server 316
12.3.4 target nfs root mount 318
12.3.5 u-boot nfs root mount example 320
12.4 summary 322
12.4.1 suggestions for additional reading 323
chapter 13 development tools 325
13.1 gnu debugger (gdb) 326
13.1.1 debugging a core dump 327
13.1.2 invoking gdb 329
13.1.3 debug session in gdb 331
13.2 data display debugger 333
13.3 cbrowser/cscope 335
13.4 tracing and profiling tools 337
13.4.1 strace 337
13.4.2 strace variations 341
13.4.3 ltrace 343
13.4.4 ps 344
13.4.5 top 346
13.4.6 mtrace 348
13.4.7 dmalloc 350
13.4.8 kernel oops 353
13.5 binary utilities 355
13.5.1 readelf 355
13.5.2 examining debug information using readelf 357
13.5.3 objdump 359
13.5.4 objcopy 360
13.6 miscellaneous binary utilities 361
13.6.1 strip 361
13.6.2 addr2line 361
13.6.3 strings 362
13.6.4 ldd 362
13.6.5 nm 363
13.6.6 prelink 364
13.5.2 examining debug information using readelf 357
13.5.3 objdump 359
13.5.4 objcopy 360
13.6 miscellaneous binary utilities 361
13.6.1 strip 361
13.6.2 addr2line 361
13.6.3 strings 362
13.6.4 ldd 362
13.6.5 nm 363
13.6.6 prelink 364
13.7 summary 364
13.7.1 suggestions for additional reading 365
chapter 14 kernel debugging techniques 367
14.1 challenges to kernel debugging 368
14.2 using kgdb for kernel debugging 369
14.2.1 kgdb kernel configuration 371
14.2.2 target boot with kgdb support 372
14.2.3 useful kernel breakpoints 376
14.2.4 sharing a console serial port with kgdb 377
14.2.5 debugging very early kernel code 379
14.2.6 kgdb support in the mainline kernel 380
14.3 kernel debugging techniques 381
14.3.1 gdb remote serial protocol 382
14.3.2 debugging optimized kernel code 385
14.3.3 gdb user-defined commands 392
14.3.4 useful kernel gdb macros 393
14.3.5 debugging loadable modules 402
14.3.6 printk debugging 407
14.3.7 magic sysreq key 409
14.4 hardware-assisted debugging 410
14.4.1 programming flash using a jtag probe 411
14.4.2 debugging with a jtag probe 413
14.5 when it doesn’t boot 417
14.5.1 early serial debug output 417
14.5.2 dumping the printk log buffer 417
14.5.3 kgdb on panic 420
14.3.4 useful kernel gdb macros 393
14.3.5 debugging loadable modules 402
14.3.6 printk debugging 407
14.3.7 magic sysreq key 409
14.4 hardware-assisted debugging 410
14.4.1 programming flash using a jtag probe 411
14.4.2 debugging with a jtag probe 413
14.5 when it doesn’t boot 417
14.5.1 early serial debug output 417
14.5.2 dumping the printk log buffer 417
14.5.3 kgdb on panic 420
14.6 summary 421
14.6.1 suggestions for additional reading 422
chapter 15 debugging embedded linux applications 423
15.1 target debugging 424
15.2 remote (cross) debugging 424
15.2.1 gdbserver 427
15.3 debugging with shared libraries 429
15.3.1 shared library events in gdb 431
15.4 debugging multiple tasks 435
15.4.1 debugging multiple processes 435
15.4.2 debugging multithreaded applications 438
15.4.3 debugging bootloader/flash code 441
15.5 additional remote debug options 442
15.5.1 debugging using a serial port 442
15.5.2 attaching to a running process 442
15.6 summary 443
15.6.1 suggestions for additional reading 444
chapter 16 open source build systems 445
16.1 why use a build system? 446
16.2 scratchbox 447
16.2.1 installing scratchbox 447
16.2.2 creating a cross-compilation target 448
16.3 buildroot 451
16.3.1 buildroot installation 451
16.3.2 buildroot configuration 451
15.6 summary 443
15.6.1 suggestions for additional reading 444
chapter 16 open source build systems 445
16.1 why use a build system? 446
16.2 scratchbox 447
16.2.1 installing scratchbox 447
16.2.2 creating a cross-compilation target 448
16.3 buildroot 451
16.3.1 buildroot installation 451
16.3.2 buildroot configuration 451
16.3.3 buildroot build 452
16.4 openembedded 454
16.4.1 openembedded composition 455
16.4.2 bitbake metadata 456
16.4.3 recipe basics 456
16.4.4 metadata tasks 460
16.4.5 metadata classes 461
16.4.6 configuring openembedded 462
16.4.7 building images 463
16.5 summary 464
16.5.1 suggestions for additional reading 464
chapter 17 linux and real time 465
17.1 what is real time? 466
17.1.1 soft real time 466
17.1.2 hard real time 467
17.1.3 linux scheduling 467
17.1.4 latency 467
17.2 kernel preemption 469
17.2.1 impediments to preemption 469
17.2.2 preemption models 471
17.2.3 smp kernel 472
17.2.4 sources of preemption latency 473
17.3 real-time kernel patch 473
17.3.1 real-time features 475
17.3.2 o(1) scheduler 476
17.1.3 linux scheduling 467
17.1.4 latency 467
17.2 kernel preemption 469
17.2.1 impediments to preemption 469
17.2.2 preemption models 471
17.2.3 smp kernel 472
17.2.4 sources of preemption latency 473
17.3 real-time kernel patch 473
17.3.1 real-time features 475
17.3.2 o(1) scheduler 476
17.3.3 creating a real-time process 477
17.4 real-time kernel performance analysis 478
17.4.1 using ftrace for tracing 478
17.4.2 preemption off latency measurement 479
17.4.3 wakeup latency measurement 481
17.4.4 interrupt off timing 483
17.4.5 soft lockup detection 484
17.5 summary 485
17.5.1 suggestion for additional reading 485
chapter 18 universal serial bus 487
18.1 usb overview 488
18.1.1 usb physical topology 488
18.1.2 usb logical topology 490
18.1.3 usb revisions 491
18.1.4 usb connectors 492
18.1.5 usb cable assemblies 494
18.1.6 usb modes 494
18.2 configuring usb 495
18.2.1 usb initialization 497
18.3 sysfs and usb device naming 500
18.4 useful usb tools 502
18.4.1 usb file system 502
18.4.2 using usbview 504
18.4.3 usb utils (lsusb) 507
18.5 common usb subsystems 508
18.5.1 usb mass storage class 508
18.1.6 usb modes 494
18.2 configuring usb 495
18.2.1 usb initialization 497
18.3 sysfs and usb device naming 500
18.4 useful usb tools 502
18.4.1 usb file system 502
18.4.2 using usbview 504
18.4.3 usb utils (lsusb) 507
18.5 common usb subsystems 508
18.5.1 usb mass storage class 508
18.5.2 usb hid class 511
18.5.3 usb cdc class drivers 512
18.5.4 usb network support 515
18.6 usb debug 516
18.6.1 usbmon 517
18.6.2 useful usb miscellanea 518
18.7 summary 519
18.7.1 suggestions for additional reading 519
chapter 19 udev 521
19.1 what is udev? 522
19.2 device discovery 523
19.3 default udev behavior 525
19.4 understanding udev rules 527
19.4.1 modalias 530
19.4.2 typical udev rules configuration 533
19.4.3 initial system setup for udev 535
19.5 loading platform device drivers 538
19.6 customizing udev behavior 540
19.6.1 udev customization example: usb automounting 540
19.7 persistent device naming 541
19.7.1 udev helper utilities 542
19.8 using udev with busybox 545
19.8.1 busybox mdev 545
19.8.2 configuring mdev 547
19.9 summary 548
19.9.1 suggestions for additional reading 548
19.6 customizing udev behavior 540
19.6.1 udev customization example: usb automounting 540
19.7 persistent device naming 541
19.7.1 udev helper utilities 542
19.8 using udev with busybox 545
19.8.1 busybox mdev 545
19.8.2 configuring mdev 547
19.9 summary 548
19.9.1 suggestions for additional reading 548
appendix a gnu public license 549
preamble 550
terms and conditions for copying, distribution, and modification 551
no warranty 555
appendix b u-boot configurable commands 557
appendix c busybox commands 561
appendix d sdram interface considerations 571
d.1 sdram basics 572
d.1.1 sdram refresh 573
d.2 clocking 574
d.3 sdram setup 575
d.4 summary 580
d.4.1 suggestions for additional reading 580
appendix e open source resources 581
source repositories and developer information 582
mailing lists 582
linux news and developments 583
open source legal insight and discussion 583
appendix f sample bdi-2000 configuration file 585
index 593