Difference between revisions of "User:Jiangq"

From eLinux.org
Jump to: navigation, search
(Created page with '= Listings = == Chapter 2 ==')
 
(Chapter 2)
Line 1: Line 1:
 
= Listings =
 
= Listings =
== Chapter 2 ==
+
== Chapter 4 ==
 +
 
 +
{|
 +
! Number
 +
! Page
 +
! Caption
 +
! Listing
 +
|-
 +
</pre>
 +
|-
 +
| 4-3
 +
| 4-15
 +
| Kernel Subdirectory
 +
| <pre>  qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_3
 +
qiang@qiang-laptop:~/Desktop/linux-2.6$ ls -ls arch/arm/plat-omap/ | grep -v \\.o
 +
total 432
 +
12 -rw-r--r-- 1 qiang qiang 11124 2010-03-23 20:06 clock.c
 +
12 -rw-r--r-- 1 qiang qiang  8521 2010-03-23 20:06 common.c
 +
4 -rw-r--r-- 1 qiang qiang  4033 2010-03-23 20:06 cpu-omap.c
 +
4 -rw-r--r-- 1 qiang qiang  2192 2010-03-23 20:06 debug-devices.c
 +
8 -rw-r--r-- 1 qiang qiang  7170 2010-03-23 20:06 debug-leds.c
 +
12 -rw-r--r-- 1 qiang qiang 10890 2010-03-23 20:06 devices.c
 +
56 -rw-r--r-- 1 qiang qiang 52586 2010-03-23 20:06 dma.c
 +
24 -rw-r--r-- 1 qiang qiang 22660 2010-03-23 20:06 dmtimer.c
 +
12 -rw-r--r-- 1 qiang qiang 10055 2010-03-23 20:06 fb.c
 +
64 -rw-r--r-- 1 qiang qiang 61308 2010-03-23 20:06 gpio.c
 +
8 -rw-r--r-- 1 qiang qiang  5058 2010-03-23 20:06 i2c.c
 +
4 drwxr-xr-x 3 qiang qiang  4096 2010-03-23 20:06 include
 +
8 -rw-r--r-- 1 qiang qiang  6265 2010-03-23 20:06 io.c
 +
24 -rw-r--r-- 1 qiang qiang 20765 2010-03-23 20:06 iommu.c
 +
12 -rw-r--r-- 1 qiang qiang  9117 2010-03-23 20:06 iommu-debug.c
 +
4 -rw-r--r-- 1 qiang qiang  2745 2010-03-23 20:06 iopgtable.h
 +
20 -rw-r--r-- 1 qiang qiang 19320 2010-03-23 20:06 iovmm.c
 +
8 -rw-r--r-- 1 qiang qiang  4819 2010-03-23 20:06 Kconfig
 +
12 -rw-r--r-- 1 qiang qiang  8522 2010-03-23 20:06 mailbox.c
 +
4 -rw-r--r-- 1 qiang qiang  882 2010-03-23 20:06 Makefile
 +
44 -rw-r--r-- 1 qiang qiang 43730 2010-03-23 20:06 mcbsp.c
 +
4 -rw-r--r-- 1 qiang qiang  2263 2010-03-23 20:06 mux.c
 +
4 -rw-r--r-- 1 qiang qiang  2739 2010-03-23 20:06 ocpi.c
 +
24 -rw-r--r-- 1 qiang qiang 21397 2010-03-23 20:06 omap_device.c
 +
8 -rw-r--r-- 1 qiang qiang  7069 2010-03-23 20:06 omap-pm-noop.c
 +
16 -rw-r--r-- 1 qiang qiang 12878 2010-03-23 20:06 sram.c
 +
20 -rw-r--r-- 1 qiang qiang 18770 2010-03-23 20:06 usb.c
 +
 
 +
</pre>
 +
|-
 +
| 4-4
 +
| 4-17
 +
| Snippet from Linux 2.6.config
 +
| <pre>
 +
qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_4
 +
#
 +
# CONFIG_64BIT is not set
 +
CONFIG_X86_32=y
 +
# CONFIG_X86_64 is not set
 +
CONFIG_X86=y
 +
CONFIG_OUTPUT_FORMAT="elf32-i386"
 +
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
 +
CONFIG_GENERIC_TIME=y
 +
CONFIG_GENERIC_CMOS_UPDATE=y
 +
CONFIG_CLOCKSOURCE_WATCHDOG=y
 +
CONFIG_GENERIC_CLOCKEVENTS=y
 +
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
 +
CONFIG_LOCKDEP_SUPPORT=y
 +
CONFIG_STACKTRACE_SUPPORT=y
 +
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 +
CONFIG_MMU=y
 +
 
 +
</pre>
 +
 
 +
|-
 +
| 4-6
 +
| 4-22
 +
| Makefile Targets
 +
| <pre>
 +
qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_6
 +
qiang@qiang-laptop:~/Desktop/linux-2.6$ make help
 +
Cleaning targets:
 +
  clean   - Remove most generated files but keep the config and
 +
                    enough build support to build external modules
 +
  mrproper   - Remove all generated files + config + various backup files
 +
  distclean   - mrproper + remove editor backup and patch files
 +
 
 +
Configuration targets:
 +
  config   - Update current config utilising a line-oriented program
 +
  menuconfig   - Update current config utilising a menu based program
 +
  xconfig   - Update current config utilising a QT based front-end
 +
  gconfig   - Update current config utilising a GTK based front-end
 +
  oldconfig   - Update current config utilising a provided .config as base
 +
  localmodconfig  - Update current config disabling modules not loaded
 +
  localyesconfig  - Update current config converting local mods to core
 +
  silentoldconfig - Same as oldconfig, but quietly, additionally update deps
 +
  randconfig   - New config with random answer to all options
 +
  defconfig   - New config with default answer to all options
 +
  allmodconfig   - New config selecting modules when possible
 +
  allyesconfig   - New config where all options are accepted with yes
 +
  allnoconfig   - New config where all options are answered with no
 +
 
 +
Other generic targets:
 +
  all   - Build all targets marked with [*]
 +
* vmlinux   - Build the bare kernel
 +
* modules   - Build all modules
 +
  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)
 +
  firmware_install- Install all firmware to INSTALL_FW_PATH
 +
                    (default: $(INSTALL_MOD_PATH)/lib/firmware)
 +
  dir/            - Build all files in dir and below
 +
  dir/file.[ois]  - Build specified target only
 +
  dir/file.ko    - Build module including final link
 +
  modules_prepare - Set up for building external modules
 +
  tags/TAGS   - Generate tags file for editors
 +
  cscope   - Generate cscope index
 +
  kernelrelease   - Output the release version string
 +
  kernelversion   - Output the version stored in Makefile
 +
  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH
 +
                    (default: /home/qiang/Desktop/linux-2.6/usr)
 +
 
 +
Static analysers
 +
  checkstack      - Generate a list of stack hogs
 +
  namespacecheck  - Name space analysis on compiled kernel
 +
  versioncheck    - Sanity check on version.h usage
 +
  includecheck    - Check for duplicate included header files
 +
  export_report  - List the usages of all exported symbols
 +
  headers_check  - Sanity check on exported headers
 +
  headerdep      - Detect inclusion cycles in headers
 +
 
 +
Kernel packaging:
 +
  rpm-pkg        - Build both source and binary RPM kernel packages
 +
  binrpm-pkg      - Build only the binary kernel package
 +
  deb-pkg        - Build the kernel as an deb package
 +
  tar-pkg        - Build the kernel as an uncompressed tarball
 +
  targz-pkg      - Build the kernel as a gzip compressed tarball
 +
  tarbz2-pkg      - Build the kernel as a bzip2 compressed tarball
 +
 
 +
Documentation targets:
 +
Linux kernel internal documentation in different formats:
 +
  htmldocs        - HTML
 +
  pdfdocs        - PDF
 +
  psdocs          - Postscript
 +
  xmldocs        - XML DocBook
 +
  mandocs        - man pages
 +
  installmandocs  - install man pages generated by mandocs
 +
  cleandocs      - clean all generated DocBook files
 +
 
 +
Architecture specific targets (x86):
 +
* bzImage      - Compressed kernel image (arch/x86/boot/bzImage)
 +
  install      - Install kernel using
 +
                  (your) ~/bin/installkernel or
 +
                  (distribution) /sbin/installkernel or
 +
                  install to $(INSTALL_PATH) and run lilo
 +
  fdimage      - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
 +
  fdimage144  - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
 +
  fdimage288  - Create 2.8MB boot floppy image (arch/x86/boot/fdimage)
 +
  isoimage    - Create a boot CD-ROM image (arch/x86/boot/image.iso)
 +
                  bzdisk/fdimage*/isoimage also accept:
 +
                  FDARGS="..."  arguments for the booted kernel
 +
                  FDINITRD=file initrd for the booted kernel
 +
 
 +
  i386_defconfig          - Build for i386
 +
  x86_64_defconfig        - Build for x86_64
 +
 
 +
  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
 +
  make V=2  [targets] 2 => give reason for rebuild of target
 +
  make O=dir [targets] Locate all output files in "dir", including .config
 +
  make C=1  [targets] Check all c source with $CHECK (sparse by default)
 +
  make C=2  [targets] Force check of all c source with $CHECK
 +
 
 +
Execute "make" or "make all" to build all targets marked with [*]
 +
For further info see the ./README file
 +
 
 +
</pre>
 +
 
 +
|-
 +
| 4-10
 +
| 4-32
 +
| Customized .config File Snippet
 +
| <pre>qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_10
 +
# CONFIG_ARCH_PNX4008 is not set
 +
# CONFIG_ARCH_PXA is not set
 +
# CONFIG_ARCH_MSM is not set
 +
# CONFIG_ARCH_SHMOBILE is not set
 +
# CONFIG_ARCH_RPC is not set
 +
# CONFIG_ARCH_SA1100 is not set
 +
# CONFIG_ARCH_S3C2410 is not set
 +
# CONFIG_ARCH_S3C64XX is not set
 +
# CONFIG_ARCH_S5P6440 is not set
 +
# CONFIG_ARCH_S5P6442 is not set
 +
# CONFIG_ARCH_S5PC1XX is not set
 +
# CONFIG_ARCH_S5PV210 is not set
 +
# CONFIG_ARCH_SHARK is not set
 +
# CONFIG_ARCH_LH7A40X is not set
 +
# CONFIG_ARCH_U300 is not set
 +
# CONFIG_ARCH_U8500 is not set
 +
# CONFIG_ARCH_NOMADIK is not set
 +
# CONFIG_ARCH_DAVINCI is not set
 +
CONFIG_ARCH_OMAP=y
 +
 
 +
#
 +
# TI OMAP Implementations
 +
#
 +
# CONFIG_ARCH_OMAP1 is not set
 +
CONFIG_ARCH_OMAP2PLUS=y
 +
# CONFIG_ARCH_OMAP2 is not set
 +
# CONFIG_ARCH_OMAP3 is not set
 +
# CONFIG_ARCH_OMAP4 is not set
 +
</pre>
 +
 
 +
|-
 +
| 4-11
 +
| 4-33
 +
| Makefile from .../arch/arm/mach-ixp4xx Kernel Subdirectory
 +
| <pre>
 +
qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_11
 +
qiang@qiang-laptop:~/Desktop/linux-2.6/arch/arm/plat-omap$ head -n 20 Makefile
 +
#
 +
# Makefile for the linux kernel.
 +
#
 +
 
 +
# Common support
 +
obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
 +
usb.o fb.o io.o
 +
obj-m :=
 +
obj-n :=
 +
obj-  :=
 +
 
 +
# OCPI interconnect support for 1710, 1610 and 5912
 +
obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
 +
 
 +
# omap_device support (OMAP2+ only at the moment)
 +
obj-$(CONFIG_ARCH_OMAP2) += omap_device.o
 +
obj-$(CONFIG_ARCH_OMAP3) += omap_device.o
 +
 
 +
obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 +
obj-$(CONFIG_OMAP_IOMMU) += iommu.o iovmm.o
 +
 
 +
</pre>

Revision as of 10:14, 15 April 2010

Listings

Chapter 4

Number Page Caption Listing
4-3 4-15 Kernel Subdirectory
  qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_3
qiang@qiang-laptop:~/Desktop/linux-2.6$ ls -ls arch/arm/plat-omap/ | grep -v \\.o
total 432
12 -rw-r--r-- 1 qiang qiang 11124 2010-03-23 20:06 clock.c
12 -rw-r--r-- 1 qiang qiang  8521 2010-03-23 20:06 common.c
 4 -rw-r--r-- 1 qiang qiang  4033 2010-03-23 20:06 cpu-omap.c
 4 -rw-r--r-- 1 qiang qiang  2192 2010-03-23 20:06 debug-devices.c
 8 -rw-r--r-- 1 qiang qiang  7170 2010-03-23 20:06 debug-leds.c
12 -rw-r--r-- 1 qiang qiang 10890 2010-03-23 20:06 devices.c
56 -rw-r--r-- 1 qiang qiang 52586 2010-03-23 20:06 dma.c
24 -rw-r--r-- 1 qiang qiang 22660 2010-03-23 20:06 dmtimer.c
12 -rw-r--r-- 1 qiang qiang 10055 2010-03-23 20:06 fb.c
64 -rw-r--r-- 1 qiang qiang 61308 2010-03-23 20:06 gpio.c
 8 -rw-r--r-- 1 qiang qiang  5058 2010-03-23 20:06 i2c.c
 4 drwxr-xr-x 3 qiang qiang  4096 2010-03-23 20:06 include
 8 -rw-r--r-- 1 qiang qiang  6265 2010-03-23 20:06 io.c
24 -rw-r--r-- 1 qiang qiang 20765 2010-03-23 20:06 iommu.c
12 -rw-r--r-- 1 qiang qiang  9117 2010-03-23 20:06 iommu-debug.c
 4 -rw-r--r-- 1 qiang qiang  2745 2010-03-23 20:06 iopgtable.h
20 -rw-r--r-- 1 qiang qiang 19320 2010-03-23 20:06 iovmm.c
 8 -rw-r--r-- 1 qiang qiang  4819 2010-03-23 20:06 Kconfig
12 -rw-r--r-- 1 qiang qiang  8522 2010-03-23 20:06 mailbox.c
 4 -rw-r--r-- 1 qiang qiang   882 2010-03-23 20:06 Makefile
44 -rw-r--r-- 1 qiang qiang 43730 2010-03-23 20:06 mcbsp.c
 4 -rw-r--r-- 1 qiang qiang  2263 2010-03-23 20:06 mux.c
 4 -rw-r--r-- 1 qiang qiang  2739 2010-03-23 20:06 ocpi.c
24 -rw-r--r-- 1 qiang qiang 21397 2010-03-23 20:06 omap_device.c
 8 -rw-r--r-- 1 qiang qiang  7069 2010-03-23 20:06 omap-pm-noop.c
16 -rw-r--r-- 1 qiang qiang 12878 2010-03-23 20:06 sram.c
20 -rw-r--r-- 1 qiang qiang 18770 2010-03-23 20:06 usb.c

4-4 4-17 Snippet from Linux 2.6.config
qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_4
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
# CONFIG_X86_64 is not set
CONFIG_X86=y
CONFIG_OUTPUT_FORMAT="elf32-i386"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y

4-6 4-22 Makefile Targets
qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_6
qiang@qiang-laptop:~/Desktop/linux-2.6$ make help
Cleaning targets:
  clean		  - Remove most generated files but keep the config and
                    enough build support to build external modules
  mrproper	  - Remove all generated files + config + various backup files
  distclean	  - mrproper + remove editor backup and patch files

Configuration targets:
  config	  - Update current config utilising a line-oriented program
  menuconfig	  - Update current config utilising a menu based program
  xconfig	  - Update current config utilising a QT based front-end
  gconfig	  - Update current config utilising a GTK based front-end
  oldconfig	  - Update current config utilising a provided .config as base
  localmodconfig  - Update current config disabling modules not loaded
  localyesconfig  - Update current config converting local mods to core
  silentoldconfig - Same as oldconfig, but quietly, additionally update deps
  randconfig	  - New config with random answer to all options
  defconfig	  - New config with default answer to all options
  allmodconfig	  - New config selecting modules when possible
  allyesconfig	  - New config where all options are accepted with yes
  allnoconfig	  - New config where all options are answered with no

Other generic targets:
  all		  - Build all targets marked with [*]
* vmlinux	  - Build the bare kernel
* modules	  - Build all modules
  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)
  firmware_install- Install all firmware to INSTALL_FW_PATH
                    (default: $(INSTALL_MOD_PATH)/lib/firmware)
  dir/            - Build all files in dir and below
  dir/file.[ois]  - Build specified target only
  dir/file.ko     - Build module including final link
  modules_prepare - Set up for building external modules
  tags/TAGS	  - Generate tags file for editors
  cscope	  - Generate cscope index
  kernelrelease	  - Output the release version string
  kernelversion	  - Output the version stored in Makefile
  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH
                    (default: /home/qiang/Desktop/linux-2.6/usr)

Static analysers
  checkstack      - Generate a list of stack hogs
  namespacecheck  - Name space analysis on compiled kernel
  versioncheck    - Sanity check on version.h usage
  includecheck    - Check for duplicate included header files
  export_report   - List the usages of all exported symbols
  headers_check   - Sanity check on exported headers
  headerdep       - Detect inclusion cycles in headers

Kernel packaging:
  rpm-pkg         - Build both source and binary RPM kernel packages
  binrpm-pkg      - Build only the binary kernel package
  deb-pkg         - Build the kernel as an deb package
  tar-pkg         - Build the kernel as an uncompressed tarball
  targz-pkg       - Build the kernel as a gzip compressed tarball
  tarbz2-pkg      - Build the kernel as a bzip2 compressed tarball

Documentation targets:
 Linux kernel internal documentation in different formats:
  htmldocs        - HTML
  pdfdocs         - PDF
  psdocs          - Postscript
  xmldocs         - XML DocBook
  mandocs         - man pages
  installmandocs  - install man pages generated by mandocs
  cleandocs       - clean all generated DocBook files

Architecture specific targets (x86):
* bzImage      - Compressed kernel image (arch/x86/boot/bzImage)
  install      - Install kernel using
                  (your) ~/bin/installkernel or
                  (distribution) /sbin/installkernel or
                  install to $(INSTALL_PATH) and run lilo
  fdimage      - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
  fdimage144   - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
  fdimage288   - Create 2.8MB boot floppy image (arch/x86/boot/fdimage)
  isoimage     - Create a boot CD-ROM image (arch/x86/boot/image.iso)
                  bzdisk/fdimage*/isoimage also accept:
                  FDARGS="..."  arguments for the booted kernel
                  FDINITRD=file initrd for the booted kernel

  i386_defconfig           - Build for i386
  x86_64_defconfig         - Build for x86_64

  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
  make V=2   [targets] 2 => give reason for rebuild of target
  make O=dir [targets] Locate all output files in "dir", including .config
  make C=1   [targets] Check all c source with $CHECK (sparse by default)
  make C=2   [targets] Force check of all c source with $CHECK

Execute "make" or "make all" to build all targets marked with [*] 
For further info see the ./README file

4-10 4-32 Customized .config File Snippet
qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_10
# CONFIG_ARCH_PNX4008 is not set
# CONFIG_ARCH_PXA is not set
# CONFIG_ARCH_MSM is not set
# CONFIG_ARCH_SHMOBILE is not set
# CONFIG_ARCH_RPC is not set
# CONFIG_ARCH_SA1100 is not set
# CONFIG_ARCH_S3C2410 is not set
# CONFIG_ARCH_S3C64XX is not set
# CONFIG_ARCH_S5P6440 is not set
# CONFIG_ARCH_S5P6442 is not set
# CONFIG_ARCH_S5PC1XX is not set
# CONFIG_ARCH_S5PV210 is not set
# CONFIG_ARCH_SHARK is not set
# CONFIG_ARCH_LH7A40X is not set
# CONFIG_ARCH_U300 is not set
# CONFIG_ARCH_U8500 is not set
# CONFIG_ARCH_NOMADIK is not set
# CONFIG_ARCH_DAVINCI is not set
CONFIG_ARCH_OMAP=y

# 
# TI OMAP Implementations
# 
# CONFIG_ARCH_OMAP1 is not set
CONFIG_ARCH_OMAP2PLUS=y
# CONFIG_ARCH_OMAP2 is not set
# CONFIG_ARCH_OMAP3 is not set
# CONFIG_ARCH_OMAP4 is not set
4-11 4-33 Makefile from .../arch/arm/mach-ixp4xx Kernel Subdirectory
 qiang@qiang-laptop:~/Desktop/linux-2.6$ cat 4_11
qiang@qiang-laptop:~/Desktop/linux-2.6/arch/arm/plat-omap$ head -n 20 Makefile
#
# Makefile for the linux kernel.
#

# Common support
obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
	 usb.o fb.o io.o
obj-m :=
obj-n :=
obj-  :=

# OCPI interconnect support for 1710, 1610 and 5912
obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o

# omap_device support (OMAP2+ only at the moment)
obj-$(CONFIG_ARCH_OMAP2) += omap_device.o
obj-$(CONFIG_ARCH_OMAP3) += omap_device.o

obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
obj-$(CONFIG_OMAP_IOMMU) += iommu.o iovmm.o