每一个machine,都要定义一个自己的machine_desc结构,该结构定义了该machine的一些最基本的特性。

struct machine_desc {
unsigned int nr; /* architecture number */
const char *name; /* architecture name */
unsigned long boot_params; /* tagged list */
const char **dt_compat; /* array of device tree
* 'compatible' strings */ unsigned int nr_irqs; /* number of IRQs */ unsigned int video_start; /* start of video RAM */
unsigned int video_end; /* end of video RAM */ unsigned int reserve_lp0 :; /* never has lp0 */
unsigned int reserve_lp1 :; /* never has lp1 */
unsigned int reserve_lp2 :; /* never has lp2 */
unsigned int soft_reboot :; /* soft reboot */
void (*fixup)(struct machine_desc *,
struct tag *, char **,
struct meminfo *);
void (*reserve)(void);/* reserve mem blocks */
void (*map_io)(void);/* IO mapping function */
void (*init_early)(void);
void (*init_irq)(void);
struct sys_timer *timer; /* system tick timer */
void (*init_machine)(void);
};

在arch/arm/include/asm/mach/arch.h中有下面的宏,用于声明处理器相关的machine_desc结构体,并将该结构体放入vmlinux.lds中指定的段中。

#define MACHINE_START(_type,_name)            \
static const struct machine_desc __mach_desc_##_type \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = MACH_TYPE_##_type, \
.name = _name, #define MACHINE_END \
};

在arch/arm/mach-s3c64xx/mach-smdk6410.c中使用上述宏声明machine_desc结构体,

MACHINE_START(SMDK6410, "SMDK6410")
/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
//.phys_io = S3C_PA_UART & 0xfff00000,
//.io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C64XX_PA_SDRAM + 0x100, .init_irq = s3c6410_init_irq,
.map_io = smdk6410_map_io,
.init_machine = smdk6410_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END

上面的宏展开得到:

static const struct machine_desc __mach_desc_SMDK6410 __used    __attribute__((__section__(".arch.info.init"))) = {

    .nr        = MACH_TYPE_SMDK6410,
.name = "SMDK6410",
.boot_params = S3C64XX_PA_SDRAM + 0x100, //0x5000_0100
.init_irq = s3c6410_init_irq,
.map_io = smdk6410_map_io,
.init_machine = smdk6410_machine_init,
.timer = &s3c24xx_timer,
}

MACH_TYPE_SMDK6410在 arch/arm/tools/mach-types文件中定义

#         machine_is_xxx      CONFIG_xxxx     MACH_TYPE_xxx   number

1621:smdk6410                MACH_SMDK6410   SMDK6410        1626

参考:linux3.1.0内核中/include/generated下mach-types.h的产生

     OK6410开发板Linux内核移植

machine_desc的更多相关文章

  1. machine_desc结构体【转】

    转自:http://blog.csdn.net/myarrow/article/details/8609564 1. 简介 内核提供了一个重要的结构体struct machine_desc ,这个结构 ...

  2. Linux内核启动过程概述

    版权声明:本文原创,转载需声明作者ID和原文链接地址. Hi!大家好,我是CrazyCatJack.今天给大家带来的是Linux内核启动过程概述.希望能够帮助大家更好的理解Linux内核的启动,并且创 ...

  3. 第4天--linux内核学习

    驱动使用方式1.编译到内核中 * make uImage进入到系统后mknod /dev/led c 500 0 创建设备节点 2.编译为模块 M make module进入到系统后 mknod /d ...

  4. Linux and the Device Tree

    来之\kernel\Documentation\devicetree\usage-model.txt Linux and the Device Tree ----------------------- ...

  5. Linux 内核高-低端内存设置代码跟踪(ARM构架)

    对于ARM中内核如何在启动的时候设置高低端内存的分界线(也是逻辑地址与虚拟地址分界线(虚拟地址)减去那个固定的偏移),这里我稍微引导下(内核分析使用Linux-3.0): 首先定位设置内核虚拟地址起始 ...

  6. Device Tree(三):代码分析【转】

    转自:http://www.wowotech.net/linux_kenrel/dt-code-analysis.html Device Tree(三):代码分析 作者:linuxer 发布于:201 ...

  7. ARM Linux启动代码分析

    前言 在学习.分析之前首先要弄明白一个问题:为什么要分析启动代码? 因为启动代码绝大部分都是用汇编语言写的,对于没学过或者不熟悉汇编语言的同学确实有一定难度,但是如果你想真正深入地学习Linux,那么 ...

  8. 【转载】关于Embedded Linux启动的经典问题

    转载自:http://linux.chinaunix.net/techdoc/install/2009/04/13/1107608.shtml 发信人: armlinux (armlinux), 信区 ...

  9. Linux内核启动

    Linux内核启动过程概述 Linux的启动代码真的挺大,从汇编到C,从Makefile到LDS文件,需要理解的东西很多.毕竟Linux内核是由很多人,花费了巨大的时间和精力写出来的.而且直到现在,这 ...

随机推荐

  1. ADC中的滤波算法

    STM32的AD最大输入时钟不超过14MHZ,最高采样速度1us,可以采用DMA或者内部的基本定时器/高级定时器来触发,利用模拟看门狗监控所选择的的所有通道,如果超过模拟的 阀[fá] 值,将产生中断 ...

  2. [干货分享]AXURE整套高保真UI框架和元件组(白色风格)

      写在前面 强烈建议开始之前阅读以下第一篇高保真UI框架的前面部分,以了解设计思想,这篇文章不再重复介绍: AXURE-整套可复用的高保真元件和框架之暗黑风格 本次共享模板的UI规范 注:由于篇幅问 ...

  3. java ReentranLock锁

    1.效果和synchronized一样,都可以同步执行,lock方法获得锁,unlock方法释放锁 使用示例: package com.test; import java.util.concurren ...

  4. c#基础2-out-ref

    //out参数要求在方法的内部 ; JiangJin(ref salary1); Console.WriteLine(salary1); Console.ReadKey(); 必须为其赋值 out.r ...

  5. ABAP EXCEPTION

    CX_ROOT | |--CX_STATIC_CHECK | |--CX_DYNAMIC_CHECK | | | |--CX_SY_ARITHMETIC_ERROR //运算 '&OPERAT ...

  6. redis 大批量数据插入导致MISCONF Redis is configured to save RDB snapshots的解决

    PS:之前写过一遍,那个方法没有彻底解决,现找到真正的解决方法 环境:redis 3.2.100 windows版(注意!!!这是关键),win10,redis客户端spring boot 2.0.7 ...

  7. uvm_reg_cbs——寄存器模型(十六)

    当你完成寄存器模型的时候,你就会想到给后来的人一个接口,给他更多的扩展,让他做更多的事,一般而言,只有做VIP时,会想到做callbacks. typedef class uvm_reg; typed ...

  8. Cause: java.lang.UnsupportedOperationException

    运行web项目的时候出现以下错误: ### Cause: java.lang.UnsupportedOperationException    at org.mybatis.spring.MyBati ...

  9. BestCoder Round #56 1002 Clarke and problem 1003 Clarke and puzzle (dp,二维bit或线段树)

    今天第二次做BC,不习惯hdu的oj,CE过2次... 1002 Clarke and problem 和Codeforces Round #319 (Div. 2) B Modulo Sum思路差不 ...

  10. 2018.2.27 JavaScript数组方法应用

    JavaScript数组方法应用 1.找出元素item在给定数组arr中的位置 function indexOf(arr,item){ return arr.indexOf(item); } func ...