Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ubuntuのriscv64版をqemuで動かした
Search
Kazuhiro NISHIYAMA
April 27, 2024
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ubuntuのriscv64版をqemuで動かした
[LILO&東海道らぐオフラインミーティング 2024-04-27](
https://lilo.connpass.com/event/316818/)での発表資料です
。
Kazuhiro NISHIYAMA
April 27, 2024
More Decks by Kazuhiro NISHIYAMA
See All by Kazuhiro NISHIYAMA
Rubyの配布パッケージの変遷
znz
0
37
Headscale + Tailscale に移行中
znz
0
78
Ruby on Rails と私
znz
0
85
riscv64.rubyci.org internal
znz
0
64
Rubyの日本語リファレンスマニュアルの現在と未来
znz
0
120
devise-two-factorを4.xから5.xに上げた話
znz
0
440
docs.ruby-lang.org/ja/ の生成方法を変えた
znz
0
120
lilo.linux.or.jpをbusterからbullseyeに上げた
znz
0
150
小規模個人アプリをRails 7.xにバージョンアップした話
znz
0
140
Other Decks in Programming
See All in Programming
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
100
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
880
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
470
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
210
「人を評価する AI」の設計と実装
ryoyanara
0
180
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
310
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
540
その節約、円になってますか?
isamumumu
1
720
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
630
Android CLI
fornewid
0
210
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
220
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
150
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Un-Boring Meetings
codingconduct
0
380
WENDY [Excerpt]
tessaabrams
11
39k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Designing for Timeless Needs
cassininazir
1
430
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
Six Lessons from altMBA
skipperchong
29
4.4k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
480
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
Odyssey Design
rkendrick25
PRO
2
750
Transcript
Ubuntuのriscv64版をqemu で動かした Kazuhiro NISHIYAMA LILO&東海道らぐオフラインミーティング 2024-04-27 2024-04-27 Powered by Rabbit
3.0.3
self.introduction 西山 和広 Ruby のコミッター github など: @znz 株式会社Ruby開発 www.ruby-dev.jp
1/10
ホスト Debian GNU/Linux 12 (bookworm) qemu-system* 1:7.2+dfsg-7+deb12u5 libvirt-daemon 9.0.0-4 u-boot-qemu
2023.01+dfsg-2 cloud-image-utils 0.33-1 2/10
ゲストイメージファイル https://cloud-images.ubuntu.com から ダウン ロード /${codename}/current/${codename}-server- cloudimg-${arch}.img でデイリービルド版 https://cloud-images.ubuntu.com/releases/ に
リリース版 基本デイリービルドでたまたま問題があるビルド だったらリリース版を選ぶぐらいでいいかも (実機用は https://cdimage.ubuntu.com/ releases/) 3/10
イメージをいい感じにする img=noble-server-cloudimg-riscv64.img wget https://cloud-images.ubuntu.com/noble/current/$img qemu-img resize "$img" +5G qcow2 形式
速度のため raw に変換するのもあり (qemu-img convert -f qcow2 -O raw "$orig" "$img") ギリギリのディスクサイズなのでリサイズ ちょっと試すなら +5G ぐらい もっと使うなら 16G とかに増やす (qemu-img resize "$img" 16G) 4/10
最低限の起動確認 qemu-system-riscv64 -nographic -M virt -m 1G \ -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf
\ -drive "if=virtio,format=qcow2,file=$img" -snapshot -machine (-M) は virt で良さそう -m は適当に増やす デフォルトの 128 だと起動しなかった -kernel は uboot で起動 -bios に opensbi の fw_jump.elf の指定は不要 -snapshot で書き込みは止めておいた 5/10
ログイン準備 mkdir config echo "instance-id: $(uuidgen || echo i-abcdefg)" >
config/meta-data vi config/user-data cloud-localds "seed.iso" config/user-data config/meta-data 起動できるが root もパスワードがなくてログ インできない cloud-init で設定するため ISO ファイル作成 -drive "if=virtio,format=raw,file=seed.iso" を追 加して起動 6/10
config/user-data 詳細は cloud-init のドキュメントを参照 例: https://cloudinit.readthedocs.io/en/latest/ reference/examples.html #cloud-config hostname: noble-riscv64
# user: ubuntu のパスワード設定 password: ubuntu chpasswd: { expire: False } ssh_pwauth: true # 各種設定 timezone: Asia/Tokyo locale: ja_JP.utf8 # 自分のssh鍵を設定 ssh_import_id: - gh:znz 7/10
起動 qemu-system-riscv64 -nographic -M virt -m 2G -smp 4 \
-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ -drive "if=virtio,format=qcow2,file=$img" \ -drive "if=virtio,format=raw,file=seed.iso" \ -device "virtio-net-device,netdev=net0" \ -netdev "user,id=net0,hostfwd=tcp::2222-:22" \ -device virtio-rng-pci \ -snapshot メモリや CPU も増やした ネット接続や RNG デバイスも追加 「ssh -o "StrictHostKeyChecking no" -p 2222 ubuntu@localhost」でログイン可能 8/10
その他の設定 今日はここまで 後日、ブログ https://blog.n-z.jp/ に記事を書く 予定 qemu-guest-agent 対応 https://wiki.qemu.org/Documentation/9psetup でホ
ストとのファイル共有 自動起動のため libvirt 管理下に移行 9/10
まとめ cloud-images.ubuntu.com にある amd64, arm64, armhf, ppc64el, riscv64, s390x はどれ
も同じように使える(はず) 最低限の起動までは arch ごとに調査が必要 cloud-init でログインできる設定が必要 他の設定はできるだけシェルスクリプトや ansible などの provisioner を使う方が楽かも cloud-init は試行錯誤しにくい ansible などは知識の流用がしやすい 10/10 Powered by Rabbit 3.0.3