烧录(u-boot、kernel、rootfs)

gk7101

开发准备:
    1). 挂在根文件系统的目录
        a. 打开文件:/etc/default/tftpd-hpa
            @sudo vi /etc/exports    
        b. 写入以下内容:
            /opt/rootfs            *(subtree_check,rw,no_root_squash,async)

        c. 重启服务器
            @sudo /etc/init.d/nfs-server-kernel restart


    2). 配置tftp远程下载服务:

        a. 打开文件:/etc/default/tftpd-hpa

            sudo vi /etc/default/tftpd-hpa

        b. 写入以下内容:

            RUN_DAEMON="yes"

            OPTIONS = "-l -s /tftpboot"


一、通过tftp烧写u-boot

    (前提: nandflash中已有别人烧写好的u-boot,此时可以通过tftp下载更新)

    A. linux @cp u-boot.bin /tftpboot

    B. arm #tftp 0xc1000000 u-boot.bin

    C. arm #snand erase 0 0x100000

    D. arm #snand write 0x40008000 0 0x100000

    E.重启开发版


二、通过tftp烧写zimage

    1. linux @cp u-boot.bin /tftpboot

    2. arm #tftp 0xc1000000 zimage   //0xc1000000为ddr的某个空的地址

    3. arm #snand erase 0x100000 0x300000  //清除nand flash的某个空间

    4. arm #snand write 0xc1000000 0x100000 0x300000  //把ddr中的zimage读到nand flash中
       //修改环境变量
    5. arm #edit  bootcmd  
            snand read 0xC1000000 0x100000 0x290000; bootm  //bootcmd=run tftpboot 表示从网络启动

    6. arm #save

三、通过tftp烧写rootfs

    A. linux @cp squashfs.img /tftpboot

    B. arm #tftp 0xc1000000 squashfs.img

    C. arm #snand erase 0x1080000 0xc00000

    D. arm #snand write 0xc1000000 0x1080000 0xc00000

    //修改环境变量()
    E. arm #edit bootargs 
            console=ttySGK0 noinitrd root=/dev/mtdblock3 rootfstype=squashfs mem=35m video=gk_fb0:720x480,720x480,8,0 . phytype=1 switch_printk=1 sensor=JXH42 wifi=MT7601 rtc=0 acc=0 product=WIFI_DVR version=v1.2.1.4

    F. arm #save


四、在第二个分区中使用cramfs
    修改rootfs中的etc/init.d/rcS
    #将第三个分区挂载到home目录
    /bin/mount -t jffs2 /dev/mtdblock3  /home

。。。
。。。


错误提示:启动开发板时打印的信息  jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00380000: 0x23c2 instead
解决:flash清除多余的分区

五、分区大小
    测试时使用的分区信息如下 (kernel 中 gk7101_spinand.c )

    static struct mtd_partition gk7101_spinand_partitions[ ] = {
         //392k    
         [0] = {
             .name   = "uboot",
             .offset = 0x00000000,
             .size   = 0x00060000,
         },
         //128K
         [1] = {
             .name   = "ubootenv",
             .offset = 0x00060000,
             .size   = 0x00020000,
         },
         //3M
         [2] = {
             .name   = "kernel",
             .offset = 0x00100000,
             .size   = 0x00300000,
         },
         //112M
         [3] = {
             .name   = "rootfs",
             .offset = 0x01080000,
             .size   = 0x06f80000,
         },
        //128k
        [4] = {
             .name   = "update",
             .offset = 0x00f60000,
             .size   = 0x00020000,
         },
         //1M
         [5] = {
             .name   = "sysinfo",
             .offset = 0x00f80000,
             .size   = 0x00100000,
         },
         //11M
         [6] = {
             .name   = "unused",
             .offset = 0x00400000,
             .size   = 0x00b60000,
         },

    };

你可能感兴趣的:(13_android底层)