跳过正文
  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

相关文章

华科软院计组概念复习

·6 分钟
noip初赛加强版既视感… 自己手动整理的 第二章 机器数:正负符号数码化后的数据称为机器数。 BCD码:用二进制编码的十进制数称为bcd码。 有权码:每位二进制数码元都有确定权值的编码。 校验码:为了发现或纠正数据传送中出现错误的编码。 浮点数的精度由尾数的位数决定。 第三章 溢出:运算结果超出了机器能表示的数据范围。 溢出的特征:结果的符号与操作数的符号不同。 变形补码:两个符号位的补码(用来检测溢出,00,11说明没有溢出,10,01说明有溢出) 对阶:使阶码相等的过程(原则是小阶码向大阶码看齐) 结果规格化:将非规格化数处理为规格化形式。

codeforces 660 C. Hard Process (ruler)

·1 分钟
cf660C solution:ruler.1A 1/* *********************************************** 2Author :111qqz 3Created Time :2016年06月08日 星期三 23时43分18秒 4File Name :code/cf/problem/660C.cpp 5************************************************ */ 6 7#include <cstdio> 8#include <cstring> 9#include <iostream> 10#include <algorithm> 11#include <vector> 12#include <queue> 13#include <set> 14#include <map> 15#include <string> 16#include <cmath> 17#include <cstdlib> 18#include <ctime> 19#define fst first 20#define sec second 21#define lson l,m,rt<<1 22#define rson m+1,r,rt<<1|1 23#define ms(a,x) memset(a,x,sizeof(a)) 24typedef long long LL; 25#define pi pair < int ,int > 26#define MP make_pair 27 28using namespace std; 29const double eps = 1E-8; 30const int dx4[4]={1,0,0,-1}; 31const int dy4[4]={0,-1,1,0}; 32const int inf = 0x3f3f3f3f; 33const int N=3E5+7; 34int n,k; 35int sum[N],a[N]; 36 37void ruler() 38{ 39 int head = 1; 40 int tail = 1; 41 int l,r; 42 int res = -1; 43 int cnt = 0 ; 44 45 while (tail<=n) 46 { 47 while (a[tail]==1) tail++; 48// cout<<"head:"<<head<<" tail:"<<tail<<endl; 49 if (a[tail]==0&&tail<=n) cnt++; 50 51 while (sum[tail]-sum[head-1]<=k&&tail<=n) tail++; 52// cout<<"head:"<<head<<"tail:"<<tail<<endl; 53 if (tail-head>res) 54 { 55 res = tail-head; 56 // cout<<"res:"<<res<<endl; 57 l = head; 58 r = tail-1; 59 } 60 61 while (head<=tail&&sum[tail]-sum[head-1]>k) head++; 62// cout<<"head::"<<head<<" tail:"<<tail<<endl; 63 if (tail<=n&&tail-head+1>res) 64 { 65 res = tail-head+1; 66 l = head; 67 r = tail; 68 } 69 70 71 } 72 73 74 for ( int i = l ; i <= r ; i++) a[i] = 1; 75 76 cout<<res<<endl; 77 for ( int i = 1 ; i <= n ; i++) cout<<a[i]<<" "; 78} 79int main() 80{ 81 #ifndef ONLINE_JUDGE 82 freopen("code/in.txt","r",stdin); 83 #endif 84 85 cin>>n>>k; 86 87 sum[0] = 0; 88 for ( int i = 1; i <= n ; i++) 89 { 90 scanf("%d",&a[i]); 91 sum[i] = sum[i-1] +(1-a[i]); 92 } 93 94 ruler(); 95 96 97 #ifndef ONLINE_JUDGE 98 fclose(stdin); 99 #endif 100 return 0; 101}

(转)树形dp题目集

·4 分钟
树,一种十分优美的数据结构,因为它本身就具有的递归性,所以它和子树见能相互传递很多信息,还因为它作为被限制的图在上面可进行的操作更多,所以各种用于不同地方的树都出现了,二叉树、三叉树、静态搜索树、AVL树,线段树、SPLAY树,后缀树等等.. 枚举那么多种数据结构只是想说树方面的内容相当多,本专辑只针对在树上的动态规划,即树形DP.做树形DP一般步骤是先将树转换为有根树,然后在树上进行深搜操作,从子节点或子树中返回信息层层往上更新至根节点。这里面的关键就是返回的信息部分,这个也没一般性的东西可讲,因为每道题目要求做的事都不尽相同。