Difference between revisions of "EBC Listings for Embedded Linux Primer"

From eLinux.org
Jump to: navigation, search
(Chapter 4: Added Listing 4-1)
(Chapter 4: Added Listing 4-4)
Line 144: Line 144:
 
|-
 
|-
 
| 4-3
 
| 4-3
| 4-14
+
| 4-15
 
| Kernel Subdirectory
 
| Kernel Subdirectory
 
| <pre>
 
| <pre>
 +
$ ls -ls arch/arm/plat-omap/ | grep -v \\.o
 +
total 776
 +
  8 -rw-r--r-- 1 yoder yoder  7933 Mar  9 12:14 Kconfig
 +
  8 -rw-r--r-- 1 yoder yoder  7799 Mar  9 12:14 Kconfig.backup
 +
  8 -rw-r--r-- 1 yoder yoder  7799 Mar  8 11:28 Kconfig~
 +
  4 -rw-r--r-- 1 yoder yoder    824 Mar  8 11:28 Makefile
 +
  4 -rw-r--r-- 1 yoder yoder  2404 Mar  8 11:18 bootreason.c
 +
16 -rw-r--r-- 1 yoder yoder  15334 Mar  8 11:18 clock.c
 +
12 -rw-r--r-- 1 yoder yoder  8210 Mar  8 11:18 common.c
 +
  4 -rw-r--r-- 1 yoder yoder  1593 Mar  8 11:18 component-version.c
 +
  4 -rw-r--r-- 1 yoder yoder  4053 Mar  8 11:18 cpu-omap.c
 +
  4 -rw-r--r-- 1 yoder yoder  1975 Mar  8 11:18 debug-devices.c
 +
  8 -rw-r--r-- 1 yoder yoder  7120 Mar  8 11:18 debug-leds.c
 +
12 -rw-r--r-- 1 yoder yoder  9975 Mar  8 11:18 devices.c
 +
60 -rwxr-xr-x 1 yoder yoder  59827 Mar  8 11:26 dma.c
 +
24 -rw-r--r-- 1 yoder yoder  20791 Mar  8 11:18 dmtimer.c
 +
12 -rw-r--r-- 1 yoder yoder  9675 Mar  8 11:25 fb.c
 +
16 -rw-r--r-- 1 yoder yoder  12815 Mar  8 11:18 gpio-switch.c
 +
48 -rw-r--r-- 1 yoder yoder  47671 Mar  8 11:18 gpio.c
 +
  8 -rw-r--r-- 1 yoder yoder  5841 Mar  8 11:18 i2c.c
 +
  4 drwxr-xr-x 3 yoder yoder  4096 Mar  8 11:18 include
 +
  4 -rw-r--r-- 1 yoder yoder  3749 Mar  8 11:18 io.c
 +
20 -rw-r--r-- 1 yoder yoder  19782 Mar  8 11:28 iommu.c
 +
20 -rw-r--r-- 1 yoder yoder  17214 Mar  8 13:42 iommu.ko
 +
  4 -rw-r--r-- 1 yoder yoder  1924 Mar  8 13:40 iommu.mod.c
 +
  4 -rw-r--r-- 1 yoder yoder  2152 Mar  8 11:28 iopgtable.h
 +
20 -rw-r--r-- 1 yoder yoder  19139 Mar  8 11:28 iovmm.c
 +
16 -rw-r--r-- 1 yoder yoder  14686 Mar  8 13:42 iovmm.ko
 +
  4 -rw-r--r-- 1 yoder yoder  1764 Mar  8 13:40 iovmm.mod.c
 +
12 -rw-r--r-- 1 yoder yoder  12069 Mar  8 11:18 mailbox.c
 +
28 -rw-r--r-- 1 yoder yoder  26560 Mar  8 11:18 mcbsp.c
 +
  4 -rw-r--r-- 1 yoder yoder  2109 Mar  8 11:18 mux.c
 +
  4 -rw-r--r-- 1 yoder yoder  2739 Mar  8 11:18 ocpi.c
 +
12 -rw-r--r-- 1 yoder yoder  10915 Mar  8 11:18 sram.c
 +
20 -rw-r--r-- 1 yoder yoder  18290 Mar  8 11:18 usb.c
 +
16 -rw-r--r-- 1 yoder yoder  13911 Mar  8 11:26 vram.c
 +
  8 -rw-r--r-- 1 yoder yoder  6426 Mar  8 11:26 vrfb.c
 +
 +
</pre>
 +
|-
 +
| 4-4
 +
| 4-17
 +
| Snippet from Linux 2.6 .config
 +
| <pre>
 +
...
 +
#
 +
# USB Input Devices
 +
#
 +
CONFIG_USB_HID=y
 +
# CONFIG_HID_PID is not set
 +
# CONFIG_USB_HIDDEV is not set
 +
 +
#
 +
# Special HID drivers
 +
#
 +
CONFIG_HID_COMPAT=y
 +
CONFIG_HID_A4TECH=y
 +
CONFIG_HID_APPLE=y
 +
CONFIG_HID_BELKIN=y
 +
CONFIG_HID_CHERRY=y
 +
...
 
</pre>
 
</pre>
 
|}
 
|}

Revision as of 18:29, 19 March 2010


Here are the listing from the Embedded Linux Primer as done on the Beagle.

Chapter 2

Number Page Caption Listing
2-1 2-6 Initial Bootloader Serial Output
Texas Instruments X-Loader 1.4.2 (Feb 19 2009 - 12:01:24)
Reading boot sector
Loading u-boot.bin from mmc


U-Boot 2009.11-rc1 (Jan 08 2010 - 21:19:52)

OMAP3530-GP ES3.1, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
I2C:   ready
DRAM:  256 MB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Board revision C4
Die ID #5444000400000000040365fa1400e007
Hit any key to stop autoboot:  0
OMAP3 beagleboard.org # 
2-2 2-7 Loading the Linux Kernel
2-3 2-9 Linux Final Boot Messages

2-4 2-21 Hello World, Embedded Style
#include <stdio.h>

int bss_var;        /* Uninitialized global variable */

int data_var = 1;   /* Initialized global variable */

int main(int argc, char **argv)
{
  void *stack_var;            /* Local variable on the stack */
  
  stack_var = (void *)main;   /* Don't let the compiler */
                              /* optimize it out */

  printf("Hello, World! Main is executing at %p\n", stack_var);
  printf("This address (%p) is in our stack frame\n", &stack_var);

  /* bss section contains uninitialized data */
  printf("This address (%p) is in our bss section\n", &bss_var);

  /* data section contains initializated data */
  printf("This address (%p) is in our data section\n", &data_var);

  return 0;
}
2-5 2-22 Hello Output for Host Computer

2-5 2-22 Hello Output for Beagle

Chapter 4

Number Page Caption Listing
4-1 4-7 Kernel Build Output
$ export OETREE="${HOME}/oe"
$ PATH=${OETREE}/angstrom-dev/staging/i686-linux/usr/bin/:${PATH}
$ PATH=${OETREE}/angstrom-dev/cross/armv7a/bin/:${PATH}
$ make CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage
  CHK     include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
  CHK     include/linux/utsrelease.h
  SYMLINK include/asm -> include/asm-arm
  CALL    scripts/checksyscalls.sh
  CHK     include/linux/compile.h
  CC      arch/arm/mach-omap2/io.o
  CC      arch/arm/mach-omap2/devices.o
      .
      .  <lines of output omitted here>
      .
  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  GZIP    arch/arm/boot/compressed/piggy.gz
  AS      arch/arm/boot/compressed/piggy.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-2.6.29-omap1
Created:      Tue Mar  9 12:58:27 2010
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2991236 Bytes = 2921.13 kB = 2.85 MB
Load Address: 0x80008000
Entry Point:  0x80008000
  Image arch/arm/boot/uImage is ready
4-2 4-9 Link Stage: vmlinux

4-3 4-15 Kernel Subdirectory
$ ls -ls arch/arm/plat-omap/ | grep -v \\.o
total 776
  8 -rw-r--r-- 1 yoder yoder   7933 Mar  9 12:14 Kconfig
  8 -rw-r--r-- 1 yoder yoder   7799 Mar  9 12:14 Kconfig.backup
  8 -rw-r--r-- 1 yoder yoder   7799 Mar  8 11:28 Kconfig~
  4 -rw-r--r-- 1 yoder yoder    824 Mar  8 11:28 Makefile
  4 -rw-r--r-- 1 yoder yoder   2404 Mar  8 11:18 bootreason.c
 16 -rw-r--r-- 1 yoder yoder  15334 Mar  8 11:18 clock.c
 12 -rw-r--r-- 1 yoder yoder   8210 Mar  8 11:18 common.c
  4 -rw-r--r-- 1 yoder yoder   1593 Mar  8 11:18 component-version.c
  4 -rw-r--r-- 1 yoder yoder   4053 Mar  8 11:18 cpu-omap.c
  4 -rw-r--r-- 1 yoder yoder   1975 Mar  8 11:18 debug-devices.c
  8 -rw-r--r-- 1 yoder yoder   7120 Mar  8 11:18 debug-leds.c
 12 -rw-r--r-- 1 yoder yoder   9975 Mar  8 11:18 devices.c
 60 -rwxr-xr-x 1 yoder yoder  59827 Mar  8 11:26 dma.c
 24 -rw-r--r-- 1 yoder yoder  20791 Mar  8 11:18 dmtimer.c
 12 -rw-r--r-- 1 yoder yoder   9675 Mar  8 11:25 fb.c
 16 -rw-r--r-- 1 yoder yoder  12815 Mar  8 11:18 gpio-switch.c
 48 -rw-r--r-- 1 yoder yoder  47671 Mar  8 11:18 gpio.c
  8 -rw-r--r-- 1 yoder yoder   5841 Mar  8 11:18 i2c.c
  4 drwxr-xr-x 3 yoder yoder   4096 Mar  8 11:18 include
  4 -rw-r--r-- 1 yoder yoder   3749 Mar  8 11:18 io.c
 20 -rw-r--r-- 1 yoder yoder  19782 Mar  8 11:28 iommu.c
 20 -rw-r--r-- 1 yoder yoder  17214 Mar  8 13:42 iommu.ko
  4 -rw-r--r-- 1 yoder yoder   1924 Mar  8 13:40 iommu.mod.c
  4 -rw-r--r-- 1 yoder yoder   2152 Mar  8 11:28 iopgtable.h
 20 -rw-r--r-- 1 yoder yoder  19139 Mar  8 11:28 iovmm.c
 16 -rw-r--r-- 1 yoder yoder  14686 Mar  8 13:42 iovmm.ko
  4 -rw-r--r-- 1 yoder yoder   1764 Mar  8 13:40 iovmm.mod.c
 12 -rw-r--r-- 1 yoder yoder  12069 Mar  8 11:18 mailbox.c
 28 -rw-r--r-- 1 yoder yoder  26560 Mar  8 11:18 mcbsp.c
  4 -rw-r--r-- 1 yoder yoder   2109 Mar  8 11:18 mux.c
  4 -rw-r--r-- 1 yoder yoder   2739 Mar  8 11:18 ocpi.c
 12 -rw-r--r-- 1 yoder yoder  10915 Mar  8 11:18 sram.c
 20 -rw-r--r-- 1 yoder yoder  18290 Mar  8 11:18 usb.c
 16 -rw-r--r-- 1 yoder yoder  13911 Mar  8 11:26 vram.c
  8 -rw-r--r-- 1 yoder yoder   6426 Mar  8 11:26 vrfb.c

4-4 4-17 Snippet from Linux 2.6 .config
...
#
# USB Input Devices
#
CONFIG_USB_HID=y
# CONFIG_HID_PID is not set
# CONFIG_USB_HIDDEV is not set

#
# Special HID drivers
#
CONFIG_HID_COMPAT=y
CONFIG_HID_A4TECH=y
CONFIG_HID_APPLE=y
CONFIG_HID_BELKIN=y
CONFIG_HID_CHERRY=y
...