2013年11月17日 星期日

[Git] Permission denied (publickey). fatal: The remote end hung up unexpectedly

今天突然想要抓github上某個專案的某個分支, 語法是這樣
$ git clone -b <branch> <remote_repo>

基本上有兩個作法, 一個是走不需要認證的http, 語法大概是這樣
$ git clone -b my-branch https://git@github.com/username/myproject.git

一個是走ssh, 但需要有public key認證, 語法大概是這樣
$ git clone -b my-branch git@github.com:user/myproject.git

結果ssh的出現了這樣的錯誤
Permission denied (publickey). fatal: The remote end hung up unexpectedly

爬文發現這真是newbie問題阿, github的help就有寫了, 步驟如下
1. 產生ssh keys
$ ssh-keygen -t rsa -C "your_email@example.com"

$ ssh-add id_rsa

2. 將public key提交給github 到Account Settings的"SSH Keys"中, 將public key的內容貼到key欄位

 3. 測試
$ ssh -T git@github.com

如果出現這樣的訊息表示OK啦
Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.

reference:
* Git: clone a specific branch [duplicate]
* Generating SSH Keys

2013年11月9日 星期六

[Linux] Ubuntu 10.04在x220下找不到ethernet

因為Ubuntu 12.04用不習慣, 只好裝回10.04, 但杯具馬上發生, 安裝完後竟然找不到ethernet
dmesg|grep -in eth
沒有網路也沒辦法下載套件,source等, 什麼都沒辦法做, 還好有估到一篇

解決步驟 1. 查詢裝置類型
$ lspci -nn|grep -in eth
5:00:19.0 Ethernet controller [0200]: Intel Corporation Device [8086:1502] (rev 04)
2. 根據vendor id + device id搜尋, 8086是Intel Corporation, 1502是Intel 82579LM Gigabit Network Card

3. 去intel網站下載適合的驅動程式 先搜尋"82579", 再作業系統欄位選擇"Linux", 會得到e1000e-2.5.4.tar.gz

4. 最後就編譯安裝, 重新啟動網路, 搞定, 看到ifconfig有eth0真是太感動了
$ cd e1000e-2.5.4/src$ make
make -C /lib/modules/2.6.32-38-generic/build SUBDIRS=/home/sosorry/driver/e1000e-2.5.4/src modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-38-generic'
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/netdev.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/ethtool.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/param.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/82571.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/ich8lan.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/80003es2lan.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/mac.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/nvm.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/phy.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/manage.o
  CC [M]  /home/sosorry/driver/e1000e-2.5.4/src/kcompat.o
  LD [M]  /home/sosorry/driver/e1000e-2.5.4/src/e1000e.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/sosorry/driver/e1000e-2.5.4/src/e1000e.mod.o
  LD [M]  /home/sosorry/driver/e1000e-2.5.4/src/e1000e.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-38-generic'
$ sudo make install
make -C /lib/modules/2.6.32-38-generic/build SUBDIRS=/home/sosorry/driver/e1000e-2.5.4/src modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-38-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-38-generic'
gzip -c ../e1000e.7 > e1000e.7.gz
# remove all old versions of the driver
find /lib/modules/2.6.32-38-generic -name e1000e.ko -exec rm -f {} \; || true
find /lib/modules/2.6.32-38-generic -name e1000e.ko.gz -exec rm -f {} \; || true
install -D -m 644 e1000e.ko /lib/modules/2.6.32-38-generic/kernel/drivers/net/e1000e/e1000e.ko
/sbin/depmod -a || true
install -D -m 644 e1000e.7.gz /usr/share/man/man7/e1000e.7.gz
man -c -P'cat > /dev/null' e1000e || true
e1000e.
$ sudo /etc/init.d/networking restart


reference: Fix for non-working wired ethernet on Dell Latitude E6520 with Intel 82579 based adapter running Ubuntu 10.04 LTS Lucid

2013年11月3日 星期日

[RPi] vcgencmd commands

vcgencmd是firmware#362371才多出來的新功能, 可以配合參數看一些資訊 首先列出可以用的參數
/opt/vc/bin/vcgencmd commands
commands="vcos, ap_output_control, ap_output_post_processing, vchi_test_init, vchi_test_exit, pm_set_policy, pm_get_status, pm_show_stats, pm_start_logging, pm_stop_logging, version, commands, set_vll_dir, led_control, set_backlight, set_logging, get_lcd_info, set_bus_arbiter_mode, cache_flush, otp_dump, codec_enabled, get_camera, get_mem, measure_clock, measure_volts, measure_temp, get_config, hdmi_ntsc_freqs, hdmi_status_show, pwm_speedup, render_bar, disk_notify, inuse_notify, sus_suspend, sus_status, sus_is_enabled, sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom, mem_reloc_stats, file, vctest_memmap, vctest_start, vctest_stop, vctest_set, vctest_get"
舉例來說, 想看目前安裝的firmware是哪一個版本
/opt/vc/bin/vcgencmd version
Sep  1 2013 23:27:46 
Copyright (c) 2012 Broadcom
version 4f9d19896166f46a3255801bc1834561bf092732 (clean) (release)
比如說想看目前BCM2835這顆SoC上的溫度
/opt/vc/bin/vcgencmd measure_temp
temp=47.1'C
比如說查看目前可以使用的codec
for codec in H264 MPG2 WVC1 MPG4 MJPG WMV9 ; do \
     echo -e "$codec:\t$(vcgencmd codec_enabled $codec)" ; \
done
H264: H264=enabled
MPG2: MPG2=disabled
WVC1: WVC1=disabled
MPG4: MPG4=enabled
MJPG: MJPG=enabled
WMV9: WMV9=disabled
還有很多可以用的參數, 詳見github

reference:
* RPI vcgencmd usage
* VideoCore Tools