You are on page 1of 20

松翰科技股份有限公司

SONiX TECHNOLOGY CO., LTD.

SONiX SN986 Series

IP Camera SoC

AR
SN986 Series SDK 介绍&使用手册

T
Document No.:

ES
Version: v0.00
Revision Date Description
0.00 2014-05-30 Initial Version

N
Apply to

O
H
or
lf
tia
en
fid
on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
1
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

Table of Contents
1 简介 ............................................................................................................................................ 3
1.1 基本介绍......................................................................................................................... 3
1.2 平台开发环境 ................................................................................................................. 3
1.2.1 主机系统 ............................................................................................................. 3

AR
1.2.2 Target Platform ................................................................................................. 4
1.3 SN986 Series SDK .......................................................................................................... 5
2 U-boot....................................................................................................................................... 11

T
2.1 U-boot 介绍 .................................................................................................................. 11
2.2 建立 U-boot ................................................................................................................. 11

ES
2.2.1 U-boot 配置 ....................................................................................................... 11
2.2.2 编译 U-boot ....................................................................................................... 11
2.3 U-boot 运行 ................................................................................................................. 11

N
2.3.1 U-boot 环境变量 .............................................................................................. 13
3 Linux 核心 ............................................................................................................................... 15
3.1
O
Linux 核心程序代码 .................................................................................................... 15
Linux 核心配置 ............................................................................................................ 15
H
3.2
3.3 编译 Linux 核心.......................................................................................................... 16
4 Root File System ....................................................................................................................... 17
or

4.1 Root File Systems 介绍 ................................................................................................. 17


4.2 Make a Root File System ............................................................................................... 17
lf

4.2.1 BusyBox 程序代码 ........................................................................................... 17


4.2.2 BusyBox 配置 ................................................................................................... 17
tia

4.2.3 设置 BusyBox 建立 root filesystem ................................................................. 18


5 编译 SN986 Serial SDK 相关模块 .......................................................................................... 19
编译相关模块 ............................................................................................................... 19
en

5.1
5.2 开发自行模块 ............................................................................................................... 19
5.2.1 如何 build 自行开发模块 .................................................................................. 19
fid

5.2.2 如何执行测试自行开发模块 ............................................................................ 19


on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
2
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

1 简介

1.1 基本介绍

AR
由于嵌入式系统限制的资源,我们不会透过在嵌入式主板(EVB or Demo board)去开发撰写代
码和编译程序。开发编译执行程序环境是需要 PC 或 notebook(host) 和 platform。主机(host )
和平台(platform)(EVB)通常通过 UART 连接,同时也支持通过网络或 JTAG

T
(SN98610&SN98601)的连接,SN98600 不支持 JATG 但支持电视输出.

ES
1.2 平台开发环境

SONIX SN986 Serial SDK 发展环境包含 Linux 服务器,Window 控制面板终端机(Putty or

N
Tera Term),SN986 platform.我们藉由 Window 控制面板终端机去编译程序. 然后可以通过网络
(nfs) or SD 卡传递编译后的文件到平台.也能透过 Quake tool or SD 卡去更新整个韧体.若开发
者不想要对于 Linux 服务器设置一个单独的主机,我们也建议可以在 Window 的 PC 使用虚拟机
O
H
器.
or

1.2.1 主机系统

对于嵌入式主机系统所需的环境,如下所述:
lf

Equipment Software Description


tia

Operating Windows 2000, Windows XP, Windows 7, or Windows 8


system (OS)
Windows
en

Hyper Terminal ( Putty, Tera Term …),


console
Applications J-link (for JTAG)
VirtualBox 4.2.16 (虚拟机)
fid

OS Fedora 18
Glibc-2.16-24.fc18.i686.rpm
on

Nss-softokn-freebl-3.14-5.fc18.i686.rpm
Zlib-1.2.7-9.fc18.i686.rpm
Linux server Perl 5.18.0
C

IO-stringy-2.110, Crypt-RC4-2.02, Digest-Perl-MD5-1.8


OLE-Storage_Lite-0.19, Spreadsheet-ParseExcel-0.59
Digest-CRC-0.18 Digest-MD5-2.52 , Text-CSV-1.32, Encode-2.5.5,
Encode-Detect-1.0.1

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
3
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

1.2.2 Target Platform

Target platform 上运行 U-boot, Linux 内核和设备驱动程序如下


:

AR
Equipment Software Description
Boot Program U-boot, version: 2011.09
SONiX Linux distribution. The Linux kernel is

T
OS developed based on the standard Linux kernel
V2.6.35.12

ES
SN986 series platform
driver Video, audio, gpio…

Applications Busybox, Video audio middleware…etc.

N
Library uClibc-0.9.32

注意:
SN986Serial platform 的一些硬件要求: O
H
SN98601:
 16MB/32MB onboard Serial Flash
or

SN98600 /98610:
 16MB/32MB onboard Serial Flash or 128MB onboard NAND Flash
lf

目前使用过的客户大部分为 SN98601 & 16M Serial Flash


下图为 SZ Sonix EVB 板
tia
en
fid
on
C

UART COMPORT 设定如下:

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
4
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

Setting Value
Baud rate 115200bps
Data bit 8 bits
Parity check N/A
Stop bit 1

AR
Flow control N/A
以 Tera Term 为例设定如下
Port 部分需根据开发者环境选择 COMNumber

T
ES
N
O
H
or
lf
tia

1.3 SN986 Series SDK

SN986 系列的 SDK 提供 SN986 系列平台上的 Linux2.6.35.12 软件开发环境。它包含源代码,


library 和 Linux 相关的开发的工具.当将我们发布的 SDK 解压缩后,可看到如下目录
en

Directory Description
fid

package Directory for all the development code packages


scriptlib Directory for the script library
sdk.cleanup The script to delete the unpacked code
on

sdk.patch The script to patch the unpacked code


sdk.unpack The script to unpack the code package
C

在执行指令./sdk.unpack 会产生目录 snx_sdk, snx_sdk 下会有以下目录

Directory Description
toolchain Directory for the repository of the cross compilation tools and image tools
bootloader Directory for the U-boot

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
5
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

kernel Directory for the repository of the Linux kernel source


app Directory for the repository of the user applications
driver Directory for the Sonix device modules (video, audio, wifi,gpio,
watchdog, ..)
middleware Directory for the Sonix middleware(video, audio, GPIO,…)

AR
filesystem Directory for the repository of the Busybox & default file for file system
buildscript-sdk Directory for SONIX SDK configurations
image Directory for the images

T
board-info Directory for the board parameter (DDR, hw-setting..)

ES
N
O
H
or

请按照下面的步骤来安装和编译 Linux 服务器上的 SN986 Serial SDK.


1. 复制发布的 SDK 压缩包到 Linux 服务器 .
lf

2. 解压缩 SDK 压缩包, 指令:“tar –xzf SDKNAME.tar.gz”


3. 等待解压缩完成
tia

4. 进入 SN986 series SDK 下指令: “cd SDKNAME”


5. 执行 unpack shell, “./sdk.unpack”, 解压全部的开发包.
en

6. 在解压完成后, 全部发布的 SDK 被设置完成.


7. 进入目录 snx_sdk 下, “cd snx_sdk”.
fid

8. 进入目录 buildscript –sdk 下,指令 “cd buildscript-sdk”


9. 执行指令“make menuconfig” 去读取 menuconfig
on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
6
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

T AR
ES
N
O
H
Platform
or
lf
tia
en
fid
on
C

DDR

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
7
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

T AR
ES
N
O
H
Sonix Driver
or

Wifi driver
lf
tia
en
fid
on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
8
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

T AR
ES
N
O
H
Sensor driver
or
lf
tia
en
fid
on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
9
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

T AR
ES
N
O
H
10. 调整所需的相关配置并储存(Save an Alternate Configuration File)
or

11. 执行指令”make; make image”.这指令可将全部 SDK 编译(U-boot,Root file


system,Kennel,nvram)
lf

12. 当编译完成后, 在“image” 下会生成 SN986 Serial SDK 所需使用的 image 檔.


(UBOOT.bin, ROOTFS-R.bin, KERNEL.bin nvram.bin, FIRMWARE.bin)
tia

13. 若需产生一个可供预烧 16M 大小的档案,可下指令:”make phy_sf”,在 image 目录下会生成


PHY_SF.bin,目前只提供 16M Serial flash 使用预烧档案
en

image
fid
on
C

UBOOT.bin,ROOTFS-R.bin,KERNEL.bin,nvram.bin 发别为 U-boot, root file system ,linux


kernel,的刻录映像档. 可透过 Sonix 的刻录工具 Quake tool & SD 卡 去执行刻录工作.
FIRMWARE.bin 则可透过 SD 卡执行刻录.

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
10
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

2 U-boot

2.1 U-boot 介绍

AR
SN986 Serial SDK U-boot 开发基础是 U-boot-2011-09. U-Boot 的是一个运行在 Linux 内核启
动前的一个小程序. 嵌入式系统 U-boot 执行这些功能:
 初始化硬件装置, 特别是内存控制器.
 设置内存的 mapping

T
 提供的参数(软件/硬件环境)给 Linux 内核。

ES
 开始 OS linux
 读取和写入任意内存位置

N
2.2 建立 U-boot

U-boot 配置
2.2.1

U-boot 的属性可以通过修改该文件进行配置, “sn986xx.h”,在 O


H
“bootloader/u-boot-2011-09/src/include/configs”.
or

2.2.2 编译 U-boot

编译 the U-boot, 请在 SDK 的”buildscript-sdk”目录下运行以下命令


lf

 # make u-boot-2011-09
tia

 # make bootimage

成功编译后,有应生成两个目标文件:
en

 ELF file: u-boot (bootloader/u-boot-2011-09/src)


 Binary file: UBOOT.bin (.目录/image)
fid

2.3 U-boot 运行
on

假如 U-boot 已经刻录到 flash, 当 SN986Serial platform 开机 U-boot 的将被执行, 那么 U-boot


的提示会在控制台上显示. SN986Serial 主板的标准输入和输出透过 UART. 请确保 UART 连接
到主机.
C

若要执行 U-boot 指令,必须在一开机时按住 enter 键,即可进入 U-boot 指令模式

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
11
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

T AR
ES
比较常用的 U-boot 指令
Command Name Categories Description
显示特定命令的所有命令或详细的帮助信息列表.

N
help Information
句法: help [command …]

printenv Environment
显示环境变量
句法: printenv [name …]
O
H
设定变量
setenv Environment
句法: setenv name [value]
储存变量在 flash 中
or

saveenv Environment
句法: saveenv
执行 Memory 中的二进制代码,一个简单的跳转到指定地址
lf

go Control 句法: go addr [arg …]


tia

执行 Memory 中的二进制代码
bootm Control 句法: bootm [ addr [ arg …] ]
en

要求二进制代码为制定格式的。通常为 mkimage 处理过的二进制档案


下载文件从 TFTP server 到内存
句法: tftp addr file
fid

下载 file 到内存位置 addr.


on

注意:
tftp Download
透过网络下载程序,需要先设定好网络配置
C

ex
#> setenv ipaddr 192.168.1.2 /* set the IP address */
#> setenv netmask 255.255.255.0 /* set the subnet mask */
#> setenv serverip 192.168.1.1 /* set the server IP address */
#> tftp 0x01000000 uImage

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
12
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

复制一块内存数据到另一块内存中
句法: cp [.b, .w, .l] source target count
cp Memory
[.b, .w, .l]代表了查看和修改形式:byte、word、long
预设为 l
显示内存中位置的内容.

AR
句法: md [.b, .w, .l] address
md Memory
[.b, .w, .l]代表了查看和修改形式:byte、word、long

T
预设为 l
用指定的数据填充内存

ES
句法: mw[.b, .w, .l] address value [count]

Set the DDR2 size starting from address with the size of count to

N
mw Memory
value.

O
[.b, .w, .l]代表了查看和修改形式:byte、word、long
预设为 l.
H
比较两块内存区
句法: cmp[.b, .w, .l] addr1 addr2 count
or

cmp Memory [.b, .w, .l]代表了查看和修改形式:bit、word、long


预设为 l.
lf

刻录图像文件到 flash
tia

update Flash
句法: update addr
列出 mmc device 中可用的 partition
mmc part SD flash
en

句法: mmc part


列出 mmc partition N 内档案
fatls mmc N SD flash
句法: fatls mmc N
fid

读入 FAT 中的一个档案
fatload SD flash
句法: fatload mmc N addr file
on

2.3.1 U-boot 环境变量


C

U-Boot 的使用环境变量来使用操作。环境变量配置设置,如波特率的串口连接,TFTP 服务器


的 IP 地址,默认的启动命令.

Environment Variable Description


ipaddr 设定平台的 IP 位置.

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
13
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

句法: setenv ipaddr XXX.XXX.XXX.XXX


设定 TFTP server IP 位置.
serverip
句法: setenv serverip XXX.XXX.XXX.XXX
设定子网掩码.
netmask
句法: setenv netmask XXX.XXX.XXX.XXX

AR
设定 gateway IP 位置
gatewayip
Syn 句法: setenv gatewayip XXX.XXX.XXX.XXX
设定 OS 开始起来的开机参数.

T
句法: setenv bootargs arg1=value1 arg2=value2 … argN=valueN

ES
bootargs ex:
setenv bootargs ‘console=ttyS0,115200 root=/dev/mtdblock2 init=/linuxrc
mem=64M’
设定 U-boot 自动开始模式跟执行的指令.

N
句法: setenv bootcmd cmd1; cmd2; … cmdN
bootcmd
Example:

O
setenv bootcmd ‘bootm 0x80040000’
H
设定 auto-boot delay 时间. 用户可以按任意键在延迟时间内切换到命令行模式.
bootdelay 单位是秒 second. 假如设为-1, auto-boot 将被关闭
句法: setenv bootdelay value
or
lf
tia
en
fid
on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
14
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

3 Linux 核心

3.1 Linux 核心程序代码

AR
Sonix SN986 Serial SDK 中 Linux 核心版本为 2.6.35.12 而且在 Sonix 平台上做了一些优化跟
修改.在 SN986 series SDK 中,核心码放在目录 kernel/linux-2.6.35.12/src 下.开发者可以去这
目录修改跟新增所需相关的应用.

T
3.2 Linux 核心配置

ES
SN986 Serial platform 预设的配置在被存放在“kernel/linux-2.6.35.12/src/arch/arm/configs”.
当在编译核心 image 文件时他将会被读取.
注意:

N
如果你不熟悉的内核和 SN986 Serial platform,不应去更改预设配置.

若要手动配置内核, 请执行以下步骤去进入 Linux 配置页面并配置所要的功能.


O
H
 确认在目录”buildscript-sdk” 下
 # cd buildscript-sdk
 # make kernelmenuconfig
or
lf
tia
en
fid
on
C

 修改配置
 储存配置后跳出
一般情况下,重新配置 Linux 内核的目的总结如下:

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
15
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

 客制化电路板的功能。
 客制化硬件设备:添加或删除特定的设备
 客制化内核的功能:添加或删除一个内核功能,如 USB 支持

AR
3.3 编译 Linux 核心

可使用以下的指令在目录 “buildscript-sdk”下去编译 linux 核心


#make linux-2.6.35.12;

T
#make kernelimage”

ES
File Path Description
KERNEL.bin /image Kernel image
uImage ./image Kernel uimage

N
O
H
or
lf
tia
en
fid
on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
16
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

4 Root File System

4.1 Root File Systems 介绍

AR
Root file system 是构成 file system 的最小集合,它包含所有 Linux 开机时需要的档案及文
件夹,如 init.d 里的各项服务,/etc、/proc、/lib 等,而且位置全都是从根目录( / )开始,它
可以算是整个 filesystem 的源头。在嵌入式系统中, root filesystem 通常包含了能满足各种
基本使用的工具,如 ls 、 mount 等,之后如果需要额外的储存空间或档案则是再透过 mount

T
来把其他的储存装置挂载进来.

ES
Directory Description
bin Executable binary files of basic commands
root Root user directory, (/root/etc_default/: Sonix

N
platform default system configuration file)
etc System configuration files
lib
sbin
System libraries
Executable binary files O
H
tmp DDR storage space
or

SN986 platform Serial flash 16M 上,/etc 是唯一可擦写目录档案大小为 1M


在第一次 platform 开机时,开机 script 会先将/root/etc_default/ 全部复制到/etc/下
若开法者将回复成出厂设定,则可先移除/etc/下档案在从开机即可.
lf
tia

4.2 Make a Root File System

SONiX SN986 series SDK 可以建立一个 root file system, 而且我们提供很多 BusyBox 功能.
en

在建立 root file system image 之前,一些相关的代码(驱动模块, middleware, app)会先去编译和


完成配置然后才建立 root file system image.配置位置在目录 snx_sdk/rootfs/下.
fid

4.2.1 BusyBox 程序代码

BusyBox 程序代码放在 filesystem/busybox-1.18.5, SONiX SN986 series SDK 所使用的版本


为 1.18.5.使用着也可以从网站 http://busybox.net.去下载 BusyBox 程序代码
on

4.2.2 BusyBox 配置
C

SONiX SN986 series SDK 在 BusyBox 提供了一些默认配置,使用着可以依照以下步骤去新增


或删除:
 确认在目录 “buildscript-sdk”下
 执行指令 # make busyboxmenuconfig

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
17
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

T AR
ES
N

 新增或关闭相关 Utilities.
 储存设定然后跳出(Save Configuration to an Alternate File)
O
H
设置 BusyBox 建立 root filesystem
or

4.2.3

若要设置 BustBox 并且建立一个 root filesystem image 档案,可在 “buildscript-sdk”


lf

目录下执行指令 make rootfs; make rootfsimage.


将自动执行以下功能:
tia

 编译 BusyBox
 设置 BusyBox 到特定目录 snx_sdk/rootfs/
 编译驱动模块,middleware.app(假如有修改)后移动到特定目录 snx_sdk/rootfs/
en

 在目录/image 下产生 rootfs.cramfs & ROOTFS-R.bin


fid

注意:
假如没有特别要求,SN986 SDK 配置的 rootfs 可以直接使用.若开发者自行开发相关的执行檔
(binary)和 library 要放到 root filesystem 内,则可先将档案放到 snx_sdk/rootfs/内相对应的
on

路径
ex: library -> /rootfs/lib/下
binary -> /root/user/bin/下
C

重新编译 root filesystem,刻录 ROOTFS-R.bin 档案,新的 file system 则会新增所建立


的档案.

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
18
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

5 编译 SN986 Serial SDK 相关模块

SONiX SN986 series SDK 提供了很多相模块包含了 application & middleware &device driver.

AR
当在” “buildscript-sdk”下,执行 make 时就会自动编译全部的相关 application & middleware &
驱动模块.当开发者若想要针对特定非 U-boot &Kernel 内的档案作修改编译时
我们提供了相关编译的方法

T
5.1 编译相关模块

ES
跟之前 U-boot or Kernel 一样需先知道 release 相对应模块名称
以 gpio middleware 为例,
若要执行 clean 动作,则指令如下

N
#make middleware_gpio-clean
若要编译指令为
#make middleware_gpio
当编译完成后可在编译 root filesytem,则修改过的 gpio middleware 档案则会被放在新的 O
H
ROOTFS-R.bin& rootfs-cramfs 内

5.2 开发自行模块
or

5.2.1 如何 build 自行开发模块


lf

首先必须先 export SN986 Serial toolchain


指令: export PATH=…./snx_sdk/toolchain/crosstool-4.5.2/bin:$PATH
tia

SN986 Serial SDK toolchain 使用 CROSS_COMPILE: arm-linux-gcc


ex:
en

arm-linux-gcc -c -o test.o test.c


arm-linux-gcc test.o -o test

5.2.2 如何执行测试自行开发模块
fid

5.2.2.1 使用 nfs
on

首先先确认 linxu server 上已经有安装 nfs server 而且已有权限去 mount


然后确认网络 ok 后,在 SN986 platform 下指令:
ex:
C

#mount -t nfs -o nolock linux_server_nfs_path /mnt


#cd /mnt
#./test
// linux_server_nfs_path 表示要 mount 到 linux server 的路径,
//mnt 为 SN986 platform 的路径

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
19
松翰科技股份有限公司
SONiX TECHNOLOGY CO., LTD.

5.2.2.2 使用 SD 卡

首先将要执行档案放到 SD 卡,然后将 SD 卡插到 SN986 platform.则会自动将 SD 内容 mount


/media/mmcblkX/.
则可透过指令去执行测试

AR
#cd /media/mmcblk1
#./test

T
ES
N
O
H
or
lf
tia
en
fid
on
C

本数据为松翰科技股份有限公司专有之财产,未经书面同意不准透露、使用,亦不准复印或转变成任何其他形式
使用 The information contained herein is the exclusive property of SONIX and shall not be distributed, reproduced or
disclosed in whole or no in part without prior written permission of SONIX.
20

You might also like