hi3518e笔记

来源:互联网 发布:淘宝知识产权怎么处罚 编辑:程序博客网 时间:2024/06/05 16:23


开发环境

Ubuntu版本:14.04LTS

SDK版本:V1.0.A.0

sdk安装

拷贝Hi3518_SDK_V1.0.A.0.tgz至Linux下

#tar -zxvf Hi3518_SDK_V1.0.A.0.tgz

# cd Hi3518_SDK_V1.0.A.0/

# ./sdk.unpack

安装SDK报错查看链接:http://blog.csdn.net/u013286409/article/details/45305911

编译整个osdrv目录

顶层makele
all: prepare hiboot hikernel hirootfs_prepare hibusybox hipctools hiboardtools hirootfs_build
prepare
task [0] prepare
task [1] build boot
task [2] build kernel
task [3] prepare rootfs
task [4] build busybox
task [5] build tools which run on pc
task [6] build tools which run on board
task [7] build rootfs

清除...
# make OSDRV_CROSS=arm-hisiv100nptl-linux CHIP=hi3518e clean
编译...
# make OSDRV_CROSS=arm-hisiv100nptl-linux CHIP=hi3518e all

kernel编译

顶层路径:Hi3518_SDK_V1.0.A.0/osdrv/kernel/linux-3.0.

# cp arch/arm/configs/hi3518e_full_defconfig .config
# make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- menuconfig
# make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- uImage

arch/arm/boot/目录下生成了uImage镜像

# ls arch/arm/boot/uImage -lh
-rw-r--r-- 1 root root 2.8M Jan 15 10:27 arch/arm/boot/uImage

clean cmd

# make ARCH=arm CROSS_COMPILE=arm- hisiv100nptl -linux- clean

按照默认配置编译出来的内核比较大,2.8M.

内核裁剪

目标:减小到2M以内
内核压缩方式修改 : Gzip ---> LZMA
General setup --->
Kernel compression mode (Gzip) --->
( ) Gzip
(X) LZMA
( ) LZO

File systems --->
-*- Miscellaneous filesystems --->
    < > YAFFS2 file system support  
YAFFS2文件系统主要用在nandflash上,当前项目用的SPI flash,可以禁掉
File systems --->
    < > Second extended fs support
ext2/ext3文件系统貌似也用不上
Device Drivers  ---> 
    [*] USB support  --->
        < >   USB Modem (CDC ACM) support             
        < >   USB Wireless Device Management support
        < >   USB Mass Storage support                  U盘的支持
        < >   USB Mustek MDC800 Digital Camera support

Kernel hacking --->

[ ] Debug Filesystem

生成内核镜像文件信息如下

Image Name:   Linux-3.0.8
Created:      Mon Jan 18 15:23:51 2016
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2054496 Bytes = 2006.34 kB = 1.96 MB
Load Address: 80008000
Entry Point:  80008000

添加exfat支持后大小:1.99M


尝试继续裁剪。。。

General setup --->
[ ] Enable AIO support

System Type --->
[ ] Support Thumb user binarie
File systems --->
[ ] Quota support

编译结果如下:
Image Name:   Linux-3.0.8
Created:      Mon Jan 18 17:41:21 2016
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2071412 Bytes = 2022.86 kB = 1.98 MB
Load Address: 80008000
Entry Point:  80008000
继续裁剪...
File systems --->
-*- Miscellaneous filesystems --->
< > Compressed ROM file system support (cramfs)

编译结果如下:
Image Name:   Linux-3.0.8
Created:      Mon Jan 18 17:55:52 2016
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2068876 Bytes = 2020.39 kB = 1.97 MB
Load Address: 80008000
Entry Point:  80008000
继续裁剪...
Device Drivers  --->
[*] Network device support  --->
[*]   Wireless LAN  ---> 
<*>   Ralink driver support  --->
--- Ralink driver support
<*>   Ralink rt2500 (USB) support 
< >   Ralink rt2501/rt73 (USB) support
< >   Ralink rt27xx/rt28xx/rt30xx (USB) support
[ ]   Ralink debug output 
Image Name:   Linux-3.0.8
Created:      Mon Jan 18 18:30:33 2016
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2062364 Bytes = 2014.03 kB = 1.97 MB
Load Address: 80008000
Entry Point:  80008000

继续裁剪...
[*] Networking support  --->
    Networking options  --->
       < > The IPv6 protocol  ---NO USE
一个IPV6协议去掉减少了0.09M
Image Name:   Linux-3.0.8
Created:      Tue Jan 19 09:43:25 2016
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    1969684 Bytes = 1923.52 kB = 1.88 MB




uboot编译

顶层路径:Hi3518_SDK_V1.0.A.0/osdrv/uboot/u-boot-2010.06

# make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- hi3518e_config

# make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux-

# cp u-boot.bin ../../tools/pc_tools/uboot_tools/

# cd ../../tools/pc_tools/uboot_tools/

# ./mkboot.sh reg_info_hi3518e.bin u-boot-ok.bin 

生成的u-boot-ok.bin为可用的uboot镜像

配置busybox

顶层路径:Hi3518_SDK_V1.0.A.0/osdrv/busybox/busybox-1.16.1

# make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- menuconfig

# make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux-

# make ARCH=arm CROSS_COMPILE=arm-hisiv100nptl-linux- install

编译安装后输出目录为_install

制作JFFS2根文件系统

顶层路径:Hi3518_SDK_V1.0.A.0/osdrv/pub

# tar -zxvf rootfs_uclibc.tgz

# mkfs.jffs2 -d ./rootfs_uclibc -l -e 0x20000 -o rootfs.jffs2

备注:貌似有点问题,待解决!


备注:

d指定根文件系统
l little-endian 小端模式
e Flash 的块大小
o 输出映像文件


SPI FLASH 烧写uboot

mw.b 0x82000000 ff 100000;tftp 0x82000000 u-boot-ok.bin;sf probe 0;sf erase 0x0 0x100000;sf write 0x82000000 0x0 0x100000;

备注:

【mw.b】内存初始化,填充内存。把内存 0x82000000 开始的 0x10000 字节设为 0xFF。

【sf probe 0】 探测并初始化SPI FLASH;

【0x82000000】内存地址

uboot相关参数

【bootargs】启动 OS 时的启动参数

【bootdelay】设置自启动延时时间。单位为秒 <-1>关闭自启动功能



知识点备注

压缩格式
       gzip是GNUzip的缩写。用于UNⅨ系统的文件压缩。我们在Linux中经常会用到后缀为.gz的文件,它们就是GZIP格式的。现今已经成为Internet 上使用非常普遍的一种数据压缩格式,或者说一种文件格式。
   LZMA相比另外两种压缩模式,它具有最高的压缩率(同样文件,通过LZMA压缩后的体积通常只有Gzip的70%),但是压缩和解压缩的速度要差一些。适用于spi flash大小非常有限的场合中
  LZO这种压缩方式压缩率最低,但是压缩和解压的速度最快。(目前该算法在 3.4 内核中还不完善,使用该压缩算法会有风险,所以目前并不使用)

0 0