Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1911650
  • 博文数量: 376
  • 博客积分: 2147
  • 博客等级: 大尉
  • 技术积分: 3642
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-06 10:47
文章分类

全部博文(376)

文章存档

2019年(3)

2017年(28)

2016年(15)

2015年(17)

2014年(182)

2013年(16)

2012年(115)

我的朋友

分类: 嵌入式

2014-07-04 11:12:06

Contents

 [hide]

[edit]Building U-Boot for the BBB

Using the appropriate Yocto-supplied toolchain and a current git pull of U-Boot:

$ export CROSS_COMPILE=arm-poky-linux-gnueabi-
$ make distclean
$ make am335x_boneblack_config
$ make

then copy MLO and u-boot.img to a properly-formatted SD card and boot, obviously stopping in U-Boot.

Note that the current U-Boot has a specific configuration for the BBB which drops NAND support:

am335x_evm                   arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL1,CONS_INDEX=1,NAND
... snip ...
am335x_boneblack             arm         armv7       am335x              ti             am33xx      am335x_evm:SERIAL1,CONS_INDEX=1,EMMC_BOOT

[edit]The list of commands

?       - alias for 'help'
askenv  - get environment variables from stdin
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
bootz   - boot Linux zImage image from memory
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
dfu     - Device Firmware Upgrade
dhcp    - boot image via network using DHCP/TFTP protocol
echo    - echo args to console
editenv - edit environment variable
eeprom  - EEPROM sub-system
env     - environment handling commands
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
ext4load- load binary file from a Ext4 filesystem
ext4ls  - list files in a directory (default /)
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fatwrite- write file into a dos filesystem
fdt     - flattened device tree utility commands
go      - start application at address 'addr'
gpio    - input/set/clear/toggle gpio pins
help    - print command description/usage
i2c     - I2C sub-system
iminfo  - print header information for application image
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
load    - load binary file from a filesystem
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
ls      - list files in a directory (default /)
md      - memory display
mm      - memory modify (auto-incrementing address)
mmc     - MMC sub system
mmcinfo - display MMC info
mw      - memory write (fill)
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
sf      - SPI flash sub-system
showvar - print local hushshell variables
sleep   - delay execution for some time
source  - run script from memory
spl     - SPL configuration
sspi    - SPI utility command
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
true    - do nothing, successfully
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version

[edit]The environment

In case it's useful, here's the default environment:

arch=arm
baudrate=115200
board=am335x
board_name=A335BNLT
board_rev=0A5C
boot_fdt=try
bootcmd=run findfdt; run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;run nandboot;
bootdelay=1
bootdir=/boot
bootenv=uEnv.txt
bootfile=uImage
bootpart=0:2
console=ttyO0,115200n8
cpu=armv7
dfu_alt_info_emmc=rawemmc mmc 0 3751936
dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw mmc 100 100;u-boot.img.raw mmc 300 400;spl-os-args.raw mmc 80 80;spl-os-image.raw mmc 900 2000;spl-os-args fat 0 1;spl-os-im1
dfu_alt_info_nand=SPL part 0 1;SPL.backup1 part 0 2;SPL.backup2 part 0 3;SPL.backup3 part 0 4;u-boot part 0 5;u-boot-spl-os part 0 6;kernel part 0 8;rootfs part 0 9
ethact=cpsw
ethaddr=90:59:af:4b:50:55
fdt_high=0xffffffff
fdtaddr=0x80F80000
fdtfile=undefined
findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi; if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; if test $board_name = A33515BB;  
importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
loadaddr=0x80200000
loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}
loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz
loaduimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
mmcargs=setenv bootargs console=${console} ${optargs} root=${mmcroot} rootfstype=${mmcrootfstype}
mmcboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd;;
mmcdev=0
mmcloados=run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootm ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootm; else echo WAR;
mmcroot=/dev/mmcblk0p2 ro
mmcrootfstype=ext4 rootwait
mtdids=nand0=omap2-nand.0
mtdparts=mtdparts=omap2-nand.0:128k(SPL),128k(SPL.backup1),128k(SPL.backup2),128k(SPL.backup3),1792k(u-boot),128k(u-boot-spl-os),128k(u-boot-env),5m(kernel),-(rootfs)
nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfstype=${nandrootfstype}
nandboot=echo Booting from nand ...; run nandargs; nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; bootm ${loadaddr}
nandimgsize=0x500000
nandroot=ubi0:rootfs rw ubi.mtd=7,2048
nandrootfstype=ubifs rootwait=1
nandsrcaddr=0x280000
netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
netboot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${loadaddr} ${bootfile}; tftp ${fdtaddr} ${fdtfile}; run netargs; bootm ${loadaddr} - ${fdtaddr}
nfsopts=nolock
ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype=${ramrootfstype}
ramboot=echo Booting from ramdisk ...; run ramargs; bootm ${loadaddr} ${rdaddr} ${fdtaddr}
ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M
ramrootfstype=ext2
rdaddr=0x81000000
rootpath=/export/rootfs
soc=am33xx
spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype=${spirootfstype}
spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; bootm ${loadaddr}
spibusno=0
spiimgsize=0x362000
spiroot=/dev/mtdblock4 rw
spirootfstype=jffs2
spisrcaddr=0xe0000
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
stderr=serial
stdin=serial
stdout=serial
usbnet_devaddr=90:59:af:4b:50:55
vendor=ti
ver=U-Boot 2013.10-rc1-00009-g3fb8588 (Aug 21 2013 - 11:04:36)


[edit]Simple informational commands

[edit]version

U-Boot 2013.10-rc3 (Sep 19 2013 - 15:12:10)
arm-poky-linux-gnueabi-gcc (GCC) 4.7.2
GNU ld (GNU Binutils) 2.23.1.20121113

[edit]bdinfo

arch_number = 0x00000E05
boot_params = 0x80000100
DRAM bank   = 0x00000000
-> start    = 0x80000000
-> size     = 0x20000000
eth0name    = cpsw
ethaddr     = 90:59:af:4b:50:55
eth1name    = usb_ether
eth1addr    = (not set)
current eth = cpsw
ip_addr     = 
baudrate    = 115200 bps
TLB addr    = 0x9FFF0000
relocaddr   = 0x9FB62000
reloc off   = 0x1F362000
irq_sp      = 0x9FA41F38
sp start    = 0x9FA41F28

[edit]coninfo

List of available devices:
serial   80000003 SIO stdin stdout stderr 
eserial5 00000003 .IO 
eserial4 00000003 .IO 
eserial3 00000003 .IO 
eserial2 00000003 .IO 
eserial1 00000003 .IO 
eserial0 00000003 .IO 

[edit]MMC-related commands

[edit]mmc list

OMAP SD/MMC: 0         [SD card]
 OMAP SD/MMC: 1        [eMMC]

Not sure what the point of that leading blank is on the second line, I think it's a formatting error.

[edit]mmc dev and mmcinfo

In my case, for a 1G SD card:

U-Boot# mmc dev 0
mmc0 is current device

U-Boot# mmcinfo
Device: OMAP SD/MMC
Manufacturer ID: 1b
OEM: 534d
Name: 00000 
Tran Speed: 50000000
Rd Block Len: 512
SD version 2.0
High Capacity: No
Capacity: 971.5 MiB
Bus Width: 4-bit

And the 2G eMMC:

U-Boot# mmc dev 1
mmc1(part 0) is current device

U-Boot# mmcinfo
Device: OMAP SD/MMC
Manufacturer ID: fe
OEM: 14e
Name: MMC02 
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.41
High Capacity: No
Capacity: 1.8 GiB
Bus Width: 4-bit

[edit]mmc part

For device 0 (again, my 1G SD card):

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              144522          00000000-01     0c Boot
  2     144585          1831410         00000000-02     83

For device 1 (eMMC):

Partition Map for MMC device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              144522          00000000-01     0c Boot
  2     144585          3598560         00000000-02     83

[edit]FAT filesystems

[edit]fatinfo

U-Boot# fatinfo mmc 0:1
Interface:  MMC
  Device 0: Vendor: Man 00001b Snr 142cd400 Rev: 11.1 Prod: 00000?
            Type: Removable Hard Disk
            Capacity: 971.5 MB = 0.9 GB (1989632 x 512)
Filesystem: FAT32 "fat        "
U-Boot# fatinfo mmc 1:1
Interface:  MMC
  Device 1: Vendor: Man 0000fe Snr 4e877ac2 Rev: 3.10 Prod: MMC02G
            Type: Removable Hard Disk
            Capacity: 1832.0 MB = 1.7 GB (3751936 x 512)
Filesystem: FAT32 "BEAGLEBONE "

[edit]fatls

The SD card FAT partition:

U-Boot# fatls mmc 0:1
   101552   mlo 
   363432   u-boot.img 

2 file(s), 0 dir(s)

The eMMC FAT partition:

U-Boot# fatls mmc 1:1    
    99976   mlo 
   379428   u-boot.img 
       26   uenv.txt 
            app/
            docs/
            drivers/
    41174   license.txt 
      292   readme.md 
    16827   start.htm 
      223   autorun.inf 
       56   id.txt 

8 file(s), 3 dir(s)

A directory in the eMMC FAT partition:

U-Boot# fatls mmc 1:1 app
            ./
            ../
 36088819   beaglebone-getting-started.zip 
      307   readme 

2 file(s), 2 dir(s)

[edit]EXT filesystems

U-Boot# ext4ls mmc 0:2
       4096 .
       4096 ..
      16384 lost+found
U-Boot# ext4ls mmc 1:2
       4096 .
       4096 ..
      16384 lost+found
       4096 bin
       4096 sbin
       4096 media
       4096 home
       4096 mnt
       4096 usr
       4096 boot
       4096 etc
       4096 tmp
       4096 run
       4096 var
       4096 lib
       4096 sys
       4096 proc
       4096 dev

[edit]gpio

Given that BBB LEDs are at GPIOs 53-56, turn the LEDs on and off:

# gpio {clear,set,toggle,input} {53,54,55,56}

[edit]MORE TO COME ...

(Return to BeagleBone Black page.)

阅读(3230) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~