Chinaunix

标题: linux porting files change [打印本页]

作者: YSLAU    时间: 2008-04-29 12:09
标题: linux porting files change


==================================================================
STEP 0: Configuration

1. mach-types add one entry
# machine_is_xxx CONFIG_xxxx  MACH_TYPE_xxx  number
   ks8695        ARCH_KS8695  KS8695          180

    The above file is needed so that the cript
    linux/arch/arm/tools/gen-mach-types can generate
    linux/include/asm-arm/mach-types.h
2.ks8695_defconfig   create a config file
  When you do make _config, e.g.make ks8695_config
  to build a kernel,then the file corresponding to the first part of
  the parameter is copied out of linux/arch/arm/def-configs/  to  
  linux/.config
3.Kconfig
    config ARCH_KS8695
    bool "Micrel/Kendin KS8695"
    help
        Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based
       System-on-Chip devices.
4. Kconfig

   1."Processor Type"

   # Select CPU types depending on the architecture selected.  This   
    selects which CPUs we support in the kernel image, and the  
   compiler instruction optimiser behaviour.
  # ARM922T
    config CPU_ARM922T
      bool "Support ARM922T processor" if ARCH_INTEGRATOR
      depends on ARCH_LH7A40X || ARCH_INTEGRATOR || ARCH_KS8695
      default y if ARCH_LH7A40X || ARCH_KS8695
      select CPU_32v4T
      select CPU_ABRT_EV4T
      select CPU_CACHE_V4WT
      select CPU_CACHE_VIVT
      select CPU_CP15_MMU
      select CPU_COPY_V4WB if MMU
      select CPU_TLB_V4WBI if MMU
    help
       The ARM922T is a version of the ARM920T, but with smaller
       instruction and data caches. It is used in Altera's
       Excalibur XA device family and Micrel's KS8695 Centaur.
       Say Y if you want support for the ARM922T processor.
       Otherwise, say N.

2."Processor Features"
     config CPU_BIG_ENDIAN
     bool "Build big-endian kernel"
       depends on ARCH_SUPPORTS_BIG_ENDIAN
     help
       Say Y if you plan on running a kernel in big-endian mode.
       Note that your board must be properly built and your board
       port must properly enable any big-endian related features
       of your chipset/board/processor.
=================================================================
=================================================================
STEP 1: make files
0.
    (zreladdr-y)
    (params_phys-y)
    (initrd_phys-y)

1.Makefile  
   machine-$(CONFIG_ARCH_KS8695)  := ks8695
   ifneq ($(machine-y),)
    MACHINE  := arch/arm/mach-$(machine-y)/
2.Makefile

ifneq ($(MACHINE),)
include $(srctree)/$(MACHINE)/Makefile.boot
endif
# Note: the following conditions must always be true:
#   ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
#   PARAMS_PHYS must be within 4MB of ZRELADDR
#   INITRD_PHYS must be in RAM
ZRELADDR    := $(zreladdr-y)
PARAMS_PHYS := $(params_phys-y)
INITRD_PHYS := $(initrd_phys-y)

export ZRELADDR INITRD_PHYS PARAMS_PHYS
targets := Image zImage xipImage bootpImage uImage

=================================================================
STEP 2: .C .S files
1. directory
      -- Low-level IRQ helper macros
      -- Debug output macros
      -- Irq number definations
      -- DMA definations
      -- Memory mapping/translation
      -- Reset operation
      -- IDLE function

    makefile.boot  define macros zreladdr-y
    entry-macro.S  Low-level IRQ helper macros for machine
       get_irqnr_and_base
       disable_irq
    debug-macro.S
        these are low level debug function, which talk to a         
        serial port without relying on interrupts and any other
        kernel functionality

    Reference:
      
       head.S
       entry-header.S
       entry-armv.S
       entry-common.S
   

    arch.c /*may be use other file name.: board-micrel.c*/
       define structure machie_desc map_desc and map_io function
       This should contain the architecture-specific fix ups and IO
       MACHINE_START(KS8695, "KS8695 Centaur Development Board")
      /* Maintainer: Micrel Semiconductor Inc. */
       .phys_io = KS8695_IO_PA,
       .io_pg_offst = (KS8695_IO_VA >> 18) & 0xfffc,
       .boot_params = KS8695_SDRAM_PA + 0x100,
       .map_io  = ks8695_map_io,
       .init_irq = ks8695_init_irq,
       .init_machine = micrel_init,
       .timer  = &ks8695_timer,
       MACHINE_END

       ks8695_map_io()->iotable_init()
       will be called in pageing_init/devicemaps_init in arch/mm.c
      
      static struct __initdata map_desc ks8695_io_desc[] = {
        {
          .virtual = KS8695_IO_VA,
          .pfn  = __phys_to_pfn(KS8695_IO_PA),
          .length  = KS8695_IO_SIZE,
          .type  = MT_DEVICE,
        }
      };
   irq.c
      You should provide the XXX_init_irq function here. This sets
      up the interrupt controller.Interrupt mask and unmask func-
      tions
         
=================================================================
=================================================================
STEP 3: include files
[asm-arm/arch-ks8695/]|[asm-arm/]memroy.h
      PHYS_OFFSET   
      refer to /documents/arm/porting and documents/arm/memory.txt
      kernel memory symbol defintion.
[asm-arm/mach]|[asm-arm/arch-ks8695]|[/asm-arm/]dma.h
        Defines for DMA channels,and DMA-able areas of memory
         
[asm-arm/arch-ks8695/]|[asm-arm/]hardware.h
      define the memory addresses,IO addresses,and so on,according  
      to your hardware specifications (memory map and IO map).
      #define KS8695_SDRAM_PA  0x00000000
      #define KS8695_IO_PA  0x03F00000
      #define KS8695_IO_VA  0xF0000000
      #define KS8695_IO_SIZE  SZ_1M
      #define KS8695_PCIMEM_PA 0x60000000
      #define KS8695_PCIMEM_SIZE SZ_512M
      #define KS8695_PCIIO_PA  0x80000000
      #define KS8695_PCIIO_SIZE SZ_64K
[asm-arm/arch-ks8695/]|[asm-arm/]io.h

[asm-arm/arch-ks8695/]|[asm-arm/]system.h

[asm-arm/arch-ks8695/]|[asm-arm/]timex.h

[asm-arm/arch-ks8695/]uncompress.h  

[asm-arm/arch-ks8695/]irqs.h
     Reference: [asm-arm/]irq.h

[asm-arm/arch-ks8695/]vmalloc.h  
    in pgtable.h
     #ifndef CONFIG_MMU
     #include "pgtable-nommu.h"
     #else
     #include
     #include

Reference:
      [asm-arm/]param.h
      [asm-arm/]time.h      
================================================================
file
ARCH        ?= arm
CROSS_COMPILE   ?= /home/arm-toolchain/gcc-3.4.4-glibc-2.3.6/bin/arm-linux-
===========================
make menuconfig
===========================
make


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/52872/showart_638092.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2