树莓派的正确吃法之串口

最近大球被人问树莓派3b的串口通信,想着正好试试刚画的直插版USB转TTL,就开始调

结果自己折腾了半天,发现RX,TX短接有信号,没法给arduino下程序,郁闷。。。问了问群里面大神,结果发现好像USB转TTL电容少写了个0(应该是0.01uf)

今天把电容换了之后,就可以下程序了(终于可以用了,感人)

—————————————分割线——————————————–

首先是远程ssh树莓派,新版树莓派系统SSH默认是不开的,需要插到电脑上在boot分区里面加个叫“SSH”的文件,然后插上板子上电就行

—————————————分割线——————————————–

在树莓派上面插上输了半天,居然发现没啥反应,搜了下,发现。。

新版树莓派3B的系统不开串口的!!(╯’ – ‘)╯︵ ┻━┻

据说是和蓝牙冲突了??↓↓↓

然后GPIO映射的串口是默认的/dev/ttyS0这个mini串口

—————————————分割线——————————————–

根据上面的提示,打开

sudo raspi-config

Interfacing Options==>Serial

会问你是否打开串口登陆,也就是我们常用的串口登陆

好不容易,终于打开了串口调试(心累)

重新进sudo raspi-config,关掉串口登陆,打开串口

重启

—————————————分割线——————————————–

接下来就是修改映射serial0到ttyAMA0

sudo nano /boot/config.txt

在最后一行加

dtoverlay=pi3-miniuart-bt

重启

搞定,终于可以用了

然后就可以安装minicom了

sudo apt-get install minicom

配置好了就可以用了

实例1:arduino下的是AnalogInOutSerial这个例程

实例2:左边窗口树莓派,右边窗口是usb转ttl

香蕉派的正确吃法之GPIO驱动点灯

分享一个简单控制GPIO的方法,如图

图看不清可以右键》在新标签中打开

用/sys/class/gpio 可以访问 GPIO ,,具体如下:
用 PA 这个字母 A (或者 B, C, …)算出组号 (就是 0 – A, 1 – B, 2 – C, etc),乘以 32,然后加上后面的数字,就是 Linux 内核的 GPIO 编号。然后把这个编号 (假设为 233 (233 就是 PH9))输出到到/sys/class/gpio/export,然后就会出现一个 /sys/class/gpio/gpio233 目录,里面 direction 文件可以设置方向 in/out ,value 可以设置/读取值 0/1

比如BPI-M2Zero需要给 PA8 输出1,用来点灯
具体做法是
1、首先计算此引脚编号。

引脚编号 = 控制引脚的寄存器基数 + 控制引脚寄存器位数
例如:想用PA8号脚,就是0X32+8=8

2、向 /sys/class/gpio/export 写入此编号,比如12号引脚,在 shell 中可以通过以下命令实现:

echo 8 > /sys/class/gpio/export

命令完成后会生成一个 /sys/class/gpio/gpio8 的目录,如果没有这个目录,说明这个引脚不能导出。

3、direction文件定义输入还是输出,可以通过下面命令定义为输出。
echo out > /sys/class/gpio/gpio8/direction
direction 能用的参数是:in、out、high、low。其中 high / low 在设置方向为输出的同时,将 value 设置为相应的 1 / 0。
4、value 文件是端口的数值,为1或0,通过下面命令将 gpio8 设置为底电平。
echo 0 > /sys/class/gpio/gpio8/value

另:python下如果想用bash可以用os.system(‘xxxx’)来调用,例:
import os
os.system(‘echo 8 > /sys/class/gpio/export’)
os.system(‘echo out > /sys/class/gpio/gpio8/direction’)
os.system(‘echo 0 > /sys/class/gpio/gpio8/value’)

Discuz搬迁需要修改的文件

1、进入config/config_global.php,修改下面的项目

 

2、进入config/config_ucenter.php,修改下面的项目

 

3、进入uc_server/data/config.inc.php,修改下面的项目

 

修改完毕后,进入论坛,迁移便完成啦!

PostgreSQL一些常用命令

最近一直在学习Postgresql,下面是自己整理的Postgresql的常用命令

连接数据库, 默认的用户和数据库是postgres
psql -U user -d dbname

切换数据库,相当于mysql的use dbname
\c dbname
列举数据库,相当于mysql的show databases
\l
列举表,相当于mysql的show tables
\dt
查看表结构,相当于desc tblname,show columns from tbname
\d tblname

\di 查看索引

创建数据库:
create database [数据库名];
删除数据库:
drop database [数据库名];
*重命名一个表:
alter table [表名A] rename to [表名B];
*删除一个表:
drop table [表名];

*在已有的表里添加字段:
alter table [表名] add column [字段名] [类型];
*删除表中的字段:
alter table [表名] drop column [字段名];
*重命名一个字段:
alter table [表名] rename column [字段名A] to [字段名B];
*给一个字段设置缺省值:
alter table [表名] alter column [字段名] set default [新的默认值];
*去除缺省值:
alter table [表名] alter column [字段名] drop default;
在表中插入数据:
insert into 表名 ([字段名m],[字段名n],……) values ([列m的值],[列n的值],……);
修改表中的某行某列的数据:
update [表名] set [目标字段名]=[目标值] where [该行特征];
删除表中某行数据:
delete from [表名] where [该行特征];
delete from [表名];–删空整个表
创建表:
create table ([字段名1] [类型1] ;,[字段名2] [类型2],……<,primary key (字段名m,字段名n,…)>;);

\copyright 显示 PostgreSQL 的使用和发行条款
\encoding [字元编码名称]
显示或设定用户端字元编码
\h [名称] SQL 命令语法上的说明,用 * 显示全部命令
\prompt [文本] 名称
提示用户设定内部变数
\password [USERNAME]
securely change the password for a user
\q 退出 psql

可以使用pg_dump和pg_dumpall来完成。比如备份sales数据库:
pg_dump drupal>/opt/Postgresql/backup/1.bak

附带一些指定给postgresql用户的常用命令:

默认用户
postgres安装完成后,会自动在操作系统和postgres数据库中分别创建一个名为postgres的用户以及一个同样名为postgres的数据库。

登录
方式1:指定参数登录
psql -U username -d database_name -h host -W
1
1
1
参数含义: -U指定用户 -d要连接的数据库 -h要连接的主机 -W提示输入密码。

方式2:切换到postgres同名用户后登录
su username
psql

当不指定参数时psql使用操作系统当前用户的用户名作为postgres的登录用户名和要连接的数据库名。所以在PostgreSQL安装完成后可以通过以上方式登录。

创建用户
方式1:在系统命令行中使用createuser命令中创建
createuser username

方式2:在PostgresSQL命令行中使用CREATE ROLE指令创建
CREATE ROLE rolename;

式3:在PostgresSQL命令行中使用CREATE USER指令创建
CREATE USER username;

CREATE USER和CREATE ROLE的区别在于,CREATE USER指令创建的用户默认是有登录权限的,而CREATE ROLE没有。

\du 指令显示用户和用户的用户属性
创建用户时设定用户属性
基本语法格式
CREATE ROLE role_name WITH optional_permissions;

示例:在创建用户时设定登录权限。
CREATE ROLE username WITH LOGIN;

可以通过\h CREATE ROLE指令查看全部可设置的管理权限
修改用户属性
修改权限的命令格式
ALTER ROLE username WITH attribute_options;

例如:可通过以下方式禁止用户登录
ALTER ROLE username WITH NOLOGIN;

设置访问权限
语法格式如下:
GRANT permission_type ON table_name TO role_name;

实例:
GRANT UPDATE ON demo TO demo_role; –赋予demo_role demo表的update权限
GRANT SELECT ON ALL TABLES IN SCHEMA PUBLIC to demo_role; –赋予demo_role所有表的SELECT权限

特殊符号:ALL代表所访问权限,PUBLIC代表所有用户
GRANT ALL ON demo TO demo_role; –赋给用户所有权限
GRANT SELECT ON demo TO PUBLIC; –将SELECT权限赋给所有用户

\z或\dp指令显示用户访问权限。
\h GRANT显示所有可设置的访问权限
撤销用户访问权限
语法格式如下:
REVOKE permission_type ON table_name FROM user_name;

其中permission_type和table_name含义与GRANT指令中相同。

用户组
在postgres中用户实际上是role,同时组也是role。 包含其他role的role就是组。

创建组示例:
CREATE ROLE temporary_users;
GRANT temporary_users TO demo_role;
GRANT temporary_users TO test_user;

切换ROLE
SET ROLE role_name; –切换到role_name用户
RESET ROLE; –切换回最初的role

INHERIT权限:该属性使组成员拥有组的所有权限
ALTER ROLE test_user INHERIT;

删除用户和组
删除用户和组很简单:

DROP ROLE role_name;
DROP ROLE IF EXISTS role_name;

删除组role只会删除组的role本身,组的成员并不会被删除

树莓派启动解析(转)

Uncompressing Linux… done, booting thekernel. //成功解压linux系统,并开启它的内核
[ 0.000000] Booting Linux on physical CPU 0x0 //在CPU上开启linux,是操作系统控制CPU
[ 0.000000] Initializing cgroup subsys cpuset //初始化cgroup
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.1.18+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3(crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #846 Thu Feb 25 14:11:56 GMT2016
//上面显示了linux内核版本,gcc版本,以及当前版本的发布日期

[ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7),cr=00c5387d
//上一条显示了CPU型号,可以看出树莓派使用了ARM

[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasinginstruction cache
[ 0.000000] Machine model: Raspberry Pi Model B Rev 2 //板子的型号
[ 0.000000] cma: Reserved 8 MiB at 0x17400000
[ 0.000000] Memory policy: Data cache writeback //采用的内存cache写机制为writeback

[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 97440
[ 0.000000] Kernel command line: dma.dmachans=0x7f35bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xfbcm2708.serial=0x153640f1 smsc95xx.macaddr=B8:27:EB:36:40:F1bcm2708_fb.fbswap=1 bcm2708.uart_clock=3000000 vc_mem.mem_base=0x1ec00000vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait //内核输入参数

//下面是各种缓存hash值
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 371876K/393216K available (5792K kernel code, 488Krwdata, 1788K rodata, 352K init, 720K bss, 13148K reserved, 8192K cma-reserved)//总内存大小和使用情况,从这里看出树莓派的内存并不大,只有370M多

[ 0.000000] Virtual kernel memory layout: //虚拟内存的布局
[ 0.000000] vector : 0xffff0000 – 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 – 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xd8800000- 0xff000000 ( 616 MB)
[ 0.000000] lowmem : 0xc0000000 – 0xd8000000 ( 384 MB)
[ 0.000000] modules : 0xbf000000- 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000- 0xc076f1f0 (7581 kB)
[ 0.000000] .init : 0xc0770000- 0xc07c8000 ( 352 kB)
[ 0.000000] .data : 0xc07c8000- 0xc0842260 ( 489 kB)
[ 0.000000] .bss : 0xc0842260- 0xc08f63e0 ( 721 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:522
[ 0.000000] clocksource stc: mask: 0xffffffff max_cycles: 0xffffffff,max_idle_ns: 1911260446275 ns
[ 0.000015] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wrapsevery 2147483647500ns //定时器信息
[ 0.000056] Switching to timer-based delay loop, resolution 1000ns
[ 0.000341] Console: colour dummy device 80×30
[ 0.001270] console [tty1] enabled //使能终端设备tty1
[ 0.001328] Calibrating delay loop (skipped), value calculated using timerfrequency.. 2.00 BogoMIPS (lpj=10000) //校正回环延时
[ 0.001413] pid_max: default: 32768 minimum: 301
[ 0.001786] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.001858] Mountpoint-cache hash table entries: 1024 (order: 0, 4096bytes)
[ 0.002905] Initializing cgroup subsys blkio //初始化cgroup
[ 0.002999] Initializing cgroup subsys memory
[ 0.003066] Initializing cgroup subsys devices
[ 0.003129] Initializing cgroup subsys freezer
[ 0.003190] Initializing cgroup subsys net_cls
[ 0.003310] CPU: Testing write buffer coherency: ok
[ 0.003430] ftrace: allocating 19747 entries in 58 pages
[ 0.107836] Setting up static identity map for 0x81c0 – 0x81f8
[ 0.110013] devtmpfs: initialized
[ 0.120832] VFP support v0.3: implementor 41 architecture 1 part 20variant b rev 5
[ 0.121284] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff,max_idle_ns: 19112604462750000 ns
[ 0.123276] pinctrl core: initialized pinctrl subsystem
[ 0.124170] NET: Registered protocol family 16 //网络校准
[ 0.129632] DMA: preallocated 4096 KiB pool for atomic coherentallocations
[ 0.131127] bcm2708.uart_clock = 3000000
[ 0.136001] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[ 0.136081] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.136288] Serial: AMBA PL011 UART driver //使用的串口驱动
[ 0.136589] 20201000.uart: ttyAMA0 at MMIO 0x20201000 (irq = 83, base_baud= 0) is a PL011 rev2
[ 0.504515] console [ttyAMA0] enabled //使能串口ttyAMA0
[ 0.508911] bcm2835-mbox 2000b880.mailbox: mailbox enabled //使能邮箱
[ 0.554869] bcm2708-dmaengine 20007000.dma: DMA legacy API manager atf2007000, dmachans=0xf35
[ 0.563600] bcm2708-dmaengine 20007000.dma: Initialized 7 DMA channels (+1 legacy)
[ 0.572162] bcm2708-dmaengine 20007000.dma: Load BCM2835 DMA engine driver
[ 0.579092] bcm2708-dmaengine 20007000.dma: dma_debug:0
[ 0.585243] SCSI subsystem initialized //初始化系统接口
[ 0.589401] usbcore: registered new interface driver usbfs
[ 0.595122] usbcore: registered new interface driver hub
[ 0.600656] usbcore: registered new device driver usb
[ 0.606686] raspberrypi-firmware soc:firmware: Attached to firmware from2016-02-25 14:31
[ 0.642371] Switched to clocksource stc
[ 0.695500] FS-Cache: Loaded
[ 0.698798] CacheFiles: Loaded

//下面显示的是TCP/IP信息
[ 0.717541] NET: Registered protocol family 2
[ 0.723470] TCP established hash table entries: 4096 (order: 2, 16384bytes)
[ 0.730661] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.737291] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.743929] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.749825] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.756511] NET: Registered protocol family 1

[ 0.761478] RPC: Registered named UNIX socket transport module.
[ 0.767532] RPC: Registered udp transport module.
[ 0.772266] RPC: Registered tcp transport module.
[ 0.777032] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.784749] hw perfevents: enabled with armv6_1176 PMU driver, 3 countersavailable
[ 0.793884] futex hash table entries: 256 (order: -1, 3072 bytes)

//虚拟文件系统有关信息
[ 0.816313] VFS: Disk quotas dquot_6.6.0
[ 0.820696] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096bytes)
[ 0.830375] FS-Cache: Netfs ‘nfs’ registered for caching
[ 0.837143] NFS: Registering the id_resolver key type
[ 0.842322] Key type id_resolver registered
[ 0.846658] Key type id_legacy registered
[ 0.854494] Block layer SCSI generic (bsg) driver version 0.4 loaded(major 252)
[ 0.862473] io scheduler noop registered
[ 0.866474] io scheduler deadline registered (default)
[ 0.872047] io scheduler cfq registered
[ 0.878477] BCM2708FB: allocated DMA memory 57800000
[ 0.883646] BCM2708FB: allocated DMA channel 0 @ f2007000
[ 0.894186] Console: switching to colour frame buffer device 82×26
[ 0.905430] Serial: 8250/16550 driver, 0 ports, IRQ sharing disabled
[ 0.915179] vc-cma: Videocore CMA driver
[ 0.920860] vc-cma: vc_cma_base = 0x00000000
[ 0.927309] vc-cma: vc_cma_size = 0x00000000 (0 MiB)
[ 0.934378]vc-cma: vc_cma_initial = 0x00000000 (0MiB)
[ 0.941677] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000mem_size:0x20000000(512 MiB)
[ 0.972179] brd: module loaded
[ 0.986062] loop: module loaded
[ 0.991863] vchiq: vchiq_init_state: slot_zero = 0xd7880000, is_master = 0
[ 1.002486] Loading iSCSI transport class v2.0-870.
[ 1.010552] usbcore: registered new interface driver smsc95xx
[ 1.018207] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 1.225875] Core Release: 2.80a
[ 1.230567] Setting default values for core params //设置内核参数的默认值
[ 1.236937] Finished setting default values for core params
[ 1.444371] Using Buffer DMA mode //使用缓冲DMA模式
[ 1.449265] Periodic Transfer Interrupt Enhancement – disabled
[ 1.456709] Multiprocessor Interrupt Enhancement – disabled
[ 1.463935] OTG VER PARAM: 0, OTG VER FLAG: 0
[ 1.469915] Dedicated Tx FIFOs mode
[ 1.475501] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt =0xd7814000 dma = 0x57814000 len=9024
[ 1.488646] FIQ FSM acceleration enabled for :
[ 1.488646] Non-periodic Split Transactions
[ 1.488646] Periodic Split Transactions
[ 1.488646] High-Speed Isochronous Endpoints
[ 1.511989] WARN::hcd_init_fiq:412: FIQ on core 0 at 0xc03dd6ac
[ 1.519570] WARN::hcd_init_fiq:413: FIQ ASM at 0xc03dd988 length 36
[ 1.527478] WARN::hcd_init_fiq:438: MPHI regs_base at 0xd8896000
[ 1.535197] dwc_otg 20980000.usb: DWC OTG Controller
[ 1.541817] dwc_otg 20980000.usb: new USB bus registered, assigned busnumber 1
[ 1.550854] dwc_otg 20980000.usb: irq 32, io mem 0x00000000
[ 1.558101] Init: Port Power? op_state=1
[ 1.563626] Init: Power Port (0)

//USB配置
[ 1.568714] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.577170]usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.586032] usb usb1: Product: DWC OTG Controller
[ 1.592305] usb usb1: Manufacturer: Linux 4.1.18+ dwc_otg_hcd
[ 1.599648] usb usb1: SerialNumber: 20980000.usb
[ 1.606886] hub 1-0:1.0: USB hub found //未找到USB扩展槽
[ 1.612310] hub 1-0:1.0: 1 port detected
[ 1.619043] usbcore: registered new interface driver usb-storage
[ 1.627142] mousedev: PS/2 mouse device common for all mice //检测鼠标设备
[ 1.635371] bcm2835-cpufreq: min=700000 max=700000
[ 1.642104] sdhci: Secure Digital Host Controller Interface driver
[ 1.649923] sdhci: Copyright(c) Pierre Ossman
[ 1.656279] sdhost: log_buf @ d7813000 (57813000)
[ 1.742444] mmc0: sdhost-bcm2835 loaded – DMA enabled (>1)
[ 1.750098] sdhci-pltfm: SDHCI platform and OF driver helper
[ 1.778321] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.786285] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.793672] usbcore: registered new interface driver usbhid
[ 1.800841] usbhid: USB HID core driver
[ 1.810806] Initializing XFRM netlink socket
[ 1.816970] Indeed it is in host mode hprt0 = 00021501
[ 1.884272] NET: Registered protocol family 17
[ 1.890739] Key type dns_resolver registered
[ 1.904607] registered taskstats version 1
[ 1.910758] vc-sm: Videocore shared memory driver
[ 1.917373] [vc_sm_connected_init]: start
[ 1.924493] [vc_sm_connected_init]: end – returning 0
[ 1.933640] Waiting for root device /dev/mmcblk0p2…
[ 1.950032] mmc0: host does not supportreading read-only switch, assuming write-enable
[ 1.963252] mmc0: new high speed SDHC card at address b368
[ 1.971221] mmcblk0: mmc0:b368 SDC 7.51 GiB
[ 1.979403] mmcblk0: p1 p2
[ 2.045919] EXT4-fs (mmcblk0p2): INFO: recovery required on readonlyfilesystem
[ 2.055107] EXT4-fs (mmcblk0p2): write access will be enabled duringrecovery
[ 2.064011] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.072304] Indeed it is in host mode hprt0 = 00001101
[ 2.272929] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 2.281447] usb 1-1: New USB device strings: Mfr=0, Product=0,SerialNumber=0
[ 2.293574] hub 1-1:1.0: USB hub found
[ 2.299629] hub 1-1:1.0: 3 ports detected
[ 2.582439] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 2.702859] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 2.711539] usb 1-1.1: New USB device strings: Mfr=0, Product=0,SerialNumber=0
[ 2.723755] smsc95xx v1.0.4
[ 2.786975] smsc95xx 1-1.1:1.0 eth0: register ‘smsc95xx’ atusb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:36:40:f1

//文件系统
[ 7.346049] EXT4-fs (mmcblk0p2): orphan cleanup on readonly fs
[ 7.354501] EXT4-fs (mmcblk0p2): 1 orphan inode deleted
[ 7.361597] EXT4-fs (mmcblk0p2): recovery complete
[ 8.869364] EXT4-fs (mmcblk0p2): mounted filesystem with ordered datamode. Opts: (null)
[ 8.881111] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 8.891282] devtmpfs: mounted
[ 8.897259] Freeing unused kernel memory: 352K (c0770000 – c07c8000)
[ 9.236671] random: systemd urandom read with 73 bits of entropy available
[ 9.252265] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT+SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[ 9.270090] systemd[1]: Detected architecture ‘arm’.
[ 9.406174] NET: Registered protocol family 10
[ 9.414751] systemd[1]: Inserted module ‘ipv6’ //支持ipv6
[ 9.426332] systemd[1]: Set hostname to . //设计主机名,此处已经被我修改过
[ 9.634011] uart-pl011 20201000.uart: no DMA platform data

[ 10.258133] systemd[1]: Starting Forward Password Requests to WallDirectory Watch.
[ 10.270389] systemd[1]: Started Forward Password Requests to WallDirectory Watch.
[ 10.282087] systemd[1]: Expecting device dev-ttyAMA0.device…
[ 10.293248] systemd[1]: Starting Remote File Systems (Pre).
[ 10.303622] systemd[1]: Reached target Remote File Systems (Pre).
[ 10.312114] systemd[1]: Starting Arbitrary Executable File Formats FileSystem Automount Point.
[ 10.328272] systemd[1]: Set up automount Arbitrary Executable FileFormats File System Automount Point.
[ 10.342079] systemd[1]: Starting Encrypted Volumes.
[ 10.351909] systemd[1]: Reached target Encrypted Volumes.
[ 10.359658] systemd[1]: Starting Swap.
[ 10.368294] systemd[1]: Reached target Swap.
[ 10.374898] systemd[1]: Expecting device dev-mmcblk0p1.device…
[ 10.385682] systemd[1]: Starting Root Slice.
[ 10.394786] systemd[1]: Created slice Root Slice.
[ 10.401561] systemd[1]: Starting User and Session Slice.
[ 10.411810] systemd[1]: Created slice User and Session Slice.
[ 10.419709] systemd[1]: Starting Delayed Shutdown Socket.
[ 10.429852] systemd[1]: Listening on Delayed Shutdown Socket.
[ 10.437687] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[ 10.449126] systemd[1]: Listening on /dev/initctl Compatibility NamedPipe.
[ 10.458152] systemd[1]: Starting Journal Socket (/dev/log).
[ 10.468458] systemd[1]: Listening on JournalSocket (/dev/log).
[ 10.476524] systemd[1]: Starting udev Control Socket.
[ 10.486376] systemd[1]: Listening on udev Control Socket.
[ 10.493947] systemd[1]: Starting udev Kernel Socket.
[ 10.503531] systemd[1]: Listening on udev Kernel Socket.
[ 10.510903] systemd[1]: Starting Journal Socket.
[ 10.520322] systemd[1]: Listening on Journal Socket.
[ 10.527576] systemd[1]: Starting System Slice.
[ 10.536809] systemd[1]: Created slice System Slice.
[ 10.543946] systemd[1]: Starting File System Check on Root Device…
[ 10.559510] systemd[1]: Starting system-systemd\x2dfsck.slice.
[ 10.580880] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[ 10.595477] systemd[1]: Starting system-autologin.slice.
[ 10.610844] systemd[1]: Created slice system-autologin.slice.
[ 10.620166] systemd[1]: Starting system-serial\x2dgetty.slice.
[ 10.634719] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ 10.643791] systemd[1]: Starting Increase datagram queue length…
[ 10.661224] systemd[1]: Starting Restore / save the current clock…
[ 10.699533] systemd[1]: Starting udev Coldplug all Devices…
[ 10.783765] systemd[1]: Starting Load Kernel Modules… //开始载入内核模块
[ 10.841213] systemd[1]: Mounting Debug File System…
[ 10.911837] systemd[1]: Starting Create list of required static devicenodes for the current kernel…
[ 10.980384] fuse init (API version 7.23)
[ 11.049606] i2c /dev entries driver
[ 11.111757] systemd[1]: Mounted Huge Pages File System.
[ 11.198073] systemd[1]: Started Set Up Additional Binary Formats.
[ 11.224599] systemd[1]: Mounting POSIX Message Queue File System…
[ 11.249546] systemd[1]: Starting Slices.
[ 11.272729] systemd[1]: Reached target Slices.
[ 11.302720] systemd[1]: Mounted POSIX Message Queue File System.
[ 11.314864] systemd[1]: Mounted Debug File System.
[ 11.328551] systemd[1]: Started File System Check on Root Device.
[ 11.356927] systemd[1]: Started Increase datagram queue length.
[ 11.370056] systemd[1]: Started Restore / save the current clock.
[ 11.402777] systemd[1]: Started Load Kernel Modules.
[ 11.426206] systemd[1]: Started Create list of required static devicenodes for the current kernel.
[ 11.460288] systemd[1]: Time has been changed
[ 11.580311] systemd[1]: Started udev Coldplug all Devices.
[ 11.803989] systemd[1]: Starting Create Static Device Nodes in /dev…
[ 11.821373] systemd[1]: Starting Apply Kernel Variables…
[ 11.855747] systemd[1]: Mounting Configuration File System…
[ 11.916927] systemd[1]: Mounting FUSE Control File System…

Raspbian GNU/Linux 8 kamisama ttyAMA0

kamisama login: //开始要求输入账户和密码进行登录

//随后我输入账号和密码即提示登录成功,登录后显示如下信息:
kamisamalogin: pi
Password:
Lastlogin: Wed Mar 9 22:17:19 CST 2016 ontty1 //上次的登录时间以及登录设备
Linuxkamisama 4.1.18+ #846 Thu Feb 25 14:11:56 GMT 2016 armv6l //系统版本发布时间

//系统简介
Theprograms included with the Debian GNU/Linux system are free software;
the exactdistribution terms for each program are described in the
individualfiles in /usr/share/doc/*/copyright.

//法律声明
DebianGNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permittedby applicable law.

摘自http://blog.csdn.net/xuanzhuanecy/article/details/51488775

windows下安装python3并配置安装pip

1,安装
据说TensorFlow在Windows上只支持64位Python3.5,在python官网下载,根据球猫推荐,之前安装的是2.7.13版本,不知道有没有影响,就卸载了,我在官网下载的是3.6.1。
2、环境配置
Windows的power shell里面不能直接输入pip所以需要配置环境变量,我的安装目录是在D:\Python36,在系统变量里,变量名“Path”下面添加python的安装目录

接下来是安装pip,在powershell下进入到D盘
D:
cd Python36\Scripts
然后运行命令
.\easy_install.exe pip

安装好了之后就可以用pip命令了

TensorFlow学习笔记——Windows安装TensorFlow

电脑配置:
OS:Window 10 64bit
CPU:Intel i5-4200H
内存:8G
显卡:Nvidia GeForce GTX 950M

一、安装python
1,安装
据说TensorFlow在Windows上只支持64位Python3.5,在python官网下载,根据球猫推荐,之前安装的是2.7.13版本,不知道有没有影响,就卸载了,纠结了半天,发现安装的是3.6.1,又重新安装了3.5.3。

2、环境配置
Windows的power shell里面不能直接输入pip所以需要配置环境变量,我的安装目录是在D:\Python36,在系统变量里,变量名“Path”下面添加python的安装目录

接下来是安装pip,在powershell下进入到D盘
D:
cd Python36\Scripts
然后运行命令
.\easy_install.exe pip

安装好了之后就可以用pip命令了

二、安装CUDA和cuDNN(如果安装CPU版本可以跳过这个步骤)
TensorFlow分为CPU版和GPU版,如果你打算安装GPU版,请先安装如下两个驱动:

1、CUDA安装:https://developer.nvidia.com/cuda-downloads

2、CuDNN安装:https://developer.nvidia.com/cudnn(要注册Nvidia用户,并加入CuDNN开发组,填若干问卷就可以下载了)选择下载版本时要注意和Cuda版本匹配。解压后覆盖至CUDA的安装目录下
例如我的安装目录是:D:\TensorFlow\Program Files\NVDIA GPU Computing Toolkit\CUDA\v8.0
三、修改pip为国内源
在C:\Users\用户名\AppData\Local\pip下面新建文件pip.ini
粘贴以下内容到文件里面
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
关于修改源的问题可以看http://www.cnblogs.com/microman/p/6107879.html
四、安装CPU版TensorFlow 0.12,Power Shell下输入:
pip install –upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
安装GPU版TensorFlow 0.12,Power Shell下输入:
pip install –upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl

现在安装基本完成了,打开python

输入测试代码

>>>import tensorflow as tf
>>>sess = tf.Session()
>>>a = tf.constant(10)
>>>b = tf.constant(22)
>>>print(sess.run(a + b))
32