搜尋此網誌
Difference : uImage,zimage,vmlinux
vmlinux是內核檔(elf), zImage是一般情況下默認的壓縮內核映射檔,壓縮vmlinux,加上一段解壓啟動代碼得到,只能從0X0位址運行。 uImage是u-boot使用bootm命令引導的Linux壓縮內核映射檔格式, 使用工具mkimage對普通的壓縮內核映射檔(zImage)加工而得。可以由bootm命令從任意位址解壓啟動內核。 由於bootloader一般要佔用0X0位址,所以,uImage相比zImage的好處就是可以和bootloader共存。 製作uImage的mkimage軟體,如果uClinux-dist有的話,一般放在uClinux-dist的tools目錄中。
Patch Kernel to Support Squashfs-Lzma (Today finished this job and test success)
P1. patch kernek to support the squashfs plus lzma
P2. Must Use Same squashfs-tools version else still will got exeception. (example : use squashfs3.4.tar.gz
to do patch kernel ,but using OpenWrt squashfs-tools () ,this will
cause exeception "WARNING: at fs/squashfs/uncomp.c:136 sqlzma_un().....sb_bread failed
reading block 0x1f4b" ) .
------------------ STEP BY STEP ----------------------
for the kernel 2.6.22 as example:
1. put 3 patch file into floder near your Kernel Source path.
3 files is (1) lzma457.tar.bz2
(2) squashfs3.4.tar.gz
(3) sqlzma3.4-457.tar.bz2
you can find these files on http://www.squashfs-lzma.org/ left side .
2. Extract the sqlzma3.4-457.tar.bz2 , find the build.sample , rename it as sqlzma.sh
follow is my modify to fit my make system .
#!/bin/bash
#
# LZMA support for SquashFS 3.4 in kernel 2.6.27.4
#
# How to use this script:
# download all required files, copy them to current directory, run this script
# it will unpack kernel sources and other archives, and will make .ko modules
# as well as mksquashfs and unsquashfs binaries
export BUILD=bin
#export KERNELPATH=../kernel-linux_2.6.22.19-4.05.0
export KERNELPATH=$LINUX_KERNEL_SOURCE
echo "sqlzma shellscript detect LINUX PATH="$LINUX_KERNEL_SOURCE
if [ ! -f squashfs3.4.tar.gz -o ! -f lzma457.tar.bz2 -o ! -f sqlzma3.4-457.tar.bz2 ]; then
echo "missing required file"
exit
fi
rm -rf squashfs3.4 lzma457
tar xjf sqlzma3.4-457.tar.bz2
tar xzf squashfs3.4.tar.gz
# tar xjf linux-2.6.27.4.tar.bz2
mkdir lzma457
tar -C lzma457 -xjf lzma457.tar.bz2
#Jacky.Xue:I have do follow kernel squashfs patch already
#patch -d $KERNELPATH -p1 < squashfs3.4/kernel-patches/linux-2.6.22/squashfs3.4-patch
patch -N -d $KERNELPATH -p1 < sqlzma2k-3.4.patch
patch -N -d squashfs3.4 -p1 < sqlzma2u-3.4.patch
patch -N -d lzma457 -p1 < sqlzma1-457.patch
ln -s ../../$KERNELPATH squashfs3.4/kernel-patches
echo "cp .config $KERNELPATH"
echo "cd $KERNELPATH"
echo "make oldconfig"
echo "make prepare"
echo "make scripts"
echo "cd -"
echo "initialize kernel sources now, by using the commands mentioned above"
echo "and then press ENTER..."
#read
make
mkdir -p $BUILD
cp ./$KERNELPATH/fs/squashfs/squashfs.ko $BUILD
cp ./lzma457/C/Compress/Lzma/kmod/sqlzma.ko $BUILD
cp ./lzma457/C/Compress/Lzma/kmod/unlzma.ko $BUILD
cp ./squashfs3.4/squashfs-tools/unsquashfs $BUILD
cp ./squashfs3.4/squashfs-tools/mksquashfs $BUILD
strip --strip-unneeded $BUILD/mksquashfs $BUILD/unsquashfs
3. after success run the script on step 2.
you will get the tools (to generate the squashfs lzma rootfile system )
mksquashfs
unsquashfs
the mksquashfs example :
mksquashfs ROOTFS_PATH IMAGE_NAME -noappend
also will get 2 ko (kernel modules)
sqlzma.ko and unlzma.ko
IF you don't want use kernel module to support squashfs-lzma ,the try step 4.
4. Modify to support kernel build-in ,
(1) modify YOUR kernelsource/fs/squashfs/Makefile
#
# Makefile for the linux squashfs routines.
#
# the environment variables are not inherited since 2.6.23
ifdef SQLZMA_EXTRA_CFLAGS
EXTRA_CFLAGS += ${SQLZMA_EXTRA_CFLAGS}
endif
obj-$(CONFIG_SQUASHFS) += unlzma.o sqlzma.o squashfs.o
unlzma-y += module.o
sqlzma-y += uncomp.o
squashfs-y += inode.o
squashfs-y += squashfs2_0.o
(2) Makesure your kernelsource/fs/squashfs/ path have follow source files:
inode.c
uncomp.c
module.c
sqlzma.h
sqmagic.h
LzmaDecode.c
LzmaDecode.h
LzmaTypes.h
squashfs2_0.c
squashfs.h
the module.c include the LzmaDecode.c file path should be change
from
#include "../LzmaDecode.c"
to
#include "LzmaDecode.c"
(3) rebuild your kernel (note i suupose that you have know how to add CONFIG_SQUASHFS in
your kernel default config)
CC fs/ramfs/inode.o
CC fs/ramfs/file-mmu.o
LD fs/ramfs/ramfs.o
LD fs/ramfs/built-in.o
CC fs/squashfs/uncomp.o
CC fs/squashfs/inode.o
CC fs/squashfs/squashfs2_0.o
CC fs/squashfs/module.o
LD fs/squashfs/unlzma.o
LD fs/squashfs/sqlzma.o
LD fs/squashfs/squashfs.o
LD fs/squashfs/built-in.o
CC fs/sysfs/inode.o
CC fs/sysfs/file.o
Ok ~ done!
P2. Must Use Same squashfs-tools version else still will got exeception. (example : use squashfs3.4.tar.gz
to do patch kernel ,but using OpenWrt squashfs-tools () ,this will
cause exeception "WARNING: at fs/squashfs/uncomp.c:136 sqlzma_un().....sb_bread failed
reading block 0x1f4b" ) .
------------------ STEP BY STEP ----------------------
for the kernel 2.6.22 as example:
1. put 3 patch file into floder near your Kernel Source path.
3 files is (1) lzma457.tar.bz2
(2) squashfs3.4.tar.gz
(3) sqlzma3.4-457.tar.bz2
you can find these files on http://www.squashfs-lzma.org/ left side .
2. Extract the sqlzma3.4-457.tar.bz2 , find the build.sample , rename it as sqlzma.sh
follow is my modify to fit my make system .
#!/bin/bash
#
# LZMA support for SquashFS 3.4 in kernel 2.6.27.4
#
# How to use this script:
# download all required files, copy them to current directory, run this script
# it will unpack kernel sources and other archives, and will make .ko modules
# as well as mksquashfs and unsquashfs binaries
export BUILD=bin
#export KERNELPATH=../kernel-linux_2.6.22.19-4.05.0
export KERNELPATH=$LINUX_KERNEL_SOURCE
echo "sqlzma shellscript detect LINUX PATH="$LINUX_KERNEL_SOURCE
if [ ! -f squashfs3.4.tar.gz -o ! -f lzma457.tar.bz2 -o ! -f sqlzma3.4-457.tar.bz2 ]; then
echo "missing required file"
exit
fi
rm -rf squashfs3.4 lzma457
tar xjf sqlzma3.4-457.tar.bz2
tar xzf squashfs3.4.tar.gz
# tar xjf linux-2.6.27.4.tar.bz2
mkdir lzma457
tar -C lzma457 -xjf lzma457.tar.bz2
#Jacky.Xue:I have do follow kernel squashfs patch already
#patch -d $KERNELPATH -p1 < squashfs3.4/kernel-patches/linux-2.6.22/squashfs3.4-patch
patch -N -d $KERNELPATH -p1 < sqlzma2k-3.4.patch
patch -N -d squashfs3.4 -p1 < sqlzma2u-3.4.patch
patch -N -d lzma457 -p1 < sqlzma1-457.patch
ln -s ../../$KERNELPATH squashfs3.4/kernel-patches
echo "cp .config $KERNELPATH"
echo "cd $KERNELPATH"
echo "make oldconfig"
echo "make prepare"
echo "make scripts"
echo "cd -"
echo "initialize kernel sources now, by using the commands mentioned above"
echo "and then press ENTER..."
#read
make
mkdir -p $BUILD
cp ./$KERNELPATH/fs/squashfs/squashfs.ko $BUILD
cp ./lzma457/C/Compress/Lzma/kmod/sqlzma.ko $BUILD
cp ./lzma457/C/Compress/Lzma/kmod/unlzma.ko $BUILD
cp ./squashfs3.4/squashfs-tools/unsquashfs $BUILD
cp ./squashfs3.4/squashfs-tools/mksquashfs $BUILD
strip --strip-unneeded $BUILD/mksquashfs $BUILD/unsquashfs
3. after success run the script on step 2.
you will get the tools (to generate the squashfs lzma rootfile system )
mksquashfs
unsquashfs
the mksquashfs example :
mksquashfs ROOTFS_PATH IMAGE_NAME -noappend
also will get 2 ko (kernel modules)
sqlzma.ko and unlzma.ko
IF you don't want use kernel module to support squashfs-lzma ,the try step 4.
4. Modify to support kernel build-in ,
(1) modify YOUR kernelsource/fs/squashfs/Makefile
#
# Makefile for the linux squashfs routines.
#
# the environment variables are not inherited since 2.6.23
ifdef SQLZMA_EXTRA_CFLAGS
EXTRA_CFLAGS += ${SQLZMA_EXTRA_CFLAGS}
endif
obj-$(CONFIG_SQUASHFS) += unlzma.o sqlzma.o squashfs.o
unlzma-y += module.o
sqlzma-y += uncomp.o
squashfs-y += inode.o
squashfs-y += squashfs2_0.o
(2) Makesure your kernelsource/fs/squashfs/ path have follow source files:
inode.c
uncomp.c
module.c
sqlzma.h
sqmagic.h
LzmaDecode.c
LzmaDecode.h
LzmaTypes.h
squashfs2_0.c
squashfs.h
the module.c include the LzmaDecode.c file path should be change
from
#include "../LzmaDecode.c"
to
#include "LzmaDecode.c"
(3) rebuild your kernel (note i suupose that you have know how to add CONFIG_SQUASHFS in
your kernel default config)
CC fs/ramfs/inode.o
CC fs/ramfs/file-mmu.o
LD fs/ramfs/ramfs.o
LD fs/ramfs/built-in.o
CC fs/squashfs/uncomp.o
CC fs/squashfs/inode.o
CC fs/squashfs/squashfs2_0.o
CC fs/squashfs/module.o
LD fs/squashfs/unlzma.o
LD fs/squashfs/sqlzma.o
LD fs/squashfs/squashfs.o
LD fs/squashfs/built-in.o
CC fs/sysfs/inode.o
CC fs/sysfs/file.o
Ok ~ done!
Kernel Patch -Example
example : kernel 2.6.34 as example
1. download patch-2.6.34.gz
2. download linux-2.6.34.tar.gz
cp patch-2.6.34.gz to linux-2.6.34
cd linux-2.6.34
gunzip patch-2.6.34.gz (if you download bz2 format ,using bunzip2 command to unzip the patch file)
now you'll get patch file : patch-2.6.34
patch -p0 < patch-2.6.34
1. download patch-2.6.34.gz
2. download linux-2.6.34.tar.gz
cp patch-2.6.34.gz to linux-2.6.34
cd linux-2.6.34
gunzip patch-2.6.34.gz (if you download bz2 format ,using bunzip2 command to unzip the patch file)
now you'll get patch file : patch-2.6.34
patch -p0 < patch-2.6.34
const enum syntas erro ..
Normal is your CFLASG define a -DXYZ
and your C source code also have the define in enum type .
and your C source code also have the define in enum type .
Uboot add extra C FLAGS HOW TO
Add on Makefile maynot working ,so find your $(ARCH)_config.mk, add
G_CFLAGS += -DBUILD_NOR_FLASH_16M -DTFTPD
PLATFORM_CPPFLAGS += $(G_CFLAGS)
Ok .rebuild uboot ....
G_CFLAGS += -DBUILD_NOR_FLASH_16M -DTFTPD
PLATFORM_CPPFLAGS += $(G_CFLAGS)
Ok .rebuild uboot ....
mkimage Usage How To
ARM example :
(1) mkimage -A arm -O linux -T kernel -a $(GZRELADDR) -C lzma \
-e $(GZRELADDR) -n 'ARM Linux-$(MS_KERNEL_NUMBER_VERSION)-LZMA' \
-d $(KDIR)/vmlinux.bin.lzma $(KDIR)/vmlinux.lzma.bin
(2) mkimage -A arm -O linux -T kernel -a $(UBOOTRELADDR) -C gzip \
-e $(GZRELADDR) -n 'ARM Linux-$(MS_KERNEL_NUMBER_VERSION)-GZIP' \
-d $(KDIR)/vmlinux.bin.gz $(KDIR)/vmlinux.gz.image
MIPS example :
(1) ${MKIMAGE} -A mips -O linux -T kernel -C gzip -a 0x${LDADDR} -e ${ENTRY} \
-n "Linux Kernel Image" -d ${VMLINUXBIN}.gz ${IMAGEPATH}/vmlinux$3.gz.uImage
(2)${MKIMAGE} -A mips -O linux -T kernel -C lzma -a 0x${LDADDR} -e ${ENTRY} \
-n "Linux Kernel Image" -d ${VMLINUXBIN}.lzma ${IMAGEPATH}/vmlinux$3.lzma.uImage
-e and -a input value can be reference my previous article.
(1) mkimage -A arm -O linux -T kernel -a $(GZRELADDR) -C lzma \
-e $(GZRELADDR) -n 'ARM Linux-$(MS_KERNEL_NUMBER_VERSION)-LZMA' \
-d $(KDIR)/vmlinux.bin.lzma $(KDIR)/vmlinux.lzma.bin
(2) mkimage -A arm -O linux -T kernel -a $(UBOOTRELADDR) -C gzip \
-e $(GZRELADDR) -n 'ARM Linux-$(MS_KERNEL_NUMBER_VERSION)-GZIP' \
-d $(KDIR)/vmlinux.bin.gz $(KDIR)/vmlinux.gz.image
MIPS example :
(1) ${MKIMAGE} -A mips -O linux -T kernel -C gzip -a 0x${LDADDR} -e ${ENTRY} \
-n "Linux Kernel Image" -d ${VMLINUXBIN}.gz ${IMAGEPATH}/vmlinux$3.gz.uImage
(2)${MKIMAGE} -A mips -O linux -T kernel -C lzma -a 0x${LDADDR} -e ${ENTRY} \
-n "Linux Kernel Image" -d ${VMLINUXBIN}.lzma ${IMAGEPATH}/vmlinux$3.lzma.uImage
-e and -a input value can be reference my previous article.
Find out Entry Point And Load address for you (Linux kernel) vmlinux.
I. For mips
1. Find ENTRY point:
example :
mips-linux-objdump -f vmlinux | grep start
arm-softfloat-linux-gnu-objdump -f vmlinux | grep start
2.Find Load Point:
example :
mips-linux-nm vmlinux | grep _ftext
arm-softfloat-linux-gnu-nm | grep _ftext
Another way :
ENTRY=`readelf -a ${VMLINUX} |grep "Entry" |cut -d":" -f 2`
LDADDR=`readelf -a ${VMLINUX}| grep "\[ 1\]" |cut -d" " -f 26`
II.For Arm
# Note: the following conditions must always be true:
# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
# PARAMS_PHYS must be within 4MB of ZRELADDR
# INITRD_PHYS must be in RAM
ZRELADDR := $(zreladdr-y)
PARAMS_PHYS := $(params_phys-y)
INITRD_PHYS := $(initrd_phys-y)
For arm system, the entry and load address just referenc follow 2 files :
(1) linuxsource/arch/arm/mach-xxxxxxxx/Makefile.boot
(2)linuxsource/arch/arm/boot/Makefile
Then using mkimage :
$(MKIMAGE) -A arm -O linux -T kernel -C none -a $(ZRELADDR) -e $(ZRELADDR) \
-n 'Linux-$(KERNELRELEASE)' -d $< $@
1. Find ENTRY point:
example :
mips-linux-objdump -f vmlinux | grep start
arm-softfloat-linux-gnu-objdump -f vmlinux | grep start
2.Find Load Point:
example :
mips-linux-nm vmlinux | grep _ftext
arm-softfloat-linux-gnu-nm | grep _ftext
Another way :
ENTRY=`readelf -a ${VMLINUX} |grep "Entry" |cut -d":" -f 2`
LDADDR=`readelf -a ${VMLINUX}| grep "\[ 1\]" |cut -d" " -f 26`
II.For Arm
# Note: the following conditions must always be true:
# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
# PARAMS_PHYS must be within 4MB of ZRELADDR
# INITRD_PHYS must be in RAM
ZRELADDR := $(zreladdr-y)
PARAMS_PHYS := $(params_phys-y)
INITRD_PHYS := $(initrd_phys-y)
For arm system, the entry and load address just referenc follow 2 files :
(1) linuxsource/arch/arm/mach-xxxxxxxx/Makefile.boot
(2)linuxsource/arch/arm/boot/Makefile
Then using mkimage :
$(MKIMAGE) -A arm -O linux -T kernel -C none -a $(ZRELADDR) -e $(ZRELADDR) \
-n 'Linux-$(KERNELRELEASE)' -d $< $@
How to debug make build ..
Sometimes the build time is long , and the old log in console will been overwrite,
so redirect the build make log in to an file is a good way to debug build problem.
(1)
make 2>&1 | tee BUILD_OPENWRT_LOG.TXT
(2)
make V=99 2>&1 | tee BUILD_OPENWRT_LOG.TXT
so redirect the build make log in to an file is a good way to debug build problem.
(1)
make 2>&1 | tee BUILD_OPENWRT_LOG.TXT
(2)
make V=99 2>&1 | tee BUILD_OPENWRT_LOG.TXT
Fedora 9 :telnet: connect to address 127.0.0.1: Connection refused
pre-step 1:
install program check
#rpm -qa | grep telnet
telnet-0.17-42.fc9.i386
telnet-server-0.17-42.fc9.i386
if no telnet-server-0.17-42.fc9.i386
do follow command (or manual downalod and install by rpm install)
#yum install telnet-server
#service xinetd restart
1. Check If port 23 enable :
netstat -tnl | grep 23
no message ->telnetd not running correctlly,
success message -> tcp 0 0 :::23 :::* LISTEN
check if /etc/xinetd.d/telnet exist
if not add one ,follow is example test ok .
#cat /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses
# unencrypted username/password pairs for authorations.
service telnet
{
disable = no
#only_from = 192.168.1.0/24
# no_access =
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
here , please confirm /usr/sbin/in.telnetd is exist, if not make sure your telnet package is install ok or not.
2. modify /etc/pam.d/login
find line and comment out
#auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
3.add your telent service host
cat /etc/hosts ( 192.168.1.11 is the vmware host OS network adapter ipaddress,
user-a30a9.betaww.edu is the host OS PC network name in domain)
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost localhost
::1 localhost6.localdomain6 localhost6
192.168.1.11 user-a30a9.betaww.edu
4,fi you complete all step ,but still can not work,try reboot your system or partial re-start some
of services .
but soory i did not research what the exactly services should be restart.
install program check
#rpm -qa | grep telnet
telnet-0.17-42.fc9.i386
telnet-server-0.17-42.fc9.i386
if no telnet-server-0.17-42.fc9.i386
do follow command (or manual downalod and install by rpm install)
#yum install telnet-server
#service xinetd restart
1. Check If port 23 enable :
netstat -tnl | grep 23
no message ->telnetd not running correctlly,
success message -> tcp 0 0 :::23 :::* LISTEN
check if /etc/xinetd.d/telnet exist
if not add one ,follow is example test ok .
#cat /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses
# unencrypted username/password pairs for authorations.
service telnet
{
disable = no
#only_from = 192.168.1.0/24
# no_access =
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
here , please confirm /usr/sbin/in.telnetd is exist, if not make sure your telnet package is install ok or not.
2. modify /etc/pam.d/login
find line and comment out
#auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
3.add your telent service host
cat /etc/hosts ( 192.168.1.11 is the vmware host OS network adapter ipaddress,
user-a30a9.betaww.edu is the host OS PC network name in domain)
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost localhost
::1 localhost6.localdomain6 localhost6
192.168.1.11 user-a30a9.betaww.edu
4,fi you complete all step ,but still can not work,try reboot your system or partial re-start some
of services .
but soory i did not research what the exactly services should be restart.
OpenWrt Make Single Package How to
example 1. Make package/ppp
make package/ppp-install V=99
example 2: Mkae tools/firmware-utils
make tools/firmware-utils-install V=99
make package/ppp-install V=99
example 2: Mkae tools/firmware-utils
make tools/firmware-utils-install V=99
OpenWrt Image Builder ,
下禮拜可能要 porting Image Builder 到我的 SDK上,希望順利啊! ~~~~~~~~
http://nuwiki.openwrt.org/oldwiki/ImageBuilderHowTo
http://nuwiki.openwrt.org/oldwiki/ImageBuilderHowTo
MTF 支援 flash nvram 終於完成.
終於把Nvram Tools 搬到 RadVision Sample Application 了,
還把把MTF config 及 MindSpeed config porting 成一個 單一 nvram default array.
最後把 RadVision Sample Application 改成使用 nvram read value 來初始化程式.
..............大部份是 dirty work ,小部份轉換的問題.
收工了!
還把把MTF config 及 MindSpeed config porting 成一個 單一 nvram default array.
最後把 RadVision Sample Application 改成使用 nvram read value 來初始化程式.
..............大部份是 dirty work ,小部份轉換的問題.
收工了!
不同 KERNEL 版本的 DEVICE MTD PATH.
#if definned(KERNEL_2.4.X.X)
#define PATH_CONFIG_MTD "/dev/mtd/5"
#elif defined(KERNEL_2.6.X.X)
#define PATH_CONFIG_MTD "/dev/mtd5"
#else
#error "Un Know Kernel Version"
#endif
#define PATH_CONFIG_MTD "/dev/mtd/5"
#elif defined(KERNEL_2.6.X.X)
#define PATH_CONFIG_MTD "/dev/mtd5"
#else
#error "Un Know Kernel Version"
#endif
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 的預設值!.
但是須要點 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
#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 的預設值!.
本機電腦的VmWare Samba 連線問題.
左圖顯示須要密碼,並且自動使用Guest 導致連入失敗.(但是samba server 是用 share mode,即不需要登入者名字 和密碼).
解決方式:使用 (\\\\localhost) 取代(\\\\:192.168.1.30/) 來建立samba 網路
磁碟機. 見左下圖...
問題發生原因我不清楚 但是估計是xp 的samba client 出問題 或是 tcp/udp port block 的問題 ..不過這樣是可以解決的.
jffs2: Too few erase blocks (1)
今天遇到一個 jffs2: Too few erase blocks (1) 的問題,其實上次做ST 的DMA 時就遭遇到,
只是那時候懶,所以直接用增加MTD 的FLASH SECTOR解決,但是這是不好的做法,因為
浪費大量的FLASH 空間...
這次跑不掉, 可能得換 FILE SYSTEM 或是 ................................................. 不知道...下禮拜
在繼續吧!
後記 (2010/8/9):
解決方式: 改換openwrt 的datalib package 取代下面使用
" mount -t jffs2 /dev/mtdblock5 /tmp/config "
所造成 jffs2: Too few erase blocks (1) 的問題.
datalib 有(1) datalib : process handel commit backup ,restore etc ACTION.
(2) config : usr application which help show ,set or get nvram variable.
datalib using ethernet loopback device "lo"
so if your system lacking lo, maybe not allowed to using this package.
唉~最近真懶!
只是那時候懶,所以直接用增加MTD 的FLASH SECTOR解決,但是這是不好的做法,因為
浪費大量的FLASH 空間...
這次跑不掉, 可能得換 FILE SYSTEM 或是 ................................................. 不知道...下禮拜
在繼續吧!
後記 (2010/8/9):
解決方式: 改換openwrt 的datalib package 取代下面使用
" mount -t jffs2 /dev/mtdblock5 /tmp/config "
所造成 jffs2: Too few erase blocks (1) 的問題.
datalib 有(1) datalib : process handel commit backup ,restore etc ACTION.
(2) config : usr application which help show ,set or get nvram variable.
datalib using ethernet loopback device "lo"
so if your system lacking lo, maybe not allowed to using this package.
唉~最近真懶!
Squashfs 在 Linux 2.6 的支援.
由於Kernel 2.6 並不直接支援 Squashfs 所以須要下載 相關的 patch 檔.
SQUASHFS 網址: http://squashfs.sourceforge.net/
Source Code Release @ http://sourceforge.net/projects/squashfs/files/
注意 4.0 已經沒有 kernel patch 了,似乎是直接有工具支援....因為不適用我的情況 沒有研究.
我的 kernel 是2.6.22 下載3.4 內有patch檔.
解開後 :
cd squashfs3.4/kernel-patches
cp linux-2.6.22/squashfs3.4-patch /root/mindspeed/2010-8-5/trunk/kernel-linux_2.6.22.19-4.05.0/
patch -p1 < squashfs3.4-patch
最後 重新 build 你的 kernel ,燒到 flash 即可.
root@192.168.1.2#cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev futexfs
nodev tmpfs
nodev inotifyfs
nodev devpts
cramfs
squashfs
nodev ramfs
nodev nfs
nodev jffs2
nodev rpc_pipefs
root@192.168.1.2#
收工....
SQUASHFS 網址: http://squashfs.sourceforge.net/
Source Code Release @ http://sourceforge.net/projects/squashfs/files/
注意 4.0 已經沒有 kernel patch 了,似乎是直接有工具支援....因為不適用我的情況 沒有研究.
我的 kernel 是2.6.22 下載3.4 內有patch檔.
解開後 :
cd squashfs3.4/kernel-patches
cp linux-2.6.22/squashfs3.4-patch /root/mindspeed/2010-8-5/trunk/kernel-linux_2.6.22.19-4.05.0/
patch -p1 < squashfs3.4-patch
最後 重新 build 你的 kernel ,燒到 flash 即可.
root@192.168.1.2#cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev futexfs
nodev tmpfs
nodev inotifyfs
nodev devpts
cramfs
squashfs
nodev ramfs
nodev nfs
nodev jffs2
nodev rpc_pipefs
root@192.168.1.2#
收工....
Embedded System Design - Library Include.
當Cross Compile 時 ,若須用到 *.a (Static Library) 不要引用在 Root File System 的
static library.(其實在Root File System 有 *.a 就有問題,不是不可以 只是非常不好,
因為你讓整個 Root File System 變大,浪費 FLASH 空間了!). 當然如果你認為你的 FLASH
夠大,你們公司有錢 都做高價位產品...那就無所謂滴..
static library.(其實在Root File System 有 *.a 就有問題,不是不可以 只是非常不好,
因為你讓整個 Root File System 變大,浪費 FLASH 空間了!). 當然如果你認為你的 FLASH
夠大,你們公司有錢 都做高價位產品...那就無所謂滴..
訂閱:
文章 (Atom)