按以下步骤来,先写这么多来提醒下自己:
1.熟悉linux的基本环境,熟悉linux的基本命令.
2.熟悉linux的交叉编译环境的的配置.
3.复习基本的C语言知识.
4.开发一个小的应用程序. ......
Ubuntu 7.10
在安装时,没有设置root密码,所以这就必须在安装完成后设置 命令如下:
$ sudo passwd root
输入你希望的root用户的密码
其它命令:
一、安装Grub
$ grub
$ find /boot/grub/stage1
(hd0,*)
$ root (hd0,*)
$ setup (hd0,*)
$ quit
$ sudo dd if=/dev/sda(*+1) of=\ubuntu.lnx bs=512 count=1
将ubuntu.lnx文件复制到Windows的根目录下,比如C:\,修改boot.ini,添加C:\ubuntu.lnx="Ubuntu 7.10"。
二、语言支持与软件更新
系统–>管理工具–>软件源–>下载自:–>其他…–>台湾–>tw.archive.ubuntu.com–>选择服务器–>关闭–>重新载入
系统–>管理工具–>语言支持(Language Support)–>支持的语言–>Chinese–>应用–>确定
$ sudo apt-get update
$ sudo apt-get upgrade
三、安装nVidia显卡驱动
下载NVIDIA-Linux-x86-100.14.19-pkg1.run。登录控制台(按下ctrl+alt+F1~F6任一)。
$ sudo /etc/init.d/ ......
linux的驱动就是个字符设备,可以用read write ioctl mmap操作,通过/dev/fbx可以像文件一样直接读写
截屏dd if=/dev/fb0 of=snapshot
恢复cat snapshot > /dev/fb0
开源的有fbgrab工具,不过是生成png文件,我自己写了一个生成bmp文件的工具叫fbcap,录制成avi格式,通过socket或serial把设备的操作发送到host上:)。
保存bmp文件代码:
int savebmp(char* filename, int size, int bmWidth, int bmHeight, int bmBitsPixel, unsigned char* buffer)
{
FILE *fp = NULL;
int j = bmHeight;
int nColors = 0;
int nPeletteLen = 0;
RGBQUAD *rgbquad = NULL;
fp = fopen(filename, "w+");
if(fp == NULL)
{
printf("open file :%s fail\n", filename);
return -1;
}
printf("size=%d, width=%d, height=%d, bitsPixel=%d\n", size, bmWidth, bmHeight, bmBitsPixel);
if (bmBitsPixel <= 8)
{
nColors = bmBitsPixel << 1;
nPeletteLen = nColors * sizeof(RGBQUAD);
rgbquad= malloc(sizeof(RGBQUAD)*nColors);
if (rgbquad == NULL)
{
fclose(fp);
return -1;
}
memset(rgbquad ......
最近对Linux的线程接口进行了些总结,也参考了网络上兄弟们的一些资料,自己同时也写了些程序进行测试,先把参考的
资料列出来吧
http://blog.mcuol.com/User/liuzhilii521/Article/12738_1.htm
下面是我的一些理解:
pthread_key_create(pthread_key_t *key,void (*destructor)(void*))
destructor这个回调函数在线程退出的时候会被调用,参数是pthread_setspecial(pthread_key_t *key,const void *value)
中的参数value
void *pthread_getspecial(pthread_key_t key)
获取的是调用的函数所在线程的具体数据
pthread_setspecial(pthread_key_t *key,const void *value)
必须在具体的线程中调用,以达到跟当前线程绑定的效果
线程退出的问题:
对于嵌入式程序来说,直到断电前很多线程是一直在运行的,并不存在线程退出的问题,但是有一部分线程,特别是模块
化了的程序,但模块的功能退出了,那么所有的资源都需要释放,不管是内存,还是线程,或者硬件资源。
Linux提供了几种退出机制:
1. pthread_exit
这个接口是谁调用谁退出,一般是线程自己退出
2. pthread_kill
这个接口是向某一个线程发出一个s ......
Linux获取毫秒级时间
Moakap
在软件设计中经常会用到关于时间的处理,用来计算语句、函数的执行时间,这时就需要精确到毫秒甚至是微妙的时间。
int gettimeofday(struct
timeval *tv, struct timezone *tz);
int settimeofday(const
struct timeval *tv , const struct timezone *tz);
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /*
microseconds */
};
struct timezone {
int tz_minuteswest; /* minutes
west of Greenwich
*/
int
tz_dsttime; /* type of DST
correction */
};
下面是个简单的例子,用来统计程序的执行时间:
…
struct timeval
t_start,t_end;
long cost_time = 0;
//get start
time
gettimeofday(&t_start,
NULL);
printf("Start
ti ......
分类:操作系统技巧
windows
系统通过
GRUB
for dos 硬盘安装
FC6
Fedora
Core 6
这里给个grub for
dos 的下载地址:
http://nchc.dl.sourceforge.net/sourceforge/grub4dos/grub_for_dos-0.4.1.zip
解压放入C:盘
其中两个文件最重要,把他们都放在C:根目录下:
1.C:\boot\grub
2.把 grldr 放入 C: 盘根目录
把 vmlinuz和initrd.img 放到 C:\linux
修改 C:\boot\grub\menu.lst
title Fedora Core 6 Install
root (hd0,0) #这里假设fc6的光盘镜像文件放在了(hd0,0)
kernel (hd0,0)/linux/vmlinuz
initrd (hd0,0)/linux/initrd.img
boot
修改 c:\boot.ini
C:\GRLDR="Start GRUB"
重启系统 启动GRUB 选择 "Fedora Core 6 Install"
开始安装 ......