搜尋此網誌

UBOOT fw_printenv and fw_setenv build - how to.

    U-boot 內建了 user application (tools) 可以在 user mode 下查看u-boot的環境變數.
但是須要點 patch :

   1. CPPFLAGS 確定有加入 (1) cross compile 的 include path (2)  kernel include path.
   example:
CPPFLAGS += -I/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/arm-softfloat-linux-gnu/sys-include
CPPFLAGS += -I/root/mindspeed/2010-7-7/trunk/kernel-linux_2.6.22.19-4.05.0/include  
 
  2.在uboot -> tools -> env 內的 makefile :
加入
 
$(obj)fw_setenv: $(SRCS) $(HEADERS)
$(CROSS_COMPILE)gcc $(CPPFLAGS) $(SRCS) -o $(obj)fw_setenv
並把
env make all 的 all  make target 從
all: $(obj)fw_printenv
改成
all: $(obj)fw_printenv $(obj)fw_setenv
 
  3. 如果make  fw_env 有錯,試著把 include file 改成
#include

#include
#include
#include
#include
#include
#include //ioctl prototype
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

//#include

#include
#include
#include

#include

#include
#include "fw_env.h"
 
     4.設定 fw_env.config (之後要複製到 rootfs/etc)
# Configuration file for fw_(printenv/saveenv) utility.

# Up to two entries are valid, in this case the redundand
# environment sector is assumed present.

# MTD device name Device offset Env. size Flash sector size
#/dev/mtd5 0x0 0x10000 0x20000
/dev/mtd2 0x0000 0x4000 0x20000

 
  此例是 我使用了 一個 32M - nor flash , uboot 佔 前面的0~0x40000
  u-boot env 的 sector size = nor flash 的erase block size =0x20000 (128k)
  而u-boot 的 env block size= 0x4000 =uboot 的預設值!.