文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>修改vivi(修改分区、添加命令)

修改vivi(修改分区、添加命令)

时间:2009-08-19  来源:sure_priterand

1.    修改、vivi/arch/s3c2410/smdk.c  添加file分区
    mtd_partition_t default_mtd_partitions[] = {
    {
        name:        "vivi",
        offset:        0,
        size:        0x00020000,
        flag:        0
    }, {
        name:        "param",
        offset:        0x00020000,
        size:        0x00010000,
        flag:        0
    }, {
        name:        "kernel",
        offset:        0x00030000,
        size:        0x000f0000,
        flag:        0
    }, {
        name:        "root",
        offset:        0x00120000,
        size:        0x00940000,
        flag:        MF_BONFS
    },{
        name:        "file",
        offset:        0x00a60000,
        size:        0x00440000,
        flag:        0
    }
};
2.  vivi/lib/command.c中添加命令 eg.添加file_cmd
    extern user_command_t file_cmd;
    add_command(&file_cmd);//file_cmd是个结构体可以仿照boot_cmd写
3.    vivi/lib/boot_kernel.c中实现命令
    user_command_t file_cmd = {
    "file",
    file_boot,//file_boot函数获取file分区的起始地址和分区大小
    NULL,
    "file[{cmds}] \t\t\t-- Booting file"
    };
    ///////////////////////////////////////////////////
    void file_boot(int argc,const char **argv)
    {
        ulong from = 0;
        size_t size = 0;
        mtd_partition_t *file_part;
        switch (argc) {
            case 1:
                file_part = get_mtd_partition("file");
                //返回的结构提供了file的起始地址和该分区大小
                if(file_part == NULL){
                    printk("Can't find default 'file' partition\n");
                    return;
                }
                from  = file_part->offset;
                size = file_part->size;
                //读取起始地址和分区大小
                break;
            default:
                display_help();
                break;
        }
        boot_file(from, size);
    }
    //////////////////////////////////////////////////////////////
    void go(unsigned long addr, long a0, long a1, long a2, long a3);
     int boot_file(ulong from, size_t size)
    {
        int ret;
        ulong boot_mem_base;
        ulong to;
        to = 0x30000000;
        printk("Copy linux file from 0x%08lx to 0x%08lx, \
        size = 0x%08lx ... ",from, to, size);
        ret = nand_read_ll((unsigned char *)to, 
                           (unsigned long)from, (int)size);
        //将代码考到ram中0x30000000地址处
        if (ret) {
            printk("failed\n");
            return -1;
        } else {
            printk("done\n");
        }
        go(to,0,0,0,0);//跳到ram中0x30000000地址处执行代码
        return 0;
        }
相关阅读 更多 +
排行榜 更多 +
边境检察最后区域手机版下载

边境检察最后区域手机版下载

角色扮演 下载
酋长你别跑手游下载

酋长你别跑手游下载

休闲益智 下载
心动漫画app下载官方版

心动漫画app下载官方版

浏览阅读 下载