Skip to content

Instantly share code, notes, and snippets.

@alexniver
Last active December 24, 2015 18:45
Show Gist options
  • Select an option

  • Save alexniver/b6f4dcdf6d0e556460f5 to your computer and use it in GitHub Desktop.

Select an option

Save alexniver/b6f4dcdf6d0e556460f5 to your computer and use it in GitHub Desktop.

#1.下载镜像并安装

https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

安装之后, 启动, 默认不会使用全部的sd卡空间, 使用fdisk和resize2fs把剩余空间也使用进来

df -h
sudo fdisk /dev/mmcblk0
p
d
2
n
p
2
#enter
#enter
w
sudo reboot
sudo resize2fs /dev/mmcblk0p2

#2.设置静态ip(方便日后ssh)

vim /etc/network/interfaces

原内容有如下4行:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

修改为类似下面的:

auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp

iface eth0 inet static
address 192.168.2.129
netmask 255.255.255.0
gateway 192.168.2.2

修改DNS

注意, 这里像网上说的, 修改/etc/resolv.conf, 只是一时好用, 重启便会有问题. 正确的姿势是

sudo vi /etc/resolvconf/resolv.conf.d/base 

添加

nameserver 192.168.2.1

重启.

#3. 修改源: 树莓派的源不能用正常的ubuntu的源, 会有问题, 国内比较好的

deb http://mirrors.ustc.edu.cn/raspbian/raspbian/   wheezy main contrib non-free rpi

##4. 安装ssh

sudo apt-get install ssh

##5. cross compile

http://airwiki.ws.dei.polimi.it/index.php/Cross-compiling_for_the_RaspberryPi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment