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
32
Headscale + Tailscale に移行中
znz
0
75
Ruby on Rails と私
znz
0
80
riscv64.rubyci.org internal
znz
0
61
Rubyの日本語リファレンスマニュアルの現在と未来
znz
0
120
devise-two-factorを4.xから5.xに上げた話
znz
0
430
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
霧の中の代数的エフェクト
funnyycat
1
420
分散システム、なんですぐ死んでしまうん?耐障害性を高めたいあなたのためのレジリエンスパターン入門
mshibuya
7
6.8k
えっ!!コードを読まずに開発を!?
hananouchi
0
230
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
180
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
190
Claude Team Plan導入・ガイド
tk3fftk
0
230
AIが無かった頃の素敵な出会いの話
codmoninc
1
220
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
540
Built Our Own Background Agent at LayerX #aidevex_findy
layerx
PRO
8
3.2k
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
170
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
390
5分で問診!Composer セキュリティ健康診断
codmoninc
0
590
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
750
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
220
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
640
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.5k
Embracing the Ebb and Flow
colly
88
5.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
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