目前分類:linux (89)

瀏覽方式: 標題列表 簡短摘要
最近買了幾個小容量的隨身碟, 為的就是要作一些開機隨身碟,
但買了還沒用到, 之前只做了
在 4GB 隨身碟安裝 Fuduntu Linux
不過這是把linux 系統安裝在隨身碟, 不是把livecd弄進隨身碟 , 而且只能在linux下弄,
安裝過程有點麻煩又花時間,

所以直接把LIVECD弄進隨身碟應該比較簡單
後來找到這個 unetbootin 這個軟體, 可以把livecd弄進隨身碟 ,
詳細請參考
http://briian.com/?p=7214


ps1.
如果隨身碟很大, 想要放很多個livecd ,
可以用
YUMI – Multiboot USB Creator (Windows)


ps2.
如果要作出可以保存檔案的隨身碟, 也就是你修改的檔案或是安裝套件後,下次用這支隨身碟開機後
你的東西還是會留著,那就要用
Universal USB Installer
做出來之後, 裡面有個casper-rw 的檔案就是你保留的filesystem ,
你可以mount -o loop 來修改裡面的檔案
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

無腦安裝法

$ sudo add-apt-repository ppa:vincent-c/nevernote
$ sudo apt-get update
$ sudo apt-get install nixnote

文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

最近買了 TP-Link WR740N , 但是hw version不是之前的 2.x 了

進 dd-wrt router database 有寫 4.0 support , 但是沒有官方下載點 ,要去 other download才有
http://www.dd-wrt.com/site/support/router-database


進了other downloads ,找了 Downloads › others › eko › BrainSlayer-V24-preSP2 › 2012 › 07-20-12-r19519 › tplink_tl-wr740nv4 這個版號
抓了下面2個檔,
http://dd-wrt.com/dd-wrtv2/downloads/others/eko/BrainSlayer-V24-preSP2/2012/07-20-12-r19519/tplink_tl-wr740nv4/factory-to-ddwrt.bin
http://dd-wrt.com/dd-wrtv2/downloads/others/eko/BrainSlayer-V24-preSP2/2012/07-20-12-r19519/tplink_tl-wr740nv4/tl-wr740nv4-webflash.bin

方法很簡單,先用web upgrade factory 那個檔, 重開後再用web upgrade另一個
打完收工
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

http://www.squashfs-lzma.org/
--> squashfs4.2


http://tukaani.org/xz/
--> http://tukaani.org/xz/xz-5.0.4.tar.bz2


./mksquashfs ../filesystem/rootfs squashfs.img -comp xz -noappend -all-root
--> 9396224 2012-11-05 11:01 squashfs.img


./mksquashfs ../filesystem/rootfs squashfs.img -comp xz -noappend -all-root -b 262144

block size 用 262144 , 壓出來的image更小一點
--> 9179136 2012-11-05 11:04 squashfs.img


@How to mount
mount -o loop /squashfs.img /media/net


@kernel config
CONFIG_SQUASHFS_XZ --> 要開

文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

linux 好像都是用 CONFIG_MTD_M25P80 這個 module 去驅動大部份的 spi flash

在 mach-omap2/board-am335xevm.c 裡面我加了下面的宣告

static const struct flash_platform_data am335x_spi_flash = {
.type = "mx25l25635e",
.name = "spi_flash",
.parts = am335x_spi_partitions,
.nr_parts = ARRAY_SIZE(am335x_spi_partitions),
};

static struct spi_board_info am335x_spi0_slave_info[] = {
{
.modalias = "m25p80",
.platform_data = &am335x_spi_flash,
.irq = -1,
.max_speed_hz = 24000000,
.bus_num = 1,
.chip_select = 0,
.mode = SPI_MODE_3,
},
};

在 drivers/mtd/devices/m25p80.c 已經有大部份的spi flash id
/* Macronix */
{ "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) },
{ "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) },
{ "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) },
{ "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) },
{ "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) },
{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },


開機可以看到 這些partition 跑出來
[ 8.159545] Creating 10 MTD partitions on "spi_flash":
[ 8.165008] 0x000000000000-0x000000020000 : "SPL"
[ 8.171875] 0x000000020000-0x000000050000 : "U-Boot"
[ 8.178833] 0x000000050000-0x000000060000 : "U-Boot Env"
[ 8.186187] 0x000000060000-0x000000080000 : "Def-config"
[ 8.193572] 0x000000080000-0x0000000a0000 : "Cur-config"
[ 8.200775] 0x0000000a0000-0x000000100000 : "User-data"
[ 8.207916] 0x000000100000-0x000000480000 : "KernelA"
[ 8.214874] 0x000000480000-0x000000800000 : "KernelB"
[ 8.221862] 0x000000800000-0x000001400000 : "rootfsA"
[ 8.228912] 0x000001400000-0x000002000000 : "rootfsB"
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

1.
debootstrap --verbose --foreign --arch armel wheezy armel_rootfs http://ftp.tw.debian.org/debian

## 補充網樂通的指令
sudo debootstrap --arch=sh4 --foreign --include aptitude,vim,openssh-server,gcc,python lenny /opt/rootfs/ http://www.si-linux.co.jp/pub/debian-sh/lenny-sh4/
##

順便插一下花, 貼一下debian 版本的代號,之前都一直搞不懂這些英文單字代表什麼意思

Debian 8 Jessie
Debian 7.0 wheezy
Debian 6.0 squeeze
Debian GNU/Linux 5.0 (lenny) — 被淘汰的穩定版
Debian GNU/Linux 4.0 (etch) — 被淘汰的穩定版
Debian GNU/Linux 3.1 (sarge) — 被淘汰的穩定版
Debian GNU/Linux 3.0 (woody) — 被淘汰的穩定版
Debian GNU/Linux 2.2 (potato) — 被淘汰的穩定版
Debian GNU/Linux 2.1 (slink) — 被淘汰的穩定版
Debian GNU/Linux 2.0 (hamm) — 被淘汰的穩定版


2.
修改 fstab
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
sysfs /sys sysfs defaults 0 0

--> chroot 之後, mount -a

3.
/debootstrap/debootstrap --second-stage


4.
echo "deb http://ftp.tw.debian.org/debian unstable main non-free contrib" > /etc/apt/sources.list

## 網樂通的 sourcelist
deb http://www.si-linux.co.jp/pub/debian-sh/lenny-sh4/ lenny main contrib non-free
deb-src http://ftp.debian.org/debian/ lenny main contrib non-free

echo LANG="C" >> /etc/environment

5.
apt-get update


ps.
遇到無法 執行 second-stage 的問題, 要把 LD_LIBRARY_PATH 改成 /lib/arm-linux-gnueabi

LD_LIBRARY_PATH contains the traditional /lib directory,
but not the multiarch directory /lib/arm-linux-gnueabi.
It is not safe to upgrade the C library in this situation;
please remove the /lib/directory from LD_LIBRARY_PATH and
try again.
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

之前我的fon 一代掛了, 只要設定完, 機器就會掛點, 想說沒救了

前題:
最近剛好看到 tp-link 740n v2 可以刷 gargoyle
請參考 http://www.mobile01.com/topicdetail.php?f=110&t=2226398&p=1
我是從 ddwrt 要刷成 gargoyle
照 aven138 大的方法直刷,
# cd /tmp
# wget http://www.gargoyle-router.com/downloads/images/ar71xx/gargoyle_1.3.15-ar71xx-tl-wr741nd-v1-squashfs-sysupgrade.bin
# mv gargoyle_1.3.15-ar71xx-tl-wr741nd-v1-squashfs-sysupgrade.bin tplink.bin
# mtd -r write /tmp/tplink.bin linux

而且gargoyle的介面還滿容易上手的, 之前 ddwrt 有點複雜, 而且 wireless client mode 我都設定不成功
沒想到 gargoyle 設計的很讚, 一下子就能設定client + AP 成功!!!


正題:
後來看到 gargoyle 也能支援我的fon , 馬上眼睛亮了起來
就去下載, 在 atheros 231x/5312 這個分類, 而且用它的 fonflash 工具 ,超方便的啦....
gargoyle_1.5.7-atheros-root.squashfs
gargoyle_1.5.7-atheros-vmlinux.lzma
一下子就刷成功了


後記:
1.5.7 + fon 設定成 wireless client + AP , 跑起來很慢, 不過至少我的fon 又復活了
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

弄了一整天,終於可以動了
我灌在 wl-500gp v1 這台 router 上 ,
這台有2個usb port , 插上16G usb disk , 當作安裝軟體的路徑


asterisk 主要是根據下面這篇,
http://www.osslab.com.tw/VoIP/IP_PBX/%E7%A1%AC%E9%AB%94%E5%BC%8F_IP_PBX/Embeeded/%E5%AE%B6%E7%94%A8_IP_PBX-ASUS_WL-500GU_%E6%94%B9%E8%A3%9D%E7%AF%87

但其中有2個地方需要變動
1. install optware
請依照這篇安裝, 需要花個1~2小時安裝
http://www.dd-wrt.com/wiki/index.php/Optware%2C_the_Right_Way

2. 最後的 sip_custom.conf
帳號裡的 context 都要改成 local , 因為 extensions_custom.conf 裡面根本沒有 internal 這個 section ,
local 裡面才有 echo test

[1000]
type=friend
context=internal
context=local
callerid="Softphone" <1000>
qualify=yes
secret=1111
nat=yes
canreinvite=no
dtmfmode=rfc2833
host=dynamic
call-limit=2
disallow=all
allow=alaw

[1001]
type=friend
context=internal
context=local
callerid="Home" <1001>
qualify=yes
secret=1111
nat=yes
canreinvite=no
dtmfmode=rfc2833
host=dynamic
call-limit=2
disallow=all
allow=alaw

搞定收工
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

最近買了 raspberry pi 這個熱門的小pc
但是在 hdmi to vga 這裡吃了好大的苦頭
找了好久才找到適合我的 dell lcd 的設定
分享一下

hdmi_drive=2
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=16
hdmi_force_hotplug=1
disable_overscan=0

但是這個設定又不適合我公司的 acer 的螢幕(快昏了)
公司的卻要改成下面的設定
hdmi_drive=2
config_hdmi_boost=4
hdmi_group=1
hdmi_mode=16
hdmi_force_hotplug=1
disable_overscan=0
overscan_left=200

有了螢幕就好辨事了, 接下來的設定請參考
http://yehnan.blogspot.tw/2012/06/raspberry-pi_10.html


有彩蛋?!!
http://blog.linz.im/2012/rpi-sys.html
/opt/vc/src/hello_pi/ 這個目錄有很多demo code

截圖秀一下
sudo apt-get install imagemagick
sleep 5; import -window root screen.png

把你的raspberrypi 桌面截圖丟到FB吧




文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

已經可以開啟 telnetd & ftpd
但是為什麼memory 只有120MB ?
uboot 傳進去kernel 只有120MB , 其它的要給誰用咧?


root@(none):~# free
total used free shared buffers
Mem: 100272 41592 58680 0 2520
Swap: 0 0 0
Total: 100272 41592 58680
root@(none):~# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/sda2 298872 273604 19100 93% /
/dev/sda3 6192512 638348 5428308 11% /mnt/usb
/dev/sda4 887188 17312 851852 2% /mnt/user
root@(none):~# cat /proc/cmdline
console=ttyAS0,115200 root=8:2 rootfstype=ext3 rw rootflags=data=journal nwhwconf=device:eth0,hwaddr:24:cf:21:b0:28:64 phyaddr:0,watchdog:5000 mem=120M bigphysarea=2048


想改機的可以參考
http://iamhahar.blogspot.tw/2012/08/blog-post.html


補上 kernel & uboot source code
http://code.google.com/p/nexttv-mod/downloads/list
http://www.ids93216.com/nexttv-mod/


20121002 update:
已經將 lighttpd 放進去 run 了

我把網樂通 toolchain 放上來 ,大家就不用重新安裝了那個 stlinux 的套件了
只要把下面的檔案解到 /opt

http://sync.hamicloud.net/_oops/jchuang1977/rkb

toolchain path:
opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-gcc

文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

這個人放了很多資料在他的log

http://www.makelinux.com/

進去resource ,會有很多online book 可以看

jchuang1977 發表在 痞客邦 留言(0) 人氣()


http://lxr.linux.no/

jchuang1977 發表在 痞客邦 留言(0) 人氣()

最近被 MLO SPL 這二個名詞搞混
ROM loads x-load (MLO)
Second Program Loader (SPL)

原來這2個指的是同一個東西, 都是 second boot loader ,
first boot loader 通常指的是cpu 裡的boot rom , 讀入 MLO/SPI image 之後, 再讀取 third boot loader (最後的bootloader )

MLO/SPI 主要的功能是 Configures external RAM
特性是 Small enough to fit in internal RAM

其實一般CPU通常不需MLO ,都是做進CPU boot rom了,
我常看到會用MLO的就是TI 的CPU了

下面有更詳細的解說
http://beagle.s3.amazonaws.com/esc/Uboot-esc-chicago-2010.pdf

jchuang1977 發表在 痞客邦 留言(1) 人氣()

偶然看到 nat loopback
http://juan.tw/?p=1367

iptables -t mangle -A PREROUTING -i ! `get_wanface` -d `nvram get wan_ipaddr` -j MARK –set-mark 0xd001
發現iptables 的指令也可以配合script command ?!!!
要回公司試試看

jchuang1977 發表在 痞客邦 留言(0) 人氣()

最近要研究 session , 只好看一下這個檔

tcp 6 10796 ESTABLISHED src=192.168.0.101 dst=24.154.182.234 sport=59234 dport=54321 packets=250 bytes=13200 src=24.154.182.234 dst=106.65.134.174 sport=54321 dport=59234 packets=373 bytes=362288 [ASSURED] mark=0 use=2
--> 這個session 是由 192.168.0.101 主動的, 之後的incoming traffic 也會用這條session , 所以不會有另一條session 是 src=24.154.182.234 進來的
--> 主要 要parser這個自動出去的封包,

tcp 6 41 TIME_WAIT src=86.33.116.119 dst=27.240.80.58 sport=49403 dport=21123 packets=7 bytes=960 src=192.168.0.101 dst=86.33.116.119 sport=21123 dport=49403 packets=5 bytes=596 [ASSURED] mark=8738 use=2
--> 這個是外面主動進來的, 如果是查BT, 應該很少這種session , 都是內部主動出去的


ddwrt timeout secs
tcp
/proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established
3600

udp
/proc/sys/net/ipv4/netfilter/ip_conntrack_udp_timeout_stream
120

連線數
計算 /proc/net/ip_conntrack 的 ASSURED 數目

NAT sessions
/proc/sys/net/ipv4/netfilter/ip_conntrack_max

文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

免費版的應該就是只有 splint


這裡有介紹一堆常用的寫程式工具,不只是寫程式,還有類似SVN , text editor , IDE 的免費工具
值得一看
http://www.thefreecountry.com/programming/index.shtml


文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

原文請參考這裡

由於原文都是介紹用 console command 
我只是把putty設定截圖放上來,有些port 用不一樣的,請自行處理


這個可以設定成 localhost:3128 為 browser proxy
PuTTY Configuration_031


這個可以設成 反向tunnel , 使用 ssh localhost -p 2222  就可以連回公司

PuTTY Configuration_032


至於bbs 我就沒設定了,因為 ptt 原本就有支援 ssh
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

轉載自下面的blog
http://sean70653.pixnet.net/blog/post/30522188-%E5%9C%A8-ubuntu-11.10-%E6%9E%B6%E8%A8%AD-samba-server-%E5%8F%8Awindows-7%E4%B8%8A%E7%9A%84%E8%A8%AD
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

轉載自 http://dominic16y.world.edoors.com/CF3spsw0h-Ns

ubuntu vnc client
可以灌 gtkvncviewer ,


接下來是要介紹 x11vnc server 指令應用的部份

安裝指令
sudo apt-get install x11vnc vnc4-common

設定密碼
(請先檢查你的家目錄底下有沒有 .vnc 資料夾,若沒有建個給它)

vncpasswd ~/.vnc/passwd

接著請輸入兩次密碼


啟動 vnc server
啟動方式由所帶的參數不同而有不同的效果

x11vnc -forever -passwd ******
多次登入,設暫時性密碼

x11vnc -rfbport 1234 -rfbauth ~/.vnc/passwd
指定port位為 1234,讀取密碼檔,記得在防火牆上打洞給1234用


參數說明
-forever 表示服務一直開啟,就是說可以多次連接/退出,不加此參數的話登錄一次後server自動關閉
-passwd 用來設置登錄密碼,請將******自行替換為密碼
執行後屏幕會顯示5900端口已經被打開,此時就可以從其他地方遠程登錄了
-rfbport 指定 port 位
-rfbauth ~/.vnc/passwd 指定密碼檔
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()

只是留個記錄,因為有些套件的source code 很難找啊...

20120402
logger 的 souce code 是 util-linux 套件  http://packages.debian.org/squeeze/util-linux
libintl 是在 gettext 裡 
文章標籤

jchuang1977 發表在 痞客邦 留言(0) 人氣()