实验器材
硬件
- 树莓派板子一块;
- 5V/1A电源一个;
- microUSB线一根;
- USB-TTL串口线一根(FT232RL芯片或PL2303芯片)。
- PC(Windows/MacOS/Linux)一台;
- 以太网线一根;
- 路由器一台
软件
- PC上的USB-TTL串口线配套的驱动程序;
- PC上的串口终端软件putty等;
- PC上的SSH软件putty等;
- sftp传输软件FileZilla;
- 交叉编译软件;
- samba、samba-common-bin软件。
实验步骤
1、给出拷贝得到的pcDuino启动时的输出文字,并逐行解释
Uncompressing Linux... done, bootingthe kernel.
[ 0.000000] Booting Linux on physical CPU 0
[ 0.000000] Initializing cgroup subsys cpu
//在加载CPU指令集后初始化CPU
[ 0.000000] Linux version 3.6.11+ ([email protected]) (gcc version 4.7.220120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08)) #474 PREEMPT Thu Jun 13 17:14:42 BST 2013
[ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7),cr=00c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasinginstruction cache
[ 0.000000] Machine: BCM2708 //打印系统信息 其中CPU是ARM
BCM 2708
[ 0.000000] cma: CMA: reserved 16 MiB at 1b000000
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
//关闭ECC,使用缓存写回的内存管理方法
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 113792
[ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656bcm2708_fb.fbheight=416 bcm2708.boardrev=0xf bcm2708.serial=0x9b7044aesmsc95xx.macaddr=B8:27:EB:70:44:AE sdhci-bcm2708.emmc_clock_freq=100000000vc_mem.mem_base=0x1ec00000
vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4elevator=deadline rootwait
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
//pid哈希表的条目数与入口
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144bytes)
//目录dentry的哈希表条目入口
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)//文件iNode哈希表条目数与入口
[ 0.000000] Memory: 448MB = 448MB total
//总内存大小
[ 0.000000] Memory: 432264k/432264k available, 26488k reserved, 0K highmem//空闲内存432264K,
26488K为保存内存空间
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4kB)
//vector地址空间
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
//fixmap地址空间
[ 0.000000] vmalloc : 0xdc800000- 0xff000000 ( 552 MB)
//虚拟连续内存空间
[ 0.000000] lowmem : 0xc0000000 - 0xdc000000 ( 448 MB)
//低内存区域空间
[ 0.000000] modules : 0xbf000000- 0xc0000000 ( 16 MB)
//系统模块区域空间
[ 0.000000] .text : 0xc0008000- 0xc04e647c (4986 kB)
[ 0.000000] .init : 0xc04e7000- 0xc0507f24 ( 132 kB)
[ 0.000000] .data : 0xc0508000- 0xc053c080 ( 209 kB)
[ 0.000000] .bss : 0xc053c0a4- 0xc05e4758 ( 674 kB)
[ 0.000000] NR_IRQS:330 //nr终端请求
[ 0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wrapsevery 4294967ms
//系统时钟的基本信息
[ 0.000000] Console: colour dummy device 80x30 //虚拟设备信息
[ 0.000000] console [tty1] enabled //虚拟ttf打开
[ 0.001031] Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)
//统计CPU计算性能
[ 0.060127] pid_max: default: 32768 minimum: 301
//pid的默认值(最大与最小)
[ 0.060462] Mount-cache hash table entries: 512
//挂载缓存入口
[ 0.061222] Initializing cgroup subsys cpuacct
//初始化CPU资源报告
[ 0.061277] Initializing cgroup subsys devices
//初始化系统设备
[ 0.061311] Initializing cgroup subsys freezer
//初始化中断的任务
[ 0.061339] Initializing cgroup subsys blkio
//初始化输入输出设备
[ 0.061431] CPU: Testing write buffer coherency: ok
//测试CPU写缓存通过
[ 0.061763] hw perfevents: enabled with v6 PMU driver, 3 countersavailable
//系统性能优化工具已打开,采用v6
PMU驱动
[ 0.061905] Setting up static identity map for 0x39d698 - 0x39d6f4
[ 0.063402] devtmpfs: initialized //设备临时文件系统初始化完
[ 0.074063] NET: Registered protocol family 16 //网络协议注册成功
[ 0.080547] DMA: preallocated 4096 KiB pool for atomic coherentallocations
[ 0.081650] bcm2708.uart_clock = 0 //初始化CPU异步时钟为0
[ 0.083044] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
//找到六个断点一个监视点
[ 0.083098] hw-breakpoint: maximum watchpoint size is 4 bytes. //监视点可监视最大内存大小为4bytes
[ 0.083135] mailbox: Broadcom VideoCore Mailbox driver
//Broadcom公司的GPU驱动
[ 0.083228] bcm2708_vcio: mailbox at f200b880
//驱动地址
[ 0.083328] bcm_power: Broadcom power driver
//博通的电源驱动
[ 0.083366] bcm_power_open() -> 0
[ 0.083392] bcm_power_request(0, 8)
[ 0.584081] bcm_mailbox_read -> 00000080, 0
[ 0.584124] bcm_power_request -> 0
[ 0.584151] Serial: AMBA PL011 UART driver
//串口驱动初始化
[ 0.584293] dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83) is a PL011 rev3
[ 0.908129] console [ttyAMA0] enabled //打开虚拟tty咨询台
[ 0.931790] bio: create slab <bio-0> at 0
//基本IO采用SLAB分配机制
[ 0.936680] SCSI subsystem initialized //SCSI子系统初始化完成
[ 0.940777] usbcore: registered new interface driver usbfs
//载入usb文件系统
[ 0.946362] usbcore: registered new interface driver hub
//载入hub驱动
[ 0.951961] usbcore: registered new device driver usb
//载入usb驱动
[ 0.958321] Switching to clocksource stc
[ 0.962558] FS-Cache: Loaded //载入文件系统缓存
[ 0.965696] CacheFiles: Loaded //缓存文件载入成功
[ 0.980472] NET: Registered protocol family 2
//网络协议注册
[ 0.985749] TCP established hash table entries: 16384 (order: 5, 131072bytes)
//TCP缓存入口设定
[ 0.993495] TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
//TCP绑定缓存入口设定
[ 1.000288] TCP: Hash tables configured (established 16384 bind 16384)
//TCP协议配置完成
[ 1.006892] TCP: reno registered //TCP协议注册完成
[ 1.010144] UDP hash table entries: 256 (order: 0, 4096 bytes)
//UDP缓存入口设定
[ 1.016043] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 1.022632] NET: Registered protocol family 1
//网络协议注册
[ 1.027501] RPC: Registered named UNIX socket transport module.
//Unix socket
传输模块注册
[ 1.033548] RPC: Registered udp transport module.
[ 1.038272] RPC: Registered tcp transport module.
[ 1.043019] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.050135] bcm2708_dma: DMA manager at f2007000 //DMA管理器地址
[ 1.054923] bcm2708_gpio: bcm2708_gpio_probe c0515d98
[ 1.060392] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000mem_size:0x20000000(512 MiB)
//物理内存信息
[ 1.069541] audit: initializing netlink socket (disabled)
//初始化网络连接套接字
[ 1.075135] type=2000 audit(0.930:1): initialized
[ 1.197359] VFS: Disk quotas dquot_6.5.2
[ 1.201395] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
//Dquot缓存入口设定
[ 1.208458] FS-Cache: Netfs ‘nfs‘ registered for caching
//网络文件系统缓存注册
[ 1.214209] NFS: Registering the id_resolver key type
[ 1.219373] Key type id_resolver registered
[ 1.223666] Key type id_legacy registered
[ 1.228031] msgmni has been set to 876 //消息队列上限设定
[ 1.233577] Block layer SCSI generic (bsg) driver version 0.4 loaded(major 252)
[ 1.241293] io scheduler noop registered
//IO调度器注册
[ 1.245341] io scheduler deadline registered (default)
[ 1.250524] io scheduler cfq registered
[ 1.278566] Console: switching to colour frame buffer device 82x26
[ 1.289970] kgdb: Registered I/O driver kgdboc.
//KGDB环境配置
[ 1.297143] vc-cma: Videocore CMA driver
[ 1.302997] vc-cma: vc_cma_base = 0x00000000
[ 1.309532] vc-cma: vc_cma_size = 0x00000000 (0 MiB)
[ 1.316703] vc-cma: vc_cma_initial = 0x00000000 (0 MiB)
[ 1.332822] brd: module loaded //载入brd模块
[ 1.342546] loop: module loaded
[ 1.347709] vchiq: vchiq_init_state: slot_zero = 0xdb000000, is_master = 0
[ 1.357076] Loading iSCSI transport class v2.0-870.
[ 1.364713] usbcore: registered new interface driver smsc95xx
//USB内核接口驱动注册完成
[ 1.372521] dwc_otg: version 3.00a 10-AUG-2012(platform bus)
//OTG版本信息
[ 1.585139] Core Release: 2.80a
[ 1.589972] Setting default values for core params
//设定内核参数为默认值
[ 1.596533] Finished setting default values for core params
[ 1.808950] Using Buffer DMA mode //使用DMA缓冲模式
[ 1.813982] Periodic Transfer Interrupt Enhancement – disabled
//关闭传输中断
[ 1.821473] Multiprocessor Interrupt Enhancement - disabled
[ 1.828738] OTG VER PARAM: 0, OTG VER FLAG: 0
[ 1.834806] Dedicated Tx FIFOs mode
[ 1.841352] dwc_otg bcm2708_usb: DWC OTG Controller
//USB接口使用DWC_OTG模式
[ 1.848083] dwc_otg bcm2708_usb: new USB bus registered, assigned busnumber 1
//注册OTG端口,设定标号为1
[ 1.857220] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[ 1.864510] Init: Port Power? op_state=1
、//初始化电源
[ 1.870116] Init: Power Port (0)
[ 1.875143] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.883801] usb usb1: New USB device strings: Mfr=3, Product=2,SerialNumber=1
//识别新USB设备
[ 1.892892] usb usb1: Product: DWC OTG Controller
[ 1.899429] usb usb1: Manufacturer: Linux 3.6.11+ dwc_otg_hcd
[ 1.907025] usb usb1: SerialNumber: bcm2708_usb
[ 1.914136] hub 1-0:1.0: USB hub found
[ 1.919701] hub 1-0:1.0: 1 port detected
[ 1.925968] Initializing USB Mass Storage driver...
//注册USB接口驱动
[ 1.932865] usbcore: registered new interface driver usb-storage
[ 1.940626] USB Mass Storage support registered.
[ 1.947136] usbcore: registered new interface driver libusual
[ 1.954956] mousedev: PS/2 mouse device common for all mice
//PS2鼠标设备适用于所有鼠标
[ 1.963069] bcm2835-cpufreq: min=700000 max=700000 cur=700000
//设定CPU内核变频机制
[ 1.970688] bcm2835-cpufreq: switching to governor powersave
//切换到省电模式
[ 1.978113] bcm2835-cpufreq: switching to governor powersave
[ 1.985476] cpuidle: using governor ladder
[ 1.991214] cpuidle: using governor menu
[ 1.996808] sdhci: Secure Digital Host Controller Interface driver
//SDHC接口驱动
[ 2.004663] sdhci: Copyright(c) Pierre Ossman
、
[ 2.010711] sdhci: Enable low-latency mode
//SDHC采用低延迟方式
[ 2.062596] mmc0: SDHCI controller on BCM2708_Arasan [platform] usingplatform‘s DMA
[ 2.073898] mmc0: BCM2708 SDHC host at 0x20300000 DMA 2 IRQ 77
//SDHC接口采用DMA通道2,77中断
[ 2.083690] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.096887] usbcore: registered new interface driver usbhid
[ 2.104353] usbhid: USB HID core driver
[ 2.114752] TCP: cubic registered
[ 2.121976] Initializing XFRM netlink socket
//初始化XFRM网络套接字
[ 2.130243] Indeed it is in host mode hprt0 = 00021501
[ 2.137305] NET: Registered protocol family 17
[ 2.152611] Key type dns_resolver registered
[ 2.162820] VFP support v0.3: implementor 41 architecture 1 part 20variant b rev 5
[ 2.183420] mmc0: new high speed SDHC card at address b368
[ 2.203131] registered taskstats version 1
//注册任务状态
[ 2.209645] mmcblk0: mmc0:b368 SDC 7.51 GiB
//读到新SD卡设备
[ 2.224378] mmcblk0: p1 p2
[ 2.372463] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.381068] Indeed it is in hostmode hprt0 = 00001101
[ 2.582745] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 2.591531] usb 1-1: New USB device strings: Mfr=0, Product=0,SerialNumber=0
[ 2.604132] hub 1-1:1.0: USB hub found
[ 2.613208] hub 1-1:1.0: 3 ports detected
[ 2.892640] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 3.013066] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 3.021911] usb 1-1.1: New USB device strings: Mfr=0, Product=0,SerialNumber=0
//以上均为扫描到新USB设备
[ 3.034070] smsc95xx v1.0.4
[ 3.097508] smsc95xx 1-1.1:1.0: eth0: register ‘smsc95xx‘ atusb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:70:44:ae
[ 4.315064] EXT4-fs (mmcblk0p2): recovery complete
[ 4.409912] EXT4-fs (mmcblk0p2): mountedfilesystem with ordered data mode. Opts: (null) //从根设备加载EXT4文件系统
[ 4.422138] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 4.431447] devtmpfs: mounted //设备临时文件系统挂载完成
[ 4.436972] Freeing init memory: 128K
[ 5.733896] udevd[154]: starting version 175
[ 12.234468] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 12.676245] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
??
Debian GNU/Linux 7 raspberrypi ttyAMA0
raspberrypi login:
2、如何通过Linux获得硬件数据,截屏给出获得的硬件数据,如CPU型号、时钟频率、内存大小等
Cpu信息:
内存大小:
内核信息:
加载的内核模块:
系统运行时间:
3、给出你的网络配置参数,截屏给出从树莓派和PC两端得到的网络已连接的证明
eth0
表示第一块网卡
第一行:
Link encap表示连接类型:Ethernet(以太网)
HWaddr表示网卡的物理地址:b8:27:eb:70:44:ae
第二行:
inet addr用来表示网卡的IP地址:192.168.1.11
Bcast表示广播地址:192.168.1.255
Mask表示掩码地址:255.255.255.0
第三行:
UP代表网卡开启状态
RUNNING代表网卡的网线被接上
MULTICAST支持组播
MTU最大传输单元:1500字节
第四、五行:
接收、发送数据包情况统计
第七行:
接收、发送数据字节数统计信息。
lo
是表示主机的回坏地址,这个一般是用来测试一个网络程序,但又不想让局域网或外网的用户能够查看,只能在此台主机上运行和查看所用的网络接口。比如把 HTTPD服务器的指定到回坏地址,在浏览器输入
127.0.0.1 就能看到你所架WEB网站了。但只是您能看得到,局域网的其它主机或用户无从知道。
从浏览器登录路由器设置,查看到树莓派和电脑的ip地址分别为192.168.1.11和192.168.1.9
即从树莓派和PC两端得到的网络已连接
4、给出你的SSH配置文件,并解释其中内容
Host *
选项“Host”只对能够匹配后面字串的计算机有效。“*”表示所有的计算机。
ForwardAgent no
“ForwardAgent”设置连接是否经过验证代理(如果存在)转发给远程计算机。
ForwardX11 no
“ForwardX11”设置X11连接是否被自动重定向到安全的通道和显示集(DISPLAY
set)。
RhostsRSAAuthentication no
“RhostsRSAAuthentication”设置是否使用用RSA算法的基于rhosts的安全验证。
RSAAuthentication yes
“RSAAuthentication”设置是否使用RSA算法进行安全验证。
PasswordAuthentication yes
“PasswordAuthentication”设置是否使用口令验证。
BatchMode no
“BatchMode”如果设为“yes”,passphrase/password(交互式输入口令)的提示将被禁止。当不能交互式输入口令的时候,这个选项对脚本文件和批处理任务十分有用。
CheckHostIP yes
“CheckHostIP”设置ssh是否查看连接到服务器的主机的IP地址以防止DNS欺骗。建议设置为“yes”。
StrictHostKeyChecking ask
“StrictHostKeyChecking”如果设置成“yes”,ssh就不会自动把计算机的密匙加入“$HOME/.ssh/known_hosts”文件,并且一旦计算机的密匙发生了变化,就拒绝连接。
IdentityFile ~/.ssh/identity
“IdentityFile”设置从哪个文件读取用户的RSA安全验证标识。
Port 22
“Port”设置连接到远程主机的端口。
Cipher 3des
“Cipher”设置加密用的密码。
EscapeChar ~
“EscapeChar”设置escape字符。
5、存在多个登陆时,如何看到不同端口的登陆,给出截屏结果
用ssh登录
查看
6、给出嵌入式板卡上的SAMBA配置文件内容,并逐行解释
[global] //全局设置
log file = /var/log/samba/log.%m
//设置log文件的大小(KB)
[tmp]
comment = Home Directories
//主目录注释
path = /tmp //实际访问资源的本机路径
browseable = yes
//是否容许其他用户浏览个人主目录
read only = no
//是否只读
create mask = 0755
//新建文件默认权限
directory mask = 0755
//新建目录的默认权限
7、给出用各种方式传递文件的过程,并从易用性、速度、安全等方面做比较
(1) 用samba传输
先安装samba
之前已经安装过了,跳过。
编辑配置文件:
重启samba服务:
打开网络共享中心:
注册新用户:
打开paspberrypi并登录:
出现以下界面:
这时就可以往里传文件了。
(2) 使用sftp传输
下载filezilla软件
传输一首歌到树莓派上。
用命令行查看这个文件
或在树莓派远程桌面上查看这个文件。
两种方式比较:
速度 |
易用性 |
安全性 |
|
Samba |
快 |
方便 |
较低 |
Sftp |
相对samba较慢 |
方便,但需下载软件 |
较高 |
8、给出你所选择的交叉编译环境的情况:来源、安装过程等
下载编译软件:
9、给出交叉编译的程序的情况,并证明它是ARM/MIPS的可执行文件
新建一个hello.c文件
编译hello.c生成a.out
查看a.out文件信息
可以看出它是ARM可执行文件。
10、给出嵌入式板卡本机开发环境的情况,给出一或两种语言编程的例子和结果
用sftp将上一步产生的a.out文件传到树莓派上
传输成功
运行a.out查看结果(忘记换行。。。)
11、给出你尝试的远程图形桌面的方式:嵌入式板卡端的配置方法,PC端软件的获得,使用结果截屏等
使用远程桌面连接
登录树莓派,出现如下界面: