/var/log/messages

May 5, 2014 - 2 minute read - Comments - programming

U-Boot で fatls

fatls というコマンドで SDCard の情報が取得できない、という不具合がある模様。諸々確認してみます。こーゆー具体的な事案があると第六感デバッガとしては嬉しい (ぇ

つうか、なんとなく仕様非公開なトラップのような気がしてきつつある今日この頃。

とりあえず help してみた。

help
?       - alias for 'help'
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'
bootelf - Boot from an ELF image in memory
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
bootvx  - Boot vxWorks from an ELF image
bootz   - boot Linux zImage image from memory
cls     - clear screen
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
dhcp    - boot image via network using DHCP/TFTP protocol
echo    - echo args to console
editenv - edit environment variable
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 /)
fdt     - flattened device tree utility commands
go      - start application at address 'addr'
gpio    - input/set/clear/toggle gpio pins
help    - print command description/usage
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
mii     - MII utility commands
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)
part    - disk partition related commands
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
pxe     - commands to get and boot from pxe files
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
setenv  - set environment variables
showvar - print local hushshell variables
sleep   - delay execution for some time
source  - run script from memory
sysboot - command to get and boot from syslinux files
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

env の出力が以下。

U-Boot> env print -a
arch=arm
baudrate=115200
board=rpi_b
board_name=rpi_b
boot_prefixes=/
boot_scripts=boot.scr.uimg
boot_targets=mmc0 usb0 pxe dhcp 
bootcmd=set usb_need_init; for target in ${boot_targets}; do run bootcmd_${target}; done
bootcmd_dhcp=run usb_init; if dhcp ${scriptaddr} boot.scr.uimg; then source ${scriptaddr}; fi
bootcmd_mmc0=setenv devnum 0; run mmc_boot;
bootcmd_pxe=run usb_init; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot;
bootdelay=2
cpu=arm1176
dhcpuboot=usb start; dhcp u-boot.uimg; bootm
do_script_boot=load ${devtype} ${devnum}:${rootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
do_sysboot_boot=sysboot ${devtype} ${devnum}:${rootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
ethact=sms0
fdt_addr_r=0x02000000
fdtfile=bcm2835-rpi-b.dtb
kernel_addr_r=0x01000000
loadaddr=0x00200000
mmc_boot=setenv devtype mmc; if mmc dev ${devnum}; then run scan_boot; fi
preboot=if load mmc 0:1 ${loadaddr} /uEnv.txt; then env import -t ${loadaddr} ${filesize}; fi
pxefile_addr_r=0x00100000
ramdisk_addr_r=0x02100000
rootpart=1
scan_boot=echo Scanning ${devtype} ${devnum}...; for prefix in ${boot_prefixes}; do run sysboot_boot; run script_boot; done
script_boot=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${rootpart} ${prefix}${script}; then echo Found ${prefix}${script}; run do_script_boot; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x00000000
soc=bcm2835
stderr=serial,lcd
stdin=serial,lcd
stdout=serial,lcd
sysboot_boot=if test -e ${devtype} ${devnum}:${rootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run do_sysboot_boot; echo SCRIPT FAILED: continuing...; fi
usb_boot=setenv devtype usb; run usb_init; if usb dev ${devnum}; then run scan_boot; fi
usb_init=if ${usb_need_init}; then set usb_need_init false; usb start 0; fi
usbethaddr=b8:27:eb:79:dc:df
vendor=raspberrypi

Environment size: 1993/16380 bytes

何を探しているのかというと例えば以下なコマンドの

U-Boot> fatinfo
usage: fatinfo <interface> [<dev[:part]>]

interface だったり dev だったりなナニが調べたいのですがどうすりゃ良いのやら。

ググッてみるに

以下なエントリを発見。

確認してみます。

U-Boot> mmcinfo
Device: bcm2835_sdhci
Manufacturer ID: 28
OEM: 4245
Name:       
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 7.5 GiB
Bus Width: 4-bit

あるいは以下。

U-Boot> fatls mmc 0 
** Unrecognized filesystem type **

む、これか。一応 /boot は fat のはずなんだけどな。別途ソース確認してみます。

夜御飯 U-Boot を RPi で動かす

comments powered by Disqus