{"id":1285,"date":"2023-04-17T15:00:00","date_gmt":"2023-04-17T15:00:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=1285"},"modified":"2023-09-02T16:56:29","modified_gmt":"2023-09-02T08:56:29","slug":"1285","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2023\/04\/17\/1285\/","title":{"rendered":"\u600e\u4e48\u5728 Debian X86-64 \u7cfb\u7edf\u4e0a\u4f7f\u7528 QEMU-SYSTEM \u5b89\u88c5 Risc-V Linux"},"content":{"rendered":"<h2>\u5b9e\u9645\u4f7f\u7528 Debian Quick Image Baker pre-baked images<\/h2>\n<p><a href=\"https:\/\/people.debian.org\/~gio\/dqib\/\">https:\/\/people.debian.org\/~gio\/dqib\/<\/a><br \/>\nxiPorts architectures Images for riscv64-virt<br \/>\n\u4e0b\u8f7d\u89e3\u538b dqib_riscv64-virt.zip<\/p>\n<pre><code>apt install opensbi u-boot-qemu\n\nqemu-system-riscv64 -machine virt -cpu rv64 -m 1G \\\n  -device virtio-blk-device,drive=hd -drive file=image.qcow2,if=none,id=hd \\\n  -device virtio-net-device,netdev=net -netdev user,id=net,hostfwd=tcp::2222-:22 \\\n  -bios \/usr\/lib\/riscv64-linux-gnu\/opensbi\/generic\/fw_jump.elf \\\n  -kernel \/usr\/lib\/u-boot\/qemu-riscv64_smode\/uboot.elf -object rng-random,filename=\/dev\/urandom,id=rng \\\n  -device virtio-rng-device,rng=rng -nographic \\\n  -append root=LABEL=rootfs console=ttyS0<\/code><\/pre>\n<p>\u8be2\u95eeGPT\u56de\u7b54: \u8981\u5728 Debian X86-64 \u7cfb\u7edf\u4e0a\u4f7f\u7528 QEMU-SYSTEM \u5b89\u88c5 Risc-V Linux\uff0c\u60a8\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u5b89\u88c5 QEMU\uff1a<br \/>\n\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>sudo apt-get update\nsudo apt-get install qemu-system<\/code><\/pre>\n<\/li>\n<li>\u4e0b\u8f7d Risc-V Linux \u955c\u50cf\uff1a<br \/>\n\u60a8\u53ef\u4ee5\u4ece RISC-V \u5b98\u65b9\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\u9002\u5408\u60a8\u7684 Linux \u955c\u50cf\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u7f51\u5740\u4e0b\u8f7d RISC-V 64\u4f4d Linux \u955c\u50cf\uff1a<br \/>\n<a href=\"https:\/\/www.sifive.com\/software\">https:\/\/www.sifive.com\/software<\/a><\/li>\n<li>\u542f\u52a8 QEMU\uff1a<br \/>\n\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<pre><code>  qemu-system-riscv64 -nographic -machine virt \\\n  -kernel \/path\/to\/vmlinux -append root=\/dev\/vda ro console=ttyS0 \\\n  -drive file=\/path\/to\/rootfs.ext2,format=raw,id=hd0 \\\n  -device virtio-blk-device,drive=hd0 \\\n  -device virtio-net-device,netdev=usernet \\\n  -netdev user,id=usernet,hostfwd=tcp::5555-:22<\/code><\/pre>\n<p>\u5176\u4e2d\uff0c\/path\/to\/vmlinux \u662f\u60a8\u4e0b\u8f7d\u7684 Linux \u955c\u50cf\u7684\u8def\u5f84\uff0c\/path\/to\/rootfs.ext2 \u662f\u60a8\u4e0b\u8f7d\u7684 rootfs \u7684\u8def\u5f84\u3002<\/p>\n<ol start=\"4\">\n<li>\n<p>\u5b89\u88c5 Linux\uff1a<br \/>\n\u5728\u542f\u52a8 QEMU \u540e\uff0c\u60a8\u5c06\u770b\u5230 Linux \u547d\u4ee4\u884c\u754c\u9762\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u8be5\u754c\u9762\u5b89\u88c5 Linux\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 Debian\uff1a<\/p>\n<p>debootstrap --arch=riscv64 stable \/mnt <a href=\"http:\/\/deb.debian.org\/debian\">http:\/\/deb.debian.org\/debian<\/a><\/p>\n<p>\u8fd9\u5c06\u5728 \/mnt \u76ee\u5f55\u4e0b\u5b89\u88c5 Debian\u3002<\/p>\n<\/li>\n<\/ol>\n<pre><code>qemu-system-riscv64 -nographic -machine virt \\\n-kernel \/mnt\/boot\/vmlinux-4.19.0-16-riscv64 \\\n-append root=\/dev\/vda ro console=ttyS0 \\\n-drive file=\/dev\/sda,format=raw,id=hd0 \\\n-device virtio-blk-device,drive=hd0 \\\n-device virtio-net-device,netdev=usernet \\\n-netdev user,id=usernet,hostfwd=tcp::5555-:22<\/code><\/pre>\n<p>\u5176\u4e2d\uff0c\/mnt\/boot\/vmlinux-4.19.0-16-riscv64 \u662f\u60a8\u65b0\u5b89\u88c5\u7684 Linux \u5185\u6838\u7684\u8def\u5f84\u3002<\/p>\n<p>\u5e0c\u671b\u8fd9\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5b89\u88c5 Risc-V Linux\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9e\u9645\u4f7f\u7528 Debian Quick Image Baker pre-baked images htt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[72],"class_list":["post-1285","post","type-post","status-publish","format-standard","hentry","category-linux","tag-riscv"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1285"}],"version-history":[{"count":1,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1285\/revisions"}],"predecessor-version":[{"id":1465,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1285\/revisions\/1465"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}