U-Boot在华恒S3C2410EDU板子上的移植(三)

2014-11-24 11:10:56 · 作者: · 浏览: 6
000 00F20000 00F40000 00F60000 00F80000
00FA0000 00FC0000 00FE0000
DAILY2410 #



DAILY2410 # protect off 1:0
Un-Protect Flash Sectors 0-0 in Bank # 1
. done
DAILY2410 #


DAILY2410 # erase 1:0
Erase Flash Sectors 0-0 in Bank # 1 [XXXXX]
DAILY2410 #



DAILY2410 # tftp 30008000 u-boot.bin
dm9000 i/o: 0x8000300, id: 0x90000a46
MAC: 00:80:00:80:00:80
operating at unknown: 15 mode
TFTP from server 192.168.2.111; our IP address is 192.168.2.110
Filename 'u-boot.bin'.
Load address: 0x30008000
Loading: T #####################
done
Bytes transferred = 103704 (19518 hex)



DAILY2410 # cp.b 30008000 0 20000
Copy to Flash... *******************************************************
#
done




7.出现新的问题,用这个uboot虽然能下载内核,说明网卡驱动正常,但是无法go,也不能正常bootm。
如果用go命令出现:
## Starting application at 0x30008000 ...
Uncompressing Linux.............................................................
Error: unrecognized/unsupported machine ID (r1 = 0x33f4fc88).

Available machine support:

ID (hex) NAME
000000c1 SMDK2410

Please check your kernel config and/or bootloader.
或者大多数时候就停在
## Starting application at 0x30008000 ...
Uncompressing Linux............................................................. 不动了。。
这是uboot传递给内核的参数发生错误。
解决方法是参照ppcboot源码中的go指令的运行方式修改。
只要修改两个文件即可:lib_arm/armlinux.c和common/cmd_boot.c。 在armlinux.c中加入
static inline void cpu_arm920_cache_clean_invalidate_all(void)
{
__asm__(
"movr1, #0/n"
"movr1, #7 << 5/n" /* 8 segments */
"1:orrr3, r1, #63 << 26/n" /* 64 entries */
"2:mcrp15, 0, r3, c7, c14, 2/n" /* clean & invalidate D index */
"subsr3, r3, #1 << 26/n"
"bcs2b/n" /* entries 64 to 0 */
"subsr1, r1, #1 << 5/n"
"bcs1b/n" /* segments 7 to 0 */
"mcrp15, 0, r1, c7, c5, 0/n" /* invalidate I cache */
"mcrp15, 0, r1, c7, c10, 4/n" /* drain WB */
);
}


static inline void cpu_arm920_tlb_invalidate_all(void)
{
__asm__(
"movr0, #0/n"
"mcrp15, 0, r0, c7, c10, 4/n"/* drain WB */
"mcrp15, 0, r0, c8, c7, 0/n"/* invalidate I & D TLBs */
);
}



void call_linux(long a0, long a1, long a2)
{
__asm__(
"movr0, %0/n"
"movr1, %1/n"
"movr2, %2/n"
"movip, #0/n"
"mcrp15, 0, ip, c13, c0, 0/n"/* zero PID */
"mcrp15, 0, ip, c7, c7, 0/n"/* invalidate I,D caches */
"mcrp15, 0, ip, c7, c10, 4/n"/* drain write buffer */
"mcrp15, 0, ip, c8, c7, 0/n"/* invalidate I,D TLBs */
"mrcp15, 0, ip, c1, c0, 0/n"/* get control register */
"bicip, ip, #0x0001/n"/* disable MMU */
"mcrp15, 0, ip, c1, c0, 0/n"/* write control register */
"movpc, r2/n"
"nop/n"
"nop/n"
: /* no outpus */
: "r" (a0), "r" (a1), "r" (a2)
);
#define RAMDISK 1
/*static*/ void setup_linux_param(ulong param_base)
{
struct param_struct *params = (struct param_struct *)param_base;
#ifdef RAMDISK
char linux_cmd[] = "initrd=0x30800000,0x440000 mem=64M root=/dev/ram init=/linuxrc console=ttyS0";
#endif
#ifdef CRAMFS
char linux_cmd[] = "root=/dev/mtdblock/2 rw mem=32M";
#endif
printf("Setup linux parameters at 0x%08lx/n", param_base);
memset(params, 0, sizeof(struct param_struct));


params->u1.s.page_size = LINUX_PAGE_SIZE;
params->u1.s.nr_pages = (DRAM_SIZE >> LINUX_PAGE_SHIFT);
#if 0
params->u1.s.page_size = LINUX_PAGE_SIZE;
params->u1.s.nr_pages = (dram_size >> LINUX_PAGE_SHIFT);
params->u1.s.ramdisk_size = 0;
params->u1.s.rootdev = rootdev;
params->u1.s.flags = 0;


#endif
/* If use ramdisk */
params->u1.s.initrd_start = 0xC0800000 ;
params->u1.s.initrd_size = 0x440000;
params->u1.s.rd_start = 0;


/* set linux command line */
if (linux_cmd == NULL) {
printf("Wrong magic: could not found linux command line/n");
} else {
memcpy(params->commandline, linux_cmd, strlen(linux_cmd) + 1);
}
}
以及几个宏变量的定义。
在cmd_boot.c中将do_go函数改为
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulongaddr, rc;
int rcode = 0;


if (argc < 2) {
printf ("Usage:/n%s/n", cmdtp->usage);
return 1;
}


addr = simple_strtoul(argv[1], NULL, 16);


printf ("## Starting application at 0x%08lx .../n", addr);


printf("Start linux ../n");
setup_linux_param(/*boot_mem_base*/0x30000000 + 0x100);
call_linux(0, 0xc1, addr);
printf("End/n");
rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
if (rc != 0) rcode = 1;


printf ("## Application terminated, rc = 0x%lx/n", rc);
return rcode;
}
就ok啦。
重新编译后,我的linux和ramdisk.image.gz就可以欢快的跑起来啦。
哈,不过这是2.4的内核,把armlinux.c中的ttyS0改为ttySAC0,在用论坛上下的zImage.2410.2.6测试一下,哈,2.6也能跑啦。
不过bootm的问题我无法解决。
做了一个uImage。Tftp 30008000后,出现:
## Booting image at 30008000 ...
Image Name:
Created: 2007-01-01 12:18:08 UTC
Image Type: ARM Linux Kernel Image (gzip compressed)
Data Size: 893780 Bytes = 872.8 kB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Uncompressing Kernel Image ... Error: inflate() returned -3
GUNZIP ERROR - must RESET board to recover


看了论坛上的旧帖,说是地址覆盖了。故改为31000000 .tftp后,bootm 31000000,呵,内核也能跑以来,可是莫名奇妙的是那些打印信息不在console上显示,怎么全都跑到lcd上显示去了。。。我晕。。就是把原来的zImage做成的uImage,解压后两个应该是一样的啊。
晕。。。不搞了。。还是先用go继续做吧。