2008年3月31日 星期一

Matlab version 2

These directions are for installing the Linux version of MATLAB 7.0 (R14) under Linux Binary Compatibility. I'll assume that you already have the install CDs, and a valid license.

Enabling Linux Binary Compatibility

The first thing we need to do is install linux binary compatibility. It's likely that you have it installed already. You can check with the following command:

pkg_info | grep linux_base
If you have it installed you will see a line similar to this:

linux_base-fc-4_9 Base set of packages needed in Linux mode (for i386/amd64)
If you have it installed please skip the next commands for installing it. Otherwise, run the following to install linux binary compatibility.


cd /usr/ports/emulators/linux_base-fc4
make install clean
Either way add the following line to /etc/rc.conf.

linux_load=YES
In order to start compatibility, use the following command:

kldload linux.ko
That will be run automatically everytime you boot with the line we added to rc.conf.

Now add the following line to /etc/fstab.

linprocfs /compat/linux/proc linprocfs rw 0 0
Now run the following two commands:

kldload linprocfs
mount /compat/linux/proc
From now on that will be done for you automatically.

Installing Matlab

Now we need to install linux-java. First you'll have to download the linux-java binary from Sun. Accept the license agreement, and download the file j2sdk-1_4_2_10-linux-i586.bin or its closest equivalent. Once downloaded, move the file to /usr/ports/distfiles/. Then we can install linux-java:

cd /usr/ports/java/linux-sun-jdk14
make install clean
Now we can move on to installing MATLAB. When you mount the cds you will have to mount them with executable permissions. Or you can follow my method of copying the contents of the cds to disk, and run the install from there. Either way will work, but I'll walk you through doing it the same way that I did.

cd /usr
mkdir mat mat2 mat3
Now copy all of the contents to those respective directories (mat for cd1, mat2 for cd2, etc).

cd /compat/linux/usr/
mkdir local
cd local
mkdir matlab
cd matlab
mkdir etc
cd etc
That was a slight pain. At this point you will want copy your prepared license.dat file to etc.

cp license.dat /compat/linux/usr/local/matlab/etc
Now that the license is prepared we're ready to begin the install.

cd /compat/linux/usr/local/matlab
/compat/linux/bin/sh /usr/mat/install
Modify that command if you are installing directly off of the cd. For the install itself you will want to take the default installation directory (the directory you are currently in). The rest of the installer is self explanatory. I'll assume the install was successful.

cd /compat/linux/usr/local/matlab/etc
ln -s lmboot /usr/local/etc/lmboot_TMW
ln -s lmdown /usr/local/etc/lmdown_TMW
We just made a few links for files that will be referenced in our license manager script. Now we'll get that script going.

cp rc.lm.glnx86 /usr/local/etc/rc.d/flexlm.sh
cd /usr/local/etc/rc.d/
chmod +x flexlm.sh
vi flexlm.sh
That will give us a good template for the file. We just need to edit a few paths. In the end your file should look like this:

#!/bin/sh
case "$1" in
start)
if [ -f /usr/local/etc/lmboot_TMW ]; then
/compat/linux/bin/sh /usr/local/etc/lmboot_TMW -u xaenn && echo 'MATLAB_lmgrd'
fi
;;
stop)
if [ -f /usr/local/etc/lmdown_TMW ]; then
/compat/linux/bin/sh /usr/local/etc/lmdown_TMW > /dev/null 2>&1
fi
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

exit 0
You will want to change xaenn to the appropriate username for your system.

/usr/local/etc/rc.d/flexlm.sh start
For the first time we need to start it manually, but it will happen at startup automatically from now on. Right now we could use MATLAB, but it's a bit cumbersome to invoke, so let's write a quick script.

vi ~/bin/matlab
Add the following lines:

#!/bin/sh
/compat/linux/bin/sh /compat/linux/usr/local/matlab/bin/matlab
As per the FreeBSD Handbook, depending on your version of emulators/linux_base, you may need to edit the matlab script.

vi /compat/linux/usr/local/matlab/bin/matlab
Edit the following line

if [ `expr "$lscmd" : '.*->.*'` -ne 0 ]; then
and replace it with

if test -L $newbase; then
And one final note, sound support has been hit or miss for me. Sometimes it works, and other times it won't. As an alternative you may use the wavwrite function, and then play the output from mplayer. It's not ideal, but it works. Finally, you'll have something nice like this:

Matlab version 1

Installing Matlab 7.0 and Femlab 3.1
Антон Хохлов orvind at mail.ru
Tue Aug 29 09:52:38 UTC 2006

Previous message: Current unassigned doc problem reports
Next message: Link Request
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

--------------------------------------------------------------------------------

Hi,

I'm a newby in this mailing list so I'm sorry if something is wrong with my letter.

Yesterday I tried to install Matlab 7.0 with the help of the correspondent
FreeBSD handbook's section. I've found out that the section is incomplete
and allows to install and run Matlab with the -nojvm option enabled
which disables X-based gui and some other features.
In addition for my work I need a FEMLAB toolbox for Matlab
(since some time ago it is called COMSOL Multiphysics toolbox),
but I could not find any manual for that anywhere in the internet.

So I wrote a short instruction of how to do that. I hope someone could fix
my english mistakes and append the instruction to FreeBSD handbook.

Installing Matlab 7.0
1. Follow the steps 10.5.1,10.5.2 and 10.5.4 of the FreeBSD handbook (Installing Matlab section). It seems you don't need to perform step 10.5.5 when installing Matlab 7.0. Don't touch $MATLAB/sys/java/jre/glnx86 as it is described in 10.5.3! Since now you can run Matlab in the text mode only (option -nojvm will be enabled automatically when Matlab starting).
2. In order to run Matlab GUI you need to install the following ports (or binary packages):
linux_base, linux-glib2, linux-xorg-libs, linux_dri and linux-openmotif.
3. Delete all files from $MATLAB/sys/os/glnx86 and $MATLAB/sys/opengl/lib, type as root:
ln -s /compat/linux/usr/X11R6/lib/libXm.so.3 $MATLAB/sys/os/glnx86/libXm.so.2
ln -s /compat/linux/usr/X11R6/lib/libGL.so.1 $MATLAB/sys/opengl/lib/glnx86/libGL.so
ln -s /compat/linux/usr/X11R6/lib/libGLU.so.1 $MATLAB/sys/opengl/lib/glnx86/libGLU.so
ln -s $MATLAB/sys/opengl/lib/libMesaGL.so $MATLAB/sys/opengl/lib/glnx86/libGL.so
ln -s $MATLAB/sys/opengl/lib/libMesaGLU.so $MATLAB/sys/opengl/lib/glnx86/libGLU.so
4. Done!
Note, after completing step 3 check that created links point to the existent libraries. If some links are broken, go to your /compat/linux/usr/X11R6/lib folder and fix them by creating symbolic links to your version of libXm.so.*, libGL.so.* and libGLU.so.*

Installing Femlab 3.1
1. Execute Femlab installer with
/compat/linux/bin/sh ./install
or just with
./install
and complete the installation process.
Point to Matlab installation path when asked (if Matlab is needed).
2. Open $FEMLAB/bin/femlab and find the line containing Linux*. Add FreeBSD* there. It's 231st line for me.
Before:
linux*|Linux*)
After:
linux*|Linux*|FreeBSD*)
If you need to run Femlab standalone (without connection to Matlab), you may skip steps 3-4 and go to 5.
3. Fetch java3d-sdk-1.3.1-linux-i386.bin or later version from anywhere. I've installed java/java3d port first and then copied the file from /usr/ports/distfiles. Unpack the file (just run with /bin/sh and accept the agreement), copy contents of created jre/lib folder to $MATLAB/sys/java/jre/glnx86/jre1.5.0/lib.
4. Check that your hostname is correct and that the correspondent line in
/etc/hosts exist, add the line in opposite case.
5. Create Femlab startup script in /usr/local/bin/
#!/bin/sh
/compat/linux/bin/sh $WHERE_FEMLAB_IS_INSTALLED/bin/femlab "$@"
6. Enjoy ;)

Yours,
Anton Khokhlov

HDTV capture driver for cx2388x

Jason Harmening jason.harmening at gmail.com
Sun Sep 30 13:17:06 PDT 2007

Previous message: problem with transcode port
Next message: HDTV capture driver for cx2388x
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

--------------------------------------------------------------------------------

Hi everyone,

I've been working on a FreeBSD driver for cx2388x-based TV cards on and off
for several months since I came
into possession of an old pcHDTV HD-3000 in late 2006. I only recently
learned about jmg's work with cxd, but I'm making my driver available in case
anyone is interested. It works reliably with my HD-3000; I've managed to
capture several hours of live TV. I've only been able to test it on my own
machine, which is 6-STABLE/amd64/SMP. It'll need a little work (interrupt
filters, at least) to be usable with 7-CURRENT.

I've attached a tarball with full sources--I hope the mail server doesn't
remove the attachments, but if it does and you're interested, let me know and
I'll send you a copy.

The driver is called "cx88"--one of the few
things it has in common with the Linux driver. Here's a not-so-brief
overview of the contents in case you're interested:

common/

Sources for cx88.ko, wich implements channel configuration, buffer
configuration, and RISC program routines common to all functions. Provides
a "board data" facility to allow drivers for different functions on the same
physical board to coordinate usage of shared resources (e.g. the SRAM).
Dynamically sizes the SRAM allocation for each DMA channel based on the total
number of DMA channels claimed by attached drivers (MPEG, analog video,
audio, etc.). Allows RISC programs to be placed in SRAM if there's enough
space. Allows for data buffers to either be allocated in the kernel and
mmap'ed or allocated in user mode and vslock'ed.

i2c/

Sources for cx88i2c.ko, which controls the onboard i2c bus. Uses
interrupt-driven, hardware I2C. Directly implements the iicbus interface
instead of going through iicbb, so on 6.x it requires the attached patch to
get iicbus.ko to export its driver_t. I don't think this is necessary on
7-CURRENT though.

mpeg/

Driver for mpeg transport stream (cx88mpeg.ko). Depends on both
cx88.ko and cx88i2c.ko.

video/

Skeleton analog video driver. Doesn't really do anything right now.

iicdev/

Sources for iicdev.ko--generic kernel mode driver for i2c device
control from user mode. Mostly I implemented this because I don't really
care for iic's use of Giant or its ioctl interface. iicdev isdevice-centric,
so an iicdev character device is created for each i2c device.

libtuner/

(libtuner.so) User-mode drivers for tuners, demodulators, and anything
else
that constitutes the "frontend". This idea, along with support for user-mode
buffers, I got from jmg's bktrau driver. Implemented in C++.
Currently only contains drivers for the Thomson DTT7612 tuner and Oren 51132
demod on the HD-3000. Configurable via text file. This is library is
designed to be easily extensible to support additional tuners/demods and to
possibly work with other drivers besides cx88.

cx88_client.cpp, cx88_user_client.cpp

Really lame capture apps I kludged up to test cx88mpeg.
cx88_client.cpp uses conventional (kernel-allocated) buffers, while
cx88_user_client.cpp uses user-allocated buffers. Mostly I included these
just to demonstrate how to use the cx88mpeg ioctl() interface.

client/

Not-so-lame multi-threaded capture app. Allows simultaneous streaming over
UDP and capture to file. Also allows for channel to be changed and signal
status to be queried on-the-fly. Uses XML configuration file for channel
maps--requires textproc/ezxml.

or51132_*.fw

8VSB and QAM firmware files for the OR51132 demodulator.
Automatically loaded as necessary by the libtuner or51132 driver.


Whew! Anyway, here are my short-term goals for the driver:

0) Keep testing and fix any bugs I find.
1) Add decent comments and documentation--this is mostly done for the
kernel-mode pieces, but libtuner and the client application need
documentation.
3) Get my hands on a pcHDTV HD-5500. If I've done things right, I'll only
need to add drivers for the LG tuner and demod to libtuner, and add a
pchdtv_hd5500 class to the capture application.
4) Work on analog video driver and maybe, once I get the 5500, audio as well.
5) When I'm ready to upgrade to FreeBSD 7.0 (probably during the beta phase),
add interrupt filters, ditch the iicbus patch, and do whatever else is
necessary to get this puppy working under 7.0.

Here are some quick instructions on how to use the driver:

1. Extract the source tarball.

2. To patch the iicbus driver:
cd /usr/src/sys/dev/iicbus
patch < patch_iicbus
Reload iicbus.ko or recompile kernel

3. Install textproc/ezxml. The capture app uses this to parse its XML
channel map configuration file.

4. From cx88_20070930 directory extracted from source tarball, type 'make',
or, if you want your system log full of status messages from the driver,
type 'make -D DIAGNOSTIC'. This will compile all kernel-mode drivers,
libtuner.so, and the capture app (called 'cx88'--creative, I know).

5. From the same directory,
kldload iicdev/iicdev.ko
kldload common/cx88.ko
kldload i2c/cx88i2c.ko
kldload mpeg/cx88mpeg.ko

To use the client application:

The capture app (cx88) depends on libtuner, so make sure the libtuner/
directory (or wherever you're keeping libtuner.so) is in your library path.
Libtuner uses a simple text-based configuration file to allow for flexible
configuration of tuner drivers that may need it--an example can be found in
client/.tuner_config, which specifies the paths to the OR51132 firmware
files. The cx88 executable uses an XML configuration file to load its
channel maps--an example can be found in client/cx88.xml. At some point I'll
document the syntax for this file, but cx88.xml should be adequate for
receiving OTA HDTV broadcasts.

Here's a list of the command-line options for the cx88 executable:

-d : [Required] Specify device from which to capture

-c : [Required] Specify initial channel, e.g. '7'
or 'ATSC:7'

-u : [Optional] Send capture over UDP to provided host

-f : [Optional] Send capture to specified file

-x : [Optional] Specify XML configuration file; default is
~/.cx88.xml

-t : [Optional] Specify libtuner configuration file; default is
~/.tuner_config

-n : [Optional] Specify non-interactive capture for provided number of
minutes

-? : Display this list of options.

If you omit the -n option, cx88 will run in interactive mode, in which case
you can enter the following commands to control the application on-the-fly:

'c':
Changes channel on-the-fly.
After entering the 'c' character, you'll be prompted to enter a channel
number, optionally prefixed with a channel profile name from the XML
configuration file. For example:
...
c
Enter channel:
ATSC:56
...

'i':
Display channel/signal stats:
...
i
Tuned to 725000000HZ
Signal strength: 80.8992%
Signal-to-noise ratio: 28.3147
Bit-error rate: 0
Uncorrected blocks: 0
...

'q': Quit the application.

Examples:

To launch cx88 in interactive mode, using device /dev/cx88mpeg0 for capture,
initially tuned to channel 33 in the 'ATSC' profile, streaming data over UDP
to host 127.0.0.1, port 8802, and also storing the same data to a file
named 'abc.ts':

./cx88 -t ./.tuner_config -x ./cx88.xml -u 127.0.0.1:8802 -f abc.ts -c
ATSC:33 -d /dev/cx88mpeg0

To launch cx88 in non-interactive mode, capturing channel 33 in the 'ATSC'
profile to a file named abc.ts for 7.5 minutes:

./cx88 -t ./.tuner_config -x ./cx88.xml -f abc.ts -c
ATSC:33 -d /dev/cx88mpeg0 -n 7.5

For playing the transport stream, either from a file or live via UDP, the best
player I've found so far is multimedia/vlc. However, I haven't yet found a
player that allows you to select from multiple program streams broadcast on
the same channel.

Anyway, I hope there are people out there interested enough to wade through
this long e-mail and maybe give the driver a try and let me know how it
works!

Thanks,
Jason Harmening

2008年3月9日 星期日

PPPOE

發信人: Eintisy.bbs@bbs.ee.ccu.edu.tw (月光小俠), 看板: 386BSD
標 題: [HOWTO] FreeBSD+PPPoE (ADSL auto redial)
發信站: 中正電機網路中繼站 (Sat Jun 30 22:54:56 2001)
轉信站: abpe.org!News.Math.NCTU!news.CDPA.nsysu!news.nsysu!ctu-gate!news.nctu!n
Origin: bbs.ee.ccu.edu.tw

[寫在前頭]
海! 各位 大大 以及 FreeBSD 的朋友們! :)
笨小俠又來了! 這次要談談另一個使用 FreeBSD+PPPoE 的心得
不知道內容是否正確,還請各位大大幫忙訂正! ^^;

[環境]
1. 再 report any error 之前, 請先確定自己的硬体沒問題...
2. kernel 方面,如果 最佳化(看/etc/default/make.conf) 參數加下去有問題
就先不要加! (Reference: /etc/dafault/make.conf)
3. 依照之前笨小俠的小文章,如果閣下的測試均沒問題,那麼剩下的就只需改一個檔
4. 其他步驟,笨小俠還是也重新貼一下好了! ^^;

[測試]
方法一:
比較直接,但是有點兒浪費本來 ppp 的功能. 而且不夠 real time ^^;
但是,好處是不必動到原來的設定,而是另跑一個 process 去 monitor ip
這個 process 可以是一個 daemon 也可以 以 cron 的方式去執行!
我比較不 prefer 這個方法... ^^; 不過,到是在 rp-pppoe 的做法中可以看出來!
這裡我只寫了 cron 的 shell script ...若需 daemon ,請 Free your Power :)

Concept Shell Script Example: [若有不正確,請自己修改,總之就是這個意思]
#!/bin/sh
IFS=" "
set -- `ping -c 5 -t 4 PEER_ADDR grep loss`
LOSS=$7
if [ "$LOSS" = "100%" ]; then
killall /usr/sbin/ppp
sleep 3
ppp -ddial hinet
fi
註: PEER_ADDR 以及 hinet 應該不用多作解釋吧? ^^;

方法二:(I prefer it... and you? ^^;)
1. 如何在沒有 make kernel 時候就做測試呢?
修改 /boot/loader.conf 加入下面的東東..
module_load="YES"
module_name="netgraph" ( <=== 注意 不是 netgraph.ko ) 其他如 ng_pppoe_load="YES" 等 module...可以參考 /boot/default/loader.conf 2. reboot (kernel.GENERIC應該有將 tun compile進去) 3. 編寫 /etc/ppp/ppp.conf 如下:(這個檔是最重要的了!) default: set log Phase Chat LCP IPCP CCP tun commadn # 這個log可以自己看manpage設! 不要 set log all ... 否則硬碟一下就爆了! :P set redial 1 86400 # Format: set redial n 秒 m 次 .. # => 當斷線時 每隔n秒重撥一次直到撥了m 次 ppp 才會放棄
# 笨小俠這兒的設定是 每隔一秒重撥一次...希望機器能隱定到重撥 86400次 :P

set reconnect 1 5
# 同上的 format, 不同處,應該是 每次dial並不會很順利connect..所以才需reconnect
# 附註:其實這兩行還有關於 timeout stuff .. 想了解更清楚,麻煩跟小俠一樣
# 將整個 ppp 的 manpage 看過一次吧! 要不然請直接放心使用! ^^;
# 另外, /usr/share/example/ppp/ppp.conf.sample 也是很好的參考資料

hinet:
set device PPPoE:ed1(網路卡device)
set speed sync
set mru 1492
set mtu 1492
enable lqr
set lqrperiod 5
set cd 5!
set dial
set login
add default HISADDR
set authname 帳號
set authkey 密碼
註:如果小俠多加了任何累綴的東西(for automatic redial),還請大大不吝賜教! :)

4. echo "nameserver 168.95.192.1" >> /etc/resolv.conf
[請注意,如果在 ppp.conf 裡頭有加入 enable dns 就不用寫這個檔了!

5. 執行 ppp 進行測試!
# /usr/sbin/ppp hinet
ppp on myhost> dial
ppp on myhost>

開另一個 term ...
$ ifconfig tun0
tun0:flags=8051mtu 1492
inet LOCAL_ADDR --> PEER_ADDR netmask 0xffffff00
Opened by PID 1234
此時,LOCAL_ADDR 就是你 get 到的 IP ...PEER_ADDR 是你 ISP's router
$ ping PEER_ADDR ....如果有通,就算成功了!
然後,趁著花好月圓時候.. 關掉 ADSL 電源(以產生突然被斷線的狀況)
再等待一些時候再開ADSL :)
$ ifconfig tun0 觀察是否自動 redial 得到新的 IP ..(Should work fine!)

6. 修改 /etc/rc.conf 加入
ppp_enable="YES"
ppp_mode="ddial"
ppp_profile="hinet" <= 請對映 ppp.conf 裡頭 ISP. 7. 若要重新 make kernl (or not ... it is up to u.) 可以不必加入 options NETGRAPH 等三項. 這樣子,也可以免去下面一個煩人的warning (WHY? :> 自己想想)
module_register: module netgraph already exists!
linker_file_sysinit "netgraph.ko" failed to register! 17

8. 編輯 /etc/ppp/ppp.linkup (這個檔是幹麻用的呢? :> 自己想想)
內容: !bg /etc/ppp/dyns.sh

9. 編輯 /etc/ppp/dyns.sh script(如果你想要動態 DNS 的話... hope it help.)
#!/bin/sh
IP=""
IFS=" "
while [ "$IP" = "" ]; do
set -- `/sbin/ifconfig tun0 /usr/bin/grep netmask`
IP=$2
done
/usr/local/bin/lynx -dump "http://www.myip.org/cgi-bin/Update.py?id=\
我註冊的帳號&pwd=我註冊的密碼&ip=${IP}&recordtype=A&hostname=我註冊的名稱"
附註:現在的 http protocal 裡頭 remote ip 應該都包含了!
如果 找的 那個 提供 Dynamic Domain Name 的 provider 要求必須自己抓 ip.
上面的 dyns.sh 是一個簡單的例子!

10. reboot and enjoy. Hope this article helps.

--

問的人,請問清楚
答的人,就能切中要領
如果問的人,問得亂七八糟
那麼答的人,也只好答非所問 !

--
◆ Origin: 中正電機網路中繼站 (bbs.ee.ccu.edu.tw)
◆ From: swsh234-239.adsl.seed.net.tw
※ X-Info: pasear -> pasear@ckeisc.ck.tp.edu.tw
※ X-Sign: 0TOF9M5hJ0vIoGgccEMA (01/08/25 21:23:17 )