git clone https://github.com/vtess/femu.git cd femu mkdir build-femu # Switch to the FEMU building directory cd build-femu # Copy femu script cp ../femu-scripts/femu-copy-scripts.sh . ./femu-copy-scripts.sh . # only Debian/Ubuntu based distributions supported sudo ./pkgdep.sh
编译 FEMU
1
./femu-compile.sh
准备虚拟机镜像
下面使用官方提供的镜像:
1 2 3 4 5 6 7 8 9 10
mkdir -p ~/images cd ~/images wget http://people.cs.uchicago.edu/~huaicheng/femu/femu-vm.tar.xz tar xJvf femu-vm.tar.xz # After these steps, you will get two files: "u20s.qcow2" and "u20s.md5sum". # You can verify the integrity of the VM image file by doing: md5sum u20s.qcow2 > tmp.md5sum diff tmp.md5sum u20s.md5sum # If diff complains that the above two files differ, then the VM image file is # corrupted. Please redo the above steps.
启动 FEMU
1 2 3 4
cd /PATH/TO/FEMU cd build-femu # 以黑盒模式启动 ./run-blackbox.sh
# Configurable SSD Controller layout parameters (must be power of 2) secsz=512 # sector size in bytes secs_per_pg=8 # number of sectors in a flash page pgs_per_blk=256 # number of pages per flash block blks_per_pl=256 # number of blocks per plane pls_per_lun=1 # keep it at one, no multiplanes support luns_per_ch=8 # number of chips per channel nchs=8 # number of channels ssd_size=16384 # in megabytes, if you change the above layout parameters, make sure you manually recalculate the ssd size and modify it here, please consider a default 25% overprovisioning ratio.
# Latency in nanoseconds pg_rd_lat=56500 # page read latency pg_wr_lat=820500 # page write latency blk_er_lat=2000000 # block erase latency ch_xfer_lat=0 # channel transfer time, ignored for now