2014年9月26日 星期五

Ubuntu恢復Hibernate功能

1. 用指令進入休眠sudo pm-hibernate
2. 恢復休眠選單
    sudo vi /etc/polkit-1/localauthority/50-local.d/
    com.ubuntu.enable-hibernate.pkla


    [Enable Hibernate]
    Identity=unix-user:*

    Action=org.freedesktop.upower.hibernate
    ResultActive=yes

2014年9月25日 星期四

Ubuntu開機自動執行程式

sudo ln -s /opt/program_xxx /etc/init.d/program_xxx
sudo update-rc.d -f program_xxx defaults
or
sudo update-rc.d -f program_xxx defaults 99 1

2014年9月24日 星期三

將Intel Galileo當成WiFi AP使用

1. Galileo已經有包含WiFi driver
    看meta-clanton/meta-clanton-distro/recipes-kernel/linx-firmware/linux-firmware_git.bbappend

2. 在meta-clanton/meta-clanton-distro/recipes-core/images/image-full.bb
    增加hostap-daemon(AP mode)及dhcp-server(DHCP Server)支援

3. 增加iptable
    使用bitbake linux-yocto-clanton -c menuconfig
    選擇
    Networking support --->
         Networking options --->
              Network packet filtering framework (Netfilter) --->
                   Core Netfilter Configuration ---> *
                   IP: Netfilter Configuration ---> *

4. 修改/etc/network/interfaces
    # Wireless interface
    auto wlan0
    iface wlan0 inet static
    address 192.168.1.254

    netmask 255.255.255.0

5. 修改/etc/dhcp/dhcp.conf
    subnet 192,168.1.0 netmask 255.255.255.0{
    range 192.168.1.21 192.168.1.100;

    option routers 192.168.1.254;
    option broadcast-address 192.168.1.255;

    option domain-name-servers 8.8.8.8;
    }

6. 修改/etc/default/dhcp-server
    INTERFACE="wlan0"

7. 修改/etc/hostapd.conf
    interface=wlan0

8. 執行/etc/init.d/networking restart

9. 設定routing
    可先執行iptables -t nat -L看是否可正確執行
    iptables --flush
    iptables --table nat --flush
    iptables --delete-chain
    iptables --table nat --delete-chain
    iptables --table nat --append POSTROUTING --out-interface eth0
    -j MASQUERADE

    iptables --append FORWARD --in-interface wlan0 -j ACCEPT
    echo 1 > /proc/sys/net/ipv4/ip_forward
 

10. 執行/etc/init.d/dhcp-server restart

11. 執行hostapd -d /etc/hostapd.conf &

P.S.
如遇到SSID沒有出現的問題,要確認一下是否wlan0已連至其他AP Router

P.S.
遇到iptables: can't initialize iptables table `nat': Table does not exist
(do you need to insmod?)
問題
iptables: can't initialize iptables table `filter': Table does not exist
(do you need to insmod?)
問題

這是因為CONFIG_NF_NAT或是CONFIG_NF_NAT_IPV4並未添加
IP: Netfilter ConfigurationCore Netfilter Configuration設定不對

Intel Galieo整合WiFi

使用Intel Centrino WiFi
Driver,iwlwifi-*.ucode可於Intel網站下載

1. 將iwlwifi-*.ucode拷貝到Galileo下的/lib/firmware/iwlwifi-*.ucode
2. 執行modprobe iwlwifi
3. 修改/etc/network/interfaces
    # Wireless interface
    auto wlan0
    iface wlan0 inet dhcp

4. 執行/etc/init.d/networking restart

如要連結至AP,可修改/etc/wpa_supplicant.conf
network={
                ssid="SSID"
                scan_ssid=1
                key_mgmt=WPA-PSK
                psk="PASSWORD"
}

2014年9月17日 星期三

Buidl Intel Galileo OS

1. 從Intel網站上下載
    Board_Support_Package_Sources_for_Intel_Quark_v1.0.1.7.7z
2. 解壓縮此檔案至~/Quark
3. 解壓縮grub-legacy...tar.gz、
    meta-clanton...tar.gz、
    Quark_EDKII...tar.gz、quark_linux...tar.gz、
    spi-flash-tools...tar.gz、sysimage...tar.gz


4. 執行./sysimage.../create_symlink.sh
5. 安裝git、gcc、g++、c++、texinfo等Ubuntu包
6. 到meta-clanton目錄
7. 執行setup.sh
8. 執行source poky/oe-init-build-env yocto_build
9. 執行bitbake image-full-galileo
10. Image在meta-clanton/yocto_build/tmp/deploy/images/

P.S.
出現找不到x264_git相關包
更改meta-clanton/meta-oe/meta-oe/recipes-multimedia/x264/x264_git.bb
---SRCREV="1cff........................................................................."
+++#SRCREV="1cff...................................................................."
+++SRCREV="ea0ca51e94323318b95bd8b27b7f9438cdcf4d9e"

P.S.
出現找不到opencv_2.4相關包
更改meta-clanton/meta-oe/meta-oe/recipes-support/opencv/opencv_2.4.3.bb
meta-clanton/meta-oe/meta-oe/recipes-support/opencv/opencv-samples_2.4.3.bb
---SRC_URI = "${SOURCEFORGE_MIRROR}/opencvlibrary/opencv-unix/${PV}/OpenCV-${PV}.tar.bz2
+++#SRC_URI = "${SOURCEFORGE_MIRROR}/opencvlibrary/opencv-unix/${PV}/OpenCV-${PV}.tar.bz2
+++SRC_URI = "ftp://ftp.netbsd.org/pub/pkgsrc/distfiles/OpenCV-${PV}.tar.bz2 \
---SRC_URI = "${SOURCEFORGE_MIRROR}/opencvlibrary/opencv-unix/${PV}/OpenCV-${PV}.tar.bz2
+++#SRC_URI = "${SOURCEFORGE_MIRROR}/opencvlibrary/opencv-unix/${PV}/OpenCV-${PV}.tar.bz2
+++SRC_URI = "ftp://ftp.netbsd.org/pub/pkgsrc/distfiles/OpenCV-${PV}.tar.bz2 \

P.S.
要重建image先
bitbake -c cleanall image-full-galileo
bitbake -c clean image-full-galileo
要重建clanton先
bitbake -c cleanall linux-yocto-clanton

P.S.
menuconfig
bitbake linux-yocto-clanton -c menuconfig

P.S.
Kernel位於meta-clanton/yocto_build/tmp/sysrppts/clanton/usr/src/kernel

P.S.
Build Quark_EDKII產生openssl錯誤
參考Quark_EDKII/CryptoPkg/Library/OppensslLib/Patch-HOWTO.txt

P.S.
載入module
參考/etc/modules-load.quark/galileo.conf

P.S.
自動啟動程式
可修改/etc/profile

參考網址
http://kei-sakaki.jp/2014/04/22/intel-quark-bsp-for-intel-galileo-development-board/
https://www.yoctoproject.org/documentation