lovedsl 发表于 2010-10-25 07:06:16

看到点资料,弄来大家看看

中兴B600机顶盒
B600 V4串口线连接 准备:
1)232TTL转化模块,TAOBAO上有卖.
2)串口线
也可以用手机数据线,可以直接从(TTL或CMOS)转成USB接口,方便笔记本联接.

第一步:连接串口
B600 V4 串口接口位置 USB口朝自己,最左边一个8针的插座.丝印标记X11
1 2
3 4
5 6
7 8
1-->VCC
2-->GND
5-->RX
6-->TX

第二步:
下载串口软件 我使用超级终端连接不上,建议使用 MiniCom
开关B600 V4.就有信息出来
设置: 波特率 115200 8位 无校验 1停止位
用超级终端在进入后用vi不会乱码.
第三步:
按住某个键,然后可以进入loader.
B600 Loader Message   不能开机的软件错误 B600 V4启动信息
B600 开启TELNET 服务 telnet 不要密码则输入以下:
echo "telnetd -l /bin/sh & " >> /etc/rc.d/rcS
telnet 要密码则输入以下内容
echo "telnetd & " >> /etc/rc.d/rcS
V4版本升到20080710版本后,可以用 idt idt 用户登录telnet
B600 开启FTP服务   B600U-BOOTUBOOT里的setenv和printenv没有实现,所以不能用来设置环境变量。好在askenv可以使用。因此B600V4可以通过tftpboot方式加裁
askenv ethaddr
00:14:15:16:17:18
askenv ipaddr
192.168.168.2
askenv serverip
192.168.168.10
tftpboot0x84801000 vmlinux
go 0x84802000
B600编译环境设置1.访问www.stlinux.com
2.下载stlinux 2.2
3.下载Fedora Core Linux 4或 5 不能下最新的8以上的.
4.安装 Virtual PC 2007 ,低版本的这个Linux装不上
5.在虚拟机里装上FC,不要启用SE Linux.
6.rpm -ivh ftp://rpmfind.net/linux/fedora/releases/9/Everything/i386/os/Packages/compat-libstdc++-33-3.2.3-63.i386.rpm
7.加载stlinux 2.2 光盘mount /dev/cdrom /mnt
8.安装stlinux包   cd /mnt/; install -c sh4
9.在bash_profile 里加入 stlinux的bin相关路径
B600 GEEXBOX移植
B600NFS启动
[*]导出root
vi /etc/exports
增加 nfs root 的目录

[*]启用tftp
vi /etc/xinetd.d/tftp
把 disable = yes 改成 np

[*]启动服务
service nfs start
service xinetd start

[*]编译允许nfs root 的内核
./build menuconfig
./build uImage
root=/dev/nfs nfsroot="192.168.1.103:/v4root" ip="192.168.1.12:192.168.1.103:192.168.1.1:255.255.255.0:QIU:eth0:off"

[*]安装原有的root fs
losetup /dev/loop0 mtd7
modprobe block2mtd
echo "/dev/loop0" > /sys/module/block2mtd/parameters/block2mtd
modprobe mtdblock
modprobe jffs2
mount -t jffs2 -o ro /dev/mtdblock1 b600
tar -cf - -C b600 . | tar xvf - -C v4root
umount b600
rmmod jffs2
rmmod mtdblock
rmmod block2mtd
losetup -d /dev/loop0
B600编程例子   B600 使用WINDOWS 共享PC上生成cifs.ko
sh4-linux-uclibc-gcc-o mount.cifs mount.cifs.c
ITV上执行
#这里有2M的内存空间虚拟的文件系统所以把东西临时放在这里
cd /var/tmp ;   
#下载内核模块
wget http://192.168.1.2/cifs.ko   
#下载安装工具
wget http://192.168.1.2/mount.cifs
#安装内核模块
insmod cifs.ko
#安装cifs
chmod 755 mount.cifs
#安装一个共享
mount.cifs //192.168.1.2/as /mnt -o directio mapchars
#从共享里读出数据
cat /mnt/a.txt
#卸载共享
umount /mnt

有网络硬盘盒的朋友,将可以利用这个特性来把文件直接下载到硬盘盒,而不需要刷硬盘盒里的固件了

需要只支持SMBFS而不支持CIFS的老式的LAN DISK可以这么安装共享
echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled
mount.cifs //192.168.1.200/film /mnt -o directio mapchars

lovedsl 发表于 2010-10-25 07:06:53

B600 P2P下载
中兴B600 V4机顶盒有128M RAM,16M Flash,硬件条件要比西部数据的My Book和迈拓的MSS网络硬盘盒要强,完全可以改造成为一个P2P下载平台。My Book和MSS上使用Clutch+Transmission和MLDonkey两种P2P下载软件,只要设法把这两个软件移植到B600 V4机顶盒,就能扩展机顶盒的功能。
目录
[隐藏]

    * 1 交叉开发平台
    * 2 内核编译
    * 3 BusyBox
    * 4 应用程序
    * 5 transmission 出错信息
    * 6 MLDonkey移植

交叉开发平台

B600采用ST的CPU,ST公司提供了开源项目STLinux的下载,下载连接为:ftp://ftp.stlinux.com/pub/stlinux/2.2/iso/STLinux-2.2-sh4.iso STLinux提供了在X86 Linux系统下交叉开发sh4平台软件的工具链。

先在PC上安装Linux操作系统,最方便的是使用VMware Workstation虚拟机(虚拟机设置256M RAM,8G硬盘)。可选的Linux操作系统有:RedHat Enterprise Linux 4/5,CentOS Linux 4/5,Fedaro Core Linux 5/6/7/8/9。

笔记:
tomac的笔记本上 RH4/5 CentOS 4/5 FC5+ (Microsoft Virturl Machine)都不能正常安装,后来是用的FC4,至少3G,我用了4G的虚拟硬盘。
安装sh4的光盘时,需要Libstdc++.so.5,需要下载安装compat-libstdc++ 3.3
wget ftp://ftp.univie.ac.at/systems/FreeBSD/ports/distfiles/rpm/i386/fedora/4/compat-libstdc++-33-3.2.3.fc4.i386.rpm
rpm -ivh *.rpm


STLinux-2.2-sh4.iso的根目录:

# ls -l
total 151
-r--r--r-- 1 root root1718 Oct 162006 gpg_key
dr-xr-xr-x 2 root root6144 Oct 172006 host
-r-xr-xr-x 1 root root1902 Oct 172006 install
-r--r--r-- 1 root root   171 Oct 172006 MD5SUM
-r--r--r-- 1 root root   136 Oct 162006 README
dr-xr-xr-x 2 root root 86016 Oct 172006 sh4
-r--r--r-- 1 root root 57335 Oct 172006 stcomps.xml

由于STLinux-2.2-sh4中的rpm是在较低版本的Linux上创建的,它们所依赖的软件包的版本号与目前的Linux不一致,安装时会出现错误。为了解决这个问题,需要修改CD中的install脚本,在其中的rpm命令中加入--nodeps选项。下面是具体方法(CD Mount在/mnt):

# cd /root
# mkdir STLinux-2.2-sh4
# cd STLinux-2.2-sh4/
# ln -s /mnt/sh4 sh4
# ln -s /mnt/host host
# ln -s /mnt/gpg_key gpg_key
# ln -s /mnt/stcomps.xml stcomps.xml
# cp /mnt/install .
# vi install

install() {
    l=""
    for r ; do
      if expr "$i" : ".*$r" >/dev/null ; then
            :
      else
            l="$l $r"
            i="$i $r"
      fi
    done
    rpm --ignorearch -Uhv $l
}


修改其中的rpm命令选项:

    rpm --nodeps --ignorearch -Uhv $l

运行安装脚本:

# ./install -c sh4
...

# ls /opt/STM/STLinux-2.2/
configdevkithost

安装完毕后,需要设置交叉编译环境PATH。打开/etc/profile,在其中增加一行:

PATH=$PATH:/opt/STM/STLinux-2.2/devkit/sh4/bin

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

更新软件包:以B600 V4为例,它使用的内核版本是2.6.17.14_stm22_0039,而光盘中的内核版本是linux-2.6.17.13_stm22_0035,因此需要从stlinux.com上下载升级包:

wget ftp://ftp.stlinux.com/pub/stlinux/2.2/updates/RPMS/host/stlinux22-host-kernel-source-2.6.17.14_stm22_0039-39.noarch.rpm
rpm --nodeps --ignorearch -Uhv stlinux22-host-kernel-source-2.6.17.14_stm22_0039-39.noarch.rpm

内核编译

内核配置

$ ln -s sh arch/sh4
$ ln -s asm-sh include/asm-sh4
$ make ARCH=sh4 stb7109eref_defconfig

也可以这么做

make ARCH=sh CROSS_COMPILE=sh4-linux- stb7109eref_defconfig
make ARCH=sh CROSS_COMPILE=sh4-linux-

为了简便起见,可以建一个build脚本

#!/bin/sh
make ARCH=sh CROSS_COMPILE=sh4-linux $1

好处是以后不记得如何写命令行,还可以通过这个脚本来回忆一下

在内核中增加EXT3和CIFS文件系统的支持,如果不改变原有的内核,也可以通过内核模块来加载。

内核编译

$ make ARCH=sh4 CROSS_COMPILE=sh4-linux-

Loadable Module Support=>Automatic KernelModule Loading 不用启用
Kernel Features=>Preemptible Kernel 这个要选上

内核模块无法加载的问题

这是由于编译环境不完全相同导致的。办法是 vi include/linux/vermagic.h
改成 "2.6.17.14_stm22_0039-V120 preempt mod_unload SH4LE gcc-4.1"

B600 V4启动信息

ext3文件系统错误
BusyBox
应用程序

wget http://www.openssl.org/source/openssl-0.9.8i.tar.gz
tar xvzf openssl-0.9.8i.tar.gz
cd openssl-0.9.8i
./config
MACHINE="sh4-linux"
vi Makefile
gcc => sh4-linux-uclibc-gcc
ar => sh4-linux-uclibc-ar

wget http://curl.haxx.se/download/curl-7.19.0.tar.gz
tar xvzf curl-7.19.0.tar.gz
cd curl-7.19.0
./configure --host=sh4-linux-uclibc --target=sh4-linux-uclibc \
--with-random=/dev/urandom --with-ssl=/opt/STM/STLinux-2.2/devkit/sh4/target/usr

wget http://mirrors.m0k.org/transmission/files/transmission-1.34.tar.bz2
tar jxvf transmission-1.34.tar.bz2
cd transmission-1.34
OPENSSL_CFLAGS=-I/usr/local/ssl/include;export OPENSSL_CFLAGS
OPENSSL_LIBS="-L/usr/local/ssl/lib -lssl -lcrypto -ldl -lz";export OPENSSL_LIBS
LIBCURL_CFLAGS=-I/usr/local/include;export LIBCURL_CFLAGS
LIBCURL_LIBS="-L/usr/local/lib -lcurl";export LIBCURL_LIBS
./configure --host=sh4-linux-uclibc --target=sh4-linux-uclibc --disable-gtk
vi third-party/shttpd/std_includes.h +31
//#include <wchar.h>
make




// tomac

ln -s /opt/STM/STLinux-2.2/   /sh4
ln -s /sh4/devkit/sh4/target/sh4target
mkdir /src
cd /src
wget http://www.openssl.org/source/openssl-0.9.8i.tar.gz
tar xvzf openssl-0.9.8i.tar.gz
ln -s openssl-0.9.8i openssl
wget http://mirrors.m0k.org/transmission/files/transmission-1.34.tar.bz2
tar jxvf transmission-1.34.tar.bz2
ln -s transmission-1.34 trans
wget http://curl.haxx.se/download/curl-7.19.0.tar.gz
tar xvzf curl-7.19.0.tar.gz
ln -s curl-7.19.0 curl

cd /src/openssl
./config no-asm no-zlib
vi Makefile
gcc => sh4-linux-uclibc-gcc
ar => sh4-linux-uclibc-ar
INSTALLTOP=/sh4target/usr/local/ssl
make clean all install

cd /src/curl-7.19.0
./configure --host=sh4-linux-uclibc --target=sh4-linux-uclibc --with-random=/dev/urandom \
--with-ssl=/sh4target/usr/local/ssl --prefix=/sh4target/usr/local/curl --enable-static=curl
make clean all install

cd /src/trans
vi third-party/shttpd/std_includes.h +31
   //#include <wchar.h>
OPENSSL_CFLAGS=-I/sh4target/usr/local/ssl/include;export OPENSSL_CFLAGS
OPENSSL_LIBS="-L/sh4target/usr/local/ssl/lib -lssl -lcrypto -ldl -lz -fPIC";export OPENSSL_LIBS
LIBCURL_CFLAGS=-I/sh4target/usr/local/curl/include;export LIBCURL_CFLAGS
LIBCURL_LIBS="-L/sh4target/usr/local/curl/lib -lcurl -fPIC";export LIBCURL_LIBS
./configure--target=sh4-linux-uclibc --disable-gtk --with-pic --enable-static=curl
make clean all install

transmission 出错信息

<4>Pid : 368, Comm: transmission-da <4>PC is at 0x295576a2 <4>PC: 295576a2 SP: 7b947b9c SR: 00008000 TEA : c0162384 Not tainted <4>R0: fcf4f0ec R1: ff00ffff R2: ff3d3c3b R3: 7b947c28 <4>R4: 297555c8 R5: 7b947be8 R6: 7b947c64 R7: 295b8000 <4>R8: 00000001 R9: 00000000 R10 : 00000000 R11 : 00000021 <4>R12 : 2956c008 R13 : 6ffffffb R14 : 7b947b9c <4>MACH: 00000712 MACL: 00000300 GBR : 2955d430 PR: 29559852 <4>Stack: <4> 7b947bb4 295b8000 00000003 2955d000 7b947c28 2955d0d4 7b947cd4 7b9486a4 <4> 001b1000 00000000 297555a0 00000000 001b0a68 00000001 00000000 00000000 <4> 0000fea8 00000012 fff2ff3e 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00001f08 00000089 <4> 000281a4 00000000 00000000 003131a7 00001000 00001899 00002e85 00000000 <4> 495f29bf 00000000 00002e85 00000000 00000000 00000000 29559b62 7b9484fc <4> 00000000 2956c008 7b9486a4 00000000 7b947cd4 7b9484dd 696c2f2e 72756362 <4> 6f732e6c 6100342e 75632f6c 6c2f6c72 6c2f6269 75636269 732e6c72 00342e6f <4> 6c646269 2e6f732e 6c2f0030 65726269 766c6f73 2e6f732e 74720030 2e6f732e <4> 6c2f0030 736e6269 6f732e6c 0000302e 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 <4> 00000000 <4> <4>Call trace: <4>
MLDonkey移植

//by cbn

首先,把虚拟机中/opt/STM/STLinux2.2/devkit/sh4 设置nfs共享然后挂载到本机硬盘,mount -t nfs 192.168.0.2:/opt/STM/STLinux2.2/devkit/sh4 /mnt/nfs

切换系统根目录chroot /mnt/nfs/target 此时,可编译OCaml10.2 但是主机内存不够,无法编译mldonkey 方法是下降mldonkey中内置ocaml版本,使其通过编译然后,拷贝相应的so至机顶盒. 运行./mlnet即可.

zhuanghong 发表于 2012-12-12 15:20:10

高手。这篇文章真的好!

mark7070 发表于 2012-12-12 15:52:26

高手在人间啊。。。。。。

56143575 发表于 2013-1-3 20:51:23

hao {:soso_e176:}

贺文军 发表于 2013-2-2 01:26:00

页: [1]
查看完整版本: 看到点资料,弄来大家看看