Chinaunix首页 | 论坛 | 博客
  • 博客访问: 629133
  • 博文数量: 112
  • 博客积分: 5011
  • 博客等级: 大校
  • 技术积分: 1406
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-25 18:46
文章分类
文章存档

2011年(1)

2010年(5)

2009年(25)

2008年(81)

我的朋友

分类: LINUX

2008-04-26 11:49:02


文章出处:piaoxiang.cublog.cn
    1、下载内核源代码,选定Linux 2.6.20.()
    2、打补丁。下载对应版本的补丁。网上好像失效,在PUDN上下载了补丁,放在这里。
文件: 2.6.20-at91.rar
大小: 53KB
下载: 下载

    3、移植好,之后,加载到开发板上,出现问题:

Error: unrecognized/unsupported machine ID

    原因:

This kind of error message happens if the machine ID which is set in U-Boot doesn't match the kernel's ID(s). Unfortunately a standard U-Boot sets the machine ID on AT91RM9200DK boards not to MACH_TYPE_AT91RM9200DK but to the generic MACH_TYPE_AT91RM9200. You can either this in board/at91rm9200dk/at91rm9200dk.c; I would recommend to obtain a new machine ID and create your own U-Boot board type, using board/at91rm9200dk as a template. The list of machine IDs can be found in include/asm-arm/mach-types.h.

The Linux kernel has to be changed accordingly to the above machine ID. There you can find the information in arch/arm/tools/mach-types arch/arm/boot/compressed/head-at91rm9200.S arch/arm/mach-at91rm9200/board-dk.c

    具体资料如下:

    U-boot端include/asm-arm/mach-types.h支持的at91rm9200的machine类型有:

#define MACH_TYPE_AT91RM9200           251
#define MACH_TYPE_AT91RM9200DK         262

    但是在board/at91rm9200dk/at91rm9200dk.c中,虽然注释中说明使用的是AT91RM9200DK-Board,但是实际使用的是MACH_TYPE_AT91RM9200。

int board_init (void)
{
    /* Enable Ctrlc */
    console_init_f ();

    /* Correct IRDA resistor problem */
    /* Set PA23_TXD in Output */
    ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_OER = AT91C_PA23_TXD2;

    /* memory and cpu-speed are setup before relocation */
    /* so we do _nothing_ here */

    /* arch number of AT91RM9200DK-Board */
    gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200;
    /* adress of boot parameters */
    gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;

    return 0;
}


Linux内核端:
arch/arm/tools/mach-types支持的at91rm9200的machine的ID有:
at91rm9200              ARCH_AT91RM9200         AT91RM9200              251
at91rm9200dk            ARCH_AT91RM9200DK       AT91RM9200DK            262
at91rm9200tb            ARCH_AT91RM9200TB       AT91RM9200TB            380
at91rm9200kr            MACH_AT91RM9200KR       AT91RM9200KR            450
at91rm9200ek            MACH_AT91RM9200EK       AT91RM9200EK            705
at91rm9200utl           MACH_AT91RM9200UTL      AT91RM9200UTL           821
at91rm9200kg            MACH_AT91RM9200KG       AT91RM9200KG            975
at91rm9200rb            MACH_AT91RM9200RB       AT91RM9200RB            1060
at91rm9200df            MACH_AT91RM9200DF       AT91RM9200DF            1119

    arch/arm/boot/compressed/head-at91rm9200.S支持的有:

.section ".start", "ax"

                @ Atmel AT91RM9200-DK : 262
                mov r3, #(MACH_TYPE_AT91RM9200DK & 0xff)
                orr r3, r3, #(MACH_TYPE_AT91RM9200DK & 0xff00)
                cmp r7, r3
                beq 99f

                @ Cogent CSB337 : 399
                mov r3, #(MACH_TYPE_CSB337 & 0xff)
                orr r3, r3, #(MACH_TYPE_CSB337 & 0xff00)
                cmp r7, r3
                beq 99f

                @ Cogent CSB637 : 648
                mov r3, #(MACH_TYPE_CSB637 & 0xff)
                orr r3, r3, #(MACH_TYPE_CSB637 & 0xff00)
                cmp r7, r3
                beq 99f

                @ Atmel AT91RM9200-EK : 705
                mov r3, #(MACH_TYPE_AT91RM9200EK & 0xff)
                orr r3, r3, #(MACH_TYPE_AT91RM9200EK & 0xff00)
                cmp r7, r3
                beq 99f

                @ Conitec Carmeva : 769
                mov r3, #(MACH_TYPE_CARMEVA & 0xff)
                orr r3, r3, #(MACH_TYPE_CARMEVA & 0xff00)
                cmp r7, r3
                beq 99f

                @ KwikByte KB920x : 612
                mov r3, #(MACH_TYPE_KB9200 & 0xff)
                orr r3, r3, #(MACH_TYPE_KB9200 & 0xff00)
                cmp r7, r3
                beq 99f

                @ Embest ATEB9200 : 923
                mov r3, #(MACH_TYPE_ATEB9200 & 0xff)
                orr r3, r3, #(MACH_TYPE_ATEB9200 & 0xff00)
                cmp r7, r3
                beq 99f

                @ Sperry-Sun KAFA : 662
                mov r3, #(MACH_TYPE_KAFA & 0xff)
                orr r3, r3, #(MACH_TYPE_KAFA & 0xff00)
                cmp r7, r3
                beq 99f

                @ Ajeco 1ARM : 1075
                mov r3, #(MACH_TYPE_ONEARM & 0xff)
                orr r3, r3, #(MACH_TYPE_ONEARM & 0xff00)
                cmp r7, r3
                beq 99f

                @ Unknown board, use the AT91RM9200DK board
                @ mov r7, #MACH_TYPE_AT91RM9200
                mov r7, #(MACH_TYPE_AT91RM9200DK & 0xff)
                orr r7, r7, #(MACH_TYPE_AT91RM9200DK & 0xff00)

99:


    真正的配置信息是在arch/arm/mach-at91rm9200/board-dk.c中。

MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")
        /* Maintainer: SAN People/Atmel */
        .phys_io = AT91_BASE_SYS,
        .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
        .boot_params = AT91_SDRAM_BASE + 0x100,
        .timer = &at91rm9200_timer,
        .map_io = dk_map_io,
        .init_irq = dk_init_irq,
        .init_machine = dk_board_init,
MACHINE_END


    由此可以看出,Uboot使用的AT91RM9200的machine ID,而内核配置的是at91rm9200 dk的machine
ID,在这种情况下就出现了不一致。所以更改的方法:

    方法一、把Uboot中board init中更改为MACH_TYPE_AT91RM9200DK

    方法二、把MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")更改为MACHINE_START(AT91RM9200, "Atmel AT91RM9200-DK")。

    只要U-boot和Linux kernel一致即可。
阅读(2017) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~