pi config

 

目錄


dphys-swapfile

 

dphys-swapfile setup|install|swapon|swapoff|uninstall

/etc/dphys-swapfile

CONF_SWAPFILE=/var/swap
CONF_SWAPSIZE=100

/etc/init.d/dphys-swapfile

 


Raspbian repository

 

deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi

 


Console 下的設定 (raspi-config)

 

查看設定:

vcgencmd get_config <config>

Example:

vcgencmd get_config init_uart_baud

init_uart_baud=0

 


系統設定

 

/boot/config.txt:

由於 Raspberry 沒有 BIOS, 所以它的類似設定放在 config.txt 內

Doc: https://elinux.org/RPiconfig

 * This is read by the GPU before the ARM CPU and Linux are initialised.

# Min 16MB, Default 64MB
gpu_mem=16

/etc/default/rcS:

/tmp 已經是 RAM Disk 來 ^^

RAMTMP=yes

 


Kernel 設定

 

Doc: https://elinux.org/RPi_cmdline.txt

/boot/cmdline.txt

# 用一行來

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1
root=PARTUUID=6c8279a5-02 rootfstype=ext4 rootwait  elevator=deadline fsck.repair=yes
net.ifnames=0 ip=192.168.88.240::192.168.88.1:255.255.255.0:rpi:eth0:off

rootwait

Tell the kernel to wait for the system partition to be accessible before starting the OS

net.ifnames

0: eth0, eth1 ...

 

 


Set Static IP address on boot

 

The /cmdline.txt thing is a real hack and the /etc/network/interfaces file is really the right way to do it

[方案1]

/cmdline.txt

# ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
ip=192.168.88.231::192.168.88.1:255.255.255.0:rpi:eth0:off

/etc/network/interfaces

iface eth0 inet manual

Notes

server-ip

The IP address of the NFS server. If this entry is blank, the address of the server which answered the BOOTP

[方案2]

/etc/network/interfaces

iface eth0 inet static
address 192.168.88.211
netmask 255.255.255.0
network 192.168.88.0
broadcast 192.168.1.255
gateway 192.168.88.1

Set Static IP address but also getting Dynamic

OS: Raspbian GNU/Linux 8

ifconfig 見唔到有兩粒 IP, 但 "ip addr" 見到

It is caused by the new dhcp client ignoring what the interfaces files does and doing its own thing in addition

解決方法

update-rc.d dhcpcd remove

OR

/etc/dhcpcd.conf

# Don't start DHCP or listen to DHCP messages.
nodhcp

 


Display Settings

 

/boot/config.txt

overscan:

可以擴充或者縮小屏幕的設置

# disable the default values of overscan that is set by the firmware.

disable_overscan=1

# 可以入正負數

# Increase this value if the text flows off the left edge of the screen;

# number of pixels to add to the firmware default value of overscan on the left edge of the screen
overscan_left=
overscan_right=
overscan_top=
overscan_bottom=

TV:

sdtv_mode=0              # 0: Normal NTSC, 2: Normal PAL ....
sdtv_aspect=1            # 1: 4:3, 3: 16:9

HDMI:

# uses "safe mode" settings to try to boot with maximum HDMI compatibility.

hdmi_safe=1

# 相當於:

hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=4
# overscan settings
disable_overscan=0
overscan_left=24
overscan_right=24
overscan_top=24
overscan_bottom=24

hdmi_force_hotplug=1        # 強制使用HDMI輸出 (not detected)

hdmi_drive=1                     # 1: Normal DVI mode (No sound);
                                         # 2: Normal HDMI mode (Sound will be sent if supported and enabled)

hdmi_group=0                   # Default 0. 此設定與 "hdmi_mode" 一起使用

  • 0   # Preferred group reported by the edid
  • 1   # CEA 格式, 用 480p, 480i 之類的命名
  • 2   # DMT (Display Monitor Timing) 格式, 用解象度命名, 比如 1024x768

hdmi_mode

ie. 代表800x600@60Hz

hdmi_group=2           
hdmi_mode=9

DMT(hdmi_group=2) 時的 hdmi_mode

hdmi_mode=4    640x480   60Hz (HDMI_DMT_VGA_60)    # 4:3
...
hdmi_mode=9    800x600   60Hz (HDMI_DMT_SVGA_60)   # 4:3
...
hdmi_mode=16   1024x768  60Hz (HDMI_DMT_XGA_60)    # 4:3
...
hdmi_mode=85   1280x720  60Hz                      # 16:9 [720p]

config_hdmi_boost

# HDMI 信號增強, 在 long HDMI cables 時用到.

# 0 ~ 11 (max)
config_hdmi_boost=0

hdmi_force_edid_audio

1 pretends that all audio formats are supported by the display,

allowing passthrough of DTS/AC3 even when this is not reported as supported.

tvservice

查看支援什麼設定:

  • /opt/vc/bin/tvservice -m CEA
  • /opt/vc/bin/tvservice -m DMT

現在的設定:

  • /opt/vc/bin/tvservice -s
state: HPD high|DVI mode|HDCP off|composite off (0x120016), 640x480 @ 60Hz, progressive

edid 資料:

/opt/vc/bin/tvservice -d edid.dat

/opt/vc/bin/edidparser edid.dat

hdmi_ignore_edid: 強行按hdmi_group和hdmi_mode規定的分辨率輸出。不檢測顯示器自身的分辨率。

disable_overscan: 強行禁止保留黑邊功能.

 


Software

 

NetSurf

Web Browser

lightweight (16MB of RAM)

omxplayer

支持 Pi 的 GPU 的播放器

i.e.

omxplayer -o hdmi video.file

-/+      音量
上       后退 600
下       前进 600
s        顯示字幕
q        退出

 


中文支援

 

安裝字型:

apt-get install ttf-wqy-zenhei

http://wenq.org/

安裝輸入法:

apt-get install ibus-table-quick-classic

 


Codecs(Hardware decoding)

 

當有 License code 後, 把它們寫到 config.txt 即可使用到 Codec 的硬解

# 此 License code 是根據 CPU serial number 而產生的

i.e.

decode_MPG2=0x12345678
decode_WVC1=0x12345678

 


GPIO

 

The GPIO pins connect directly into the core of the ARM processer, and are static-sensitive

pinout

14 15 16   ....  26
1   2  3   ....  13

3.3V Serial Port

16 GND
17 TX
18 RX

Default baud rate: 115200

由設定 init_uart_baud 控制

Python Code

import RPi.GPIO as GPIO
import uinput
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)

def main():
    events = (
        uinput.KEY_ESC,
             )

    device = uinput.Device(events)

    device.emit(uinput.KEY_ESC, 1) # Press.
    device.emit(uinput.KEY_ESC, 0) # Release.
   
while 1:
   if GPIO.input(17)==True:
      main()

 


Overclocking

 

/boot/config.txt

arm_freq     frequency of ARM in MHz. Default 700.
sdram_freq   frequency of SDRAM in MHz. Default 400.
gpu_freq     (相當於同時設定 core_freq, h264_freq, isp_freq, v3d_freq )
 core_freq      frequency of GPU processor core in MHz.
 h264_freq      frequency of hardware video block in MHz.
 isp_freq       frequency of image sensor pipeline block in MHz.
 v3d_freq       frequency of 3D block in MHz. Default 250.

# When busy, ARM frequency go up to "arm_freq" and down to "arm_freq_min" on idle.

# All frequencies and voltages stay high.

force_turbo=1

 


over_voltage

 

over_voltage                # Default 0 (1.2V)

ARM/GPU core voltage adjust. [-16,8] equates to [0.8V,1.4V] with 0.025V steps.

over_voltage_sdram

(over_voltage_sdram_c, over_voltage_sdram_i, over_voltage_sdram_p together )

 


參考

 

PLL 是 Phase Locking Loop 的縮寫

Simple Raspberry Pi qemu emulation in Windows for beginners

  •  http://sourceforge.net/projects/rpiqemuwindows/

Other

 

 

Creative Commons license icon Creative Commons license icon