顯示具有 Unix 標籤的文章。 顯示所有文章
顯示具有 Unix 標籤的文章。 顯示所有文章

星期一, 4月 15, 2013

Ubuntu pptp server

1. install pptpd service
sudo apt-get install pptpd

2. iptables rules
-A INPUT -i xyz0 -p tcp -m state --state NEW --dport 1723 -j ACCEPT

-A INPUT -i xyz0 -p gre -j ACCEPT
-A OUTPUT -i xyz0 -p gre -j ACCEPT
-A INPUT -i xyz0 -p tcp --sport 1723 -s xxx.xxx.xxx.xxx -j ACCEPT
-A OUTPUT -i xyz0 -p tcp --dport 1723 -d xxx.xxx.xxx.xxx -j ACCEPT

xyz0 is the out interface.
xxx.xxx.xxx.xxx is the pptp server address

3. /etc/pptpd.conf
modify localip & remoteip

localip xxx.xxx.xxx.xxx
remoteip 192.168.x.51-59

xxx.xxx.xxx.xxx is the pptp server address

4. /etc/ppp/chap-secrets
add one entry for pptpd

# client server secret IP addresses
"user" pptpd "password" *

5. start pptpd service

星期日, 10月 21, 2012

Pandaboard mldonkey server

1. the original mldonkey with precise has bug.
https://bugs.launchpad.net/ubuntu/+source/mldonkey/+bug/1060007

2. try to build for my own.
   - get mldonkey-3.1.3.tar.bz2 from official site
   - extract & get build depend package
     apt-get install build-essential checkinstall ocaml-nox ocaml-native-compilers zlib1g-dev
   - change CXXFLAGS -O2 to -Os
   - ./configure --disable-multinet
   - make -j2
   - copy ./mlnet to /usr/bin/mlnet (to replace the old one)

3. regarding the password for remote user.
    - telnet 127.0.0.1 4000
    - useradd admin xxxx (xxxx is password you want)

Ref: https://help.ubuntu.com/community/MLDonkey
       http://mldonkey.sourceforge.net/Quickstart_guide
       http://mldonkey.sourceforge.net/CompilationProblems

Pandaboard disable ondemand cpu governor

1. sudo update-rc.d ondemand disable

2. modify rc.local
# By default this script does nothing.
#set scaling_governor to userspace
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo userspace > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# set cpufreq to 800Mhz
echo 800000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
echo 800000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed

Openbravo POS note in Lucid (ARMv7)

RXTX could use the repo's package

but, RXTXComm.jar need to be put in /usr/lib/jvm/java-6-openjdk/jre/lib/ext

librxtxParallel.so, librxtxSerial.so need to be put in /usr/lib/jvm/java-6-openjdk/jre/lib/arm

Use TestSerialPort to do the test.
1. javac *.java
2. java ListCommPorts (check result)

Ubuntu ttySx default only root & dialout have permission to use.
so, the openbravo user need to join dialout group.

for autologon & auto-launch openbravo-pos
/etc/lxdm/lxdm.conf need to be modified
[base]
autologin=opos
session=/opt/openbravopos-2.30/start.sh

Pandaboard Ubuntu 12.04 precise note

My goal is make an device that be my wireless access point, transmission daemon, mldonkey daemon & samba server in my home.

1. first I take a look the following info as reference.
    http://drizztcp.wordpress.com/category/pandaboard/

2. Grab the Ubuntu 12.04 image from http://cdimage.ubuntu.com/releases/12.04/release/. I choose http://cdimage.ubuntu.com/releases/12.04/release/ubuntu-12.04-preinstalled-server-armhf+omap4.img.gz for  my Pandaboard A2.

3. Make bootable SDCard & following the install instruction. https://wiki.ubuntu.com/ARM/OmapDesktopInstall

4. Now, I have an bootable Panda.

5. Configuration the hostapd.  I don't want just take my panda as AP only. So, I decide to run dhcpd on wlan0.
  5.1 dhcp-server part:
     5.1.1. apt-get install isc-dhcp-server
     5.1.2 modify /etc/default/isc-dhcp-server
        - INTERFACES="wlan0"
     5.1.3 modify /etc/dhcp/dhcpd.conf
        - option domain-name "myhome.net";
        - option domain-name-servers 168.95.192.1, 168.95.1.1; (for my Hinet DNS)
        - subnet 192.168.0.0 netmask 255.255.255.0 {
              range 192.168.0.100 192.168.0.150;
              option subnet-mask 255.255.255.0;
              option broadcast-address 192.168.0.255;
              option routers 192.168.0.254;
            }
  5.2 hostapd part:
    5.2.1 /etc/network/interfaces We need wlan0 has static ip to be the rule of dhcp-server.
       - auto wlan0
          iface wlan0 inet static
          address 192.168.0.254
          netmask 255.255.255.0
          network 192.168.0.0
          broadcast 192.168.0.255
    5.2.2 /etc/hostapd/hostapd.conf
        - interface=wlan0
          driver=nl80211
          ssid=panda-wifi
          hw_mode=g
          ieee80211n=1  # enable 802.11n support.
          wmm_enabled=1
          #ht_capab=[HT40-][HT40+] #Ti wl1271 only up to 65Mbps. HT40 will cause module hang.
          channel=5
          macaddr_acl=0
          #0 is allow all connection, 1 is deny all connect, only accept in hostspd.accept
          accept_mac_file=/etc/hostapd/hostapd.accept
          deny_mac_file=/etc/hostapd/hostapd.deny
          auth_algs=1
          ignore_broadcast_ssid=0
          wpa=2
          wpa_passphrase=xxxxxx #choose the password you want.
          wpa_key_mgmt=WPA-PSK
          wpa_pairwise=TKIP
          rsn_pairwise=CCMP
    5.2.3 touch /etc/hostapd/hostapd.accept & /etc/hostapd/hostapd.deny to let hostapd daemon running.
  OK, we have wlan0 & hostapd work now. Next, I want the pppoe work. Zyxel P874 seems performance is not good enough for P2P.
6. PPPoE on eth0
  6.1 install ppp, pppoe support
       - apt-get install ppp pppconfig pppoe pppoeconf
  6.2 /etc/ppp/peers/dsl-provider
       - pty "/usr/sbin/pppoe -I eth0 -T 80 -m 1452"
         noipdefault
         usepeerdns
         defaultroute         
         user "????????@ip.hinet.net"
  6.3 /etc/ppp/chap-secrets, /etc/ppp/pap-secrets
       - "????????@ip.hinet.net" * "??????"
  6.4 /etc/network/interfaces
       - add dsl-provider section
          auto dsl-provider
          iface dsl-provider inet ppp
          provider dsl-provider
    6.5 PPPoE keepalive.sh (for auto-reconnect)
#!/bin/sh

# keepalive.sh

# This is a keepalive script for the Casema cable modems. This script was
# lifted from the /usr/doc/HOWTO/unmaintained/mini/Dynamic-IP-Hacks
# document. There should be an entry in your crontab looking like:
# */2 * * * * /etc/ppp/keepalive.sh
# to run this script every 2 minutes to see if your connection is still
# up, if not, gracefully kill the pppd process and remake it.
# Modify paths as necessary.


if [ -f /var/run/ppp0.pid ]; then
testing=$(ping -c4 -l4 168.95.192.1 2>&1 | grep "0 packets")
if [ "$testing" != "" ]; then
        /usr/bin/poff -a
        sleep 10
        /usr/bin/pon dsl-provider
fi
else
        /usr/bin/pon dsl-provider
fi
    6.6 /etc/crontab
        - */2 *    * * *   root    /etc/ppp/keepalive.sh  (for auto-reconnect)

7. To be an Wireless router
    7.1 /etc/sysctl.conf
       - enable IPv4 forward
          net.ipv4.ip_forward=1
    7.2 add iptable rule.
       - wlan0 as LAN (192.168.0.xxx/24) , ppp0 as Internet connection
       7.2.1 /etc/firewall-rules
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i wlan0 -s 127.0.0.1/8 -j DROP
-A OUTPUT -o wlan0 -d 127.0.0.1/8 -j DROP
-A INPUT -i ppp0 -s 127.0.0.1/8 -j DROP
-A OUTPUT -o ppp0 -d 127.0.0.1/8 -j DROP
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 127.0.0.0/8 -d 127.0.0.0/8 -i lo -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 22 -j ACCEPT
#for transmission package
-A INPUT -i ppp0 -p tcp -m tcp --dport 9091 -j ACCEPT
-A INPUT -i ppp0 -p tcp -m tcp --dport 51413 -j ACCEPT
#for FTP
-A INPUT -i wlan0 -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -i wlan0 -p tcp -m tcp --dport 21 -j ACCEPT
# for SSH
-A INPUT -i wlan0 -p tcp -m tcp --dport 22 -j ACCEPT
#for SMB/CIFS
-A INPUT -i wlan0 -p tcp -m tcp --dport 139 -j ACCEPT
-A INPUT -i wlan0 -p tcp -m tcp --dport 445 -j ACCEPT
#for transmission package
-A INPUT -i wlan0 -p tcp -m tcp --dport 4001 -j ACCEPT
-A INPUT -i wlan0 -p tcp -m tcp --dport 9091 -j ACCEPT
#for SMB/CIFS
-A INPUT -i wlan0 -p udp -m udp --dport 137 -j ACCEPT
-A INPUT -i wlan0 -p udp -m udp --dport 138 -j ACCEPT
#deny hacker scan
-A INPUT -p tcp --tcp-flags ALL NONE -j DROP
-A FORWARD -p tcp --tcp-flags ALL NONE -j DROP
-A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
-A FORWARD -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
-A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
-A FORWARD -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
-A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
-A FORWARD -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
-A INPUT -p tcp --tcp-flags ACK,FIN FIN -j DROP
-A FORWARD -p tcp --tcp-flags ACK,FIN FIN -j DROP
-A INPUT -p tcp --tcp-flags ACK,URG URG -j DROP
-A FORWARD -p tcp --tcp-flags ACK,URG URG -j DROP
# icmp allow list
-A INPUT -p icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp --icmp-type 3/4 -j ACCEPT
-A INPUT -p icmp --icmp-type 4 -j ACCEPT
-A INPUT -p icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp --icmp-type 12 -j ACCEPT
-A INPUT -p icmp --icmp-type 14 -j ACCEPT
-A INPUT -p icmp --icmp-type 16 -j ACCEPT
-A INPUT -p icmp --icmp-type 18 -j ACCEPT
COMMIT
     7.2.2 /etc/network/interfaces
        - modify dsl-provider section.
           auto dsl-provider
           iface dsl-provider inet ppp
           pre-up iptables-restore < /etc/firewall-rules
           provider dsl-provider

8. install transmission daemon & do basic setting.

BTW, I upgrade the kernel to 3.4.0 (from PPA) & upgrade the tiwlan-wl12xx-dkms, tiwlan-wl12xx-firmware to help wl1271 more stable.

Done...

星期一, 10月 15, 2012

Upgrade lucid to precise

1. boot.scr mmc init 2;fatload mmc 2 80200000 uImage;bootm 0x80200000 setenv bootargs console=ttyO2,115200n8 mem=512M@0x80000000 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait mpurate=${mpurate} ethaddr=${ethaddr} omapdss.def_disp=dvi omapfb.mode=dvi:800x600MR-16@60 vram=4M --no-log ps: --no-log is workaround for "init: Failed to create pty - disabling logging for job"

2. apt sources.list modify /etc/apt/sources.list, replace lucid to precise

3. do dist-upgrade apt-get dist-upgrade -o APT::Immediate-Configure=false during dist-upgrade, some configuration file will be changed

4. mkdir lib/modules dir mkdir -p /lib/modules/2.6.37-gb0042ce touch /lib/modules/2.6.37-gb0042ce/modules.dep

5. remove old udev net rules rm /etc/udev/rules.d/70-persistent-net.rules

6. do backup tar cvpf gogobox-ubuntu-precise-20121015.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/mnt --exclude=/sys /

星期五, 6月 24, 2011

OMAPDSS:How to enable DVI display

How to enable DVI display
DVI display can be enabled in two ways
1. Using bootargs
Eg: omapdss.def_disp="dvi" omapfb.mode=dvi:720x480@60
2. Using SYSFS attributes
echo 0 > /sys/devices/platform/omapdss/display0/enabled
echo "" > /sys/devices/platform/omapdss/manager0/display
fbset -fb /dev/fb0 -xres 720 -yres 480
echo "dvi" > /sys/devices/platform/omapdss/manager0/display
echo 1 > /sys/devices/platform/omapdss/display2/enabled
kill
Restart without enabling rotation: matrix_gui -qws /usr/share/matrix/html/menu_main.html

ref: http://processors.wiki.ti.com/index.php/AM37x_EVM_Software_Developer%27s_Guide

星期四, 6月 16, 2011

Bash - rename your file name

for i in *.rmvb; do mv $i `echo $i | cut -d '.' -f 2,3,4,5,6`; done

ex: 远古外星人.Ancient.Aliens.S02E10.HDTV-RMVB.rmvb to Ancient.Aliens.S02E10.HDTV-RMVB.rmvb

星期日, 3月 27, 2011

Ubuntu Backup/Restore

reference from: http://ubuntuforums.org/showthread.php?t=81311

1. Gen the Tar file:
tar cvpf sendai-backup.tar --exclude=/proc --exclude=/lost+found --exclude=/sendai-backup.tar --exclude=/mnt --exclude=/sys /

2. Restore the tar to target
tar xvpf sendai-backup.tar -C /

3. mkdir the exclude dir
mkdir proc
mkdir lost+found
mkdir mnt
mkdir sys

星期三, 7月 16, 2008

apt-get got gpgv error on debian-mipsel

1. get ntpdate
2. ntpdate time.stdtime.gov.tw
3. run `apt-get update` should be fine.

星期二, 7月 08, 2008

Debian on mipsel projects (1)

Debian commands memo:

1. debootstrap
2. debfrost
3. deborphan
4. apt-utils
5. aptitude
6. dpkg-reconfigure
7. update-rc.d
8. rcconf (like: ntsysv)
9. localpurge

Debian from scrath:
1. dfsbuild

Myth TV:

星期四, 8月 11, 2005

Xcursor in Xorg 6.8.2

the Xcursor on support transparent.
To modify the cursor source, the location is xorg_src/xc/programs/xcursorgen/xxx

星期三, 7月 27, 2005

Grub on /dev/hdc

/sbin/grub --batch --device-map=/dev/null <<"EOF"
device (hd0) /dev/hda
device (hd1) /dev/hdc
root (hd1,0)
setup (hd1)
quit
"EOF"

grub.conf
---
timeout 2
default 0
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
# For booting GNU/Linux
title JT Linux
kernel /boot/vmlinuz root=/dev/ram0 video=vesafb:ywrap,mtrr,1024x768-24@60 quiet splash=silent,theme:emergence ramdisk_size=32768 CONSOLE=/dev/tty1 vga=792
root (hd0,0)
initrd /boot/jt-ramdisk.gz
---

星期六, 7月 09, 2005

Gentoo ati drm driver in X.org 6.8.2

configuration step:

genkernel --udev --menuconfig all
  • Device Drivers - Character devices)
    • add Real Time Clock Support
    • /dev/agpgart (AGP support)
      • Intel
      • SiS chipset support
      • VIA chipset suport
  • modify /etc/modules.autoload.d/kernel-2.6
    • rtc
    • agpgart
    • sis-agp
    • fglrx
wait for compiling finished...
  • ATI-Drivers
    • emerge ati-drivers
    • emerge ati-drivers-extra (contains testing apps.)
    • opengl-update ati
  • X.org setting
    • fglrxconfig
      • do not chose AGPGART support, becasue of already built-in in kernel
      • modify BuisID to fit your VGA card in /etc/X11/xorg.conf
done....