s3c6410烧写u-boot&&Linux

一、u-boot的制作:sd卡,nandFlash

前提:

    1.安装了交叉编译器,arm-gcc

    2.有以下的目录

    [root@localhost 6410]# ls
    myDocument  s3c6410  s3c6410.bz2
    [root@localhost 6410]# cd s3c6410
    [root@localhost s3c6410]# ls
    code  resource  smdk6410_resource  tool
    [root@localhost s3c6410]# cd smdk6410_resource/
    [root@localhost smdk6410_resource]# ls
    busybox-1.13.3  datasheet  openJtag  schema  tools
    cross_compile   images     rootfs    src     usb-rs232-redhat-driver
    [root@localhost smdk6410_resource]# cd src/
    [root@localhost src]# ls    
    busybox-1.13.3                  linux-2.6.28_smdk6410.tar.bz2  udev-128.tar.gz
    busybox-1.13.3-mini6410.tar.gz  u-boot-1.1.6_smdk6410
    linux-2.6.28_smdk6410           u-boot-1.1.6_smdk6410.tar.bz2
    [root@localhost src]# tar xvf u-boot-1.1.6_smdk6410.tar.bz2 

    [root@localhost src]# cd u-boot-1.1.6_smdk6410

    3.相关文件:

        1).修改编译器的位置:

            [root@localhost u-boot-1.1.6_smdk6410]# vim Makefile

             CROSS_COMPILE = /usr/local/arm/arm-none-linux-gnueabi/bin/arm-none-linux-\

gnueabi-     //即在CROSS――COMPILE上填写交叉编译器位置的前缀

        2).修改u-boot的参数和信息:

            [root@localhost u-boot-1.1.6_smdk6410]# vim include/configs/smdk6410.h

                a)设置命令提示符是什么

                    #define CFG_PROMPT              "yyj@up # "     /* Monitor Command Prompt

                b)设置把u-boot制作在sd卡启动还是nandFlash启动(只能选择一个,把其它都注释掉)

                 /* Boot configuration (define only one of next) */

                //#define CONFIG_BOOT_NOR
                #define CONFIG_BOOT_NAND   //nandFlash启动
                //#define CONFIG_BOOT_MOVINAND  //sd卡启动
                //#define CONFIG_BOOT_ONENAND


                c)设置ip,启动倒数等等

                    #define CONFIG_ETHADDR          00:40:5c:26:0a:5b
                    #define CONFIG_NETMASK          255.255.255.0
                    #define CONFIG_IPADDR           192.168.1.20
                    #define CONFIG_SERVERIP         192.168.1.12//服务器ip,一般为pc

                    #define CONFIG_GATEWAYIP        192.168.1.1

   
    4.步骤:

        sd卡:

            a)make clean;make distclean;

            b)vim Makefile  //修改CROSS_COMPILE =  XX(交叉编译器的前缀)

            c)vim include/configs/sdmk6410.h   (修改Boot configuration为sd卡启动,即把#define CONFIG_BOOT_MOVINAND的注释去掉,其它的注释,当然还可以修改ip-->CONFIG――IPADDR,命令提示符为什么CFG――PROMPT)

            d)make smdk6410_config;make;(smdk6410_config就是Makefile里面的定义的变量,make完成之后就会生成一个u-boot.bin)

            make的最后会生成下面的信息:

            -Map u-boot.map -o u-boot
            /usr/local/arm/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objcopy --gap-    fill=0xff -O srec u-boot u-boot.srec
            /usr/local/arm/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin
            /usr/local/arm/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump -d u-boot > u-boot.dis

            所以在当前目录下会生成以下文件:

            [root@localhost u-boot-1.1.6_smdk6410]# ls u-boot*
            u-boot  u-boot.bin  u-boot.dis  u-boot.map  u-boot.srec

            e)[root@localhost u-boot-1.1.6_smdk6410]# ./mkmovi (生成u-boot-movi.bin)

            f)[root@localhost u-boot-1.1.6_smdk6410]# ls u-boot* -lh
                -rwxrwxrwx. 1 root root 648K 1月  15 22:20 u-boot
                -rwxrwxrwx. 1 root root 192K 1月  15 22:20 u-boot.bin
                -rwxrwxrwx. 1 root root 1.4M 1月  15 22:20 u-boot.dis
                -rwxrwxrwx. 1 root root 166K 1月  15 22:20 u-boot.map
                -rwxrwxrwx. 1 root root 264K 1月  15 22:24 u-boot-movi.bin
                -rwxrwxrwx. 1 root root 577K 1月  15 22:20 u-boot.srec

            //为什么要做step e)呢,因为google规定u-boot必须是264K,而我们自己制造出来的东西即u-boot.bin只有192K,不足,所以我们用./mkmovi来在u-boot.bin后面填充零来让其大小达到264K和制造成sd格式的u-boot

            g)插入sd卡,先把其umount media/XX;./write_sd /dev/sdb  ./u-boot-movi.bin(注意不能写分区,即/dev/sdb1不可以)

            h)板子插入sd卡,把板子选择启动开关调到sd卡启动即可!

    

        nandFlash:

            a)make clean;make distclean;

            b)vim Makefile  //修改CROSS_COMPILE =  XX(交叉编译器的前缀)

            c)vim include/configs/sdmk6410.h   (修改Boot configuration为nandFlash卡启动,即把#define CONFIG_BOOT_NAND的注释去掉,其它的注释,当然还可以修改ip-->CONFIG――IPADDR,命令提示符为什么 CFG――PROMPT)

            d)make smdk6410_config;make;(smdk6410_config就是Makefile里面的定义的变量,make完成之后就会生成一个u-boot.bin)

            e)[root@localhost u-boot-1.1.6_smdk6410]# ./mkmovi (生成u-boot-movi.bin,即生成nandFlash所能识别的格式)

            f)pc:安装并配置好tftp和设置好ip,并把u-boot-nand.bin拷贝到相应的位置即可

             arm:tftp 50001000 u-boot-nand.bin

                nand erase clean

                nand write 50001000 0 100000(1M)

    


            

你可能感兴趣的:(linux,u-boot烧写)