https://pdos.csail.mit.edu/6.828/2020/tools.html

https://zhuanlan.zhihu.com/p/537461426

code

# 克隆代码
cd ~/Projects
mkcd xv6
git clone git://g.csail.mit.edu/xv6-labs-2020 labs
cd labs

# 拉取全部分支
git fetch --all
for branch in $(git branch -r | grep -vE "HEAD|master|main"); do
    git checkout --track $branch
done

# 设置远端为自己的仓库
git remote set-url origin [email protected]:yaoyao_qiekn/xv6.git

上面用到了 mkcd 这个很好用的 自定义命令

<aside> <img src="/icons/key-antique_gray.svg" alt="/icons/key-antique_gray.svg" width="40px" /> mkdir -p mkcd Project**/**a**/**src

都可以创建层级目录,但是 mkcd 做不到 {}

leoua7@MacBookPro test_shell__ % mkdir -p Project/{a,b,c,d}/src
leoua7@MacBookPro test_shell__ % tree
.
└── Project
├── a
│   └── src
├── b
│   └── src
├── c
│   └── src
└── d
└── src
#   mkcd command
#   This is an improvised version of the mkcd command at <http://superuser.com/questions/152794/is-there-a-shortcut-to-mkdir-foo-and-immediately-cd-into-it>
#   This function has to be added to the ~/.bashrc file
#   After that you can run command like: mkdir abc, mkdir -p one/two/three
#
function mkcd {
  last=$(eval "echo \$$#")
  if [ ! -n "$last" ]; then
    echo "Enter a directory name"
  elif [ -d $last ]; then
    echo "\`$last' already exists"
  else
    mkdir $@ && cd $last
  fi
}

</aside>

Aliyun ECS Ubuntu

arm m1 pro 遇到一些问题,换用 阿里云服务器 x86

简单配置一下 nvim tmux ssh git ,然后配置 xv6 环境

sudo apt upgrade
sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu 

Debug

gdb-multiarch
target remote localhost:xxxxx
file kernel/kernel
vim ~/.gdbinit

# 添加以下内容
add-auto-load-safe-path /home/leoua7/projects/xv6/.gdbinit