对 u-boou1.1.6的do_go修改(最好不动)

conjimmy · · 1399 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

common/cmd_boot.c

int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
        ulong   addr, 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);
/**jimmy addd the below 3 lines*/
setup_linux_param(0x30000100);
         call_linux(0,0x0c1,0x30008000);
         printf("ok\n");



在lib_arm/armlinux.c中添加

static inline void cpu_arm920_cache_clean_invalidate_all(void)
{
__asm__(
"mov r1, #0\n"
"mov r1, #7 << 5 \n"  /* 8 segments */
"1:orr r3, r1, #63 << 26 \n"  /* 64 entries */
"2:mcr p15, 0, r3, c7, c14, 2 \n" /* clean & invalidate D index */
"subs r3, r3, #1 << 26 \n"
"bcs 2b \n"  /* entries 64 to 0 */
"subs r1, r1, #1 << 5 \n"
"bcs 1b \n"  /* segments 7 to 0 */
"mcr p15, 0, r1, c7, c5, 0 \n"  /* invalidate I cache */
"mcr p15, 0, r1, c7, c10, 4 \n" /* drain WB */
);
}

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

 

void  call_linux(long a0, long a1, long a2)
{
__asm__(
"mov r0, %0 \n"
"mov r1, %1 \n"
"mov r2, %2 \n"
"mov ip, #0 \n"
"mcr p15, 0, ip, c13, c0, 0 \n"/* zero PID */
"mcr p15, 0, ip, c7, c7, 0 \n"/* invalidate I,D caches */
"mcr p15, 0, ip, c7, c10, 4 \n"/* drain write buffer */
"mcr p15, 0, ip, c8, c7, 0 \n"/* invalidate I,D TLBs */
"mrc p15, 0, ip, c1, c0, 0 \n"/* get control register */
"bic ip, ip, #0x0001 \n"/* disable MMU */
"mcr p15, 0, ip, c1, c0, 0 \n"/* write control register */
"mov pc, 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 = 0x00001000;
params->u1.s.nr_pages = (0x04000000 >> 12);
#if 0
params->u1.s.page_size = 0x00001000;
params->u1.s.nr_pages = (0x04000000 >> 12);
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);
}
}






有疑问加站长微信联系(非本文作者)

本文来自:CSDN博客

感谢作者:conjimmy

查看原文:对 u-boou1.1.6的do_go修改(最好不动)

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1399 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传