您的位置:首页 > 其它

达芬奇开发_烧写Flash:方案一:使用ramdisk,烧写到nor flash,文件格式ext2

2008-07-03 21:37 585 查看
达芬奇开发_烧写Flash:

方案一:使用ramdisk,烧写到nor flash,文件格式ext2

 

作者:耿磊

说明:跳线选择12连通其它都不连接。

1. Copy the kernel image in /tftpboot directory:

host $ cp ~workdir/lsp/ti-davinci/arch/arm/boot/uImage /tftpboot

2. Copy the initial RAM disk file system in /tftpboot directory:

host $ cp /mnt/def_cd/ramdisk.gz /tftpboot/

3. Download the Linux kernel via TFTP:

DVEVM # setenv serverip <tftp server ip address>

DVEVM # setenv bootfile uImage

DVEVM # dhcp

BOOTP broadcast 1

*** Unhandled DHCP Option in OFFER/ACK: 44

*** Unhandled DHCP Option in OFFER/ACK: 46

DHCP client bound to address <dvem ip address>

TFTP from server <tftp server ip address>; our IP address is <dvevm ipaddress>

Filename 'uImage'.

Load address: 0x80700000

Loading:

###################################################

###################################################

done

Bytes transferred = 823844 (c9224 hex)

The dhcp command obtains IP settings and then downloads the Linux kernel image (as specified by the serverip and bootfile environment variables). Note the Load address (0x80700000) and Bytes transferred (0xc9224), as these are needed in the following steps.

4. Download the RAM disk file system via TFTP:

DVEVM # tftp 0x85000000 ramdisk.gz

TFTP from server <tftp server ip address>; our IP address is <dvevm ip

address>

Filename 'ramdisk.gz'.

Load address: 0x85000000

Loading:

###################################################

###################################################

done

Bytes transferred = 2304639 (232a7f hex)

The tftp command downloads the ramdisk.gz file at 0x85000000. Note the Load address (0x85000000)and Bytes transferred (0x232a7f), as these are needed in the following steps.

5. Determine the location in flash to store image:

EVM # flinfo

Bank # 1: MY AMD 29LV256M (256 Mbit)

Size: 16 MB in 256 Sectors

Sector Start Addresses:

02000000 02010000 02020000 02030000 02040000 (RO)

02050000 02060000 02070000 02080000 02090000

020A0000 020B0000 020C0000 020D0000 020E0000

0x2FBCA3=232a7f+0xc9224
The U-Boot code and data are stored in the first five sectors,
starting at 0x2000000. Note that the trailing (RO) indicates that the sectors are read-only or protected from erasing and writing. The Linux kernel image should be saved to the 0x20500000 location, the first free sector after U-Boot.

6. Erase the flash:

DVEVM # protect off 0x2050000 +0x2FBCA3

Note: 0x2FBCA3(长度)是内核和RAM Disk大小的和。

DVEVM # erase 0x2050000 +0x2FBCA3

Erasing sector 5 ... done.

Erasing sector 6 ... done.

The protect off command makes the flash writable (not necessary for this example), while the erase command prepares the flash for writing by erasing the old contents. Note the start address (0x2050000) is derived from the output of flinfo and the length (the size of the Linux kernel image plus the RAM disk file system downloaded via the TFTP server).

7. Copy from RAM into flash:

DVEVM # cp.b 0x80700000 0x2050000 0xc9224

Copy to Flash.../done

DVEVM # cp.b 0x85000000 0x2119224 0x232a7f

Copy to Flash.../done

The cp (copy) command is used to copy the Linux kernel image in RAM into the accessible flash memory. The arguments are the source address, the destination address, and the length. The .b extension on the cp command specifies a byte-wise copy.

8. Protect the flash from writing:

DVEVM # protect on 0x2050000 +0x2FBCA3

The protect command makes the flash sector read-only, to ensure that the kernel image and RAM disk file system are not accidentally overwritten.

9. Set the U-Boot Command and Linux Kernel Command Line:

DVEVM # setenv bootargs console=ttyS0,115200n8 ip=dhcp root=/dev/ram0 rw initrd=0x85000000,6M

DVEVM# setenv bootcmd ‘cp.b 0x2119224 0x85000000 0x232a7f; bootm 0x20500000’

这个启动命令是设置使用Flash中的内核镜像,地址是0x2050000.

Linux内核中的参数(bootargs)设置使用RAM disk 作为跟文件系统。The Linux kernel command line arguments are set (bootargs) to use the RAM disk as the root file system.

10. Now, the system is ready to boot, so save the u-boot environment variable:

DVEVM # saveenv

DVEVM # boot

Linux现在就可以从flash上启动,并且根文件系统被挂载到/dev/ram0上。

在16MNOR flash存储器上,u-boot、root file system和压缩的RAM disk如表分布。 



 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐