跳过正文
  1. Posts/

OS课设之geek os 非最终版

·2 分钟

参考了这篇博客

流程部分不再具体描述,可以参考上面的博客。

只详细给出我遇到的问题。

我的pc环境是:Linux 111qqz-ThinkPad-X200 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

linux mint 17.2 cinnamon

1apt-get install build-essential
2apt-get install bochs bochs-x nasm

http://sourceforge.net/projects/geekos/files/ 下载geekos软件包并且解压

1$ cd ~/geekos-0.3.0/src/project0/build$
2$ make depend
3$ make

报错。。

解法办法:修改/home/rkz2013/geekos-0.3.0/src/project0/build

目录下的Makefile文件。

1CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror  改为
2CC_GENERAL_OPTS := $(GENERAL_OPTS)

make后再次出现错误:

1fmtout.c:(.text+0xa16):对‘__stack_chk_fail’未定义的引用

解决办法:

1project0/build 目录下的makefile文件的148行
2添加编译选项 -fno-stack-protector

然后又报错

1i386 architecture of input file `geekos/lowlevel.o' is incompatible with i386:x86-64 output

解决办法:

修改/home/rkz2013/geekos-0.3.0/src/project0/build目录下的Makefile的100行至109行如下。 (改动了100行,106行,109行。。。交叉编译什么的,因为做OS大作业的时候搞过这个。。。如果之前没有交叉编译过可能出现库依赖不全的情况。。。? 缺什么安什么就好了。)

 1TARGET_CC := $(TARGET_CC_PREFIX)gcc -m32
 2101
 3# Host C compiler.  This is used to compile programs to execute on
 4# the host platform, not the target (x86) platform.  On x86/ELF
 5# systems, such as Linux and FreeBSD, it can generally be the same
 6# as the target C compiler.
 7HOST_CC := gcc -m32
 8107
 9# Target linker.  GNU ld is probably to only one that will work.
10TARGET_LD := $(TARGET_CC_PREFIX)ld  -m elf_i386

新建一个.bochsrc的配置文件

放入一下内容

 1# An example .bochsrc file.
 2# You will need to edit these lines to reflect your system.
 3vgaromimage: file=/usr/share/vgabios/vgabios.bin
 4romimage: file=/usr/share/bochs/BIOS-bochs-latest
 5megs: 8
 6boot: a
 7floppya: 1_44=fd.img, status=inserted
 8#floppya: 1_44=fd_aug.img, status=inserted
 9log: ./bochs.out
10keyboard_serial_delay: 200
11vga_update_interval: 300000
12mouse: enabled=0
13private_colormap: enabled=0
14i440fxsupport: enabled=0
15# Uncomment this to write all bochs debugging messages to
16# bochs.out.  This produces a lot of output, but can be very
17# useful for debugging the kernel.
18#debug: action=report

保存在主目录下。

然后再启动bochs 再次报错

1bochs-bin: symbol lookup error: /usr/lib/bochs/plugins/libbx_x.so: undefined symbol: XpmCreatePixmapFromData

解决办法:

1export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libXpm.so.4

相关文章

linux下的对拍写法

·1 分钟
1首先先生成三个程序: 2$ g++ a+b.cpp -o a+b 3$ g++ a+b2.cpp -o a+b2 4$ g++ make.cpp -o make 5然后生成数据 6$ ./make > in.txt 7然后运行两个程序 8$ ./a+b < in.txt > out.txt 9$ ./a+b2 < in.txt > ans.txt 10最后对拍 11$ diff out.txt ans.txt 12输出的结果可以man diff查阅一下相关文档中关于输出含义的内容 13注:上面的$都是命令提示符,复制粘贴时不需要

tmp

·1 分钟
1#include <iostream> 2#include <vector> 3#include <cstring> 4#include <set> 5#include <algorithm> 6#include <cstdio> 7 8using namespace std; 9const int N=1E4+7; 10int n,k,Q; 11int siz; 12int pos[N]; 13int sum[N]; 14int dis[N]; 15bool vis[N]; 16vector < pair<int,int> > edge[N]; 17 18struct node 19{ 20 int l,r; 21 int id; 22 23 bool operator < (node b)const 24 { 25 if (pos[l]==pos[b.l]) return r<b.r; 26 return pos[l]<pos[b.l]; 27 } 28 29 30}q[N]; 31 32 33void dfs( int u,int val) 34{ 35 vis[u] = true; 36 dis[u+1] = val; 37 38 int Siz = edge[u].size(); 39 for ( int i = 0 ; i < Siz ; i ++) 40 { 41 int v = edge[u][i].first; 42 43 if (!vis[v]) 44 { 45 dfs(v,val+edge[u][i].second); 46 } 47 } 48} 49int main() 50{ 51 52 freopen("in.txt","r",stdin); 53 siz = 100; 54 for ( int i = 0 ; i < 10000 ; i++) pos[i] = i/siz; 55 while (scanf("%d %d %d",&n,&k,&Q)!=EOF) 56 { 57 memset(vis,false,sizeof(vis)); 58 memset(dis,0,sizeof(dis)); 59 memset(sum,0,sizeof(sum)); 60 for ( int i = 1 ;i < n ; i++) 61 { 62 int u = i; 63 int v = i/k; 64 edge[u].push_back(make_pair(v,i)); 65 edge[v].push_back(make_pair(u,i)); 66 } 67 68 for ( int i = 1 ;i <= Q ; i++) 69 { 70 scanf("%d %d",&q[i].l,&q[i].r); 71 q[i].id = i; 72 } 73 74 sort(q+1,q+Q+1); 75 76 dfs(0,0); 77 for ( int i = 1 ; i <= n ; i++) sum[i] = sum[i-1]+dis[i]; 78 } 79}

NYOJ 505 因子和阶乘

·1 分钟
http://acm.nyist.net/JudgeOnline/problem.php?pid=509 题意:中文题目。。。 思路:快速筛即可。。。妈蛋。。。这个oj不能用宏编译==。。。然后一直TLE…去掉了就好了。。sad

poj 1350 Cabric Number Problem

·1 分钟
http://poj.org/problem?id=1350 题意:6174问题。。。一个四位数。。四个数字重排。。。最大的减去最小的得到新的数字。最后一定能得到6174或者0.除非这个四位数的四个数字都一样。写出变化的过程。