├── .github └── workflows │ ├── build.yaml │ └── tag.yaml └── README.md /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: Build Debian Rootfs 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | tags: 7 | - "v*.*.*" 8 | 9 | jobs: 10 | Build: 11 | runs-on: ${{ matrix.config.os }} 12 | container: 13 | image: ${{ matrix.config.image }} 14 | options: --privileged 15 | name: ${{ matrix.config.name }} 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | config: 20 | - { 21 | os: ubuntu-latest, 22 | suite: bullseye, 23 | arch: amd64, 24 | qemu-arch: "x86_64", 25 | name: 'Debian-bullseye-amd64', 26 | kernel: 'linux-image-amd64', 27 | artifact: 'debian-bullseye-amd64', 28 | hostname: 'debian-bullseye-amd64', 29 | qcow2: 'debian-bullseye-amd64.qcow2', 30 | rootfs: 'debian-bullseye-amd64.tar.xz', 31 | pool: 'http://deb.debian.org/debian', 32 | image: 'lazymio/qemu-full:v8.1.4', 33 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 34 | } 35 | - { 36 | os: ubuntu-latest, 37 | suite: bullseye, 38 | arch: mipsel, 39 | qemu-arch: "mipsel", 40 | name: 'Debian-bullseye-mipsel-malta', 41 | kernel: 'linux-image-4kc-malta', 42 | artifact: 'debian-bullseye-mipsel-malta', 43 | hostname: 'debian-bullseye-mipsel-malta', 44 | qcow2: 'debian-bullseye-mipsel-malta.qcow2', 45 | rootfs: 'debian-bullseye-mipsel-malta.tar.xz', 46 | pool: 'http://deb.debian.org/debian', 47 | image: 'lazymio/qemu-full:v8.1.4', 48 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 49 | } 50 | - { 51 | os: ubuntu-latest, 52 | suite: bullseye, 53 | arch: mips64el, 54 | qemu-arch: "mips64el", 55 | name: 'Debian-bullseye-mips64el-malta', 56 | kernel: 'linux-image-5kc-malta', 57 | artifact: 'debian-bullseye-mips64el-malta', 58 | hostname: 'debian-bullseye-mips64el-malta', 59 | qcow2: 'debian-bullseye-mips64el-malta.qcow2', 60 | rootfs: 'debian-bullseye-mips64el-malta.tar.xz', 61 | pool: 'http://deb.debian.org/debian', 62 | image: 'lazymio/qemu-full:v8.1.4', 63 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 64 | } 65 | - { 66 | os: ubuntu-latest, 67 | suite: bullseye, 68 | arch: armhf, 69 | qemu-arch: "arm", 70 | name: 'Debian-bullseye-armhf-armmp', 71 | kernel: 'linux-image-armmp', 72 | artifact: 'debian-bullseye-armhf-armmp', 73 | hostname: 'debian-bullseye-armhf-armmp', 74 | qcow2: 'debian-bullseye-armhf-armmp.qcow2', 75 | rootfs: 'debian-bullseye-armhf-armmp.tar.xz', 76 | pool: 'http://deb.debian.org/debian', 77 | image: 'lazymio/qemu-full:v8.1.4', 78 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 79 | } 80 | # - { 81 | # os: ubuntu-latest, 82 | # suite: bullseye, 83 | # arch: armel, 84 | # qemu-arch: "arm", 85 | # name: 'Debian-bullseye-armel-versatile', 86 | # kernel: 'linux-image-versatile', # Has been removed: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977126 87 | # artifact: 'debian-bullseye-armel-versatile', 88 | # hostname: 'debian-bullseye-armel-versatile', 89 | # qcow2: 'debian-bullseye-armel-versatile.qcow2', 90 | # rootfs: 'debian-bullseye-armel-versatile.tar.xz', 91 | # iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 92 | # } 93 | - { 94 | os: ubuntu-latest, 95 | suite: bullseye, 96 | arch: arm64, 97 | qemu-arch: "aarch64", 98 | name: 'Debian-bullseye-arm64', 99 | kernel: 'linux-image-arm64', 100 | artifact: 'debian-bullseye-arm64', 101 | hostname: 'debian-bullseye-arm64', 102 | qcow2: 'debian-bullseye-arm64.qcow2', 103 | rootfs: 'debian-bullseye-arm64.tar.xz', 104 | pool: 'http://deb.debian.org/debian', 105 | image: 'lazymio/qemu-full:v7.2.8', # v8.x will segfault, no idea 106 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 107 | } 108 | - { 109 | os: ubuntu-latest, 110 | suite: bullseye, 111 | arch: i386, 112 | qemu-arch: "i386", 113 | name: 'Debian-bullseye-i386', 114 | kernel: 'linux-image-686', 115 | artifact: 'debian-bullseye-i386', 116 | hostname: 'debian-bullseye-i386', 117 | qcow2: 'debian-bullseye-i386.qcow2', 118 | rootfs: 'debian-bullseye-i386.tar.xz', 119 | pool: 'http://deb.debian.org/debian', 120 | image: 'lazymio/qemu-full:v8.1.4', 121 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 122 | } 123 | - { 124 | os: ubuntu-latest, 125 | suite: unstable, 126 | arch: riscv64, 127 | qemu-arch: "riscv64", 128 | name: 'Debian-bullseye-riscv64', 129 | kernel: 'linux-image-riscv64', 130 | artifact: 'debian-bullseye-riscv64', 131 | hostname: 'debian-bullseye-riscv64', 132 | qcow2: 'debian-bullseye-riscv64.qcow2', 133 | rootfs: 'debian-bullseye-riscv64.tar.xz', 134 | pool: 'http://deb.debian.org/debian', 135 | image: 'lazymio/qemu-full:v8.2.0', 136 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 137 | } 138 | - { 139 | os: ubuntu-latest, 140 | suite: bullseye, 141 | arch: ppc64el, 142 | qemu-arch: "ppc64le", 143 | name: 'Debian-bullseye-ppc64el', 144 | kernel: 'linux-image-powerpc64le', 145 | artifact: 'debian-bullseye-ppc64el', 146 | hostname: 'debian-bullseye-ppc64el', 147 | qcow2: 'debian-bullseye-ppc64el.qcow2', 148 | rootfs: 'debian-bullseye-ppc64el.tar.xz', 149 | pool: 'http://deb.debian.org/debian', 150 | image: 'lazymio/qemu-full:v8.1.4', 151 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 152 | } 153 | - { 154 | os: ubuntu-latest, 155 | suite: bullseye, 156 | arch: s390x, 157 | qemu-arch: "s390x", 158 | name: 'Debian-bullseye-s390x', 159 | kernel: 'linux-image-s390x', 160 | artifact: 'debian-bullseye-s390x', 161 | hostname: 'debian-bullseye-s390x', 162 | qcow2: 'debian-bullseye-s390x.qcow2', 163 | rootfs: 'debian-bullseye-s390x.tar.xz', 164 | pool: 'http://deb.debian.org/debian', 165 | image: 'lazymio/qemu-full:v8.2.0', 166 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 167 | } 168 | # - { # Known not working: https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1779934.html 169 | # os: ubuntu-latest, 170 | # suite: bullseye, 171 | # arch: armel, 172 | # qemu-arch: "arm", 173 | # name: 'Debian-bullseye-rpi', 174 | # kernel: 'linux-image-rpi', 175 | # artifact: 'debian-bullseye-rpi', 176 | # hostname: 'debian-bullseye-rpi', 177 | # qcow2: 'debian-bullseye-rpi.qcow2', 178 | # rootfs: 'debian-bullseye-rpi.tar.xz', 179 | # pool: 'http://deb.debian.org/debian', 180 | # image: 'lazymio/qemu-full:v8.2.0', 181 | # iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 182 | # } 183 | - { # Disabled due to no kernel available 184 | os: ubuntu-latest, 185 | suite: unstable, 186 | arch: loong64, 187 | qemu-arch: "loongarch64", 188 | name: 'Debian-bullseye-loong64', 189 | kernel: 'linux-image-loong64', 190 | artifact: 'debian-bullseye-loong64', 191 | hostname: 'debian-bullseye-loong64', 192 | qcow2: 'debian-bullseye-loong64.qcow2', 193 | rootfs: 'debian-bullseye-loong64.tar.xz', 194 | pool: 'http://ftp.ports.debian.org/debian-ports', 195 | image: 'lazymio/qemu-full:v8.2.0', 196 | iface: 'eth0' # Append "net.ifnames=0", ref: https://wiki.debian.org/NetworkInterfaceNames 197 | } 198 | steps: 199 | - uses: actions/checkout@v2 200 | 201 | - name: '🚧 Mount binfmt_misc' 202 | shell: bash 203 | run: | 204 | mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc 205 | update-binfmts --display 206 | ls /opt/binfmt_fixed/ | awk '{print $1}' | xargs -L 1 update-binfmts --importdir /opt/binfmt_fixed --unimport 207 | ls /opt/binfmt_fixed/ | awk '{print $1}' | xargs -L 1 update-binfmts --importdir /opt/binfmt_fixed --import 208 | ls /opt/binfmt_fixed/ | awk '{print $1}' | xargs -L 1 update-binfmts --enable 209 | update-binfmts --display 210 | 211 | - name: '🚧 Dependency' 212 | shell: bash 213 | run: | 214 | apt update && apt install libguestfs-tools linux-image-generic debian-ports-archive-keyring aria2 -y 215 | 216 | - name: '🚧 Deboostrap 1st stage' 217 | if: ${{ !contains(matrix.config.arch, 'loong64') }} 218 | shell: bash 219 | run: | 220 | mkdir mnt 221 | debootstrap --foreign --arch=${{ matrix.config.arch }} --include=locales ${{ matrix.config.suite }} mnt/ ${{ matrix.config.pool }} 222 | 223 | # https://wiki.debian.org/LoongArch/sbuildQEMU 224 | # https://docs.loongnix.cn/loongnix/faq/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/%E6%A1%8C%E9%9D%A2%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F.html 225 | - name: '🚧 Install Loong ArchLiunux firstly' 226 | if: ${{ contains(matrix.config.arch, 'loong64') }} 227 | shell: bash 228 | run: | 229 | mkdir arch 230 | cd arch 231 | echo "https://mirrors.nju.edu.cn/loongarch/archlinux/iso/latest/archlinux-bootstrap-loong64.tar.gz \ 232 | https://mirrors.pku.edu.cn/loongarch/archlinux/iso/latest/archlinux-bootstrap-loong64.tar.gz \ 233 | https://mirrors.wsyu.edu.cn/loongarch/archlinux/iso/latest/archlinux-bootstrap-loong64.tar.gz \ 234 | https://mirror.iscas.ac.cn/loongarch/archlinux/iso/latest/archlinux-bootstrap-loong64.tar.gz" | aria2c --lowest-speed-limit=1M -s14 -x14 -k2M -j 4 --continue=true -i - 235 | tar xf archlinux-bootstrap-loong64.tar.gz 236 | mkdir -p root.loong64/target 237 | # echo "Server = https://mirrors.nju.edu.cn/loongarch/archlinux/$repo/os/$arch" > root.loong64/etc/pacman.d/mirrorlist 238 | echo "nameserver 8.8.8.8" >> root.loong64/etc/resolv.conf # Configure DNS manually 239 | mount --bind /proc root.loong64/proc 240 | mount --bind /dev root.loong64/dev 241 | chroot root.loong64/ pacman-key --init 242 | chroot root.loong64/ pacman-key --populate 243 | # chroot root.loong64/ pacman-key --refresh-keys # Slow and seems not necessary 244 | sed -i -e "s/CheckSpace/#CheckSpace/g" root.loong64/etc/pacman.conf 245 | chroot root.loong64/ pacman -Syu --noconfirm archlinux-keyring 246 | for i in 1 2 3 4 5; do bash -c "chroot root.loong64/ pacstrap /target base base-devel linux linux-firmware networkmanager grub efibootmgr" && break; done 247 | umount --recursive --force root.loong64/dev || true # It's okay they failed 248 | umount --recursive --force root.loong64/proc || true 249 | 250 | 251 | - name: '🚧 Deboostrap 1st stage (loong64)' 252 | if: ${{ contains(matrix.config.arch, 'loong64') }} 253 | shell: bash 254 | run: | 255 | mkdir mnt/ 256 | debootstrap --foreign --arch=${{ matrix.config.arch }} \ 257 | --variant=buildd --include=locales \ 258 | --include=debian-ports-archive-keyring \ 259 | --components=main \ 260 | --keyring=/etc/apt/trusted.gpg.d/debian-ports-archive-2023.gpg \ 261 | --extra-suites=unreleased \ 262 | ${{ matrix.config.suite }} mnt/ ${{ matrix.config.pool }} 263 | 264 | 265 | - name: '🚧 Deboostrap 2nd stage' 266 | shell: bash 267 | run: | 268 | chroot mnt/ debootstrap/debootstrap --second-stage 269 | 270 | - name: '🚧 Install Kernel & fstab' 271 | if: ${{ !contains(matrix.config.arch, 'loong64') }} 272 | shell: bash 273 | run: | 274 | bash -c "echo 'fake /usr ext4 fake 0 1' > mnt/etc/fstab" 275 | chroot mnt/ apt update && chroot mnt/ apt install ${{ matrix.config.kernel }} -y 276 | bash -c "echo '/dev/sda / ext4 errors=remount-ro 0 1' > mnt/etc/fstab" 277 | 278 | - name: '🚧 Install SSH' 279 | if: ${{ !contains(matrix.config.arch, 'loong64') }} 280 | shell: bash 281 | run: | 282 | chroot mnt/ apt install openssh-server -y 283 | 284 | - name: '🚧 Configure Loongarch ArchLinux' 285 | if: ${{ contains(matrix.config.arch, 'loong64') }} 286 | shell: bash 287 | run: | 288 | cd arch/root.loong64/ 289 | mount --bind /proc target/proc 290 | mount --bind /dev target/dev 291 | 292 | echo "nameserver 8.8.8.8" >> target/etc/resolv.conf 293 | echo ${{ matrix.config.hostname }} > target/etc/hostname 294 | 295 | chroot target/ pacman-key --init 296 | chroot target/ pacman-key --populate 297 | sed -i -e "s/CheckSpace/#CheckSpace/g" target/etc/pacman.conf 298 | chroot target/ pacman -Syu --noconfirm openssh 299 | 300 | chroot target/ systemctl enable sshd 301 | chroot target/ systemctl enable NetworkManager 302 | 303 | chroot target/ useradd -m -G wheel -s /bin/bash debian 304 | chroot target/ bash -c 'echo "debian:debian" | chpasswd' 305 | chroot target/ bash -c 'echo "root:root" | chpasswd' 306 | 307 | umount --recursive --force target/dev || true # It's okay they failed 308 | umount --recursive --force target/proc || true 309 | 310 | cd ../../ 311 | mv mnt debian 312 | mv arch/root.loong64/target mnt 313 | mv debian mnt/ 314 | 315 | echo "nameserver 8.8.8.8" >> mnt/debian/etc/resolv.conf 316 | 317 | - name: '🚧 Configure Debian' 318 | if: ${{ !contains(matrix.config.arch, 'loong64') }} 319 | shell: bash 320 | run: | 321 | bash -c "ls -lha mnt/etc/network/" 322 | bash -c "echo >> mnt/etc/network/interfaces" 323 | bash -c "echo 'auto ${{ matrix.config.iface }}' >> mnt/etc/network/interfaces" 324 | bash -c "echo 'iface ${{ matrix.config.iface }} inet dhcp' >> mnt/etc/network/interfaces" 325 | 326 | bash -c "cat /dev/null > mnt/etc/machine-id" 327 | bash -c "echo ${{ matrix.config.hostname }} > mnt/etc/hostname" 328 | 329 | # sudo chroot mnt bash -c 'echo "debian:debian" | chpasswd' 330 | chroot mnt bash -c "adduser --disabled-password --gecos '' debian" 331 | chroot mnt bash -c 'echo "root:root" | chpasswd' 332 | chroot mnt bash -c 'echo "debian:debian" | chpasswd' 333 | 334 | - name: '📦 Pack qcow2' 335 | shell: bash 336 | run: | 337 | mkdir artifact 338 | virt-make-fs --type=ext4 --size=5G mnt raw.img 339 | qemu-img convert -c -f raw -O qcow2 raw.img artifact/${{ matrix.config.qcow2 }} 340 | 341 | - name: '📦 Pack Initrd & Kernel' 342 | if: ${{ contains(matrix.config.arch, 'loong64') }} 343 | shell: bash 344 | run: | 345 | find mnt/boot -name "vmlinu*" -exec mv {} ./artifact/vmlinuz-loong64 ';' 346 | find mnt/boot -name "initram*" -exec mv {} ./artifact/initrd.img-loong64 ';' 347 | cd artifact 348 | echo "https://mirrors.nju.edu.cn/loongarch/archlinux/images/QEMU_EFI_8.1.fd \ 349 | https://mirrors.pku.edu.cnloongarch/archlinux/images/QEMU_EFI_8.1.fd \ 350 | https://mirrors.wsyu.edu.cn/loongarch/archlinux/images/QEMU_EFI_8.1.fd \ 351 | https://mirror.iscas.ac.cn/loongarch/archlinux/images/QEMU_EFI_8.1.fd" | aria2c --lowest-speed-limit=200K -s14 -x14 -k1M -j 4 --continue=true -i - 352 | mv QEMU_EFI_8.1.fd bios-loong64-8.1.bin 353 | 354 | - name: '📦 Pack Initrd & Kernel' 355 | if: ${{ !contains(matrix.config.arch, 'loong64') }} 356 | shell: bash 357 | run: | 358 | cp mnt/boot/vmlinu* ./artifact/ 359 | cp mnt/boot/initrd.img-* ./artifact/ 360 | 361 | - name: '📦 Pack Rootfs' 362 | shell: bash 363 | run: | 364 | ls -la . 365 | ls -la artifact/ 366 | tar caf artifact/${{ matrix.config.rootfs }} --one-file-system mnt 367 | 368 | - name: '📤 Upload artifact' 369 | uses: actions/upload-artifact@v2 370 | with: 371 | path: ./artifact/ 372 | name: artifact 373 | 374 | publish: 375 | needs: [Build] 376 | runs-on: ubuntu-latest 377 | steps: 378 | - uses: actions/download-artifact@v2 379 | with: 380 | name: artifact 381 | path: artifact 382 | 383 | - name: '📦 Check artifacts' 384 | shell: bash 385 | run: | 386 | ls -la artifact/ 387 | 388 | - name: '📦 Release' 389 | if: startsWith(github.ref, 'refs/tags') 390 | uses: softprops/action-gh-release@v1 391 | with: 392 | token: ${{ secrets.RELEASE_TOKEN }} 393 | files: ./artifact/* 394 | -------------------------------------------------------------------------------- /.github/workflows/tag.yaml: -------------------------------------------------------------------------------- 1 | name: Tag and Release 2 | 3 | on: 4 | schedule: 5 | - cron: '0 9 5 * *' 6 | workflow_dispatch: 7 | 8 | jobs: 9 | tag: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | with: 14 | token: ${{ secrets.RELEASE_TOKEN }} 15 | 16 | - name: '🐙 Tag & Push' 17 | shell: bash 18 | run: | 19 | git config --local user.name "mio" 20 | git config --local user.email "mio@lazym.io" 21 | git tag "v`date +'%Y.%m.%d'`" 22 | 23 | - name: '🐙 Push tags to trigger building' 24 | uses: ad-m/github-push-action@master 25 | with: 26 | github_token: ${{ secrets.RELEASE_TOKEN }} 27 | branch: ${{ github.ref }} 28 | tags: true -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DebianOnQEMU 2 | 3 | Debian qcow2 multi-arch images on QEMU. 4 | 5 | If this project helps you, please give it a star! 6 | 7 | You may be also interested in the side project: [qemu-full](https://github.com/wtdcode/qemu-full) 8 | 9 | ## Quick Start 10 | 11 | Download `vmlinuz`, `initrd` and `qcow2` image from the release page, and start your virtual machine with QEMU. 12 | 13 | In most cases, you want to access the virtual machine via SSH, so don't forget to add a port forwarding or bridge your network interfaces. 14 | 15 | Below are a few quick start command lines. Note the file names should be replaced by the ones you download. 16 | 17 | ### AMD64 18 | 19 | ```bash 20 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 21 | qemu-system-x86_64 -m 512 -kernel ./vmlinuz-5.10.0-13-amd64 \ 22 | -initrd ./initrd.img-5.10.0-13-amd64 \ 23 | -append "console=ttyS0 debug root=/dev/sda net.ifnames=0" \ 24 | -hda ./debian-bullseye-amd64.qcow2 -nographic \ 25 | -nic user,model=virtio-net-pci,hostfwd=tcp::5555-:22 26 | ``` 27 | 28 | ## i386 29 | 30 | ```bash 31 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 32 | qemu-system-i386 -m 512 -kernel ./vmlinuz-5.10.0-26-686 \ 33 | -initrd ./initrd.img-5.10.0-26-686 \ 34 | -append "console=ttyS0 debug root=/dev/sda net.ifnames=0" \ 35 | -hda ./debian-bullseye-i386.qcow2 -nographic \ 36 | -nic user,model=virtio-net-pci,hostfwd=tcp::5555-:22 37 | ``` 38 | 39 | ### ARM 40 | 41 | ```bash 42 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full:v8.2.0 \ 43 | qemu-system-arm -m 512 -M virt -cpu cortex-a15 \ 44 | -kernel ./vmlinuz-5.10.0-26-armmp \ 45 | -initrd ./initrd.img-5.10.0-26-armmp \ 46 | -device virtio-blk-device,drive=hd0 \ 47 | -drive if=none,file=debian-bullseye-armhf-armmp.qcow2,id=hd0 \ 48 | -append "root=/dev/vda rw console=ttyAMA0 rodata=n net.ifnames=0" \ 49 | -device virtio-net-device,netdev=usernet \ 50 | -netdev user,id=usernet,hostfwd=tcp::5555-:22 -nographic 51 | ``` 52 | 53 | Refer to [QEMU ARM doc](https://wiki.qemu.org/Documentation/Platforms/ARM) for details. 54 | 55 | ### ARM64 56 | 57 | ```bash 58 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 59 | qemu-system-aarch64 -m 512 -M virt -cpu cortex-a57 -kernel ./vmlinuz-5.10.0-26-arm64 \ 60 | -initrd ./initrd.img-5.10.0-26-arm64 \ 61 | -append "console=ttyAMA0 debug root=/dev/sda net.ifnames=0" \ 62 | -hda ./debian-bullseye-arm64.qcow2 -nographic \ 63 | -nic user,model=virtio-net-pci,hostfwd=tcp::5555-:22 64 | ``` 65 | 66 | `cortext-a8` or `cortext-a9` are not supported. 67 | 68 | ### RISCV64 69 | 70 | ```bash 71 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 72 | qemu-system-riscv64 -m 512 -M virt -kernel ./vmlinux-6.6.8-riscv64\ 73 | -initrd ./initrd.img-6.6.8-riscv64 \ 74 | -append "rw console=ttyS0 debug root=/dev/vda net.ifnames=0" \ 75 | -device virtio-blk-device,drive=hd0 \ 76 | -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \ 77 | -drive file=./debian-bullseye-riscv64.qcow2,id=hd0 -nographic \ 78 | -device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::5555-:22 79 | ``` 80 | 81 | Refer to [QEMU doc](https://wiki.qemu.org/Documentation/Platforms/RISCV) and [Debian doc](https://wiki.debian.org/RISC-V) for more configurations. 82 | 83 | ### S390x 84 | 85 | ```bash 86 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 87 | qemu-system-s390x -m 512 -machine s390-ccw-virtio -cpu max,zpci=on \ 88 | -kernel ./vmlinuz-5.10.0-26-s390x -initrd ./initrd.img-5.10.0-26-s390x \ 89 | -append "console=ttyAMA0 debug root=/dev/vda rw net.ifnames=0"\ 90 | -hda ./debian-bullseye-s390x.qcow2 \ 91 | -nographic -nic user,model=virtio,hostfwd=tcp::5555-:22 92 | ``` 93 | 94 | Refer to [QEMU doc](https://wiki.qemu.org/Documentation/Platforms/S390X) for details. 95 | 96 | ### PPC 97 | 98 | 99 | ```bash 100 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 101 | qemu-system-ppc64 -m 512 -cpu power9 -kernel ./vmlinux-5.10.0-26-powerpc64le \ 102 | -initrd ./initrd.img-5.10.0-26-powerpc64le \ 103 | -append "console=hvc0 debug root=/dev/sda net.ifnames=0" \ 104 | -hda ./debian-bullseye-ppc64el.qcow2 -nographic \ 105 | -nic user,model=virtio-net-pci,hostfwd=tcp::5555-:22 106 | ``` 107 | 108 | ### MIPS 109 | 110 | ```bash 111 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 112 | qemu-system-mipsel -m 512 -M malta -kernel ./vmlinuz-5.10.0-26-4kc-malta \ 113 | -initrd ./initrd.img-5.10.0-26-4kc-malta \ 114 | -append "console=ttyAMA0 debug root=/dev/sda net.ifnames=0" \ 115 | -hda ./debian-bullseye-mipsel-malta.qcow2 -nographic \ 116 | -nic user,model=virtio-net-pci,hostfwd=tcp::5555-:22 117 | ``` 118 | 119 | ```bash 120 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full \ 121 | qemu-system-mips64el -m 512 -M malta -cpu 5KEc -kernel ./vmlinuz-5.10.0-26-5kc-malta \ 122 | -initrd ./initrd.img-5.10.0-26-5kc-malta \ 123 | -append "console=ttyAMA0 debug root=/dev/sda net.ifnames=0" \ 124 | -hda ./debian-bullseye-mips64el-malta.qcow2 \ 125 | -nographic -nic user,model=virtio-net-pci,hostfwd=tcp::5555-:22 126 | ``` 127 | 128 | ### Loongarch64 129 | 130 | So far, Loongarch64 Debian ports are [not complete](https://wiki.debian.org/Ports/loong64) but we can boot Loong Archlinux and run debian userland inside. 131 | 132 | ```bash 133 | docker run -p 5555:5555 -v `pwd`:/work --rm -it lazymio/qemu-full:v8.2.0 \ 134 | qemu-system-loongarch64 -m 1024m -cpu la464-loongarch-cpu \ 135 | -M virt -append "console=ttyS0 rw debug root=/dev/vda" \ 136 | -kernel ./vmlinuz-loong64 -initrd ./initrd.img-loong64 \ 137 | -bios ./bios-loong64-8.1.bin \ 138 | -hda ./debian-bullseye-loong64.qcow2 --nographic \ 139 | -nic user,model=virtio-net-pci,hostfwd=tcp::5555-:22 140 | ``` 141 | 142 | After the system is up, SSH into it and use: 143 | 144 | ``` 145 | [root@debian-bullseye-loong64 ~]# cd /debian/ 146 | [root@debian-bullseye-loong64 debian]# chroot . 147 | root@debian-bullseye-loong64:/# cat /etc/issue 148 | Debian GNU/Linux trixie/sid \n \l 149 | 150 | root@debian-bullseye-loong64:/# uname -a 151 | Linux debian-bullseye-loong64 6.7.0-rc2-2 #1 SMP PREEMPT Mon, 27 Nov 2023 08:42:49 +0000 loongarch64 GNU/Linux 152 | root@debian-bullseye-loong64:/# apt 153 | apt 2.7.7 (loong64) 154 | Usage: apt [options] command 155 | 156 | apt is a commandline package manager and provides commands for 157 | searching and managing as well as querying information about packages. 158 | It provides the same functionality as the specialized APT tools, 159 | like apt-get and apt-cache, but enables options more suitable for 160 | interactive use by default. 161 | 162 | Most used commands: 163 | list - list packages based on package names 164 | search - search in package descriptions 165 | show - show package details 166 | install - install packages 167 | reinstall - reinstall packages 168 | remove - remove packages 169 | autoremove - automatically remove all unused packages 170 | update - update list of available packages 171 | upgrade - upgrade the system by installing/upgrading packages 172 | full-upgrade - upgrade the system by removing/installing/upgrading packages 173 | edit-sources - edit the source information file 174 | satisfy - satisfy dependency strings 175 | 176 | See apt(8) for more information about the available commands. 177 | Configuration options and syntax is detailed in apt.conf(5). 178 | Information about how to configure sources can be found in sources.list(5). 179 | Package and version choices can be expressed via apt_preferences(5). 180 | Security details are available in apt-secure(8). 181 | This APT has Super Cow Powers. 182 | root@debian-bullseye-loong64:/# 183 | ``` 184 | 185 | Or using a docker approach: 186 | 187 | ```bash 188 | pacmam -Syu docker 189 | mkdir -p /etc/docker 190 | # This is important to avoid ip addresses conflicting with host's docker! 191 | echo > /etc/docker/daemon.json < /debian/Dockerfile 200 | echo "ADD . /" >> /debian/Dockerfile 201 | cd /debian && docker build -t debian_rootfs . 202 | docker run -it --rm debian_rootfs bash 203 | ``` 204 | 205 | Once Debian ports is available we can jump over ArchLinux and boot Debian directly. 206 | 207 | ## Usage 208 | 209 | ### SSH 210 | 211 | Two users created: `root:root` and `debian:debian` and ssh server is up by default. 212 | 213 | ### Resize disk 214 | 215 | On host: 216 | 217 | ```bash 218 | qemu-img resize ./debian-bullseye-loong64.qcow2 16G 219 | ``` 220 | 221 | On emulated targets: 222 | 223 | ```bash 224 | parted /dev/vda resizepart 1 100% 225 | resize2fs /dev/vda 226 | reboot 227 | ``` 228 | --------------------------------------------------------------------------------