split_lzo_lib.sh
split_lzo_lib.sh
#!/bin/sh
#输入文件名
filename=$1
#分割文件大小
filesize=4096
#输出库文件名
libname="lib"$(echo $filename | tr . _)".a"
#输出头文件名
hname=$(echo $filename | tr . _ | awk '{print $0".h"}')
hdefine=$(echo ${hname}"_" | tr a-z A-Z | tr . _)
#echo $hname
#echo $hdefine
#echo $libname
#自动分割文件
echo split
split -a 2 -d -b $filesize $filename ${filename}"_"
#压缩并删除原文件
echo lzo
ls | grep ${filename}"_.." | awk '{print "minilzo-2.06.exe "$1"\r\nrm "$1}' | sh
#bin2elf
echo bin2elf
ls | grep ${filename}"_...lzo" | awk '{print "arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm --rename-section .data=.text "$1" "$1".o\r\nrm "$1}' | sh
#生成静态库文件
echo ar
ls | grep ${filename}"_...lzo.o" | awk '{print "arm-none-eabi-ar -rcs "libn" "$1"\r\nrm "$1}' libn=$libname | sh
#生成头文件
echo .h
arm-none-eabi-nm $libname | awk -F ' T | A ' 'BEGIN{count=0}{if(count==0){print "#ifndef "hdef"\r\n#define "hdef;count=1}else if($2!=""){print "\textern uint32_t "$2";"}}END{print "\t#define LZO_OUT_LEN ("len")\n#endif"}' hdef=$hdefine len=$filesize > $hname
split_lzop_bin2elf.sh
#!/bin/sh
# 输入文件名
filename=$1
# 分割文件大小
filesize=$2
# 输出库文件名
libname="lib"$(echo $filename | tr A-Z a-z)".a"
# 输出头文件名
hname=$(echo $filename | tr A-Z a-z | awk -F '.' '{print $1".h"}')
hdefine=$(echo ${hname}"_" | tr a-z A-Z | tr . _)
#echo $hname
#echo $hdefine
#echo $libname
# 自动分割文件
echo split
split -a 2 -d -b $filesize $filename ${filename}"_"
# 压缩并删除原文件
echo lzo
ls | grep ${filename}"_.." | awk '{print "lzop.exe -U -1 "$1" -o "$1".LZO"}' | sh
# bin2elf
echo bin2elf
# lzop自动把输出文件名都变成了小写
filename=$(echo $filename | tr A-Z a-z)
ls | grep ${filename}"_...lzo" | awk '{print "arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm --rename-section .data=.text "$1" "$1".o\r\nrm "$1}' | sh
# 生成静态库文件
echo ar
ls | grep ${filename}"_...lzo.o" | awk '{print "arm-none-eabi-ar -rcs "libn" "$1"\r\nrm "$1}' libn=$libname | sh
# 生成头文件
echo .h
arm-none-eabi-nm $libname | awk -F ' T | A ' 'BEGIN{count=0}{if(count==0){print "#ifndef "hdef"\r\n#define "hdef;count=1}else if($2!=""){print "\textern uint32_t "$2";"}}END{print "#endif"}' hdef=$hdefine > $hname
split_lzo_lib.sh的更多相关文章
- 数据库备份并分离日志表(按月)sh 脚本
#!/bin/sh year=`date +%Y` month=`date +%m` day=`date +%d` hour=`date +%H` dir="/data/dbbackup/f ...
- Linux下如何查找.sh后缀的文件
find / -name *.sh或locate *.shfind 与locate的区别:locate 配合数据库查看文件位置 find 实际搜寻硬盘查询文件名称
- sh 测试网段在线主机
yum install nmap nmap -sP 192.168.21.1/24 查看网段在线主机 grep -vwf file1 file2 文件内容比较 #!/bin/bash # day=` ...
- Maven打包生成可运行bat/sh脚本文件
利用Maven的appassembler-maven-plugin插件,就可以实现自动打包可运行的脚本,还可以跨平台. <plugin> <groupId>org ...
- 记一个简单的保护if 的sh脚本
真是坑爹,就下面的sh,竟然也写了很久! if [ `pwd` != '/usr/xx/bin/tomcat' ] then echo "rstall is not allowed in c ...
- 主机巡检脚本:OSWatcher.sh
主机巡检脚本:OSWatcher.sh 2016-09-26更新,目前该脚本只支持Linux操作系统,后续有需求可以继续完善. 注意: 经测试,普通用户执行脚本可以顺利执行前9项检查: 第10项,普通 ...
- Oracle巡检脚本:ORAWatcher.sh
Oracle巡检脚本:ORAWatcher.sh #!/usr/bin/ksh echo "" echo "ORAWatcher Version:1.0.1" ...
- 解决:/bin/sh: 1: /home/**/custom_app.sh: Permission denied错误
出现如下错误,一般是执行权限不够. /bin/sh: : /home/custom_app.sh: Permission denied 解决方法是:cd 到此文件目录,对提示的文件赋予可执行权限或读写 ...
- SH Script Grammar
http://linux.about.com/library/cmd/blcmdl1_sh.htm http://pubs.opengroup.org/onlinepubs/9699919799/ut ...
随机推荐
- spring boot 启动数据库报错(Exception during pool initialization.)
2018-06-27 14:12:28.804 ERROR 14312 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariP ...
- Angular2 兼容 UC浏览器、QQ浏览器、猎豹浏览器
找到/src/polyfills.ts文件 把/** IE9, IE10 and IE11 requires all of the following polyfills. **/下注释掉的代码恢复 ...
- windows性能监视器的使用
https://blog.csdn.net/ab7434588/article/details/53023799 一般在客户端通过LoadRunner对服务器进行压力测试,都需要实时监控服务器端的系统 ...
- HDU 1058 Humble Numbers (动规+寻找丑数问题)
Humble Numbers Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- Linq------错误: Unable to determine the principal end of an association between the types
[Table("bma_stores")] public class Store { //加上即可 [Required] public virtual Product Produc ...
- Spring学习笔记--使用Spring基于Java的配置
我们需要使用@Component注解来定义一个配置类,在配置类中我们定义Bean: package com.moonlit.myspring; import org.springframework.c ...
- Mybatis框架中Mapper文件传值参数获取。【Mybatis】
1.参数个数为1个(string或者int) dao层方法为以下两种: /** * 单个int型 */ public List<UserComment> findByDepartmentI ...
- vue+node+mongoDB火车票H5(七)-- nodejs 爬12306查票接口
菜鸟一枚,业余一直想做个火车票查票的H5,前端页面什么的已经写好了,node+mongoDB 也写了一个车站的接口,但 接下来的爬12306获取车次信息数据一直卡住,网上的爬12306的大部分是pyt ...
- Angular2+学习第3篇 基本知识-组件
一.插值表达式 基本用法与ng1一样. 可以使用 Angular 内置的 json 管道,来显示对象信息,管道用来格式化数据 import { Component } from '@angular/c ...
- jquery筛选数组方法——$.grep(),$.map()
function greptest() { var arr = "1,2,3,'',one,two,three".split(','); var newarr = $.grep(a ...