DM3730调试心得(2)

时间:2023-01-02 08:42:53

继续

4.uboot的环境变量在sd卡加载到内核中后,saveenv会同时加载环境变量到nandflash的一段处,所以sd卡再次启动时,环境变量不在从sd卡取,而是直接使用保存在nandflash中的环境变量。

第一次

U-Boot 2010.06 (Jul 08 2011 - 04:34:45)                                         
                                                                                
OMAP34xx/35xx-GP ES2.1, CPU-OPP2 L3-165MHz                                      
OMAP3 EVM board + LPDDR/NAND                                                    
I2C:   ready                                                                    
DRAM:  256 MiB                                                                  
NAND:  HW ECC [Kernel/FS layout] selected                                       
512 MiB                                                                         
*** Warning - bad CRC or NAND, using default environment               //起初找不到nand中的环境变量。。使用sd中uboot自带的默认环境变量。        
                                                                                
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
Read back SMSC id 0x92200000                                                    
Die ID #08ee00229ff80000015f26ad0f01e009                                        
Net:   smc911x-0                                                                
Hit any key to stop autoboot:  0                                                
OMAP3_EVM # setenv bootdelay 5                                                  
OMAP3_EVM # saveenv                                                             
Saving Environment to NAND...                                                   
Erasing Nand...                                                                 
Erasing at 0x240000 -- 100% complete.                    //保存后是先从放env的地方清除nand,然后写入                      
Writing to Nand... done                                                         
OMAP3_EVM #              

再次启动

U-Boot 2010.06 (Jul 08 2011 - 04:34:45)                                         
                                                                                
OMAP34xx/35xx-GP ES2.1, CPU-OPP2 L3-165MHz                                      
OMAP3 EVM board + LPDDR/NAND                                                    
I2C:   ready                                                                    
DRAM:  256 MiB                                                                  
NAND:  HW ECC [Kernel/FS layout] selected                                       
512 MiB                                                                         
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
Read back SMSC id 0x92200000                                                    
Die ID #08ee00229ff80000015f26ad0f01e009                                        
Net:   smc911x-0                                                                
Hit any key to stop autoboot:  0                                                
OMAP3_EVM #
前后两次不一样,这次的环境变量从nand找到,不在说是使用默认环境变量,而使用的环境变量是第一次保存在nand中的数据。

最重要的是uboot会识别evn,就是两者要匹配。如果前者下载在nand中的环境变量是uboot1启动后保存的,sd卡是uboot2,配置sd卡启动后,是不会加载nand中的,虽然nand中有这个变量,但是不匹配,依旧使用默认自带的配置,所以依旧是uboot2的env2 被加载,saveenv后,sd卡启动,那就从nand 加载env2.如果此时从nand启动,那么此时uboot1启动了但是env2和它不匹配,所以用的还是env1。因此这个环境变量蛮重要的不能弄错。


4d57 65d1 6f62 746f 6d63 3d64 6669 6d20    WM.ebootcmd=if m           
80000010: 636d 6920 696e 3b74 7420 6568 206e 6669    mc init; then if           
80000020: 7220 6e75 6c20 616f 6264 6f6f 7374 7263     run loadbootscr           
80000030: 7069 3b74 7420 6568 206e 7572 206e 6f62    ipt; then run bo           
80000040: 746f 6373 6972 7470 203b 6c65 6573 6920    otscript; else i           
80000050: 2066 7572 206e 6f6c 6461 6975 616d 6567    f run loaduimage           
80000060: 203b 6874 6e65 7220 6e75 6d20 636d 6f62    ; then run mmcbo           
80000070: 746f 203b 6c65 6573 7220 6e75 6e20 6e61    ot; else run nan           
80000080: 6264 6f6f 3b74 6620 3b69 6620 3b69 6520    dboot; fi; fi; e           
80000090: 736c 2065 7572 206e 616e 646e 6f62 746f    lse run nandboot           
800000a0: 203b 6966 6200 6f6f 6474 6c65 7961 313d    ; fi.bootdelay=1           
800000b0: 0030 6162 6475 6172 6574 313d 3531 3032    0.baudrate=11520           
800000c0: 0030 6f62 746f 6966 656c 753d 6d49 6761    0.bootfile=uImag           
800000d0: 0065 6f6c 6461 6461 7264 303d 3878 3032    e.loadaddr=0x820           
800000e0: 3030 3030 0030 7375 7462 7974 633d 6364    00000.usbtty=cdc           
800000f0: 615f 6d63 6300 6e6f 6f73 656c 743d 7974    _acm.console=tty           
80000100: 304f 312c 3531 3032 6e30 0038 6d6d 6163    O0,115200n8.mmca           
80000110: 6772 3d73 6573 6574 766e 6220 6f6f 6174    rgs=setenv boota           
80000120: 6772 2073 6f63 736e 6c6f 3d65 7b24 6f63    rgs console=${co           
80000130: 736e 6c6f 7d65 7220 6f6f 3d74 642f 7665    nsole} root=/dev           
80000140: 6d2f 636d 6c62 306b 3270 7220 2077 6f72    /mmcblk0p2 rw ro           
80000150: 746f 7366 7974 6570 653d 7478 2033 6f72    otfstype=ext3 ro           
80000160: 746f 6177 7469 6e00 6e61 6164 6772 3d73    otwait.nandargs=           
80000170: 6573 6574 766e 6220 6f6f 6174 6772 2073    setenv bootargs            
80000180: 6f63 736e 6c6f 3d65 7b24 6f63 736e 6c6f    console=${consol           
80000190: 7d65 7220 6f6f 3d74 642f 7665 6d2f 6474    e} root=/dev/mtd           
800001a0: 6c62 636f 346b 7220 2077 6f72 746f 7366    block4 rw rootfs           
800001b0: 7974 6570 6a3d 6666 3273 6c00 616f 6264    type=jffs2.loadb           
800001c0: 6f6f 7374 7263 7069 3d74 6166 6c74 616f    ootscript=fatloa           
800001d0: 2064 6d6d 2063 2030 7b24 6f6c 6461 6461    d mmc 0 ${loadad           
800001e0: 7264 207d 6f62 746f 732e 7263 6200 6f6f    dr} boot.scr.boo           
800001f0: 7374 7263 7069 3d74 6365 6f68 5220 6e75    tscript=echo Run           
80000200: 696e 676e 6220 6f6f 7374 7263 7069 2074    ning bootscript            
80000210: 7266 6d6f 6d20 636d 2e20 2e2e 203b 6f73    from mmc ...; so           
80000220: 7275 6563 2420 6c7b 616f 6164 6464 7d72    urce ${loadaddr}           
80000230: 6c00 616f 7564 6d69 6761 3d65 6166 6c74    .loaduimage=fatl           
80000240: 616f 2064 6d6d 2063 2030 7b24 6f6c 6461    oad mmc 0 ${load           
80000250: 6461 7264 207d 4975 616d 6567 6d00 636d    addr} uImage.mmc           
80000260: 6f62 746f 653d 6863 206f 6f42 746f 6e69    boot=echo Bootin           
80000270: 2067 7266 6d6f 6d20 636d 2e20 2e2e 203b    g from mmc ...;            
80000280: 7572 206e 6d6d 6163 6772 3b73 6220 6f6f    run mmcargs; boo           
80000290: 6d74 2420 6c7b 616f 6164 6464 7d72 6e00    tm ${loadaddr}.n           
800002a0: 6e61 6264 6f6f 3d74 6365 6f68 4220 6f6f    andboot=echo Boo           
800002b0: 6974 676e 6620 6f72 206d 616e 646e 2e20    ting from nand .           
800002c0: 2e2e 203b 7572 206e 616e 646e 7261 7367    ..; run nandargs           
800002d0: 203b 6e6f 6e65 6e61 2064 6572 6461 2420    ; onenand read $           
800002e0: 6c7b 616f 6164 6464 7d72 3220 3038 3030    {loadaddr} 28000           
800002f0: 2030 3034 3030 3030 203b 6f62 746f 206d    0 400000; bootm            
80000300: 7b24 6f6c 6461 6461 7264 007d 6964 6965    ${loadaddr}.diei           
80000310: 2364 303d 6538 3065 3230 3932 6666 3038    d#=08ee00229ff80           
80000320: 3030 3030 3531 3266 6136 3064 3066 6531    000015f26ad0f01e           
80000330: 3030 0039 7465 6168 7463 733d 636d 3139    009.ethact=smc91           
80000340: 7831 302d 7300 6474 6e69 733d 7265 6169    1x-0.stdin=seria           
80000350: 006c 7473 6f64 7475 733d 7265 6169 006c    l.stdout=serial.           
80000360: 7473 6564 7272 733d 7265 6169 006c 0000    stderr=serial...