- 博客(17)
- 资源 (1)
- 收藏
- 关注
原创 内核编译脚本
#!/bin/bash #Name:#Desc:#Usage:#Path:#Update:export ARCH=armexport CROSS_COMPILE=arm-linux-make -j8镜像生成脚本mkimage -A arm -O linux -T kernel -C none -a 0xc0008000 -e 0xc0008000 -n linux-3.2.18 -d zImage uImage
2020-06-30 21:16:24 271
原创 查看平台内核信息脚本
#!/bin/bash #Name:#Desc:#Usage:#Path:#Update:echo "Ubuntu Version: $(cat /proc/version)"echo "Ubuntu bit :$(getconf LONG_BIT)"echo "Ubuntu CPU:$(cat /proc/cpuinfo)"
2020-06-30 21:11:33 123
原创 快速创建 shell脚本
#!/bin/bash#Name:vibash#Desc:用来建立bash脚本#Usage:vibash [filename]#Path:~/bin#Update:2020-2-22touch $1.shecho "#!/bin/bash " >> $1.shecho "#Name:" >> $1.shecho "#Desc:" >> $1.shecho "#Usage:" >> $1.shecho "#Path:" >>
2020-06-30 21:08:09 270
原创 脚本:Ubuntu18-20.04 ip地址配置补充
以下脚本更正系统潜迁移时无法找到网卡的情况#!/bin/bash#Name: env install#Desc: lazy to install one to one#Usage: env_config#Path: ~/bin#Update: 20200404check() { dpkg -l | egrep -o "$name" >> temp.log for tmp1 in $(cat temp.log) do if [ $tmp1 = $name ] t
2020-06-30 20:20:35 462 3
原创 linux内核模块的优缺点
利用内核模块的动态装载性具有如下优点:·将内核映象的尺寸保持在最小,并具有最大的灵活性;·便于检验新的内核代码,而不需重新编译内核并重新引导。但是,内核模块的引入也带来了如下问题:·对系统性能和内存利用有负面影响;·装入的内核模块和其他内核部分一样,具有相同的访问权限,因此,差的内核模块会导致系统崩溃;·为了使内核模块访问所有内核资源,内核必须维护符号表,并在装入和卸载模块时修改这些符号表;·有些模块要求利用其他模块的功能,因此,内核要维护模块之间的依赖性。·内核必须能够在卸载模块时通知模块
2020-06-30 19:35:44 1746
原创 makefile清除目标文件的规则
刚开始学习makefile的时候,我觉得直接删除多于的*.o 文件和 tags和cscope产生的数据库,就好了后来发现,这样做不是很好,不符合程序员的修养 。举一个简单的例子:bj.PHONY:all cleansrc=$(wildcard *.c)objs=$(src:.c=.o)target=test.dall: make $(target) @ctags -R @cscope -Rbq$(target): $(objs) gcc $(filter %.o,$^) -o $
2020-06-27 21:24:30 2187
原创 win10 Linux子系统 交叉编译器注意事项
如果你的机器是32位的 ,就不需要安装32位的运行库了如果你的机器是64位的 ,就需要安装32位的运行库Ubuntu20.04 64位机器安装32位运行库sudo apt install lib32z1在子系统上还得进一步配置 编译环境一下是命令:整理所得sudo apt updatesudo apt install qemu-user-staticsudo update-binfmts --install i386 /usr/bin/qemu-i386-static --mag.
2020-06-27 13:28:50 663
原创 DTH11 驱动实例代码(一)
#include<stdio.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>#include<stdlib.h>#include<wiringPi.h>#define TempPath "/sys/class/thermal/thermal_zone0/temp"#define MaxSize 20#define TMDMoneDatalen
2020-06-24 20:36:58 233
原创 C 如何在函数中返回一个数组
int test(int *b){ int data; for( data = 0 ; data < 5 ; data++) { *(b+data) = data*2; } return 0;}int main(void){ int buf[5]; test(buf); printf("buf[2]=%d\n",buf[2]); return 0;}在C语言中是无法在函数中返回一个数组的 ,所以,利用指针的特性,对形参进行处理,实际参数也会发生变化,就
2020-06-23 20:48:07 7663
原创 vim 配置文件 C/C++
"设置字符编码set fenc=utf-8 set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936 " 不要使用vi的键盘模式,而是vim自己的 set nocompatible " history文件中需要记录的行数 set history=100 " 在处理未保存或只读文件的时候,弹出确认 set confirm " 与windows共享剪贴板 set clipboard+=unnamed " 侦测文件类型 filetype
2020-06-17 21:56:22 373 2
原创 UNIX/Linux上进度条的实现
#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<string.h>struct Bar{ unsigned int cur_status; unsigned int total_status; char bar_type;};int Draw_Bar(struct Bar status){ unsigned int speed_percent; char
2020-06-17 13:58:32 141
原创 GitHub下载慢的解决办法
1.首先建立一个gitee的账户2. 创建的一个仓库3. 导入已有的旧仓库4. 将github的仓库地址复制到地址栏5. 等待10-20秒6.然后就可以下载码云上的仓库
2020-06-16 10:07:39 131
原创 shell实现 cp 进度条
#!/bin/bash #Name:#Desc:#Usage:#Path:#Update:draw_bar(){ local cur=$1 local all=$2 let local speed=(cur*100)/all local fonts="#" let local count=speed-1 [[ $((count%2)) -eq 1 ]]&&let count++ local str=$(for i in $(seq 1 $((count/2)
2020-06-16 01:48:30 606
原创 SVN批量配置脚本 ,容易 和 笨的方法
!/bin/bash #Name:#Desc:#Usage:#Path:#Update:svn_config(){ name=$(ls /home/.svn/) for temp in $name do cd /home/.svn/$temp/conf cat authz | sed '23aadmin=hongsir1994' | sed '28a[/]' | sed ' 30a@admin=rw' > authz_s mv authz_s authz ca
2020-06-11 18:00:50 185
原创 关于GNU C\C++ 的环境配置脚本优化第二版本
#!/bin/bash #Name: C/C++ env install&conf#Desc: env isntall#Usage: C_env#Path: ~/bin#Update: 2020 0405check() { local temp=$(dpkg -s $name | egrep "Status") local install_ok="Status: install ok installed" if [ "$temp" = "$install_ok" ] th
2020-06-11 17:38:37 148 1
原创 pipe 双管道 简易实现代码
#include<stdio.h>#include<fcntl.h>#include<sys/types.h>#include<sys/stat.h>#include<string.h>#include<stdlib.h>#include<unistd.h>#include<sys/wait.h>#define FILEPATH “/home/hongsir1994/test.log”int c
2020-06-05 16:17:54 326
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人