免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3483 | 回复: 0
打印 上一主题 下一主题

uboot patch for QT2410 and GTA01/02 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-07 19:39 |只看该作者 |倒序浏览

               
       
               
                        Bootloader/zh cn
http://wiki.openmoko.org/wiki/Bootloader/zh_cn
From OpenMoko
Jump to:
[color="#0000ff"]navigation
,
[color="#0000ff"]search




Neo1973控制台上的u-boot


Neo1973上的u-boot引导菜单
   
        
            
            
            Contents
            [
[color="#0000ff"]hide
]
            
[color="#0000ff"]1 概述
               
[color="#0000ff"]2 引导装载程序源代码
               
[color="#0000ff"]3 引导装载程序二进制文件
               
[color="#0000ff"]4 引导装载程序开发
               
[color="#0000ff"]4.1 QT2410
                    
[color="#0000ff"]4.2 GTA01
                    
                    
               
[color="#0000ff"]5 建立可引导的映像文件
               
[color="#0000ff"]6 引导菜单
               
[color="#0000ff"]6.1 进入引导菜单
                    
[color="#0000ff"]6.2 使用引导菜单
                    
[color="#0000ff"]6.3 给引导菜单增加项目

               
[color="#0000ff"]7 引导装载程序命令提示行
               
[color="#0000ff"]7.1 Accessing the bootloader prompt
                    
[color="#0000ff"]7.1.1 Using usbtty from Linux
                        
[color="#0000ff"]7.1.2 Typical u-boot prompt

                    
[color="#0000ff"]7.2 Commands on the bootloader prompt
                    
[color="#0000ff"]7.2.1 自动引导
                        
[color="#0000ff"]7.2.2 环境变量
                        
[color="#0000ff"]7.2.3 MMC/SD卡
                        
[color="#0000ff"]7.2.4 NAND
                        
[color="#0000ff"]7.2.4.1 从 NAND 加载内核
                           
[color="#0000ff"]7.2.4.2 向 NAND 写新的引导装载程序
                           
[color="#0000ff"]7.2.4.3 向 NAND 写内核
                           
[color="#0000ff"]7.2.4.4 向 NAND 写根文件系统

                        
[color="#0000ff"]7.2.5 Neo1973 相关的命令
                        
[color="#0000ff"]7.2.5.1 关机
                           
[color="#0000ff"]7.2.5.2 充电器相关
                           
[color="#0000ff"]7.2.5.2.1 查询充电器状态
                                
[color="#0000ff"]7.2.5.2.2 禁用充电器
                                
[color="#0000ff"]7.2.5.2.3 强制快速充电
                                
[color="#0000ff"]7.2.5.2.4 使能/禁用自动快速充电

                           
[color="#0000ff"]7.2.5.3 背光灯
                           
[color="#0000ff"]7.2.5.4 振动

                        
[color="#0000ff"]7.2.6 S3C2410 专用命令
                        
                        
[color="#0000ff"]7.2.7 QT2410上的TFTP
                        
                        
                    
               
[color="#0000ff"]8 设备固件升级

            
        
   
[
[color="#0000ff"]edit
]
概述
GTA01使用了
[color="#810081"]u-boot
引导装载程序。
关于u-boot的更多信息可以在下列地方找到

  • [color="#0000ff"]http://www.denx.de/wiki/DULG
       

  • [color="#0000ff"]http://www.gumstix.org/tikiwiki/tiki-index.php?page=U-Boot
       

  • [color="#810081"]http://linuxdevices.com/articles/AT5085702347.html

    但是,未经修改的u-boot不支持GTA01所需要的许多特性,比如
  • 利用
    [color="#810081"]S3C2410 Steppingstone
    从NAND闪存启动
       
  • 从SD/Transflash读取内核/initrd
       
  • S3C2410 NAND闪存
       
  • 通过S3C2410 USB Device控制器下载程序
       
  • S3C2410 Framebuffer启动logo/状态显示
    [color="#0000ff"]Harald Welte
    正在为这些解决问题而工作,并且实际上它们中的大多数已经得到了实现。
    [
    [color="#0000ff"]edit
    ]
    引导装载程序源代码

    [color="#0000ff"]http://svn.openmoko.org/trunk/src/target/u-boot/patches/
    可以获得当前的引导装载程序的补丁。
    Untar the sources, apply the patch. run "make gta01bv3_config" (or
    gta01bv2_config, or whatever hardware revision you have), run "make".
    You will get a resulting "u-boot.bin" image, which you can directly
    flash (either using existing bootloader or
    [color="#0000ff"]sjf2410-linux
    ) into NAND.
    [
    [color="#0000ff"]edit
    ]
    引导装载程序二进制文件
    最新的引导装载程序二进制文件可以从
    [color="#0000ff"]http://buildhost.openmoko.org/tmp/gta01/deploy/images/
    网站找到。它应该写到 NAND flash 0x00000000 (size 0x30000) 地址处。
    [
    [color="#0000ff"]edit
    ]
    引导装载程序开发
    [
    [color="#0000ff"]edit
    ]
    QT2410
    If you want to do bootloader development on the QT2410, it's easier
    to work with a bootloader image that can be downloaded via USB into RAM
    instead of flashing.
    为了做到这一点,你需要编辑 u-boot/include/configs/qt2410.h 文件,将32行的 "if 0" 改为 "if 1",然后用 "make" 重新编译。
    The resulting "u-boot.bin" is _NOT SUITABLE_ for NAND flash, but only for direct execution from within ram, e.g. by using the
    [color="#0000ff"]s3c2410_boot_usb
    program.
    [
    [color="#0000ff"]edit
    ]
    GTA01
    Doing bootloader development on the GTA01 is a bit more tricky.
    first, we don't have any NOR flash. Second, there is no other way to
    boot _but_ from NAND. Therefore, we also don't have a USB downloader
    like the QT2410.
    The main problem is: The
    [color="#0000ff"]S3C2410 Steppingstone
    unconditionally copies the first 4k of flash into its internal SRAM.
    That SRAM segment stays unconditionally mapped at physical address
    zero. How do we get around this
    [
    [color="#0000ff"]edit
    ]
    使用JTAG从RAM启动
    So how can we boot from RAM? We use JTAG / OpenOCD to
    • reset and halt the cpu at PC=0

    > reset halt
    target halted in ARM state due to debug request, current mode: Supervisor
    cpsr: 0x400000d3 pc: 0x00000000
    MMU: disabled, D-Cache: disabled, I-Cache: disabled
    • download a small piece of code for low-level SDRAM timing initialization (overwrite 4k SRAM of steppingstone)

    > load_binary /space/misc/gta01/u-boot.git/foo.bin 0
    downloaded 332 byte in 0s 21899us
    • assert a break point at address 0x33f80000 (which indicates that the low-level code has finished)

    > bp 0x33f80000 4 hw
    breakpoint added at address 0x33f80000
    • run the code up to the break point

    > resume
    Target 0 resumed
    > Target 0 halted
    target halted in ARM state due to breakpoint, current mode: Supervisor
    cpsr: 0x600000d3 pc: 0x33f80000
    MMU: disabled, D-Cache: disabled, I-Cache: enabled
    • download the u-boot RAM image to 0x33f80000

    > load_binary /space/misc/gta01/u-boot.git/u-boot.bin 0x33f80000
    downloaded 135692 byte in 6s 567264us
    • resume processing

    > resume
    Target 0 resumed
    At this point, the display backlight gets bright and we see the following familiar prompt on the serial console:
    U-Boot 1.1.6 (Jan 13 2007 - 23:44:23)
    DRAM:  128 MB
    NAND:  64 MiB
    *** Warning - bad CRC or NAND, using default environment
    In:    serial
    Out:   serial
    Err:   serial
    Hit any key to stop autoboot:  0
    GTA01Bv2 #
    [
    [color="#0000ff"]edit
    ]
    建立可引导的映像文件
    u-boot needs bootable images (such as kernels, but also initrd and others) in form of a so-called uImage. In order to create a uImage from e.g. a vmlinux kernel image, you can proceed as follows:
    objcopy -O binary -R .note -R .comment -S vmlinux linux.bin
    gzip -9 linux.bin
    u-boot/tools/mkimage -A arm -O linux -T kernel -C gzip -a 30008000 -e 30008000 -n "Kernel Image QT2410" -d linux.bin.gz uImage
    [
    [color="#0000ff"]edit
    ]
    引导菜单


    u-boot boot menu on Neo1973
    As of the Phase-0 release, our u-boot version now features an on-screen boot menu.
    [
    [color="#0000ff"]edit
    ]
    进入引导菜单
    You can access the boot meny by pressing and holding the
    [color="#0000ff"]Neo1973 AUX Button
    together with the power button while switching the phone on.
    [
    [color="#0000ff"]edit
    ]
    使用引导菜单
    By pressing the
    [color="#0000ff"]Neo1973 AUX Button
    you can cycle through the menu items. Use the POWER button to select one item.
    [
    [color="#0000ff"]edit
    ]
    给引导菜单增加项目
    You can add items to the boot menu by setting environment variables. FIXME.
    [
    [color="#0000ff"]edit
    ]
    引导装载程序命令提示行
    [
    [color="#0000ff"]edit
    ]
    Accessing the bootloader prompt
    The bootloader prompt is available either on the serial console (via
    [color="#0000ff"]Debug Board
    ),
    or as virtual USB Serial device (USB CDC_ACM). Whether the serial port
    or usb i used depends on the u-boot environment variables stdin, stdout and stderr.
    Whether or not you use usbtty, the first couple of messages will always be displayed on the serial console.
    The bootloader is currently configured to waid for three seconds. If a key press on the stdin is received within those three seconds, auto-boot is aborted.
    [
    [color="#0000ff"]edit
    ]
    Using usbtty from Linux
    Just by connecting the phone in u-boot mode to your Linux pc should make it detect a
    [color="#0000ff"]CDC ACM
    device, and you should get a new tty device called /dev/ttySAC0. Use
    your favourite terminal emulator (minicom, cu, zc, ...) to access it
    like any other serial port.
    First, you should try to check whether the USB device shows up in 'lsusb' while you're running in u-boot mode:
    # lsusb -d 1457:5119
    Bus 005 Device 079: ID 1457:5119
    # lsusb -v -d 1457:5119
    Bus 005 Device 079: ID 1457:5119
    Device Descriptor:
    bLength                18
    bDescriptorType         1
    bcdUSB               1.10
    bDeviceClass            2 Communications
    bDeviceSubClass         0
    bDeviceProtocol         0
    bMaxPacketSize0        16
    idVendor           0x1457
    idProduct          0x5119
    bcdDevice            0.00
    iManufacturer           1 OpenMoko, Inc
    iProduct                2 Neo1973 Bootloader U-Boot 1.2.0-g6c7cac8c-dirty-moko3
    iSerial                 3 0000000
    bNumConfigurations      1
    Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           85
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          4 TTY via USB
    bmAttributes         0xc0
    Self Powered
    MaxPower                0mA
    Interface Descriptor:
    bLength                 9
    bDescriptorType         4
    bInterfaceNumber        0
    bAlternateSetting       0
    bNumEndpoints           1
    bInterfaceClass         2 Communications
    bInterfaceSubClass      2 Abstract (modem)
    bInterfaceProtocol      1 AT-commands (v.25ter)
    iInterface              6 Control Interface
    CDC Header:
    bcdCDC               0.6e
    CDC Call Management:
    bmCapabilities       0x00
    bDataInterface          1
    CDC ACM:
    bmCapabilities       0x00
    CDC Union:
    bMasterInterface        0
    bSlaveInterface         1
    Endpoint Descriptor:
    bLength                 7
    bDescriptorType         5
    bEndpointAddress     0x81  EP 1 IN
    bmAttributes            3
    Transfer Type            Interrupt
    Synch Type               None
    Usage Type               Data
    wMaxPacketSize     0x0010  1x 16 bytes
    bInterval             255
    Interface Descriptor:
    bLength                 9
    bDescriptorType         4
    bInterfaceNumber        1
    bAlternateSetting       0
    bNumEndpoints           2
    bInterfaceClass        10 CDC Data
    bInterfaceSubClass      0 Unused
    bInterfaceProtocol      0
    iInterface              5 Bulk Data Interface
    Endpoint Descriptor:
    bLength                 7
    bDescriptorType         5
    bEndpointAddress     0x02  EP 2 OUT
    bmAttributes            2
    Transfer Type            Bulk
    Synch Type               None
    Usage Type               Data
    wMaxPacketSize     0x0010  1x 16 bytes
    bInterval             255
    Endpoint Descriptor:
    bLength                 7
    bDescriptorType         5
    bEndpointAddress     0x83  EP 3 IN
    bmAttributes            2
    Transfer Type            Bulk
    Synch Type               None
    Usage Type               Data
    wMaxPacketSize     0x0010  1x 16 bytes
    bInterval             255
    Interface Descriptor:
    bLength                 9
    bDescriptorType         4
    bInterfaceNumber        2
    bAlternateSetting       0
    bNumEndpoints           0
    bInterfaceClass       254 Application Specific Interface
    bInterfaceSubClass      1 Device Firmware Update
    bInterfaceProtocol      1
    iInterface              7 USB Device Firmware Upgrade
    Device Status:     0x0001
    Self Powered
    Next, you can access it using your favourite terminal program.
    Then, if the environment is not set correctly, you will need to use the current console (e.g. serial console) to set
    GTA01Bv2 # setenv stderr usbtty
    GTA01Bv2 # setenv stdout usbtty
    GTA01Bv2 # setenv stdin usbtty
    [
    [color="#0000ff"]edit
    ]
    Typical u-boot prompt
    U-Boot 1.2.0-moko1 (Feb 16 2007 - 00:36:13)
    DRAM:  128 MB
    NAND:  64 MiB
    Found Environment offset in OOB..
    Video: 640x480x8 31kHz 59Hz
    USB:   S3C2410 USB Deviced
    In:    serial
    Out:   serial
    Err:   serial
    Hit any key to stop autoboot:  0
    GTA01Bv3 #
    [
    [color="#0000ff"]edit
    ]
    Commands on the bootloader prompt
    [
    [color="#0000ff"]edit
    ]
    自动引导
    Auto-boot executes the command specified in the bootcmd environment variable. The default configuration is:
    GTA01Bv3 # printenv
    bootcmd=setenv bootargs ${bootargs_base} ${mtdparts}; nand read.e 0x32000000 kernel; bootm 0x32000000
    This basically tells us that it will load the content of the NAND partition kernel to memory address 0x32000000 and then try to boot it.
    [
    [color="#0000ff"]edit
    ]
    环境变量
    u-boot is configured to manage a non-volatile environment that is
    stored in NAND flash. You can use the commands to read/alter/store the
    environment in the following example:
    GTA01Bv2 # printenv
    baudrate=115200
    bootargs=rootfstype=jffs2 root=/dev/mtdblock4 console=ttySAC0,115200 console=tty0 loglevel=8 dyntick=enable lpj=252416
    usbtty=cdc_acm
    bootdelay=10
    stdout=serial
    stderr=serial
    stdin=serial
    mtdparts=mtdparts=neo1973-nand:0x00030000(u-boot),0x0000c000(u-boot_env),0x00200000(kernel),0x00130000(splash),0x03c94000(rootfs)
    mtdids=nand0=neo1973-nand
    bootargs_base=rootfstype=jffs2 root=/dev/mtdblock4 console=ttySAC0,115200 console=tty0 loglevel=8 dyntick=enable lpj=252416
    bootcmd=setenv bootargs ${bootargs_base} ${mtdparts}; nand read.e 0x32000000 kernel; bootm 0x32000000
    pcf50606_int1=0x40
    filesize=160C000
    partition=nand0,0
    mtddevnum=0
    mtddevname=u-boot
    Environment size: 670/16380 bytes
    GTA01Bv3 # setenv bootdelay 10
    GTA01Bv3 # printenv bootdelay
    bootdelay=10
    GTA01Bv3 # saveenv
    Saving Environment to NAND...
    Erasing Nand...Writing to Nand... done
    GTA01Bv3 #
    Note: When setting multiple commands, e.g. for bootcmd, you need to escape the ';', for instance
    GTA01Bv3 # setenv bootcmd mmcinit\; ext2load mmc 0 0x32000000 uImage\; bootm 0x32000000
    [
    [color="#0000ff"]edit
    ]
    MMC/SD卡
    in order to initialize a MMC/SD card, you have to use the ``mmcinit command.
    GTA01Bv3 # mmcinit
    trying to detect SD Card...
    MMC found. Card desciption is:
    Manufacturer ID = 58d564
    HW/FW Revision = 3 8
    Product Name = 21DN!@X
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP