利用 uflash 工具製作 TI davinci DM368 SD 啓動卡

實驗環境:

DM368 平臺 : LW3xx

SD card : SanDisk micro SD 512MB

HOST : ubuntu 10.04.4 64-bit

CROSS_COMPILE : CodeSourcery GNU Toolchain for ARM Processors: 2009q1-203 version


1,設置 ARM 交叉編譯工具的路徑

#export PATH=$PATH:$CROSS_COMPILE_PATH
2,下載最新的 u-boot for davinci

3,解壓縮 u-boot-davinci

#tar zxvf u-boot-davinci.tar.gz
4,編譯 u-boot-davinci

#make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- distclean
#make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- davinci_dm365evm_config
#make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

5,編譯成功後,在目錄 u-boot-davinci/tools/uflash 下會生成 uflash 可執行文件

6,編譯適用於 LW3xx 平臺的 SD 啓動用的 UBL 二進制文件,並拷貝到目錄 u-boot-davinci/tools/uflash

編譯 LW3xx UBL 請參考《TI davinci DM368 UBL 編譯方法》

7,參閱文檔 u-boot-davinci/tools/uflash/README 

8,格式化 SD 卡

#fdisk /dev/mmcblk0
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): d
Partition number (1-4): 1
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15484, default 1): 20
Last cylinder, +cylinders or +size{K,M,G} (20-1280, default 1280):
Using default value 1280
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

再重新插拔 SD 卡

9,製作 SD 卡文件系統 

#mkfs.ext3 /dev/mmcblk0p1
mke2fs 1.41.11 (14-Mar-2010)

/dev/mmcblk0p1 is mounted; will not make a filesystem here!

如遇到上面的錯誤提示,請執行 umount 命令卸載 SD 卡,然後在重新執行 mkfs.ext3 命令

#umount /media/f3565e35-6a85-4627-b050-0e623708fae5
#mkfs.ext3 /dev/mmcblk0p1
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
10120 inodes, 40352 blocks
2017 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=41418752
5 block groups
8192 blocks per group, 8192 fragments per group
2024 inodes per group
Superblock backups stored on blocks:
    8193, 24577

Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

10,修改 config.txt 文件,該文件保存了 u-boot 默認的環境變量

11,運行 uflash

./uflash -d /dev/mmcblk0 -p DM3XX -u ubl_DM36x_ARM432_DDR340_OSC24_SDMMC.bin -b ../../u-boot.bin -vv

輸出信息如下:

DM3XX
UBL Size 8211
U-Boot Size 317559
First partition starts at 1216(622592)
Required Blocks 764, Available Blocks 1215
UBL Magic Number        : a1aced00
UBL Entry Point         : 00000100
UBL Number of Blocks    : 00000010
UBL Starting Block      : 00000075
UBL Load Address        : 00000000
Writing UBL Signature
Writing UBL
U-Boot Magic Number        : a1aced66
U-Boot Entry Point         : 81080000
U-Boot Number of Blocks    : 0000026d
U-Boot Starting Block      : 0000008f
Load U-Boot Address        : 81080000
Writing U-Boot Signature
Writing U-Boot
Done...
12,設置 LW3xx 平臺從 SD 卡啓動,插入 uflash 製作的 SD 卡,然後上電即可



如想在 u-boot 官方網站下載的 u-boot-2012.04 中增加 uflash 的功能,步驟如下:

1,下載 u-boot-2012.04

2,解壓 u-boot-2012.04

3,將 u-boot-davinci/tools/uflash 拷貝到 u-boot-2012.04/tools/

4,手動刪除 u-boot-2012.04/tools/uflash/uflash

5,修改 u-boot-2012.04/tools/Makefile 第 24 行

TOOLSUBDIRS = uflash

6,參照上面 4 - 12 的步驟













發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章