debian下为stm32f429i-discovery编译uboot、linux内核和根文件系统

 

交叉编译器:arm-uclinuxeabi-2010q1

交叉编译器下载下来后解压,然后将其中bin文件夹路径加入到PATH变量中.

 

根据《debian下烧写stm32f429I discovery裸机程序》安装openocd.

 

安装genromfs,使用下面命令:

sudo apt-get install genromfs

 

已经有人提供好脚本,只要执行几条命令即可。使用git下载文件并进行编译:

git clone https://github.com/jserv/stm32f429-linux-builder.git
make

会自动从github仓库中将uboot和内核源码以及busybox下载下来,并且制作成u-boot.bin,xipImage.bin,以及romfs.bin

如果已经连接好开发板和pc,可以用make install将文件加载到开发板中(因为现在手头没有开发板,所以没有测试这一步)。

 

需要注意是,这个版本的uboot中使用uart3来作为串口连接端,如果使用ft232与开发板相连,那么连接方式如下:

GND和VCC连线方式不变,但PC10连接TXD,PC11连接RXD。

 

之前我试过直接编译这个uboot,然后采用uart3来进行连接,用minicom可以看到到uboot的输出信息。

其他内容我还没有测试。

 

补注:几天后我找到了开发板,然后执行make install,但是失败了。因为make install 其实相当于调用了下面的命令(请查看文件mk/flash.mak):

 openocd \
    -f interface/stlink-v2.cfg \
    -f target/stm32f4x_stlink.cfg \
    -c "init" \
    -c "reset init" \
    -c "flash probe 0" \
    -c "flash info 0" \
    -c "flash write_image erase $(uboot_target)  0x08000000" \
    -c "flash write_image erase $(kernel_target) 0x08020000" \
    -c "flash write_image erase $(rootfs_target) 0x08120000" \
    -c "reset run" -c shutdown

这是因为我使用了普通账户来执行命令,而openocd需要用root账户才能执行成功。我在openocd 前添加了sudo,然后再执行make install,烧写成功。

然后使用uart3连接串口,并重启开发板,使用minicom打开串口,得到下面的信息:

U-Boot 2010.03-00003-g934021a (Jun 09 2014 - 09:41:51)

CPU  : STM32F4 (Cortex-M4)
Freqs: SYSCLK=180MHz,HCLK=180MHz,PCLK1=45MHz,PCLK2=90MHz
Board: STM32F429I-DISCOVERY board,Rev 1.0
DRAM:   8 MB
Using default environment

Hit any key to stop autoboot:  0 
## Booting kernel from Legacy Image at 08020000 ...
   Image Name:   Linux-2.6.33-arm1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    738336 Bytes = 721 kB
   Load Address: 08020040
   Entry Point:  08020041
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Linux version 2.6.33-arm1 (host@debian) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #1 Mon Jun 9 09:43:55 CST 2014
CPU: ARMv7-M Processor [410fc241] revision 1 (ARMv7M)
CPU: NO data cache, NO instruction cache
Machine: STMicro STM32
Ignoring unrecognised tag 0x54410008
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 1778
Kernel command line: stm32_platform=stm32429-disco mem=7M console=ttyS2,115200n8 consoleblank=0 root=/dev/mtdblock0 rdinit=/sbin/init video=vfb:enable,fbmem:0x907000000
PID hash table entries: 32 (order: -5, 128 bytes)
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 7MB = 7MB total
Memory: 6976k/6976k available, 192k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0x00000000 - 0x00001000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
    lowmem  : 0x90000000 - 0x90700000   (   7 MB)
    modules : 0x90000000 - 0x90800000   (   8 MB)
      .init : 0x9000a000 - 0x9000e000   (  16 kB)
      .text : 0x08028000 - 0x080c4000   ( 624 kB)
      .data : 0x90008000 - 0x90018460   (  66 kB)
Hierarchical RCU implementation.
NR_IRQS:90
Console: colour dummy device 80x30
Calibrating delay loop... 168.34 BogoMIPS (lpj=841728)
Mount-cache hash table entries: 512
bio: create slab <bio-0> at 0
Switching to clocksource cm3-systick
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
Console: switching to colour frame buffer device 60x53
fb0: Virtual frame buffer device, using 1024K of video memory
Serial: STM32 USART driver
stm32serial.2: ttyS2 at MMIO 0x40004800 (irq = 39) is a STM32 USART Port
console [ttyS2] enabled
brd: module loaded
uclinux[mtd]: ROM probe address=0x8120000 size=0x59000
Creating 1 MTD partitions on "ROM":
0x000000000000-0x000000059000 : "ROMfs"
ARMv7-M VFP Extension supported
VFS: Mounted root (romfs filesystem) readonly on device 31:0.
Freeing init memory: 16K
starting pid 27, tty '/dev/ttyS2': '/bin/login -f root'
Welcome to
          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _ 
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|

For further information check:
http://www.uclinux.org/

Jan  1 00:00:01 login[27]: root login on 'ttyS2'
~ # ls
bin        etc        proc       root       sys        usr
dev        lib        ramfs.img  sbin       tmp        var

同时在开发板屏幕上还显示了一个企鹅的图标。

基本上测试就完成了,整个脚本都是完全可以使用的。如果需要在开发板上添加额外的模块。可以直接在现在的源代码下添加功能,相信会节约不少时间。

posted on 2014-06-07 13:51  qiaoqiao2003  阅读(2790)  评论(0编辑  收藏  举报

导航