0

基于 systemd-nspawn 和 QEMU User Mode 搭建 openEuler RISC-V 软件包的快速开发环境

 2 weeks ago
source link: https://blog.251.sh/use-qemu-user-mode-to-build-openeuler-risc-v-packages
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

基于 systemd-nspawn 和 QEMU User Mode 搭建 openEuler RISC-V 软件包的快速开发环境

November 21, 2022

示例于 Ubuntu 22.04 LTS 上. 对于中国大陆的小伙伴来说,所有的 github.com 可以用 kgithub.com 代替.

Step 01: 准备 osc 编译环境

sudo apt install python3-rpm
git clone https://github.com/openSUSE/osc.git
cd osc
chmod +x setup.py
./setup.py build
sudo ./setup.py install
git clone https://github.com/openSUSE/obs-build.git
cd obs-build
sudo make install

Step 02: 编译 QEMU

中国大陆用户编译 QEMU 可以用 curl https://mirrors.tuna.tsinghua.edu.cn/git/qemu/qemu.sh | bash 这个脚本来一键 clone.

apt install ninja-build png-config libglib2.0-dev
git clone https://github.com/qemu/qemu.git
cd qemu
./configure \
  --static \
  --enable-attr \
  --enable-tcg \
  --enable-linux-user \
  --target-list=riscv64-linux-user \
  --without-default-devices \
  --without-default-features \
  --disable-install-blobs \
  --disable-debug-info \
  --disable-debug-tcg \
  --disable-debug-mutex
make -j$(nproc)
sudo make install
sudo apt install zstd systemd-container
sudo ./scripts/qemu-binfmt-conf.sh --persistent yes --credential yes --systemd riscv64
sudo systemctl restart systemd-binfmt

Step 03: 大功告成

最后就是编译时间!

osc build 22.09 riscv64 --vm-type=nspawn

不要忘记把 osc 的设置内容写入 .config/osc/oscrc 下!


如果喜欢本文,欢迎点击下方的「鼓掌」按钮!

如果上面没有加载出任何东西,可以点击这里


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK