山东大学操作系统课设

环境预装

主要步骤:
1. 安装虚拟机
2. nachos解压
3. 编译执行
前面两步略,这里着重记录第三步的环境搭建。
操作系统课设据h老师说,需要gcc和g++版本低于4才行,PPT里面也是3.4版本的。所以我选择了3.4版本。

工具

重点:ubuntu版本是12.04,16.04的部分可行,18.04安装不了nachos
安装增强功能和右键打开终端功能,这一步一人而异吧。我用的是VirtualBox + Ubuntu12.04,增强功能是为了在虚拟机和主机之间进行双向复制粘贴。
本身右键没有打开终端功能,也是为了方便,命令:

sudo apt-get install nautilus-open-terminalnautilus -q

mips

将mips的tar包安装到/usr/local中并解压,由于要用到root权限,所以要在命令行进行,sudo mv gcc-2.8.1-mips.tar.gz /usr/local
之后解压,也需要root权限,sudo tar -xzvf gcc-2.8.1-mips.tar.gz
解压
之后就会有mip文件夹。
mips

下载安装包

我的虚拟机是Ubuntu12.04,里面含有的是gcc4.6,没有g++。所以需要通过安装包方式安装。我采用的是deb方式,命令行方式如下:
wget http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/gcc-3.4-base_3.4.6-6ubuntu5_i386.deb
sudo dpkg --force-depends -i gcc-3.4-base_3.4.6-6ubuntu5_amd64.deb
但是,我感觉太慢了就下好了安装包之后再执行的第二条命令。
下载网址:http://old-releases.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/
需要的安装包如下图:
安装包
找到对应的链接就可以下载了。

安装

上述安装包下载好后,就可以进行安装操作了:sudo dpkg --force-depends -i *.deb
(对了,安装命令要和安装包在同一级目录下)

版本切换

首先增加gcc和g++的可选项
命令:sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-3.4 30以及sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-3.4 30
然后进行版本切换:
命令:sudo update-alternatives --config gccsudo update-alternatives --config g++
之后选择数字即可。
由于我的只有一个,所以会提示只有一个候选项
只有一个候选项

小Bug

这个时候是能够进行编译的,但是会报一堆错,我只记得了一个错,有一个文件没找到:/usr/include/gnu/stubs-32.h。确实,没有这个文件
gnu
执行下面这两条命令:
sudo apt-get install gcc-multilib
sudo apt-get install g++-multilib
就OK了。
安装速度可能会很慢,请耐心等待。
再编译就行了。
编译
出现了和指导书上一样的结果,太开心了。
PS :如果出现了/usr/include/gnu/stubs-32.h找不到,而且上面的命令不行的话,建议卸载gcc和g++,再从安装命令sudo dpkg --force-depends -i *.deb来一遍。
命令:sudo apt-get remove gccsudo apt-get remove g++

Requirements 1. Simulate a Unix file system on your Windows Platform 2. Understand the file system on Unix system, and the usage of i-nodes 3. Implement the function of sub-directory 4. The task needs to be completed using C++ or C 5. Tasks/Functionalities The following functions are required in your file system: 1. Allocate 16MB space in memory as the storage for your file system. The space is divided as blocks with block size 1KB Assume block address length is 32-bit; Design the information contained in i-node The i-node should support up to 10 direct block addresses The i-node should support at least one indirect block address 2. The fist block is used for storing the i-node for the root directory(/). While your program is lunched, two directories (/dir1 and / dir1/dir2) should be created, and also two files need to be written as /dir1/file1 and /dir1/dir2/file2 (5 marks) 3. File 1 and 2 contain the message of “This is file 1.” and “This is file2”. 4. Following commands should be supported in your system: a) Create a file:createFile fileName fileSize (10 marks) i.e.:createFile /dir1/myFile 1024 (in bytes) if fileSiz > max file size, print out an error message. The file content is filled up with filename + repeated digits from 0 - 9 i.e.: “myFile012345678901234567890123….” b) Delete a file:deleteFile filename (10 marks) i.e.:deleteFile /dir1/myFile c) Create a directory:createDir (5 marks) i.e.:createDir /dir1/sub1 d) Delete a directory:deleteDir (5 marks) i.e.: deleteDir /dir1/sub1 (The current working directory is not allowed to be deleted) e) Change current working direcotry:changeDir (5 marks) i.e.: changeDir /dir2 f) List all the files and sub-directories under current working directory:dir (5 marks) You also need to list at least two file attributes. (i.e. file size, time created, etc.) g) Copy a file : cp (5 marks) i.e.: file1 file2 h) Display the usage of storage space:sum (10 marks) Display the usage of the 16MB
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值