Skip to content

Commit

Permalink
Merge branch 'next' into feature/docker-container
Browse files Browse the repository at this point in the history
  • Loading branch information
pooriaPoorsarvi committed Oct 22, 2024
2 parents 07cd33c + 3899007 commit 4e4c940
Show file tree
Hide file tree
Showing 9 changed files with 440 additions and 82 deletions.
27 changes: 0 additions & 27 deletions 1x3-mesh.topology

This file was deleted.

42 changes: 0 additions & 42 deletions 2x3-mesh.topology

This file was deleted.

11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

## [🎯 Features](#features)

***Functional-First**. 1 MIPS/core functional first simulation.
* 🕰 **Timing-First**. 10 KIPS/core cycle-accurate simulation.
***Functional-First**. 1 MIPS functional first simulation.
* 🕰 **Timing-First**. 70 KIPS cycle-accurate simulation.
* 🗂️ **Components-based**. Create custom components.
***Free**. QFlex is completely free and open source.

Expand Down Expand Up @@ -56,12 +56,11 @@ ln -s qemu/build/aarch64-softmmu/qemu-system-aarch64 qemu-aarch64
### 6. Add Images

[Download a simple image](https://github.com/parsa-epfl/qflex/releases/latest/) and place it the
repository root location. Release may also contain `checkpoint` ready to experiment with a warmed up timing simulator.
repository root location.

```sh
wget https://github.com/parsa-epfl/qflex/releases/latest/download/images.tar.xz
wget https://github.com/parsa-epfl/qflex/releases/latest/download/ckpt.tar.xz
tar -xvf images.tar.xz
tar -xvf ckpt.tar.xz
```

The repository tree under images folder should look like this.
Expand All @@ -78,7 +77,7 @@ images/
### 7. Run
```sh
./runq images/bb-trace # run keenkraken release version
./runq images/bb-timing-dev # run knottykraken debug version
./runq images/bb-timing # run knottykraken release version
```
The filesystem now contains basic tools provided by `/bin/busybox` like `ls`, `cd`, etc.

Expand Down
98 changes: 98 additions & 0 deletions docs/03-CREATING-QEMU-IMAGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Creating OS image

A VM (Virtual Machine) image is a snapshot of a virtual machine's state, comprising its operating system, software, configurations, and data. It encapsulates the disk storage and storage properties. VM images are used to deploy and replicate virtual machines efficiently, simplifying the process of creating new instances with identical setups. They enable portability across different virtualization platforms and facilitate backup and recovery operations. VM images can be stored in various formats, such as VMDK, VHD, or QCOW2, tailored to specific virtualization solutions like QEMU.

## How to build an image

You can either:
1. download a pre-baked image
2. install an image from an ISO
3. build a bare GNU/Linux kernel

## Pre-Backed image

Using a pre backed image is the simplest way to get started using a VM.
First, choose an image among the following provider.

### Provider
* Debian [arm64-virt](https://people.debian.org/~gio/dqib/)

All the next pre-baked image require some modification before being used. The following will set the root password for your image.
```bash
virt-customize -v -a [image name] --root-password password:[new root password]

```
* Ubuntu [Cloud Image](https://cloud-images.ubuntu.com/)
* Arch [Repo](https://gitlab.archlinux.org/archlinux/arch-boxes/), [Packages](https://geo.mirror.pkgbuild.com/images/)
* Fedora [aarch64](https://fedoraproject.org/cloud/download)
* CentOS [Packages](https://cloud.centos.org/centos/)
* CirrOS [...disk.img](http://download.cirros-cloud.net/)

### How to run
```bash
qemu-system-aarch64 -machine virt -m 2G -cpu max -smp 1 \
-bios [path to QEMU build dir]/pc-bios/edk2-aarch64-code.fd \
-drive file=[pre-baked file],if=virtio,format=qcow2
```

## Build manually

*VERY useful links*
* [Install Alpine Linux in QEMU](https://wiki.alpinelinux.org/wiki/QEMU)
* [Running an aarch64 image in qemu](https://openqa-bites.github.io/posts/2022/2022-04-13-qemu-aarch64/)

***

Building the image manually is similar to setting up an OS on a physical machine. It's a matter of inserting the bootable CD-ROM or USB key.

### x86\_64

To create an Ubuntu image for QEMU, first, download the Ubuntu ISO from the official website. Then, use QEMU's disk image creation tool to allocate storage space.

```bash
qemu-img create -f qcow2 ubuntu.qcow2 40G

```

Next, initialize a disk image file using the desired format, like QCOW2. Launch a QEMU virtual machine with the Ubuntu ISO as a bootable CD-ROM.

```bash
qemu-system-x86_64 -m 4096 -drive file=ubuntu.qcow2 -cdrom [Ubuntu ISO file]
```

Follow the Ubuntu installation prompts, selecting disk space allocation and configuration options. Complete the installation process, shutting down the virtual machine once finished. [For reference](https://realtechtalk.com/QEMU_KVM_How_To_Manually_Create_Basic_Virtual_Machine_VM-2138-articles)

***

### aarch64

To create an Ubuntu image for QEMU targeting aarch64 (arm64), start by obtaining the Ubuntu arm64 ISO. Then, allocate storage space using QEMU's disk image creation tool.

```bash
qemu-img create -f qcow2 ubuntu.qcow2 40G

```
Proceed to create a UEFI firmware image for arm64 architecture using QEMU's provided tools.

```bash
truncate -s 64m efi.img
truncate -s 64m varstore.img
dd if=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd of=efi.img conv=notrunc
```
Launch a QEMU virtual machine with the UEFI firmware and Ubuntu ISO attached.

```bash
qemu-system-aarch64 -nographic -machine virt,gic-version=max -m 2G -cpu max -smp 2 \
-drive file=efi.img,if=pflash,format=raw \
-drive file=varstore.img,if=pflash,format=raw \
-drive file=ubuntu.qcow2,if=virtio,format=qcow2 \
-cdrom [Ubuntu ISO file]
```

Follow Ubuntu's installation prompts, configuring disk space and system settings. Complete the installation and shut down the VM.
[For reference](https://futurewei-cloud.github.io/ARM-Datacenter/qemu/how-to-launch-aarch64-vm/)


## Bare GNU/Linux Kernel
[TODO]

Loading

0 comments on commit 4e4c940

Please sign in to comment.