# simplessd-fullsystem 安裝筆記 ## simplessd-fullsystem > 使用 ubuntu 24.04版 ### 安裝過程 首先按照官網的指令安裝dependencies ``` sudo apt install build-essential sudo apt install scons python-dev-is-python3 zlib1g-dev m4 cmake sudo apt install libprotobuf-dev protobuf-compiler sudo apt install libgoogle-perftools-dev ``` 安裝 git 並將程式 clone 下來 ``` sudo apt install git git clone git@github.com:simplessd/simplessd-fullsystem cd simplessd-fullsystem git submodule update --init --recursive ``` 出現以下問題代表必須先去 github 配置 ssh key,直接把程式下載下來解壓縮後面會出錯 ![image](https://hackmd.io/_uploads/HJG2AYBJxx.png) ``` ssh-keygen -t rsa -C "s98420@gmail.com" cd ~/.ssh cat id_rsa.pub ``` 複製 key 之後貼到 github 配置 gem5 ``` scons build/X86/gem5.opt -j 8 --ignore-style ``` ``` mkdir $HOME/m5 export M5_PATH=$HOME/m5 apt install device-tree-compiler cd simplessd-fullsystem cd system/arm/dt make ``` 下載官方提供的資料並放在m5資料夾下 https://drive.google.com/drive/folders/14b-kJmGXOhltX9Aqr8XV9i48KkZk4Lzs 裝完後路徑長這樣 ![image](https://hackmd.io/_uploads/Syyrmhrkgl.png) ``` mv *.dtb $M5_PATH/binaries ``` 配置完成,執行以下指令即可運行 ``` ./build/X86/gem5.opt --debug-flag=M5Print --debug-file=debug.txt \ ./configs/example/fs.py --kernel=x86_64-vmlinux-4.9.92\ --num-cpu=4 --cpu-clock=2GHz --caches --l2cache --cpu-type=AtomicSimpleCPU \ --mem-size=4GB --mem-type=DDR4_2400_8x8 \ --ssd-interface=nvme --ssd-config=./src/dev/storage/simplessd/config/sample.cfg --disk-image=x86root.img ``` ### 安裝過程可能會遇到的BUG #### 1:scons 只支援 python2,需降級版本 ![image](https://hackmd.io/_uploads/rJrTxcBJel.png) 手動安裝 python2 ``` wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz sudo tar xzf Python-2.7.18.tgz cd Python-2.7.18 sudo ./configure --enable-optimizations sudo make altinstall sudo ln -sfn '/usr/local/bin/python2.7' '/usr/bin/python2' sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2 sudo update-alternatives --config python # (選擇切換 Python 版本) ``` https://pypi.org/project/setuptools/44.1.1/ https://pypi.org/project/pip/20.3.4/#files https://pypi.org/project/virtualenv/15.2.0/#files 分別解壓縮後安裝 ``` sudo python2 setup.py install ``` 建立虛擬環境 ``` virtualenv -p python2.7 venv27 . venv27/bin/activate ``` 手動安裝scons https://pypi.org/project/SCons/3.1.2/ 解壓縮後安裝 ``` sudo python2 setup.py install ``` #### 2:沒有six ![image](https://hackmd.io/_uploads/Sy4ZncB1eg.png) 手動安裝 six https://pypi.org/project/six/#files ``` python2.7 -m pip install six-1.17.0-py2.py3-none-any.whl (用sudo的方法會裝到全域環境) ``` #### 3:各種include缺失 ![image](https://hackmd.io/_uploads/HyhvC5H1gx.png) 到 controller.cc 裡面補上 ``` #include <limits> ``` ![image](https://hackmd.io/_uploads/Hy-B1sSJle.png) 到 attr.h 裡面補上 ``` #include <cstdint> ``` ![image](https://hackmd.io/_uploads/ryxMLoHygx.png) 到 cprintf_formats.hh 裡面補上 ``` #include <cstdint> ``` ![image](https://hackmd.io/_uploads/r1NsuiHklx.png) 到 instance_specific_extensions_int.h 裡面補上 ``` #include <typeinfo> ``` ![image](https://hackmd.io/_uploads/HkgCYorkgg.png) 到 Histogram.hh 裡面補上 ``` #include <cstdint> ``` #### 4 ![image](https://hackmd.io/_uploads/HJ3JxsSJgl.png) 依照 https://github.com/gem5/gem5/commit/28a15f203d778112908633371f7bc6e96bf37fe3 提供的方法修改 主要是將 statistics.hh 裡面的 index >= 0 全部刪除 #### 5 ![image](https://hackmd.io/_uploads/HylzQorkeg.png) 到 replaceable_entry.hh 裡面改掉 print 的名字 ``` printEntry() const ``` #### 6 ![image](https://hackmd.io/_uploads/By87woS1eg.png) 到SConstruct把下面整段註釋掉 ``` main.Append(CCFLAGS=['-Werror', '-Wno-error=deprecated-declarations', '-Wno-error=deprecated',]) ``` #### 7 ![image](https://hackmd.io/_uploads/Sy2SusHJxg.png) 把前面改掉的 print 改回來 #### 8 ![image](https://hackmd.io/_uploads/r1odciH1gg.png) 參考 https://github.com/gem5/gem5/commit/39d4cdcd6bf1966b21c0d598e529c011f551b6bb 更改函式 #### 9:RAM不夠 ``` collect2: fatal error: ld terminated with signal 9 [Killed] ``` 需增加swap的容量 ## simplessd-standalone > 使用 ubuntu 24.04版 ### 安裝過程 ``` git clone git@github.com:simplessd/simplessd-standalone cd simplessd-standalone git submodule update --init --recursive ``` ``` cmake -DDEBUG_BUILD=off . make -j 8 ``` 配置完成,運行以下指令可開始模擬 ``` ./simplessd-standalone ./config/sample.cfg ./simplessd/config/sample.cfg ``` ### 可能的BUG #### 1:各種include缺失 ![image](https://hackmd.io/_uploads/rykm83B1gl.png) 到 controller.cc 裡面補上 ``` #include <limits> ``` ![image](https://hackmd.io/_uploads/SybDv3Bygg.png) 到 convert.cc 裡面補上 ``` #include <cstring> ``` #### 2 ![image](https://hackmd.io/_uploads/r1tAI3rkgx.png) 更改CMakelists的其中一段為 ``` if (DEBUG_BUILD) set(CMAKE_CXX_FLAGS "-O0 -g -rdynamic -pthread -Wall -Wextra -Werror ${CMAKE_CXX_FLAGS}") else () set(CMAKE_CXX_FLAGS "-O2 -rdynamic -pthread -Wall -Wextra ${CMAKE_CXX_FLAGS}") ``` #### 3 ![image](https://hackmd.io/_uploads/BkFI_3B1gx.png) 將setupStack修改為 ``` static bool setupStack() { stack_t st; const auto stack_size = 2 * SIGSTKSZ; static uint8_t *stack = new uint8_t[stack_size]; st.ss_sp = stack; st.ss_size = stack_size; st.ss_flags = 0; return sigaltstack(&st, nullptr) == 0; } ``` #### 4 ![image](https://hackmd.io/_uploads/S1etY2rylx.png) 創一個output資料夾並將指令修改為 ``` ./simplessd-standalone ./config/sample.cfg ./simplessd/config/sample.cfg ./output ```